From ck
Inverts documentation into machine-readable CLAUDE.md files per module with navigation skills for AI agents. Useful for living, agent-first docs that stay current. Triggers: documentation inversion, skills as docs.
npx claudepluginhub juliusbrussee/cavekitThis skill uses the workspace's default tool permissions.
Traditional documentation drifts out of sync because it lives separately from the code. Documentation inversion places guidance directly in the codebase, structured for agent consumption, so that AI can explore the source and find current information on demand.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Guides agent creation for Claude Code plugins with file templates, frontmatter specs (name, description, model), triggering examples, system prompts, and best practices.
Traditional documentation drifts out of sync because it lives separately from the code. Documentation inversion places guidance directly in the codebase, structured for agent consumption, so that AI can explore the source and find current information on demand.
Structure documentation for programmatic navigation -- hierarchical, cross-referenced, with explicit entry points -- so that AI agents can find what they need without human guidance.
Traditional documentation assumes a human reader who will browse, search, and interpret context. Agent-first documentation assumes a machine reader that needs: explicit entry points, structured hierarchies, cross-references it can follow programmatically, and guidance on what to explore next.
Developer ships a feature → Writes a wiki article explaining it
↓
Weeks or months elapse
↓
Another developer refactors the feature
↓
The wiki article is never revised
↓
A third developer (or an agent) follows the stale article
↓
Incorrect assumptions, wasted effort, subtle bugs
Why it rots:
Developer modifies a module → Updates the co-located CLAUDE.md in the same PR
↓
Navigation skill describes HOW to explore, not WHAT exists
↓
Plugin bundles skills so agents can load them on demand
↓
Agent enters the module → loads skill → reads live source code
↓
Guidance stays accurate because the source itself is the authority
Why it stays current:
Place a CLAUDE.md file at the root of each significant module, library, or directory.
What goes in a CLAUDE.md:
# {Module Name}
## Purpose
{One paragraph: what this module does and why it exists}
## Entry Points
- `src/index.ts` -- Public API surface. Start here for understanding exports.
- `src/core/engine.ts` -- Core logic. Start here for understanding internals.
## Architecture
{Brief description of how the module is structured internally}
### Key Files
| File | Responsibility |
|------|---------------|
| `src/index.ts` | Public API, re-exports |
| `src/core/engine.ts` | Core processing engine |
| `src/core/types.ts` | Shared type definitions |
| `src/utils/helpers.ts` | Utility functions |
## Conventions
- {Naming conventions specific to this module}
- {Error handling patterns}
- {Testing patterns}
## Dependencies
- `{dependency-a}` -- Used for {purpose}
- `{dependency-b}` -- Used for {purpose}
## Cross-References
- See `../shared/CLAUDE.md` for shared utilities
- See `../api/CLAUDE.md` for the API layer that consumes this module
Key properties of a good CLAUDE.md:
A navigation skill teaches the agent how to explore a library or module. It does not describe the library's current state -- it describes the process for understanding it.
Navigation Skill Template:
---
name: {library-name}-navigation
description: >
Teaches the agent how to navigate and understand the {library-name} library.
Triggers: "{library-name}", "how does {library-name} work",
"understand {library-name}".
---
# Navigating {Library Name}
## Quick Orientation
1. Read `{root}/CLAUDE.md` for purpose and entry points
2. Read `{root}/src/index.ts` for the public API surface
3. Read `{root}/src/core/types.ts` for core type definitions
## Understanding the Architecture
1. Start with the entry point identified in CLAUDE.md
2. Trace the main flow: {describe the primary call path}
3. Key abstractions: {list the 3-5 most important interfaces/classes}
## Common Tasks
### Adding a New Feature
1. Define types in `src/core/types.ts`
2. Implement core logic in `src/core/`
3. Export from `src/index.ts`
4. Add tests in `tests/`
### Fixing a Bug
1. Identify the failing test or behavior
2. Trace from the public API inward
3. Core logic is in `src/core/engine.ts`
4. Edge cases are typically in `src/utils/helpers.ts`
### Understanding a Specific Feature
1. Search for the feature name in `src/core/`
2. Read the test file for that feature -- tests document behavior
3. Check CLAUDE.md for any conventions specific to that area
## Anti-Patterns to Avoid
- {Pattern to avoid and why}
- {Pattern to avoid and why}
Why skills work better than static docs:
Bundle related navigation skills into a Claude Code plugin:
{library-name}-docs/
├── plugin.json
└── skills/
├── navigation/
│ └── SKILL.md # How to navigate the library
├── contributing/
│ └── SKILL.md # How to contribute to the library
└── troubleshooting/
└── SKILL.md # How to debug common issues
plugin.json:
{
"name": "{library-name}-docs",
"description": "Agent-first documentation for {library-name}",
"version": "1.0.0"
}
When an agent encounters the library:
Level 1: CLAUDE.md files (per-directory, auto-loaded)
↓
Level 2: Navigation skills (per-library, loaded on demand)
↓
Level 3: Plugin packages (distributable, installable)
Bad (human-narrative style):
This module was originally created in 2023 to handle user authentication.
Over time, we've added OAuth support, session management, and rate limiting.
The main file you'll want to look at is auth.ts, which contains most of the
logic. There's also a helpers file with some utility functions.
Good (machine-structured style):
# Auth Module
## Purpose
User authentication: login, logout, session management, OAuth, rate limiting.
## Entry Points
- `src/auth.ts` -- Core auth logic (login, logout, verify)
- `src/oauth.ts` -- OAuth provider integrations
- `src/session.ts` -- Session management
- `src/rate-limit.ts` -- Rate limiting middleware
## Key Types
- `AuthUser` in `src/types.ts` -- Authenticated user object
- `Session` in `src/types.ts` -- Session state
- `OAuthProvider` in `src/oauth.ts` -- Provider interface
## Conventions
- All auth functions return `Result<T, AuthError>` -- never throw
- Sessions are stored in Redis -- see `src/session.ts` for connection setup
- Rate limits are per-IP by default -- see `src/rate-limit.ts` for config
| Dimension | Human-Oriented | Agent-Oriented |
|---|---|---|
| Layout | Flowing paragraphs and narrative arcs | Labeled sections, bullet lists, and tables |
| Starting points | Buried in prose ("you'll want to look at...") | Dedicated "Entry Points" section with exact file paths |
| Type information | Woven into explanatory text | Enumerated with source locations |
| Historical context | Prominent (gives humans background) | Absent (agents only need current state) |
| Coding standards | Scattered across wikis or tribal knowledge | Stated as explicit rules inside the CLAUDE.md |
| Links to related docs | Vague ("check the API docs") | Precise (../api/CLAUDE.md#authentication) |
CLAUDE.md files are hierarchical -- an agent entering a directory loads the CLAUDE.md from that directory AND all parent directories up to the project root.
project/
├── CLAUDE.md # Project-wide conventions (loaded everywhere)
├── src/
│ ├── CLAUDE.md # Source code conventions (loaded in src/ and below)
│ ├── auth/
│ │ ├── CLAUDE.md # Auth module specifics (loaded in auth/ and below)
│ │ └── oauth/
│ │ └── CLAUDE.md # OAuth specifics (loaded only in oauth/)
│ └── api/
│ └── CLAUDE.md # API module specifics
└── tests/
└── CLAUDE.md # Testing conventions
When an agent works in src/auth/oauth/, it loads:
project/CLAUDE.md -- project-wide conventionsproject/src/CLAUDE.md -- source code conventionsproject/src/auth/CLAUDE.md -- auth module conventionsproject/src/auth/oauth/CLAUDE.md -- OAuth-specific conventionsUse this hierarchy intentionally:
src/: coding conventions, import patterns, error handling patterns| Signal | Meaning |
|---|---|
| CLAUDE.md not updated in 6+ months but code changed significantly | Documentation may be stale |
| Agent frequently ignores CLAUDE.md guidance | Guidance may be outdated or unhelpful |
| Agent asks clarifying questions about a module that has a CLAUDE.md | CLAUDE.md is missing key information |
| New team members still rely on tribal knowledge | CLAUDE.md files are incomplete |
Problem: CLAUDE.md lists every file and function in the module. Fix: Focus on entry points and navigation, not exhaustive inventory. The agent can read the directory listing itself.
Problem: CLAUDE.md reads like a blog post about the module's history. Fix: Use tables, lists, and labeled sections. Agents parse structure, not stories.
Problem: CLAUDE.md repeats what is already in code comments and docstrings. Fix: CLAUDE.md should describe the module-level view -- architecture, conventions, entry points. Code comments handle the function-level view.
Problem: CLAUDE.md is written once and never touched again. Fix: Make CLAUDE.md updates part of the code review process. If you changed the module's architecture, update the CLAUDE.md.
Problem: All documentation is in a single root CLAUDE.md file. Fix: Use the hierarchy. Root CLAUDE.md has project-wide conventions; each module has its own CLAUDE.md with module-specific guidance. This mirrors progressive disclosure.
Documentation inversion is a natural extension of SDD's context architecture:
| SDD Concept | Documentation Inversion Counterpart |
|---|---|
| Context directory structure (specs/, plans/, impl/) | Per-module CLAUDE.md files co-located with source |
| Progressive disclosure (index file points to detail files) | CLAUDE.md hierarchy cascading from project root to leaf modules |
| Specifications as the source of truth | CLAUDE.md as the authoritative guidance artifact for each module |
| Skills encoding reusable procedures | Navigation skills encoding reusable exploration workflows |
| Plugins as a distribution mechanism | Documentation plugins bundling skills for installation into other projects |
The key insight from SDD applies directly: strong documentation enables agents to orient themselves in unfamiliar code and contribute meaningfully without step-by-step human direction.