codebase-index
Skill1 starsChanged 40 days agoMITView on GitHub
Enforces structured directory indexing via INDEX.md, hierarchical navigation, and deterministic index maintenance across the codebase. Use when exploring codebases, locating functions or symbols without reading raw files, planning changes, adding, modifying, moving, or deleting files, auditing repository organization, or preventing token exhaustion during long agent sessions. Triggers on 'explore codebase', 'where is', 'find function', 'locate file', 'codebase map', 'save tokens', 'audit index', 'add file', 'remove file', 'codebase structure'.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- denfry/codebase-indextheir own version, first seen Nov 2, 2026
- gnegreiros-ux/agentica-design-systemtheir own version, first seen Oct 13, 2026
- KonghaYao/peritheir own version, first seen Oct 10, 2026
- murphytrueman/design-system-opstheir own version, first seen Sep 23, 2026
- cris-achiardi/claude-skillstheir own version, first seen Nov 14, 2025
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- KonghaYao/peri★ 248same name
- murphytrueman/design-system-ops★ 197same name
- cris-achiardi/claude-skills★ 66same name
- denfry/codebase-index★ 13same name
- gnegreiros-ux/agentica-design-system★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
We split this skill into the rules it gives an agent
11 rules. 0 are common, 4 are distinctive, and 7 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 33
Direct In-File Edits: When the exact file and lines to modify are already identified and open in context.
- Distinctive: line 82
Use the bundled Python tool to automatically inspect the directory, identify files, and preserve existing documentation:
- Very specific: line 89
Every INDEX.md must follow this structure (see references/schema.md for full details):
- Very specific: line 124
Add the new file to the manifest table in the folder's INDEX.md.
- Distinctive: line 125
Document its role, exports, and dependencies.
- Very specific: line 127
Remove or update the corresponding entry in INDEX.md.
- Very specific: line 129
Update the Public Exports / API column in INDEX.md.
- Very specific: line 131
Add a row in Subdirectories & Child Modules linking to its INDEX.md.
- Distinctive: line 134
Before concluding your task, execute the audit command:
- Very specific: line 140
If exit code is 0 (✅), the repository is consistent.
- Very specific: line 141
If exit code is 1 (❌), fix the reported missing indices, unindexed files, or orphan entries before finishing.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Codebase Index & Hierarchical Navigation Guide
This skill establishes an Index-First Architecture for navigating, documenting, and maintaining codebases. By decoupling discovery from raw file reading, AI agents locate functionality in seconds while consuming up to 85%–90% fewer tokens and eliminating hallucinated imports.
🎯 When to Use This Skill
Activate and follow this skill whenever you encounter any of the following scenarios:
| Scenario / Intent | What the Agent Must Do |
| Exploration & Discovery (“Where is the auth logic?”, “How are bookings handled?”) | Consult the nearest INDEX.md to pinpoint target files before opening raw code. Never run full-repo greps blindly. |
| Adding New Files or Modules (“Create a payment service”, “Add a new route”) | Scaffold or add the new file to the folder's INDEX.md manifest with its role, public exports, and dependencies. |
| Deleting or Moving Files (“Remove legacy auth”, “Move utils to lib”) | Immediately update or remove the file's entry in the corresponding INDEX.md to prevent ghost references. |
| Modifying Public Contracts / APIs (“Add a parameter to login()”, “Export new helper”) | Reconcile the Public Exports / API column in INDEX.md in the exact same task. |
| Pre-Flight / Task Completion (“I'm done with the refactor”) | Run python3 scripts/index_manager.py audit before concluding to verify zero drift. |
| Preventing Token Exhaustion (Long agent sessions, rate-limit constraints) | Use indices as high-density semantic caches instead of dumping thousands of source lines into context. |
🚫 When NOT to Use This Skill
- Direct In-File Edits: When the exact file and lines to modify are already identified and open in context.
- Throwaway Scratch Scripts: One-off scripts in temporary directories (
/tmp, scratchpads) that are not part of the committed architecture. - Single-File Micro-Projects: Trivial repositories with fewer than 5 total files where folder hierarchy does not exist.
1. Core Principles & Why This Matters
- Information Density over Blind Traversal:
Reading five 300-line source files costs ~6,000 tokens. Reading one well-maintained 40-line
INDEX.mdcosts ~150 tokens and provides exact exports, patterns, and architectural responsibilities upfront. - Deterministic Parity (Zero-Drift): An index that does not match disk reality is worse than no index. Any file addition, deletion, or public contract change must be reconciled in the same task.
- Bounded Context Granularity:
Indices exist at architectural boundaries (root,
src/, major layers likeactions/,db/,lib/,pages/,docs/, etc.) and any sub-folder containing 3 or more files or a distinct sub-domain. Leaf utility folders with 1–2 files are documented inside their parent index.
2. The Index-First Navigation Protocol
Whenever an agent or developer is tasked with implementing a feature, fixing a bug, or understanding the architecture:
[Start Task]
│
▼
Consult Root / Module INDEX.md
│
▼
Locate target file, role, & public exports in manifest table
│
├───────────────────────┬────────────────────────┐
▼ ▼ ▼
Target is directly Target is in a Target does not exist
in this directory sub-module folder (New feature needed)
│ │ │
▼ ▼ ▼
Read ONLY that file Traverse to Child Proceed to create file
(surgical view_file) INDEX.md & register in INDEX.mdProhibited Behaviors:
- DO NOT execute open-ended, deep recursive scans or grep the entire repo when an
INDEX.mdexists for that layer. - DO NOT view multiple large source files sequentially just to "see what is inside" — read the directory's
INDEX.mdfirst.
3. How to Create & Document an Index
Automated Scaffolding (Recommended)
Use the bundled Python tool to automatically inspect the directory, identify files, and preserve existing documentation:
python3 scripts/index_manager.py scaffold <path-to-directory>Canonical Schema
Every INDEX.md must follow this structure (see references/schema.md for full details):
# Index: `<directory>`
**Responsibility**: <Directory purpose and domain boundary>
**Architectural Layer**: <Domain | Application | Infrastructure | Presentation | Shared>
## Subdirectories & Child Modules
| Subdirectory | Responsibility | Index |
| :--- | :--- | :--- |
| [`submodule/`](./submodule/) | Purpose of sub-module | [INDEX.md](./submodule/INDEX.md) |
## File Manifest
| File | Role / Pattern | Public Exports / API | Key Dependencies |
| :--- | :--- | :--- | :--- |
| [`service.ts`](./service.ts) | Use Case / Orchestrator | `createOrder()`, `cancelOrder()` | `drizzle-orm`, `zod` |
## Invariants & Directory Rules
- <Coupling rules, layer constraints, or security obligations>
<!-- Reconciled by codebase-index -->4. Maintenance & Definition of Done
Maintenance is mandatory. Every agent modifying the repository must follow this reconciliation cycle:
Trigger Conditions:
- File Created:
- Add the new file to the manifest table in the folder's
INDEX.md. - Document its role, exports, and dependencies.
- Add the new file to the manifest table in the folder's
- File Deleted or Moved:
- Remove or update the corresponding entry in
INDEX.md.
- Remove or update the corresponding entry in
- Public API Modified:
- Update the
Public Exports / APIcolumn inINDEX.md.
- Update the
- New Subdirectory Added:
- Add a row in
Subdirectories & Child Moduleslinking to itsINDEX.md.
- Add a row in
Verification Step (Pre-Flight):
Before concluding your task, execute the audit command:
python3 scripts/index_manager.py audit- If exit code is
0(✅), the repository is consistent. - If exit code is
1(❌), fix the reported missing indices, unindexed files, or orphan entries before finishing.
5. Tooling Reference: index_manager.py
| Command | Usage | Description |
audit | python3 scripts/index_manager.py audit | Audits the repo for missing indices, unindexed files, or orphan entries. |
scaffold <dir> | python3 scripts/index_manager.py scaffold src/services | Scaffolds or updates INDEX.md in <dir> preserving existing docs. |
sync-all | python3 scripts/index_manager.py sync-all | Re-syncs file manifests across all existing indices in the repo. |
tree | python3 scripts/index_manager.py tree | Displays the architectural index map of the project. |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

