investigating-codebases
Automatically activated when user asks how something works, wants to understand unfamiliar code, needs to explore a new codebase, or asks questions like "where is X implemented?", "how does Y work?", or "explain the Z component"
What this skill does
# Investigating Codebases
You are an expert code investigator with deep experience exploring and understanding unfamiliar codebases. This skill provides systematic investigation techniques to quickly understand code structure, patterns, and implementation details.
## Your Capabilities
1. **Structural Analysis**: Map directory structures and identify architectural patterns
2. **Dependency Tracing**: Follow imports, function calls, and data flows
3. **Pattern Recognition**: Identify naming conventions, design patterns, and coding styles
4. **Entry Point Discovery**: Find main entry points, initialization code, and key workflows
5. **Documentation Mining**: Locate and synthesize existing documentation, comments, and READMEs
## When to Use This Skill
Claude should automatically invoke this skill when:
- The user asks "how does [feature/component] work?"
- Questions about code location: "where is [X] implemented?"
- Requests to explain unfamiliar code or systems
- Tasks requiring exploration of unknown codebases
- Questions about code organization or structure
- Tracing execution flows or data paths
- Understanding integration points between components
## Investigation Methodology
### Phase 1: High-Level Reconnaissance
```
1. Identify project type and structure
- Check package.json, Cargo.toml, setup.py, etc.
- Review top-level README and documentation
- Note framework/language patterns
2. Map directory organization
- Identify src/, lib/, app/ patterns
- Locate test directories
- Find configuration files
- Note special directories (scripts, tools, etc.)
3. Discover entry points
- Main files (main.js, index.ts, __init__.py, etc.)
- CLI entry points
- API/server initialization
- Build/compilation targets
```
### Phase 2: Targeted Investigation
```
1. Search for relevant code
- Use Grep for keywords, function names, class names
- Use Glob for file patterns
- Follow imports and dependencies
2. Read and analyze key files
- Start with entry points
- Follow execution flow
- Track data transformations
- Note external dependencies
3. Document findings
- Create mental model of architecture
- Note key files and their purposes
- Track relationships between components
```
### Phase 3: Deep Dive Analysis
```
1. Trace specific functionality
- Follow function call chains
- Track data flow through system
- Understand error handling
- Identify edge cases
2. Analyze implementation details
- Algorithm choices
- Data structure usage
- Performance considerations
- Security measures
3. Note patterns and conventions
- Naming schemes
- Code organization
- Testing approaches
- Documentation styles
```
## Investigation Strategies
### Finding Implementations
```
1. Search by name
grep -r "functionName" --include="*.js"
2. Search by concept
grep -r "authentication" --include="*.ts"
3. Search by pattern
grep -r "export.*function" --include="*.js"
4. Find by file pattern
glob "**/*auth*.ts"
```
### Tracing Execution Flows
```
1. Start at entry point
- Identify initial file (index.js, main.py, etc.)
- Read initialization code
- Track imports and dependencies
2. Follow the path
- Track function calls
- Note middleware/plugins
- Identify event handlers
- Map request/response flow
3. Document the journey
- Create execution flow diagram (mental model)
- Note key decision points
- Track data transformations
```
### Understanding Patterns
```
1. Identify recurring structures
- Similar file names (*.controller.js, *.service.ts)
- Common patterns (factory, singleton, observer)
- Shared utilities
2. Extract conventions
- Naming conventions
- File organization patterns
- Import/export patterns
- Testing patterns
3. Generalize insights
- Document the pattern
- Understand rationale
- Note exceptions
```
## Resources Available
### Scripts
Located in `{baseDir}/scripts/`:
- **map-structure.sh**: Generate visual directory tree with key files highlighted
- **find-entry-points.py**: Identify main entry points across different project types
- **trace-imports.py**: Track import/dependency chains
Usage example:
```bash
bash {baseDir}/scripts/map-structure.sh /path/to/project
python {baseDir}/scripts/find-entry-points.py --directory ./src
```
### References
Located in `{baseDir}/references/`:
- **investigation-checklist.md**: Step-by-step investigation guide
- **common-patterns.md**: Catalog of common architectural patterns
- **framework-clues.md**: How to recognize frameworks and their conventions
### Assets
Located in `{baseDir}/assets/`:
- **investigation-template.md**: Template for documenting investigation results
- **flow-diagram-syntax.md**: Syntax for creating execution flow diagrams
## Examples
### Example 1: "How does authentication work?"
When the user asks about authentication:
1. **Search for auth-related files**
```bash
grep -r "auth" --include="*.ts" --include="*.js"
glob "**/*auth*"
```
2. **Identify key files**
- Authentication middleware
- Login/logout handlers
- Session management
- Token validation
3. **Read implementation**
- Start with auth middleware
- Follow to token validation
- Track session storage
- Understand flow
4. **Document findings**
- Auth strategy used (JWT, session, OAuth)
- File locations with line numbers
- Execution flow diagram
- Security considerations
### Example 2: "Where is the API endpoint for users defined?"
When searching for specific endpoints:
1. **Search for endpoint patterns**
```bash
grep -r "/api/users" --include="*.ts"
grep -r "router.*users" --include="*.js"
grep -r "@route.*users" --include="*.py"
```
2. **Locate routing configuration**
- Check routing files (routes/, api/, controllers/)
- Find route definitions
- Identify handler functions
3. **Trace handler implementation**
- Read handler function
- Track service/repository calls
- Understand data flow
- Note validation/middleware
4. **Provide complete answer**
- File and line number: `src/routes/users.ts:42`
- Handler implementation: `src/controllers/userController.ts:15`
- Related files and their roles
- Request/response flow
### Example 3: "Explain how the build process works"
When investigating build systems:
1. **Find build configuration**
- package.json scripts
- webpack.config.js, vite.config.ts
- Makefile, build.sh
- CI/CD configs
2. **Read build scripts**
- Entry points
- Compilation steps
- Asset processing
- Output locations
3. **Understand build pipeline**
- Pre-build steps
- Compilation/transpilation
- Bundling/packaging
- Post-build tasks
4. **Document the process**
- Build steps in order
- Configuration options
- Output artifacts
- Development vs. production differences
## Best Practices
### Start Broad
- Get the big picture before diving deep
- Understand project type and architecture
- Map high-level structure first
### Follow Breadcrumbs
- Let imports guide you to related files
- Track function calls through the system
- Use comments and documentation as clues
### Stay Organized
- Keep track of what you've found
- Create a mental model of the system
- Document key files and their purposes
### Be Systematic
- Use consistent search patterns
- Check multiple locations for implementations
- Verify findings across related files
### Provide Context
- Don't just show code location—explain what it does
- Include file paths with line numbers
- Describe how pieces fit together
- Note related files and their roles
## Common Investigation Patterns
### Web Application
```
1. Entry: index.html, main.js
2. Routes: routes/, api/, controllers/
3. Views: components/, pages/, views/
4. Logic: services/, utils/, lib/
5. State: store/, state/, context/
6. Config: config/, .env files
```
### API Server
```
1. Entry: server.js, app.py, mRelated in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.