agentleFS
desertcachedesertcache/agent-os/skills/index-codebase/SKILL.md

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

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
  1. Distinctive:

    If the project name doesn't match any entry in the mapping, ask the user to provide the codebase path.

    line 19
  2. Distinctive:

    Use the Explore subagent (Task tool with subagent_type=Explore, thoroughness="very thorough") to analyze:

    line 23
  3. Distinctive:

    Tests: Test framework, test location, coverage setup

    line 30
  4. Very specific:

    Read <vaultPath>/<projectVaultFolder>/CODEBASE.md if it exists.

    line 38
  5. Distinctive:

    If doesn't exist: Create new file.

    line 41
  6. Distinctive:

    After writing, display a brief summary:

    line 108
  7. Distinctive:

    Use the Explore subagent for thorough analysis — don't try to manually glob everything

    line 117
  8. Distinctive:

    Don't include file contents in the index — just structure, patterns, and metadata

    line 118
  9. Distinctive:

    Keep the CODEBASE.md under 200 lines for readability

    line 119
  10. Distinctive:

    If a section has nothing to report, use "N/A" rather than omitting it

    line 122
  11. Very specific:

    All paths come from agent-os.config.json — never hardcode user-specific paths

    line 123

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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:

  1. Structure: Top-level directory layout, key folders, file organization
  2. Dependencies: package.json / requirements.txt / pyproject.toml — frameworks, libraries, versions
  3. Entry Points: Main files, startup scripts, CLI commands
  4. Architecture: Routing, models/schemas, middleware, services, utilities
  5. Configuration: Environment variables (.env.example), config files, constants
  6. Tests: Test framework, test location, coverage setup
  7. Build & Deploy: Build scripts, Dockerfile, CI/CD config
  8. Code Conventions: Naming patterns, file naming, import style, error handling approach
  9. State Management: How state is managed (database, in-memory, external services)
  10. 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 index

Output

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

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.