Researching the Codebase
Understand existing patterns and implementation before making changes.
Announce at start: "I'm using the knowns.research skill to research [topic]."
Core principle: UNDERSTAND WHAT EXISTS BEFORE ADDING NEW CODE.
The Process
Step 1: Search Documentation
json
// Search docs for topic
mcp__knowns__search_docs({ "query": "<topic>" })
// Read relevant docs
mcp__knowns__get_doc({ "path": "<path>", "smart": true })
Step 2: Search Completed Tasks
json
// Find similar work that was done
mcp__knowns__search_tasks({ "query": "<keywords>" })
// View task for implementation details
mcp__knowns__get_task({ "taskId": "<id>" })
Learn from history - completed tasks often contain valuable insights.
Step 3: Search Codebase
bash
# Find files by name pattern find . -name "*<pattern>*" -type f | grep -v node_modules | head -20 # Search code content grep -r "<pattern>" --include="*.ts" --include="*.tsx" -l | head -20
Step 4: Analyze Patterns
Look for:
- •How similar features are implemented
- •Common patterns used
- •File/folder structure conventions
- •Naming conventions
- •Error handling patterns
Step 5: Document Findings
markdown
## Research: [Topic] ### Existing Implementations - `src/path/file.ts`: Does X - `src/path/other.ts`: Handles Y ### Patterns Found - Pattern 1: Used for... - Pattern 2: Applied when... ### Related Docs - @doc/path1 - Covers X - @doc/path2 - Explains Y ### Recommendations Based on research: 1. Reuse X from Y 2. Follow pattern Z 3. Avoid approach W because...
Research Checklist
- • Searched documentation
- • Reviewed similar completed tasks
- • Found existing code patterns
- • Identified reusable components
- • Noted conventions to follow
After Research
Use findings in task:
json
// Create informed task
mcp__knowns__create_task({
"title": "<title>",
"description": "Based on research: use pattern from X"
})
What to Look For
| Looking For | Where to Check |
|---|---|
| Conventions | @doc/CONVENTIONS, existing code |
| Patterns | @doc/patterns/*, similar features |
| Utilities | src/utils/, src/lib/ |
| Examples | Completed tasks, tests |
| API design | Existing endpoints, @doc/api/* |
When to Research
Always research before:
- •Implementing new features
- •Adding new patterns
- •Making architectural decisions
Skip research for:
- •Simple bug fixes with clear cause
- •Trivial changes following obvious patterns
Remember
- •Check docs and tasks first
- •Look at how similar things are done
- •Note file locations for reference
- •Look at tests for expected behavior
- •Document findings for future reference