skills/c0ntr0lledcha0s/investigating-codebases/SKILL.md
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"
npx skillsauth add aiskillstore/marketplace investigating-codebasesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
Claude should automatically invoke this skill when:
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
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
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
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"
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
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
Located in {baseDir}/scripts/:
Usage example:
bash {baseDir}/scripts/map-structure.sh /path/to/project
python {baseDir}/scripts/find-entry-points.py --directory ./src
Located in {baseDir}/references/:
Located in {baseDir}/assets/:
When the user asks about authentication:
Search for auth-related files
grep -r "auth" --include="*.ts" --include="*.js"
glob "**/*auth*"
Identify key files
Read implementation
Document findings
When searching for specific endpoints:
Search for endpoint patterns
grep -r "/api/users" --include="*.ts"
grep -r "router.*users" --include="*.js"
grep -r "@route.*users" --include="*.py"
Locate routing configuration
Trace handler implementation
Provide complete answer
src/routes/users.ts:42src/controllers/userController.ts:15When investigating build systems:
Find build configuration
Read build scripts
Understand build pipeline
Document the process
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
1. Entry: server.js, app.py, main.go
2. Routes: routes/, endpoints/, handlers/
3. Middleware: middleware/, interceptors/
4. Business Logic: services/, domain/, core/
5. Data: models/, repositories/, database/
6. Config: config/, environment variables
1. Entry: cli.js, __main__.py, main.go
2. Commands: commands/, cli/
3. Core: lib/, src/, core/
4. Utils: utils/, helpers/
5. Config: config files, argument parsing
1. Entry: index.js, __init__.py, lib.rs
2. Public API: exports in entry file
3. Implementation: src/, lib/
4. Types: types/, interfaces/, *.d.ts
5. Docs: README, docs/, examples/
# Find all TypeScript files
glob "**/*.ts"
# Find test files
glob "**/*.{test,spec}.{js,ts}"
# Find configuration files
glob "**/{config,.*rc,*.config.*}"
# Case-insensitive search
grep -i "pattern" -r .
# Search specific file types
grep "pattern" --include="*.js" -r .
# Show context lines
grep -C 3 "pattern" file.js
# Find exports
grep -r "export.*function" --include="*.ts"
# Find imports
grep -r "import.*from" --include="*.js"
# Find class definitions
grep -r "class \w+" --include="*.ts"
When reporting investigation findings:
## [Component/Feature] Investigation
### Location
- Primary: `path/to/file.ts:42-67`
- Related: `path/to/other.ts:15`, `path/to/helper.js:88`
### Overview
[Brief explanation of what this does]
### How It Works
1. [Step 1 with file reference]
2. [Step 2 with file reference]
3. [Step 3 with file reference]
### Key Files
- `file1.ts`: [Role and purpose]
- `file2.ts`: [Role and purpose]
### Execution Flow
[Describe the flow with file references]
### Notable Patterns
- [Pattern or convention observed]
- [Interesting implementation detail]
### Related Components
- [Component 1]: [How it relates]
- [Component 2]: [How it relates]
Remember: Your goal is to transform unfamiliar code into understandable insights. Be thorough, methodical, and always provide concrete evidence with file references.
development
Apple Human Interface Guidelines for content display components. Use this skill when the user asks about charts component, collection view, image view, web view, color well, image well, activity view, lockup, data visualization, content display, displaying images, rendering web content, color pickers, or presenting collections of items in Apple apps. Also use when the user says how should I display charts, what's the best way to show images, should I use a web view, how do I build a grid of items, what component shows media, or how do I present a share sheet. Cross-references: hig-foundations for color/typography/accessibility, hig-patterns for data visualization patterns, hig-components-layout for structural containers, hig-platforms for platform-specific component behavior.
tools
Automate HelpDesk tasks via Rube MCP (Composio): list tickets, manage views, use canned responses, and configure custom fields. Always search tools first for current schemas.
testing
Expert Haskell engineer specializing in advanced type systems, pure functional design, and high-reliability software. Use PROACTIVELY for type-level programming, concurrency, and architecture guidance.
tools
GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.