Skip to content

amanpal3/Dr-SKILLs / .agent/plugins/gsd/.agents/skills/context-fetch

context-fetch

Verified

Search-first skill to reduce unnecessary file reads by searching before loading

Context Fetch Skill

Core principle: Search first, read targeted sections, never load full files blindly.


When to Use

Activate this skill before:

  • Starting any coding task
  • Beginning a refactor
  • Investigating a bug
  • Understanding unfamiliar code

Process

Step 1: Define the Question

What are you trying to find or understand?

Examples:

  • "Where is the login endpoint defined?"
  • "How does the caching layer work?"
  • "What calls the processPayment function?"

Step 2: Identify Keywords

Extract searchable terms:

QuestionKeywords
Login endpointlogin, auth, POST.*login
Caching layercache, redis, memoize
Payment callsprocessPayment, payment

Step 3: Search Before Reading

PowerShell:

# Simple pattern search
Select-String -Path "src/**/*.ts" -Pattern "login" -Recurse

# With ripgrep (if available)
rg "login" --type ts

Bash:

# With ripgrep (recommended)
rg "login" --type ts

# With grep
grep -r "login" src/ --include="*.ts"

Step 4: Evaluate Results

From search results, identify:

  1. Primary candidates — Files directly matching your question
  2. Secondary candidates — Files that reference primary candidates
  3. Ignore list — Files with keyword but unrelated context

Step 5: Targeted Reading

Only read what's justified:

# Read specific line range (PowerShell)
Get-Content "src/auth/login.ts" | Select-Object -Skip 49 -First 30

# Read specific function (with view_code_item tool)
# view_code_item: src/auth/login.ts -> handleLogin

Inputs

When invoking this skill, provide:

InputDescriptionExample
QuestionWhat you're trying to find"Where is user validation?"
ScopeDirectory or file patternsrc/, *.service.ts
KeywordsTerms to search forvalidate, user, schema

Outputs

After executing this skill, report:

  1. Candidate files — Ranked by relevance
  2. Relevant extracts — Key snippets found
  3. Next reads — Specific files/line-ranges to read next
  4. Skip list — Files searched but not relevant

Anti-Patterns

❌ Loading Everything First

# BAD: Reading 5 full files to "understand context"
Read: src/auth/login.ts (500 lines)
Read: src/auth/register.ts (400 lines)
Read: src/auth/types.ts (200 lines)

✅ Search Then Target

# GOOD: Search first, read only what's needed
Search: "validatePassword" in src/auth/
Found: login.ts:45, register.ts:78
Read: login.ts lines 40-60

❌ Broad Searches

# BAD: Searching for common terms
Search: "function" → 10,000 results

✅ Specific Searches

# GOOD: Searching for specific identifiers
Search: "validateUserCredentials" → 3 results

Context Efficiency Metrics

Track your efficiency:

MetricGoodPoor
Files searched10+<5
Files fully read<310+
Lines read<2001000+
Targeted sectionsYesNo

Integration with GSD

This skill supports GSD's context management:

  • Prevents context pollution — Less irrelevant code loaded
  • Supports wave execution — Each wave starts with minimal context
  • Enables model switching — Less context = easier handoff

Quick Reference

1. Define question     → What am I looking for?
2. Extract keywords    → What terms to search?
3. Search codebase     → rg/grep/Select-String
4. Evaluate results    → Which files matter?
5. Read targeted       → Specific lines only
6. Report findings     → Candidates + extracts

Part of GSD methodology. See PROJECT_RULES.md for search-first discipline rules.

reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall