Add android-project-full-audit and local-worker-handoff skills; sync scaffold skill
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
216cf3478d
commit
59fc08fa5f
27 changed files with 1064 additions and 11 deletions
|
|
@ -0,0 +1,58 @@
|
|||
# File-auditor prompt
|
||||
|
||||
Use this verbatim (fill the `{…}` placeholders) when spawning a subagent for one batch. The main model follows the same rules when it audits files itself.
|
||||
|
||||
---
|
||||
|
||||
You are auditing part of an Android codebase. Your job is to read source files **one at a time, in full**, and record what they reveal about how the app is implemented into a shared library of audit docs. Documentation (README, docs/, KDoc claims, comments describing intent) is NOT evidence — only code and build config is. If a comment says one thing and the code does another, record what the code does (and note the mismatch under `observations`).
|
||||
|
||||
- Project root: `{PROJECT_ROOT}`
|
||||
- Audit workspace: `{AUDIT_DIR}`
|
||||
- Helper: `A="{SKILL_DIR}/scripts/audit.sh"`
|
||||
- Your batch: `{AUDIT_DIR}/batches/{BATCH_FILE}` (one project-relative path per line)
|
||||
- Orientation context (from the main pass): {ORIENTATION_SUMMARY}
|
||||
|
||||
## Before starting
|
||||
|
||||
1. `bash $A patterns {AUDIT_DIR}` — see what is already documented, so you don't re-describe known patterns.
|
||||
2. Skim `{AUDIT_DIR}/library/<category>.md` headers for the categories your batch likely touches.
|
||||
|
||||
## For each file in the batch, in order
|
||||
|
||||
1. **Read the whole file** with the file-read tool (`Read` / `read`), one file per call (never judge from the filename or a grep, and never `cat` groups of files through Bash). For very large files (>800 lines) read it in chunks, but read all of it.
|
||||
2. Decide what it shows. Categories: `build-and-modules file-organization architecture ui navigation networking serialization persistence concurrency dependency-injection background-work platform-integration security-auth observability testing features observations`. One file can feed several categories.
|
||||
3. For each thing it shows, choose ONE of:
|
||||
- **New pattern** → record it:
|
||||
```bash
|
||||
bash $A finding {AUDIT_DIR} <category> <kebab-slug> <path> "<Short title>" <<'EOF'
|
||||
- **What:** concrete mechanism (library + version if visible, class/function names)
|
||||
- **How:** 2–5 bullets on how it actually works here, citing `path:line` for key lines
|
||||
- **Why it matters / where it connects:** related files/classes (optional)
|
||||
EOF
|
||||
```
|
||||
Slug names the *pattern*, not the file: `okhttp-auth-interceptor`, `room-flow-dao`, `hilt-viewmodel-injection`, `feature-checkout-flow`.
|
||||
- **Refinement of an existing pattern** (adds something genuinely new — a variant, an exception, a second mechanism, or a correction of an earlier claim) → same `finding` command with the existing slug and **no title**; it is inserted under that entry.
|
||||
- **Pure repetition** (same pattern, nothing new) → `bash $A also {AUDIT_DIR} <category> <slug> <path>` only. Do not write prose. This keeps prevalence counts honest without bloating the docs.
|
||||
4. **Features:** if the file is a screen, route, entry point, worker, receiver, or widget the user experiences, record a `features` entry (slug `feature-<name>`) describing in user language what it lets the user do, the entry-point file, and the route/deep link if any. Read string resources referenced for labels if needed.
|
||||
5. Mark the file — exactly one status:
|
||||
- `contributed` — you recorded at least one `finding` (new or refinement)
|
||||
- `redundant` — only `also` occurrences; note = the slug(s) it repeats
|
||||
- `trivial` — nothing worth recording (empty, constants, generated-like, tiny glue); note = why
|
||||
- `skipped` — could not read / binary / out of scope; note = why
|
||||
```bash
|
||||
bash $A mark {AUDIT_DIR} <path> <status> "<short note>"
|
||||
```
|
||||
|
||||
## Rules
|
||||
|
||||
- Evidence over inference. Every claim cites a path (and line where useful). If you infer something not directly visible, prefix it with "Inferred:".
|
||||
- Library versions come from `libs.versions.toml` / build files, never from docs.
|
||||
- Never open `local.properties`, keystores, `google-services.json` or `.env` files, and never copy secrets (API keys, tokens) into the library — note their presence and location only.
|
||||
- Line numbers you cite must come from what the file-read tool showed you. If you didn't see the line, cite the file without a line number.
|
||||
- Prefer one sharp entry over many vague ones. Don't restate what a pattern already says.
|
||||
- Stay inside your batch. If a file references something important outside it, mention the referenced path in your finding; another pass covers it.
|
||||
- Use only the helper to write to the library and ledger (it handles locking — other auditors are writing concurrently). Do not edit library files directly.
|
||||
|
||||
## When done
|
||||
|
||||
Run `bash $A coverage {AUDIT_DIR}` and reply with ≤15 lines: counts by status for your batch, the new slugs you created, and anything surprising (conflicting patterns, migrations in progress, suspected dead code).
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
# Report template
|
||||
|
||||
Write `{AUDIT_DIR}/REPORT.md` with this structure. Every table cell that names a file must be a real, project-relative path that exists. Pull content from `library/*.md`, `occurrences.tsv`, `ledger.tsv` and `audit.sh tree` output — not from memory, not from docs.
|
||||
|
||||
```markdown
|
||||
# <App name> — Architecture Audit
|
||||
_Audited <date> from source at <project path> (<git short SHA if available>). Files in scope: N; read: N; contributed: N; redundant: N; trivial: N; skipped: N._
|
||||
_Source of truth: implementation only. Documentation was not used as evidence._
|
||||
|
||||
## 1. At a glance
|
||||
3–6 bullets: what the app is, the architectural style in one line, UI toolkit, async model, DI, data layer, module count.
|
||||
|
||||
## 2. Build & toolchain
|
||||
| Item | Value | Source |
|
||||
|---|---|---|
|
||||
| AGP / Gradle / Kotlin / JDK | … | `gradle/libs.versions.toml` |
|
||||
| compileSdk / minSdk / targetSdk | … | … |
|
||||
| Modules | N (list or link to §3) | `settings.gradle.kts` |
|
||||
| Build types / flavors | … | … |
|
||||
| Annotation processing | KSP / KAPT | … |
|
||||
|
||||
## 3. File tree organization
|
||||
- **Scheme:** e.g. "multi-module, package-by-feature: `:feature:*` (UI+VM), `:core:*` (data, network, db, designsystem), `:app` (wiring)". State whether packaging is by feature, by layer, or mixed, with evidence.
|
||||
- A trimmed tree (modules → key packages, file counts), ≤40 lines, from `audit.sh tree`.
|
||||
- Module dependency direction (Mermaid `graph` or arrow list) if multi-module.
|
||||
- Naming conventions observed, and notable outliers.
|
||||
|
||||
## 4. Implementation summary
|
||||
| Category | Implementation details | Code pointers |
|
||||
|---|---|---|
|
||||
| UI | Jetpack Compose (Material 3), custom theme in `:core:designsystem`; Coil for images | `feature/home/.../HomeScreen.kt`, `core/designsystem/.../Theme.kt` |
|
||||
| Navigation | Navigation Compose 2.8 type-safe routes; one NavHost | `app/.../AppNavHost.kt` |
|
||||
| Networking | Retrofit + OkHttp, auth interceptor, kotlinx.serialization converter | `core/network/.../NetworkModule.kt`, `.../AuthInterceptor.kt` |
|
||||
| Concurrency | Coroutines + Flow; injected dispatchers; `stateIn(WhileSubscribed)` in VMs | … |
|
||||
| … one row per category that has findings: architecture, serialization, persistence, DI, background work, platform integration, security/auth, observability, testing, build | | |
|
||||
|
||||
Rules: "Implementation details" names concrete libraries/mechanisms (+version when known) and, when a category has competing approaches, lists both with rough prevalence ("StateFlow in 14 VMs, LiveData in 3 legacy VMs"). "Code pointers" = 1–3 exemplar files that best show the category (the exemplars from the library, preferring the clearest over the first-seen).
|
||||
|
||||
## 5. Features (user perspective)
|
||||
| Feature | What it lets the user do | Entry point |
|
||||
|---|---|---|
|
||||
| Sign in | Log in with email/password or Google; stays signed in across launches | `feature/auth/.../LoginScreen.kt` |
|
||||
| … | | |
|
||||
|
||||
Include user-perceivable background features (sync, notifications, widgets, share targets, deep links). Group by area if > 15 rows.
|
||||
|
||||
## 6. Architecture & data flow
|
||||
- Layering as implemented (UI → VM → UseCase? → Repository → DataSource), with one traced example end-to-end citing each file in the chain.
|
||||
- State management shape (UiState / events / effects).
|
||||
- Offline/caching strategy, source of truth.
|
||||
- Optional Mermaid diagram.
|
||||
|
||||
## 7. Observations
|
||||
- **Inconsistencies / migrations in progress** (two ways of doing the same thing, with counts).
|
||||
- **Risks & tech debt** (with paths).
|
||||
- **Strengths** worth preserving.
|
||||
|
||||
## 8. Coverage & method
|
||||
How many files were in scope, read, and contributed; what was excluded and why (generated code, resources counted not read: `resource-counts.tsv`); how many subagents/batches. Location of the library: `{AUDIT_DIR}/library/`.
|
||||
|
||||
## 9. Usage & duration
|
||||
Paste `usage.md` verbatim: wall-clock duration, per-phase durations, and the token table per harness / session kind / model, with the total row. Below it, add one line per caveat that applies:
|
||||
- Tokens for writing this report fall after `finish` and are not included.
|
||||
- The run was resumed across sessions, so wall clock includes idle time.
|
||||
- A local model (vLLM/Ollama) reports no cache hits, so its input shows as uncached.
|
||||
- Another audit or unrelated work ran in the same session during the window, so the session row includes that.
|
||||
```
|
||||
|
||||
After writing the file, print to the terminal: section 1, the Implementation summary table, the Features table, the top 3–5 observations, the duration and token total row from §9, and the path to `REPORT.md`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue