安卓库源码自动定位阅读

SKILL开发

原名 Android Library Source Reader · 标识 zhc-android-lib-reader

开发 未标注权限 许可证不明确
安装这个技能

当项目代码里引用的类、接口或注解在工作区找不到时,自动定位并阅读对应的库源码,帮助快速弄清外部依赖的实现细节。

一句话选型结论

按资料字段整理

安卓库源码自动定位阅读是开发类的 Agent Skill,安装方式未标注,权限级别未标注,许可证不明确,有可直接复制的安装命令。技能本质是给模型读的说明书,效果取决于模型与客户端;装完先用一个小任务验证,再放进正式流程。

分类开发 安装方式未标注 权限级别未标注权限 许可证许可证不明确
累计安装 未标注 本周 未标注
GitHub 星标 未标注 仓库 未标注
下载量 未标注 技能市场下载数
权限级别 未标注权限 安装前请确认风险范围
许可证 许可证不明确 未说明

安装

未标注
在支持 Skills 的客户端里执行,装完问一句「你有哪些技能」验证
skillhub install user_75978add/zhc-android-lib-reader
  1. 1
    确认客户端支持

    确认你的客户端支持 Skills(Claude、Codex、Cursor 等),并升级到较新的版本。

  2. 2
    拿到技能文件

    执行上面的命令安装;也可以把仓库里的 SKILL.md 手动放进客户端的 skills 目录。

  3. 3
    刷新技能列表

    重新打开客户端,或刷新技能列表,让新放进来的技能被加载。

  4. 4
    验证是否生效

    问一句「你有哪些技能」,确认列表里出现它,再拿一个小任务试跑。

技能档案

开发
字段来自技能仓库与公开索引,中文说明由本站标注
作者 / 维护方user_75978add仓库 未标注 · 版本 未标注
宿主客户端未标注技能可被这些客户端加载
安装方式未标注安装包 community
权限级别未标注权限安装前请确认风险范围
许可证未说明许可证不明确,商用前请自行确认条款
仓库可用性available技能仓库当前是否可访问
最近核验2026-11-06上游最后核验时间 · 数据更新 2026-11-06
正文体量13.6 KBSKILL.md 原文大小,越大说明说明书写得越细

能做什么

0 项能力
上游给出的能力概览与适用场景
排查类找不到报错阅读第三方库实现理解注解来源

典型使用场景

3 类
按分类整理的常见用法,具体以 SKILL.md 为准
写代码与改 bug

按需求补代码、定位并修掉报错。

读仓库与生成改动

让模型读懂项目结构,再给出可落地的改动。

跑测试与排查故障

按现象排查问题,补测试用例并复跑。

选择建议

装之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 有可直接复制的安装命令,不用自己翻文档找入口。

先想清楚的地方

  • 没有标注权限级别,实际能做什么要装好后确认。
  • 许可证不明确,商用或二次分发前先到仓库确认条款。
  • 没有做站内核验,内容以作者仓库为准。
  • 技能只是说明书,实际效果取决于模型与客户端,装完先用小任务试一遍。

更适合

  • 需要在开发场景里给模型补一套做法的人。
  • 愿意先读一遍 SKILL.md、确认它会让模型做什么的人。

不太适合

  • 对许可证要求很严、必须明确可商用的人。
  • 只想装完就自动变强、不打算看说明书的人。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
技能权限级别安装方式累计安装宿主客户端安装命令
安卓库源码自动定位阅读当前 未标注权限 未标注 未标注 未标注 有
技能审查员 浏览器控制 ClawHub 市场 877.9 万 OpenClaw 有
Vercel React 最佳实践 浏览器控制 GitHub 仓库 849.1 万 Codex、Claude、Cursor 有
GitHub 代码协作 联网访问 ClawHub 市场 763.3 万 OpenClaw 有
网页设计指南 联网访问 GitHub 仓库 668.6 万 Codex、Claude、Cursor 有
本体论 只读 ClawHub 市场 663.7 万 OpenClaw 有

SKILL.md 全文

13.6 KB
模型实际读到的说明书原文,来自技能仓库

Android Library Source Reader

> Let AI Agents read Gradle dependency library source code directly — just like Android Studio.

Core Capabilities

  1. Read source by class name — Give a fully qualified class name (e.g. com.google.gson.Gson), auto-locate and extract source code
  2. Read source by Maven coordinate — Give a coordinate (e.g. com.google.code.gson:gson:2.11.0), extract the entire library
  3. Search library source — Search keywords across extracted library source code
  4. List library structure — View the package structure and file listing of a library
  5. Auto version matching — Automatically parse the actual library version from project build.gradle or libs.versions.toml

Prerequisites

Tool Required Install
jadx Yes (for decompilation) brew install jadx
python3 Yes macOS: pre-installed or brew install python3
rg (ripgrep) Yes brew install ripgrep
jar Yes (JDK) Install JDK: brew install openjdk
unzip Yes macOS: pre-installed

> Note: jadx is the primary decompiler used when no -sources.jar is available. Without it, decompilation of compiled .class files will fail. The tool also bundles CFR/Fernflower as fallbacks (run scripts/fetch-decompilers.sh to download them).

First Use

When this skill is triggered for the first time (no ~/.gradle/android-lib-reader/class-lookup.txt or it has fewer than 100 entries):

  1. Run init to verify environment:
    bash scripts/lib-reader.sh init
  2. Run index-all to build the full class index (~1 minute, one-time):
    bash PROJECT_ROOT=/path/to/android/project scripts/lib-reader.sh index-all
  3. After indexing, all find-class calls will achieve instant lookup (~0.1s) via binary search.

The AI Agent should check if the index exists before first use and guide the user through setup if needed.

Trigger Conditions

MUST trigger whenever the AI Agent encounters any of these situations during normal development work (bug fixing, feature implementation, code review, etc.):

  • Class/symbol not found: Grep or Glob for a class name returns zero results in the workspace — the class is from a dependency, not project source. Do NOT report "class not found" to the user; use this skill to find and read it.
  • Import without definition: Code imports a class (e.g. import com.xxx.yyy.ZzzClass) but no .kt/.java file defining it exists in the project
  • Understanding library behavior: Need to check how a third-party API works internally — constructor params, callback interfaces, exception types, default values
  • Debugging through SDK code: Stack trace or crash points to a library class; need to read the source to understand the failure
  • API contract verification: Need to confirm method signatures, return types, or threading guarantees of a dependency class
  • User explicitly requests: "read library source", "show me the implementation of XxxClass", "阅读库源码"

> Key principle: When you cannot find a class definition in the project, your FIRST action should be to use this skill — not to tell the user "I can't find the class".

Decompiler Architecture

The tool supports 3 decompilers with automatic selection and fallback chain:

Priority Decompiler Source Notes
1 (highest) jadx brew install jadx Best quality; failure is final (no fallback)
2 CFR Bundled JAR (scripts/decompilers/cfr.jar) Robust for complex generics and obfuscated code
3 Fernflower Bundled JAR (scripts/decompilers/fernflower.jar) IntelliJ's decompiler, good readability

Selection logic (_select_decompiler): No Java version binding — selection is purely based on availability:
1. If jadx is on $PATH → use jadx
2. Else if cfr.jar exists → use CFR
3. Else if fernflower.jar exists → use Fernflower
4. Else → error, no decompiler available

Fallback chain (decompile_jar):
- jadx: No fallback. If jadx fails, the artifact is genuinely broken — returns error immediately.
- CFR → Fernflower: If CFR produces no output, automatically retries with Fernflower (and vice versa).
- If all fallbacks exhausted → returns error with actionable message.

Setup bundled decompilers (no jadx required):

bash scripts/fetch-decompilers.sh

This downloads CFR 0.152 from Maven Central and Fernflower from JetBrains Maven repository.

Design principles:
- decompile_jar owns selection + execution + fallback — callers don't need to know which decompiler is used.
- ensure_decompiler only checks/installs, never called in find-source critical path (no blocking brew install).

Lookup Strategy

Layer 1: Source JAR Extraction (Fastest, covers ~90% of open-source libraries)

Most open-source libraries publish a -sources.jar alongside the main artifact. Gradle downloads it to local cache during sync.

~/.gradle/caches/modules-2/files-2.1/<groupId>/<artifactId>/<version>/
  ├── <hash>/<artifactId>-<version>.jar          # Compiled artifact
  ├── <hash>/<artifactId>-<version>-sources.jar   # Source ✅
  └── <hash>/<artifactId>-<version>.pom           # Metadata

Steps:

# 1. Find source JAR
SOURCE_JAR=$(find ~/.gradle/caches/modules-2/files-2.1/<groupId>/<artifactId>/<version> \
  -name "*-sources.jar" -type f 2>/dev/null | head -1)

# 2. Read target class file directly from JAR (no extraction to disk)
# Convert class name com.google.gson.Gson to path com/google/gson/Gson.java
unzip -p "$SOURCE_JAR" "com/google/gson/Gson.java"

Layer 2: JAR/AAR Decompilation (Fallback when no source available)

When no source JAR exists, uses the decompiler fallback chain to decompile .jar or classes.jar inside .aar files.

# 1. Find compiled artifact
ARTIFACT=$(find ~/.gradle/caches/modules-2/files-2.1/<groupId>/<artifactId>/<version> \
  \( -name "*.jar" -not -name "*-sources.jar" -not -name "*-javadoc.jar" \) \
  -o -name "*.aar" 2>/dev/null | head -1)

# 2. If AAR, extract classes.jar first
if [[ "$ARTIFACT" == *.aar ]]; then
  unzip -o -q "$ARTIFACT" classes.jar -d /tmp/aar-extract/
  ARTIFACT=/tmp/aar-extract/classes.jar
fi

# 3. Decompile (auto-selects best available decompiler)
CACHE_DIR=~/.gradle/android-lib-reader/decompiled/<groupId>/<artifactId>/<version>
# decompile_jar handles jadx/CFR/Fernflower selection and fallback automatically

Cache Design

Cache Directory Structure

~/.gradle/android-lib-reader/
├── sources/                                    # Layer 1: Source extraction (legacy, dir-based)
│   └── <groupId>/<artifactId>/<version>/
│       └── com/example/MyClass.java
├── decompiled/                                 # Layer 2: Decompiled output
│   └── <groupId>/<artifactId>/<version>/
│       └── [sources/]com/example/MyClass.java
├── index.tsv                                   # Library coordinate index (TSV format, cross-session)
├── class-index.txt                             # Inverted index (library → classes, human-readable)
└── class-lookup.txt                            # Sorted lookup (class → library, binary search)

index.tsv Format

com.google.code.gson:gson:2.11.0    source  /path/to/gson-2.11.0-sources.jar    2026-06-10T17:50:00
com.example.internal:sdk:1.0.0  decompiled  /path/to/decompiled/sources 2026-06-10T18:00:00

> Note: The index was migrated from index.json to index.tsv for better performance. Legacy index.json files are auto-migrated on first use.

Environment Variables

Variable Description Default
PROJECT_ROOT Android project root for version matching Current directory
GRADLE_USER_HOME Custom Gradle home directory ~/.gradle

Script Commands

Script path: scripts/lib-reader.sh

PROJECT_ROOT=/path/to/android/project scripts/lib-reader.sh <command> [args]

Command Reference

Command Description Example
init Environment check and setup (tools, Gradle cache, index status) scripts/lib-reader.sh init
find-source <gid> <aid> [ver] Extract library source (auto-resolve version from project when omitted) scripts/lib-reader.sh find-source com.squareup.okhttp3 okhttp
find-class <className> Find and extract source by class name with auto version matching scripts/lib-reader.sh find-class com.google.gson.Gson
search <keyword> Fuzzy search libraries in Gradle cache scripts/lib-reader.sh search retrofit
tree <gid> <aid> <ver> List extracted library file structure scripts/lib-reader.sh tree com.google.code.gson gson 2.8.6
list List all cached libraries scripts/lib-reader.sh list
index-all Full index (source JAR + compiled JAR + AAR) scripts/lib-reader.sh index-all
rebuild-index Rebuild class name index for cached libraries scripts/lib-reader.sh rebuild-index
clean Clear all cache scripts/lib-reader.sh clean

find-class Search Strategy

find-class uses a two-layer progressive search:

  1. Layer 0: Index lookup (~0.1s) — Binary search via look on sorted class-lookup.txt. Supports exact match by FQCN and fuzzy match by simple class name. When multiple candidates exist, prefers the version used by the project.
  2. Layer 1: Parallel source JAR scan (~10s) — 8-way parallel unzip -Z -1 | grep across all source JARs in Gradle cache. Falls back here when the class index has no match.

Recommended: Run index-all once on first use to build the full index. All subsequent find-class calls will hit Layer 0 with instant response.

Version Matching Mechanism

find-class and find-source (when version is omitted) automatically parse the actual library version from the project:

  1. Variable reference: "com.xxx:yyy:$version" → find variable definition → extract version
  2. Hardcoded version: "com.xxx:yyy:1.2.3" → extract directly
  3. Version Catalog (inline): module = "com.xxx:yyy" with version = "1.2.3" in .toml
  4. Version Catalog (ref): module = "com.xxx:yyy" with version.ref = "xxx" → resolves from [versions] section

Output includes version match status:
- VERSION_MATCH:Project uses version X.Y.Z — Exact match
- VERSION_WARN:Project uses X.Y.Z, but only found source for A.B.C — Version mismatch, note caution

Real-World Query Examples

# Simple class name → fuzzy match
$ find-class Gson
FUZZY_MATCH:Gson -> com.google.gson.Gson
FOUND:.../gson-2.8.5-sources.jar!com/google/gson/Gson.java
COORD:com.google.code.gson:gson:2.8.5

# FQCN → exact index match (~0.3s)
$ find-class okhttp3.OkHttpClient
FOUND:.../okhttp-3.14.9-sources.jar!okhttp3/OkHttpClient.java
COORD:com.squareup.okhttp3:okhttp:3.14.9

# AndroidX class
$ find-class androidx.lifecycle.ViewModel
FOUND:.../lifecycle-viewmodel-2.3.0-sources.jar!androidx/lifecycle/ViewModel.java

# Internal SDK class
$ find-class MMOkHttpDns
FUZZY_MATCH:MMOkHttpDns -> com.immomo.mmdns.MMOkHttpDns
FOUND:.../mmdns-2.2.16.noweb2-sources.jar!com/immomo/mmdns/MMOkHttpDns.java

AI Agent Query Guide

When you cannot find a class in the project source, use these commands in order of preference:

  1. find-class <FQCN> — Best when you know the full class name from an import statement
  2. find-class <SimpleName> — When you only see the class name without package
  3. find-source <gid> <aid> — When you know the Maven coordinate (version auto-resolved)
  4. search <keyword> — When unsure about class name, search by library keyword

Notes

  • Prefer source JAR (Layer 1) over decompilation
  • Version matching: Always confirm the actual library version used by the project (check build.gradle or gradle.lockfile)
  • jadx is required for decompilation fallback. See Prerequisites section above for install instructions.
  • AAR vs JAR: AAR is Android library format containing classes.jar, resources, AndroidManifest, etc.; must extract before decompiling
  • Cache is persistent: ~/.gradle/android-lib-reader/ persists across sessions
  • Custom Gradle home: Set GRADLE_USER_HOME environment variable if using a non-default Gradle directory
  • Clear cache: rm -rf ~/.gradle/android-lib-reader/ to clear; will re-extract on next use

常见问题

5 问
答案由本站依据条目字段整理
安卓库源码自动定位阅读怎么安装?

在支持 Skills 的客户端里执行:skillhub install user_75978add/zhc-android-lib-reader。安装方式为未标注。装完刷新技能列表或重开客户端。

安卓库源码自动定位阅读支持哪些客户端?

资料没有标注宿主客户端,但只要客户端支持 Skills(Claude、Codex、Cursor 等),一般都能加载。

安卓库源码自动定位阅读权限高吗,安全吗?

权限级别为未标注权限。安装前先看它会读取或写入哪些内容。

安卓库源码自动定位阅读收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于技能本身和所用的模型或客户端,正式使用前按作者说明确认。

安卓库源码自动定位阅读用什么许可证?

许可证标注为 未说明(许可证不明确)。商用或二次分发前请到仓库确认条款原文。

热门专题

按场景挑技能
全部专题 →

技能内容以作者仓库为准;分类、权限级别与许可证状态的中文说明为中文整理,最近核验 2026-11-06。