Codebase Documentation Search
This skill provides patterns for discovering and leveraging project-specific documentation at runtime. Use it to find existing solutions, understand patterns, and avoid reinventing the wheel.
When to Use This Skill
Search codebase docs when:
- Starting a new feature (check for existing patterns)
- Debugging an issue (check for documented solutions)
- Planning technical work (understand architecture decisions)
- Before making architectural changes (review existing decisions)
- When encountering unfamiliar code (find explanations)
Standard Documentation Locations
Search these locations in order of priority:
High Priority (Project-Specific)
| Location | Purpose |
|---|---|
CLAUDE.md | AI-specific project instructions |
AGENTS.md | AI agent guidelines |
docs/ | General project documentation |
docs/projects/ | Project-specific docs |
docs/solutions/ | Documented problem solutions |
docs/learnings/ | Captured learnings |
Medium Priority (Context)
| Location | Purpose |
|---|---|
README.md | Project overview |
docs/guides/ | How-to guides |
docs/architecture/ | Architecture decisions |
playbook/ | Workflow documentation |
Lower Priority (Reference)
| Location | Purpose |
|---|---|
*.md files in root | Various documentation |
| Code comments | Inline documentation |
| Test files | Expected behaviors |
Search Strategy
Step 1: Glob for Documentation Files
# Find all markdown files in standard locations
Glob: docs/**/*.md
Glob: **/README.md
Glob: **/CLAUDE.md
Glob: **/AGENTS.md
Step 2: Grep for Relevant Content
# Search for keywords in documentation
Grep: "keyword" in docs/
Grep: "error message" in docs/solutions/
Grep: "pattern name" in docs/
Step 3: Read Relevant Files
After finding matches, read the most relevant files to understand:
- Existing solutions to similar problems
- Architectural decisions and rationale
- Patterns used in the codebase
- Known gotchas or constraints
YAML Frontmatter Search
For learnings and solutions with YAML frontmatter, use targeted searches:
# Frontmatter schema for learnings
---
title: "Brief descriptive title"
date: YYYY-MM-DD
trigger: [chat-session|project-completion|blocker-overcome]
category: [performance|database|integration|workflow|debugging]
tags: [relevant, searchable, keywords]
severity: [critical|high|medium|low]
module: "affected_module_name"
---
Search by Category
Grep: "category: performance" in docs/learnings/
Grep: "category: database" in docs/solutions/
Search by Tags
Grep: "tags:.*authentication" in docs/
Grep: "tags:.*caching" in docs/learnings/
Search by Module
Grep: "module: user_service" in docs/
Search Patterns by Context
Before Starting a Feature
- Search for similar features:
Grep: "feature-name" in docs/ - Check for architectural patterns:
Grep: "pattern" in docs/architecture/ - Look for related learnings:
Grep: "category:.*relevant-category" in docs/learnings/
When Debugging
- Search for the error:
Grep: "error message" in docs/solutions/ - Check for known issues:
Grep: "symptom" in docs/learnings/ - Look for troubleshooting guides:
Glob: docs/**/troubleshoot*.md
Before Making Changes
- Check for architecture decisions:
Grep: "component-name" in docs/architecture/ - Look for related decisions:
Grep: "decision" in docs/ - Review existing patterns:
Glob: docs/patterns/**/*.md
Handling Missing Documentation
If documentation doesn't exist for your area:
- Note the gap - This is valuable feedback
- Proceed with caution - Make educated decisions
- Document as you go - Create the docs you wish existed
- Capture learnings - Use
/playbook:learningsafter completing work
Integration with Playbook Commands
This skill is automatically used by:
/playbook:tech-plan- Searches for architecture docs and existing patterns/playbook:work- Searches for relevant learnings before starting tasks/playbook:debug- Searches for existing solutions to similar problems
Best Practices
- Search before creating - Always check if documentation exists
- Use specific keywords - More specific searches yield better results
- Check multiple locations - Docs may be in unexpected places
- Read frontmatter - YAML metadata helps filter relevant docs
- Note gaps - Missing docs are opportunities to improve
- Keep docs updated - Update docs when you find them outdated
Example Workflow
# Before implementing user authentication:
1. Search for existing auth docs:
Glob: docs/**/*auth*.md
Grep: "authentication" in docs/
2. Check for security patterns:
Grep: "security" in docs/architecture/
3. Look for related learnings:
Grep: "category: security" in docs/learnings/
Grep: "tags:.*auth" in docs/solutions/
4. Review findings and incorporate into planning
Good documentation search prevents duplicate work and leverages institutional knowledge.
