| name | research |
| description | Analyze local codebase and scrape external documentation on demand |
Research Skill
Comprehensive research capabilities combining codebase analysis and external documentation scraping. Provides targeted context for implementation tasks.
When to Use
Invoke this skill when:
- Starting implementation of a new feature
- Need to understand existing code patterns
- Require external library documentation
- Context priming for
/tasks-autopilot
Part 1: Codebase Analysis
Process
Step 1: Analyze Task Requirements
From the task description, identify:
- What needs to be created (new files)
- What needs to be modified (existing files)
- What patterns to follow (existing code)
Task: "Implement password hashing for user registration"
Needs:
Create: password hashing utilities
Modify: user schema (add passwordHash)
Follow: existing auth patterns
Step 2: Search for Relevant Files
By filename:
find src -name "*password*" -o -name "*auth*" -o -name "*user*" 2>/dev/null
By content:
grep -rl "password\|hash\|bcrypt" src/ --include="*.ts" --include="*.tsx"
By imports:
grep -rh "from.*auth\|from.*user" src/ --include="*.ts" | head -10
Step 3: Analyze Dependencies
For each found file:
What does it import?
grep "^import" src/auth/index.ts
What imports it?
grep -rl "from.*auth" src/ --include="*.ts"
Step 4: Detect Project Patterns
Testing framework:
grep -E "vitest|jest|mocha" package.json
ls src/__tests__/ 2>/dev/null || ls src/**/*.test.ts 2>/dev/null
API framework:
grep -rh "from.*hono\|from.*express\|from.*trpc" src/ --include="*.ts" | head -3
Database ORM:
grep -rh "from.*drizzle\|from.*prisma" src/ --include="*.ts" | head -3
Step 5: Score and Rank Files
| Factor | Points |
|---|---|
| Filename matches keyword | +10 |
| Content matches keyword | +2 per match (max 10) |
| In expected directory | +5 |
| Has test file | +3 |
| Recently modified | +2 |
Keep top 20 files within token budget.
Step 6: Generate Codemaps
For files that need modification, use /codemap:
/codemap src/db/schema/users.ts
/codemap src/server/routers/auth.ts
Pattern Detection Reference
| Pattern | Detection |
|---|---|
| Testing | vitest or jest in package.json |
| tRPC | Import from @trpc/server |
| Hono | Import from hono |
| Drizzle | Import from drizzle-orm |
| Prisma | Import from @prisma/client |
Part 2: Documentation Scraping
Process
Step 1: Identify Libraries
From the task description, detect which libraries are involved:
Task: "Implement password hashing for user registration"
Libraries detected:
- bcrypt (password hashing)
- drizzle (database storage)
Step 2: Load Doc Sources Registry
cat .claude/lib/doc-sources.json
Step 3: Match Topics
For each library, find relevant topics:
bcrypt:
- usage (matches: hash, password)
drizzle:
- insert (matches: create user)
- schema (matches: passwordHash field)
Step 4: Scrape with Exact Paths
Use mycli scrapers with exact URL and CSS selector:
# Scrape bcrypt docs
mycli scrape crawl4ai \
--url "https://www.npmjs.com/package/bcrypt" \
--selector "#readme"
# Scrape drizzle insert docs
mycli scrape crawl4ai \
--url "https://orm.drizzle.team/docs/insert" \
--selector "article"
Scraper Selection
| Site Type | Scraper | Why |
|---|---|---|
| Static docs | crawl4ai | Fast, handles static HTML |
| SPAs | firecrawl | Renders JavaScript |
| npm README | crawl4ai | Static content |
Token Budget
- Max 500 tokens per topic
- Extract code examples preferentially
- Skip navigation, headers, footers
Output Format
{
"task": "Implement password hashing",
"codebase": {
"files": {
"toCreate": [
{ "path": "src/auth/password.ts", "purpose": "Password utils" }
],
"toModify": [
{ "path": "src/db/schema/users.ts", "codemap": "..." }
],
"toReference": [
{ "path": "src/server/routers/auth.ts", "codemap": "..." }
]
},
"patterns": {
"testing": { "framework": "vitest", "location": "src/__tests__/" },
"api": { "framework": "tRPC", "location": "src/server/routers/" },
"database": { "orm": "drizzle", "location": "src/db/schema/" }
}
},
"docs": [
{
"library": "bcrypt",
"topic": "usage",
"url": "https://www.npmjs.com/package/bcrypt",
"content": "..."
}
]
}
Integration with Context Priming
This skill is invoked by /tasks-prime:
/tasks-prime ENG-102
↓
1. Invoke research skill
↓
2. Codebase analysis
- Find relevant files
- Detect patterns
- Generate codemaps
↓
3. Documentation scraping
- Detect libraries
- Scrape relevant topics
↓
4. Output context JSON
Adding New Libraries
Edit .claude/lib/doc-sources.json:
{
"new-library": {
"name": "New Library",
"baseUrl": "https://docs.newlibrary.dev",
"keywords": ["newlib", "specific-feature"],
"topics": {
"getting-started": {
"path": "/docs/start",
"selector": "article.content",
"keywords": ["start", "install", "setup"]
}
}
}
}