index-codebase
Skill0 starsChanged 9 months agoMITView on GitHub
Build persistent CODEBASE.md in the vault for a project. Explores the codebase structure, conventions, and architecture. Use when the user says "index codebase", "map codebase", or "/index-codebase <project>". Takes a project name as argument.
- Reads credentials
In this repository9 other files it gives its agents.
- templates/CLAUDE.mdCLAUDE.md
- audit-instructionsSkill
- meeting-notesSkill
- project-statusSkill
- red-teamSkill
- retroSkill
- session-cleanupSkill
- session-handoffSkill
- session-startSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 9 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 19
If the project name doesn't match any entry in the mapping, ask the user to provide the codebase path.
- Distinctive: line 23
Use the Explore subagent (Task tool with subagent_type=Explore, thoroughness="very thorough") to analyze:
- Distinctive: line 30
Tests: Test framework, test location, coverage setup
- Very specific: line 38
Read <vaultPath>/<projectVaultFolder>/CODEBASE.md if it exists.
- Distinctive: line 41
If doesn't exist: Create new file.
- Distinctive: line 108
After writing, display a brief summary:
- Distinctive: line 117
Use the Explore subagent for thorough analysis — don't try to manually glob everything
- Distinctive: line 118
Don't include file contents in the index — just structure, patterns, and metadata
- Distinctive: line 119
Keep the CODEBASE.md under 200 lines for readability
- Distinctive: line 122
If a section has nothing to report, use "N/A" rather than omitting it
- Very specific: line 123
All paths come from agent-os.config.json — never hardcode user-specific paths
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Index Codebase
Explore a project's codebase and produce a comprehensive CODEBASE.md reference in the vault.
Step 1: Parse Arguments
The user provides a project name (e.g., my-app, api-server).
Map to codebase path and vault path using the Project-Codebase Mapping table in CLAUDE.md (always in system prompt), or from agent-os.config.json.
If the project name doesn't match any entry in the mapping, ask the user to provide the codebase path.
Step 2: Explore the Codebase
Use the Explore subagent (Task tool with subagent_type=Explore, thoroughness="very thorough") to analyze:
- Structure: Top-level directory layout, key folders, file organization
- Dependencies: package.json / requirements.txt / pyproject.toml — frameworks, libraries, versions
- Entry Points: Main files, startup scripts, CLI commands
- Architecture: Routing, models/schemas, middleware, services, utilities
- Configuration: Environment variables (.env.example), config files, constants
- Tests: Test framework, test location, coverage setup
- Build & Deploy: Build scripts, Dockerfile, CI/CD config
- Code Conventions: Naming patterns, file naming, import style, error handling approach
- State Management: How state is managed (database, in-memory, external services)
- TODOs/FIXMEs/HACKs: Grep for these markers across the codebase
Step 3: Check for Existing CODEBASE.md
Read <vaultPath>/<projectVaultFolder>/CODEBASE.md if it exists.
- If exists: This is an update. Compare with new findings. Only update changed sections. Add a changelog entry at the bottom.
- If doesn't exist: Create new file.
Step 4: Write CODEBASE.md
Write to <vaultPath>/<projectVaultFolder>/CODEBASE.md:
---
date: YYYY-MM-DD
tags: [codebase, index, <project-name>]
auto-generated: true
---
# <Project Name> — Codebase Index
> Auto-generated by `/index-codebase`. Last updated: YYYY-MM-DD
## Overview
[1-2 sentence description of what this project does and its tech stack]
## Structure<tree output, 2-3 levels deep, annotated>
## Dependencies
| Package | Version | Purpose |
|---|---|---|
| ... | ... | ... |
## Entry Points
- **Main**: `path/to/main` — [description]
- **CLI**: `path/to/cli` — [if applicable]
- **API**: `path/to/routes` — [if applicable]
## Architecture
[Description of the architecture pattern: MVC, service layer, etc.]
### Key Files
| File | Purpose |
|---|---|
| ... | ... |
## Configuration
| Env Variable | Purpose | Default |
|---|---|---|
| ... | ... | ... |
## Code Conventions
- [naming patterns, file naming, import style]
- [error handling approach]
- [logging approach]
## Tests
- Framework: [jest/pytest/etc]
- Location: [path]
- Run: [command]
## Known Issues / TODOs
- [ ] [TODO items found in code]
## Changelog
- YYYY-MM-DD: Initial indexOutput
After writing, display a brief summary:
Codebase indexed: <project>
Written to: <vaultPath>/<projectFolder>/CODEBASE.md
Files scanned: N
Key findings: [1-2 notable things about the codebase]Rules
- Use the Explore subagent for thorough analysis — don't try to manually glob everything
- Don't include file contents in the index — just structure, patterns, and metadata
- Keep the CODEBASE.md under 200 lines for readability
- On re-runs, preserve manual edits (check for sections not in the template)
- Skip node_modules, pycache, .git, dist, build directories
- If a section has nothing to report, use "N/A" rather than omitting it
- All paths come from agent-os.config.json — never hardcode user-specific paths
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.

