Get the FREE Ultimate OpenClaw Setup Guide →

investigating-a-codebase

Scanned
npx machina-cli add skill ed3dai/ed3d-plugins/investigating-a-codebase --openclaw
Files (1)
SKILL.md
4.9 KB

Investigating a Codebase

Overview

Understand current codebase state to ground planning and design decisions in reality, not assumptions. Find existing patterns, verify design assumptions, and provide definitive answers about what exists and where.

When to Use

Use for:

  • Verifying design assumptions before implementation ("Design assumes auth.ts exists - verify")
  • Finding existing patterns to follow ("How do we currently handle API errors?")
  • Locating features or code ("Where is user authentication implemented?")
  • Understanding component architecture ("How does the routing system work?")
  • Confirming existence definitively ("Does feature X exist or not?")
  • Preventing hallucination about file paths and structure

Don't use for:

  • Information available in external docs (use internet research)
  • Questions answered by reading 1-2 specific known files (use Read directly)
  • General programming questions not specific to this codebase

Core Investigation Workflow

  1. Start with entry points - main files, index, package.json, config
  2. Use multiple search strategies - Glob patterns, Grep keywords, Read files
  3. Follow traces - imports, references, component relationships
  4. Verify don't assume - confirm file locations and structure
  5. Report definitively - exact paths or "not found" with search strategy

Verifying Design Assumptions

When given design assumptions to verify:

  1. Extract assumptions - list what design expects to exist
  2. Search for each - file paths, functions, patterns, dependencies
  3. Compare reality vs expectation - matches, discrepancies, additions, missing
  4. Report explicitly:
    • ✓ Confirmed: "Design assumption correct: auth.ts:42 has login()"
    • ✗ Discrepancy: "Design assumes auth.ts, found auth/index.ts instead"
    • + Addition: "Found logout() not mentioned in design"
    • - Missing: "Design expects resetPassword(), not found"

Why this matters: Prevents implementation plans based on wrong assumptions about codebase structure.

Quick Reference

TaskStrategy
Where is XGlob likely names → Grep keywords → Read matches
How does X workFind entry point → Follow imports → Read implementation
What patterns existFind examples → Compare implementations → Extract conventions
Does X existMultiple searches → Definitive yes/no → Evidence
Verify assumptionsExtract claims → Search each → Compare reality vs expectation

Investigation Strategies

Multiple search approaches:

  • Glob for file patterns across codebase
  • Grep for keywords, function names, imports
  • Read key files to understand implementation
  • Follow imports and references for relationships
  • Check package.json, config files for dependencies

Don't stop at first result:

  • Explore multiple paths to verify findings
  • Cross-reference different areas of codebase
  • Confirm patterns are consistent not one-off
  • Follow both usage and definition traces

Verify everything:

  • Never assume file locations - always verify with Read/Glob
  • Never assume structure - explore and confirm
  • Document search strategy when reporting "not found"
  • Distinguish "doesn't exist" from "couldn't locate"

Reporting Findings

Lead with direct answer:

  • Answer the question first
  • Supporting details second
  • Evidence with exact file paths and line numbers

Provide actionable intelligence:

  • Exact file paths (src/auth/login.ts:42), not vague locations
  • Relevant code snippets showing current patterns
  • Dependencies and versions when relevant
  • Configuration files and current settings
  • Naming, structure, and testing conventions

Handle "not found" confidently:

  • "Feature X does not exist" is valid and useful
  • Explain what you searched and where you looked
  • Suggest related code as starting point
  • Report negative findings prevents hallucination

Common Mistakes

MistakeFix
Assuming file locationsAlways verify with Read/Glob before reporting
Stopping at first resultExplore multiple paths to verify findings
Vague locations ("in auth folder")Exact paths (src/auth/index.ts:42)
Not documenting search strategyExplain what was checked when reporting "not found"
Confusing "not found" typesDistinguish "doesn't exist" from "couldn't locate"
Skipping design assumption comparisonExplicitly report: confirmed/discrepancy/addition/missing
Reporting assumptions as factsOnly report what was verified in codebase

Source

git clone https://github.com/ed3dai/ed3d-plugins/blob/main/plugins/ed3d-research-agents/skills/investigating-a-codebase/SKILL.mdView on GitHub

Overview

Investigating a Codebase helps teams plan features by understanding the current state, identifying existing patterns, and verifying exact code existence. It grounds decisions in reality to reduce guesswork and design defects.

How This Skill Works

Start from entry points like main files and package.json, then apply multiple search strategies (glob, grep, and direct reads) to trace imports and references. Verify file locations and structure before reporting, ensuring conclusions are definitive.

When to Use It

  • Verifying design assumptions before implementation (e.g., auth.ts exists and where).
  • Finding existing patterns to follow (e.g., how API errors are handled).
  • Locating features or code (e.g., where user authentication is implemented).
  • Understanding component architecture (e.g., routing and module layout).
  • Confirming existence of specific files or features (definitively).

Quick Start

  1. Step 1: Identify entry points (package.json, index.ts) and top-level modules.
  2. Step 2: Run glob and grep searches for relevant patterns and terms.
  3. Step 3: Read matched files, verify locations, and report exact paths.

Best Practices

  • Start at entry points (main files, package.json, config).
  • Use glob, grep, and direct reads for comprehensive coverage.
  • Follow imports and references to map relationships.
  • Never assume file locations or structure; verify with reads.
  • Document search strategy and findings with exact paths and evidence.

Example Use Cases

  • Does feature X exist? Provide exact path and a yes/no answer.
  • Where is user authentication implemented? e.g., src/auth/login.ts.
  • What patterns exist for API error handling? Show file paths and conventions.
  • How does the routing system work? Trace the entry point and imports.
  • Is auth.ts used by design, or is it auth/index.ts? Provide verification.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers