home / skills / ed3dai / ed3d-plugins / investigating-a-codebase

This skill helps you verify codebase state and locate existing patterns to ground design decisions in reality.

npx playbooks add skill ed3dai/ed3d-plugins --skill investigating-a-codebase

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
4.9 KB
---
name: investigating-a-codebase
description: Use when planning or designing features and need to understand current codebase state, find existing patterns, or verify assumptions about what exists; when design makes assumptions about file locations, structure, or existing code that need verification - prevents hallucination by grounding plans in reality
user-invocable: false
---

# 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

| Task | Strategy |
|------|----------|
| **Where is X** | Glob likely names → Grep keywords → Read matches |
| **How does X work** | Find entry point → Follow imports → Read implementation |
| **What patterns exist** | Find examples → Compare implementations → Extract conventions |
| **Does X exist** | Multiple searches → Definitive yes/no → Evidence |
| **Verify assumptions** | Extract 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

| Mistake | Fix |
|---------|-----|
| Assuming file locations | Always verify with Read/Glob before reporting |
| Stopping at first result | Explore multiple paths to verify findings |
| Vague locations ("in auth folder") | Exact paths (src/auth/index.ts:42) |
| Not documenting search strategy | Explain what was checked when reporting "not found" |
| Confusing "not found" types | Distinguish "doesn't exist" from "couldn't locate" |
| Skipping design assumption comparison | Explicitly report: confirmed/discrepancy/addition/missing |
| Reporting assumptions as facts | Only report what was verified in codebase |

Overview

This skill helps you inspect a Python codebase to ground design and planning in reality. It finds files, verifies assumptions about structure, exposes patterns, and gives definitive answers about what exists and where. Use it to prevent hallucinations about file locations, APIs, or architecture.

How this skill works

I start from likely entry points (main files, setup/config, package files) and run targeted searches: glob for candidate paths, grep for keywords and symbols, then read and follow imports to trace implementations. For design assumptions I extract claims, search for each item, compare reality with expectations, and report with exact paths, snippets, and the search strategy used.

When to use it

  • Before implementing features that depend on existing files or modules
  • When verifying design assumptions about file names, functions, or locations
  • To locate implementations or patterns to follow (auth, routing, error handling)
  • When you need a definitive yes/no about whether a feature or symbol exists
  • To document architecture and conventions before writing new code

Best practices

  • Always verify with glob/grep/read rather than assuming file paths
  • Search broadly and follow import/reference traces, not just first hit
  • Report exact file paths and line numbers, plus small evidence snippets
  • Document the search strategy when something isn’t found
  • Compare design assumptions explicitly: confirmed, discrepancy, addition, missing

Example use cases

  • Design assumes auth.py exists in src/auth — verify and provide exact path or equivalent file
  • Find how API errors are handled across the codebase and extract the canonical pattern
  • Locate where user routing and registration are implemented and list entry points
  • Check if a specific utility function or class exists and report exact matches or absence with search scope
  • Verify package/config declarations (setup.cfg/pyproject.toml) and report dependency clues relevant to feature design

FAQ

What if a search returns many similar hits?

I prioritize likely entry points and implementations, then cross-check examples to determine the canonical pattern and note outliers.

How do you report a missing feature?

I state it’s not found, show what paths and keywords I searched, and suggest closest files or places to add the feature.