agentleFS
bordenetbordenet/superpowers-plus/skills/engineering/codebase-recon/skill.md

codebase-recon

Skill8 starsChanged 6 months agoMITView on GitHub

Use when investigating a feature area, doing an RCA, or auditing code across multiple repos and perspectives. Runs structured searches through 8 lenses (security, auth, data flow, error handling, config/secrets, test coverage, API surface, cross-repo consistency) and produces a findings table with evidence.

3 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Identify all repos that could be involved: Ask the user if unclear.

    line 53
  2. Distinctive:

    Run these searches across ALL repos in scope.

    line 69
  3. Very specific:

    Run each lens IN ORDER. Each lens has specific search patterns and a checklist.

    line 82
  4. Very specific:

    Verify feature visibility is gated by plan/tier/flag, not just by whether data happens to exist.

    line 91
  5. Distinctive:

    Verify identical behavior across repos: same data references, same gating logic, no diverged copy-pastes.

    line 103
  6. Very specific:

    Quality Gate: Run progressive-harsh-review.

    line 131
  7. Distinctive:

    Don't trust comments: Verify files exist; don't assume conventional layout.

    line 145
  8. Very specific:

    Don't claim external CLI calls are correct by syntax alone: If scope includes wrapper scripts invoking gh, aws, kubectl, npm, etc., …

    line 146

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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

Codebase Recon — Wide-Band Investigation

Purpose: Systematic multi-lens investigation of a feature area, producing structured findings with evidence.

Announce at start: "I'm using the codebase-recon skill to investigate this area across 8 lenses."

Reference index

Load reference.md for full grep commands and checklists behind each lens (section: Lens Search Patterns).


When to Use

Use codebase-recon when:

  • Root cause is UNKNOWN — you can't write "the bug is X in file Y because Z"
  • The defect might span multiple repos or call chains
  • You need to map blast radius before changing shared code
  • The request is "how does this work?" or "find all places that..." — exploration, not a fix
  • Pre-fix investigation to scope a surgical-fix (result: feeds directly into surgical-fix Phase 0)

Handoff: codebase-recon → produces investigation report → surgical-fix Phase 0 consumes it. Do NOT switch without a written scope statement.


Phase 0: Scope & Anchor (5 min)

  1. Define the investigation target — a feature name, bug report, ticket, or area of concern.
  2. Identify all repos that could be involved. Ask the user if unclear.
  3. Create a coverage map — a table tracking what has/hasn't been searched:
| Repo | Searched | Files checked | Findings |
|------|----------|---------------|----------|
| repo-a | ☐ | 0 | 0 |
| repo-b | ☐ | 0 | 0 |
  1. Set the output document location (wiki page, local file, or inline).

Phase 1: Cross-Repo Entry Point Search (10 min)

Run these searches across ALL repos in scope. Record every hit.

# Primary search — adapt KEYWORD to feature area, EXTS to language
grep -rn 'KEYWORD' --include="*.ts" --include="*.js" --include="*.py" REPO_PATH | head -50

Output: A ranked list of files by relevance. Open the top 5-10 in the viewer to understand data flow.


Phase 2: Run All 8 Lenses (30-45 min)

Run each lens IN ORDER. Each lens has specific search patterns and a checklist. Record ALL findings in the master table (Phase 3 format). Full search commands: see reference.md.

Lens 1: Authentication & Authorization

Find every entry point (public HTTP handlers, exported API routes) and verify auth enforcement and account scoping.

Lens 2: Security — Injection & Secrets

Find SQL injection risks (parameterized queries absent), hardcoded API keys/secrets, and debug dump endpoints.

Lens 3: Feature Gating & Entitlement

Verify feature visibility is gated by plan/tier/flag, not just by whether data happens to exist.

Lens 4: Data Flow — Where Does Data Come From and Go?

Trace data from database queries → server → client → outbound integrations (HTTP calls, webhooks, etc.).

Lens 5: Error Handling & Fail Mode

Determine what happens when things go wrong: gate queries must fail CLOSED, errors must be logged (not swallowed), users see graceful degradation, not stack traces.

Lens 6: Test Coverage

Find test files: find REPO_PATH -name "*test*" -o -name "*spec*" | grep -i 'KEYWORD'.

Lens 7: Cross-Repo Consistency

Verify identical behavior across repos: same data references, same gating logic, no diverged copy-pastes.

Lens 8: Git Blame & Change History

Understand WHO introduced WHAT and WHEN. Run AFTER Lenses 1-7 are complete — collect findings first, then git-blame all of them in one pass.


Phase 3: Findings Table (10 min)

| # | Lens | File | Lines | Finding | Severity | Evidence |
|---|------|------|-------|---------|----------|----------|
| 1 | Auth | handler.ts | L41 | public route with no auth check | Critical | grep output |
| 2 | Security | query.ts | L71 | unsanitized user input in SQL | Critical | view L69-73 |

Severity scale: Critical (unauthenticated access, injection, tenant exposure) · High (missing gate, wrong-tier data) · Medium (hardcoded config, debug endpoint, missing error handling) · Low (missing tests, inconsistent patterns)


Phase 4: Synthesis & Report (15 min)

  1. Group findings by theme (not by lens — a single finding may span lenses)
  2. Write Bottom Line — 3-5 sentences summarizing what's broken and what to do
  3. Create fix priority list — P0 (today), P1 (this sprint), P2 (tech debt)
  4. Update coverage map — mark what's been searched
  5. List open questions — things you couldn't determine from code alone

Quality Gate: Run progressive-harsh-review. Score <6: remediate. 6-8: PASS_WITH_FIXES. >8: PASS.

Handoff to surgical-fix

"Investigation complete. Handing off finding #X to surgical-fix for implementation."

Include: file(s), line(s), what's wrong, proposed fix approach.

Anti-Patterns (MUST AVOID)

  1. Don't fix things during recon. Record findings, don't edit code.
  2. Don't go deep on one file. Breadth first, depth second.
  3. Don't skip repos. Gaps in coverage are where bugs hide.
  4. Don't trust comments. Verify files exist; don't assume conventional layout.
  5. Don't claim external CLI calls are correct by syntax alone. If scope includes wrapper scripts invoking gh, aws, kubectl, npm, etc., escalate to external-cli-audit — bash control flow tells you nothing about scope/identity/persistence-layer flags.

Failure Modes

FailureRecovery
Only searched one repoReturn to Phase 0 coverage map; search all in-scope repos
Skipped a lens as "probably clean"All lenses are mandatory; complete in order
Claimed external CLI wrappers are correct without checking CLI defaultsRun external-cli-audit for each external CLI invoked

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.