agentleFS
TheQmaksTheQmaks/areclaw/.claude/skills/find-api/SKILL.md

find-api

Skill67 starsChanged 9 months agoMITView on GitHub

Discover, document, and map all API endpoints of an Android application

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Search for annotated interfaces — this is the goldmine:

    line 31
  2. Distinctive:

    Look for direct HTTP usage:

    line 49
  3. Distinctive:

    If endpoint strings are obfuscated:

    line 66
  4. Very specific:

    Look for string constants with URL patterns (/api/, /v1/, /v2/)

    line 67
  5. Distinctive:

    Look for JSON field names (they reveal data models)

    line 68
  6. Very specific:

    Check strings.xml and other resource files for URLs

    line 69
  7. Very specific:

    Check res/raw/ and assets/ for config files

    line 70
  8. Distinctive:

    If static analysis is insufficient or obfuscated:

    line 74
  9. Distinctive:

    If traffic was captured:

    line 128

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/find-api — API Discovery & Documentation

You are mapping the complete API surface of an Android application. Goal: a developer could rebuild the API client from your output.

Input

  • $ARGUMENTS — package name or APK path

Phase 1: Static Discovery

1a. Decompile (if not already done)

jadx -d workspace/output/$PKG --deobf $APK

1b. Quick Automated Scan

# apkleaks finds URLs, endpoints, API keys in seconds
apkleaks -f $APK --json -o workspace/reports/$PKG-endpoints.json

Review output — often catches endpoints that manual grep misses (string concatenation, BuildConfig fields).

1c. Retrofit Interfaces

Search for annotated interfaces — this is the goldmine:

grep -rn "@GET\|@POST\|@PUT\|@DELETE\|@PATCH\|@HEAD\|@HTTP" workspace/output/$PKG/

For each interface found:

  • Map method → HTTP verb + path
  • Map @Query, @Field, @Body, @Path parameters
  • Map return type (usually Call<Model> or Observable<Model>)
  • Find the model classes for request/response

1c. Base URL Discovery

grep -rn 'baseUrl\|BASE_URL\|API_URL\|SERVER_URL\|ENDPOINT\|api_host' workspace/output/$PKG/
grep -rn 'https\?://[a-zA-Z0-9.-]*api[a-zA-Z0-9.-]*' workspace/output/$PKG/

1d. Non-Retrofit HTTP

Look for direct HTTP usage:

grep -rn 'HttpURLConnection\|OkHttpClient\|Volley\|WebView.*loadUrl' workspace/output/$PKG/

1e. WebSocket / Real-time

grep -rn 'WebSocket\|ws://\|wss://\|Socket\.IO\|firebase' workspace/output/$PKG/

1f. GraphQL / gRPC

grep -rn 'graphql\|/graphql\|query.*{.*}\|ManagedChannel\|\.grpc\.' workspace/output/$PKG/

Phase 2: Handle Obfuscation

If endpoint strings are obfuscated:

  • Look for string constants with URL patterns (/api/, /v1/, /v2/)
  • Look for JSON field names (they reveal data models)
  • Check strings.xml and other resource files for URLs
  • Check res/raw/ and assets/ for config files

Phase 3: Dynamic Discovery (if device available)

If static analysis is insufficient or obfuscated:

# Option A: Frida API tracer (captures Retrofit calls)
frida -U -f $PKG -l workspace/frida-scripts/api-tracer.js

# Option B: Full HTTP logging (captures all traffic)
frida -U -f $PKG -l workspace/frida-scripts/ssl-bypass.js -l workspace/frida-scripts/http-logger.js

# Navigate the app to trigger API calls
python pytools/ui_explorer.py snapshot
# Walk through key screens

Save traffic to workspace/traffic/$PKG-traffic.json

Phase 4: Correlation

Build the complete picture:

  • UI Screen → Activity → API Call: Which screen triggers which endpoint?
  • Auth Flow: Login endpoint → token → how token is passed → refresh flow
  • Data Models: Request/response JSON structures

Phase 5: Output

API Documentation (Markdown)

Save to workspace/reports/$PKG-api.md:

# API Documentation: <App Name>

## Base URLs
- Production: https://api.example.com
- CDN: https://cdn.example.com

## Authentication
- Type: Bearer JWT / API Key / OAuth2
- Login: POST /auth/login → { access_token, refresh_token }
- Token passed via: Authorization header / cookie / custom header

## Endpoints

### Auth
| Method | Path | Auth | Body | Response |
|--------|------|------|------|----------|
| POST | /auth/login | No | { email, password } | { token, user } |
| POST | /auth/refresh | Bearer | { refresh_token } | { token } |

### Users
| Method | Path | Auth | Params | Response |
...

Postman Collection

If traffic was captured:

python pytools/traffic_to_collection.py frida workspace/traffic/$PKG-traffic.json --name "$PKG API" --output workspace/collections/$PKG.json

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.