.wrangler/memory/knowledge-base/reference-prompts/skills/codebase-index/SKILL.md
Automatically generate relationship and dependency maps for any component-based codebase (React, Vue, Svelte, Astro, Next.js, Angular, Solid). Auto-detects framework. Supports TOON format for 30-60% token savings. Use when indexing codebases, mapping component relationships, documenting dependencies, or understanding unfamiliar projects. Generates JSON/TOON files mapping component usage, imports, npm dependencies, utilities, CSS, and data queries.
npx skillsauth add bacchus-labs/wrangler codebase-indexInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate comprehensive, framework-agnostic relationship and dependency maps for component-based codebases with optional TOON format for token-efficient AI consumption.
Scans any component-based codebase to automatically generate relationship maps:
Framework Support: React, Vue, Svelte, Astro, Next.js, Angular, Solid (auto-detected)
Output Formats:
# Auto-detect framework, output TOON
python scripts/index_codebase.py /path/to/project
# Specify framework and format
python scripts/index_codebase.py /path/to/project --framework react --format json
# Use tab delimiters (even more token-efficient)
python scripts/index_codebase.py /path/to/project --delimiter "\t"
The skill automatically detects your framework from package.json:
| Framework | Detection | Extensions |
|-----------|-----------|------------|
| Astro | astro dependency | .astro |
| React | react dependency | .jsx, .tsx |
| Next.js | next dependency | .jsx, .tsx |
| Vue | vue dependency | .vue |
| Svelte | svelte dependency | .svelte |
| Angular | @angular/core | .ts |
| Solid | solid-js | .jsx, .tsx |
Override auto-detection:
python scripts/index_codebase.py /path/to/project --framework vue
Why TOON?
Example TOON output:
components[3]{name,path,type,framework,uses,usedBy}:
Button,src/components/atoms/Button.tsx,atom,react,[0]:,[2]: Card,Page
Card,src/components/molecules/Card.tsx,molecule,react,[1]: Button,[1]: Page
Page,src/pages/index.tsx,page,react,[2]: Button,Card,[0]:
statistics:
totalComponents: 3
atoms: 1
molecules: 1
pages: 1
vs JSON (same data):
{
"components": {
"Button": {
"path": "src/components/atoms/Button.tsx",
"type": "atom",
"framework": "react",
"uses": [],
"usedBy": ["Card", "Page"]
},
...
}
}
| Aspect | TOON | JSON | |--------|------|------| | Token count | 40-70% smaller | Baseline | | LLM accuracy | 70.1% | 65.4% | | Human readable | ✅ | ✅ | | Tool compatible | ⚠️ (new format) | ✅ | | Best for | AI consumption | Tooling |
Recommendation: Use TOON for AI context, JSON for tooling integration.
All files generated in src/.ai/ (or first source directory found):
src/.ai/
├── index.toon # Entry point
└── relationships/
├── component-usage.toon # Component graph
├── dependencies.toon # NPM + utilities + CSS
└── data-flow.toon # Data queries
Auto-detects component types from directory structure:
| Pattern | Type |
|---------|------|
| /atoms/ | atom |
| /molecules/ | molecule |
| /organisms/ | organism |
| /templates/ | template |
| /ui/ | ui |
| /layouts/ | layout |
| /pages/, /views/, /routes/ | page |
| /hooks/ | hook |
| /contexts/ | context |
| Other | component |
For tabular data, choose delimiter for optimal tokenization:
# Comma (default) - most readable
python scripts/index_codebase.py /path/to/project --delimiter ","
# Tab - often fewer tokens
python scripts/index_codebase.py /path/to/project --delimiter "\t"
# Pipe - middle ground
python scripts/index_codebase.py /path/to/project --delimiter "|"
Tab output example:
components[2 ]{name path type}:
Button src/Button.tsx atom
Card src/Card.tsx molecule
Generate both formats for different use cases:
# Generate TOON for AI
python scripts/index_codebase.py /path/to/project --format toon
# Generate JSON for tools
python scripts/index_codebase.py /path/to/project --format json
After indexing, read files to understand codebase:
index.toon/json - Overview and metadatarelationships/component-usage.toonrelationships/dependencies.toonrelationships/data-flow.toon# Primitive field
name: Button
# Nested object
user:
id: 123
name: Ada
# Primitive array
tags[3]: react,typescript,ui
# Tabular array (uniform objects)
items[2]{id,name,price}:
1,Widget,9.99
2,Gadget,14.50
# List array (mixed)
items[3]:
- 1
- name: Item
- [2]: sub,array
.astro componentsclient.fetch() queries.jsx, .tsxfetch() and axios patterns.vue components.svelte components.component.ts fileshttp.get() patterns.jsx, .tsxFlexible directory discovery:
app/ for Next.js)src/ if presentTypical structures supported:
# React/Next.js
app/
components/
pages/
# Vue
src/
components/
views/
# Astro
src/
components/
layouts/
pages/
Component Metadata (manual .metadata.json):
Codebase Index (this skill):
No duplication - These systems complement each other.
Large projects (500+ components):
The indexer is resilient:
# Let it auto-detect everything
python scripts/index_codebase.py ~/projects/my-app
# Output:
# 🔍 Scanning react codebase...
# ✅ Generated component-usage.toon
# ✅ Generated dependencies.toon
# ✅ Generated data-flow.toon
# ✅ Generated index.toon
#
# Summary:
# 🎯 Framework: react
# 📝 Format: TOON
# ✅ 42 components indexed
# ✅ 156 relationships mapped
# ✅ 8 utilities tracked
# ✅ 3 queries documented
# 💡 TOON format: 30-60% more token-efficient than JSON
# Same command - overwrites previous index
python scripts/index_codebase.py ~/projects/my-app
# For edge cases where auto-detect fails
python scripts/index_codebase.py ~/projects/my-app --framework vue
No components found?
node_modules in exclusionsWrong framework detected?
--framework flag to overridepackage.json dependenciesImport relationships missing?
TOON parse errors?
Utilities not found?
lib/, utils/, or helpers/ directories exist.ts files (not .d.ts)JSON (123 tokens):
{
"Button": {
"path": "src/components/Button.tsx",
"type": "atom",
"framework": "react",
"uses": [],
"usedBy": ["Card", "Header", "Footer"]
}
}
TOON (52 tokens, 58% reduction):
Button:
path: src/components/Button.tsx
type: atom
framework: react
uses[0]:
usedBy[3]: Card,Header,Footer
Tabular TOON (even better for multiple components):
components[3]{name,path,type,uses,usedBy}:
Button,src/components/Button.tsx,atom,[0]:,[3]: Card,Header,Footer
Card,src/components/Card.tsx,molecule,[1]: Button,[1]: Page
Footer,src/components/Footer.tsx,organism,[2]: Button,Icon,[0]:
# .husky/post-merge
#!/bin/sh
python scripts/index_codebase.py . --format toon
git add src/.ai/
name: Update Codebase Index
on:
push:
branches: [main]
jobs:
index:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Index codebase
run: python scripts/index_codebase.py . --format toon
- name: Commit changes
run: |
git add src/.ai/
git commit -m "Update codebase index" || true
git push
Potential additions:
tools
Use when creating technical specifications for features, systems, or architectural designs. Creates comprehensive specification documents using the Wrangler MCP issue management system with proper structure and completeness checks.
testing
Creates and refines agent skills using TDD methodology with pressure testing and rationalization detection. Use when creating new skills, editing existing skills, testing skills with pressure scenarios, or verifying skills work before deployment.
tools
Use when design is complete and you need detailed implementation tasks - creates tracked MCP issues with exact file paths, complete code examples, and verification steps. Optional reference plan file for architecture overview.
development
Validates governance file completeness, format compliance, and metric accuracy. Use when auditing governance health, after bulk changes, or ensuring documentation integrity.