From example-skills
Explores unfamiliar codebases iteratively via 4-phase loop: discover structure/entry points with shell commands, evaluate relevance, refine focus. For onboarding new projects.
How this skill is triggered — by the user, by Claude, or both
Slash command
/example-skills:iterative-code-explorationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
A systematic pattern for progressively exploring and understanding unfamiliar codebases through iterative context refinement.
A systematic pattern for progressively exploring and understanding unfamiliar codebases through iterative context refinement.
When working with new codebases, you often don't know:
Standard approaches fail:
┌─────────────────────────────────────────────┐
│ │
│ ┌──────────┐ ┌──────────┐ │
│ │ DISCOVER │─────▶│ EVALUATE │ │
│ └──────────┘ └──────────┘ │
│ ▲ │ │
│ │ ▼ │
│ ┌──────────┐ ┌──────────┐ │
│ │ LOOP │◀─────│ REFINE │ │
│ └──────────┘ └──────────┘ │
│ │
│ Max 3-4 cycles, then synthesize │
└─────────────────────────────────────────────┘
Start with broad exploration:
# Find entry points
find . -name "main.*" -o -name "index.*" -o -name "app.*" | head -20
# Discover project structure
tree -L 3 -I 'node_modules|dist|build'
# Find configuration
find . -name "*.config.*" -o -name "package.json" -o -name "*.toml"
# Identify key patterns
grep -r "export class" --include="*.ts" src/ | head -20
grep -r "def " --include="*.py" . | head -20
Document initial findings:
Assess discovered files for relevance:
# Read high-value files
cat README.md
cat ARCHITECTURE.md 2>/dev/null
cat docs/overview.md 2>/dev/null
# Check package manifests
cat package.json | jq '.dependencies, .scripts'
cat Cargo.toml 2>/dev/null
cat requirements.txt 2>/dev/null
Scoring Criteria:
Focus on specific areas identified as relevant:
# Dive into specific modules
ls -la src/core/
cat src/core/index.ts
# Trace dependencies
grep -r "import.*from.*core" --include="*.ts" src/ | head -20
# Find related patterns
grep -A 5 -B 5 "class UserService" src/**/*.ts
# Check tests for usage examples
find . -name "*.test.*" -o -name "*.spec.*" | head -10
Build mental model:
Decision point - do you need more context?
Continue if:
Stop if:
Discover: Find similar existing features
grep -r "feature-name" src/
find . -name "*feature*"
Evaluate: Review implementation patterns
cat src/features/similar-feature/index.ts
Refine: Check tests and edge cases
cat src/features/similar-feature/*.test.ts
Loop: Trace dependencies until clear
Discover: Locate error origin
grep -r "error message" src/
git log -S "error message"
Evaluate: Understand surrounding context
cat path/to/file.ts | grep -A 20 -B 20 "error location"
Refine: Check call sites and callers
grep -r "functionName" --include="*.ts" src/
Loop: Expand context as needed
Discover: Map current structure
find src/ -name "*.ts" | xargs wc -l | sort -n
grep -r "class\|interface" --include="*.ts" src/ | wc -l
Evaluate: Identify coupling points
grep -r "import.*from.*module" src/ | cut -d: -f2 | sort | uniq -c | sort -rn
Refine: Find all usages
grep -r "ComponentName" --include="*.ts" src/
Loop: Ensure all references found
After each loop iteration, document:
## Iteration N
**Query**: What I was looking for
**Found**: X files, Y patterns, Z components
**Relevance**: High/Medium/Low with reasons
**Gaps**: What's still unclear
**Next**: What to explore in next iteration
**Key Files**:
- path/to/file.ts - Core implementation (★★★)
- path/to/other.ts - Supporting utility (★★)
**Mental Model Update**:
- New understanding of X
- Connection between Y and Z
- Pattern: Description
Complements:
npx claudepluginhub a-organvm/a-i--skills --plugin document-skillsProvides a checklist for code reviews covering functionality, security, performance, maintainability, tests, and quality. Use for pull requests, audits, team standards, and developer training.