pi-heartbeat
Configure periodic health checks via HEARTBEAT.md and the /heartbeat command.
Generate and maintain AI-readable markdown documentation for a codebase in docs/. Use this skill whenever the user asks to document their codebase, generate project docs, create architecture docs, update documentation after code changes, build a knowledge base for AI agents,
$ npx -y skills add espennilsen/pi --skill codebase-docs --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/codebase-docsContext preview
The summary Claude sees to decide when to auto-load this skill.
Generate and maintain AI-readable markdown documentation for a codebase in docs/. Use this skill whenever the user asks to document their codebase, generate project docs, create architecture docs, update documentation after code changes, build a knowledge base for AI agents,
name: codebase-docs description: > Generate and maintain AI-readable markdown documentation for a codebase in docs/. Use this skill whenever the user asks to document their codebase, generate project docs, create architecture docs, update documentation after code changes, build a knowledge base for AI agents, create onboarding docs, map out a codebase, or explain a project structure. Also trigger when users say things like "document this repo", "create docs for my project", "update the docs", "write architecture documentation", "help AI understand my code", "generate a codebase overview", or "maintain docs". This skill is specifically about creating structured markdown files in a docs/ directory that serve as a knowledge base — NOT about writing inline code comments, README files, or API reference docs from docstrings.
Generate and maintain a structured set of markdown files in `docs/` that give AI agents (and humans) a fast, accurate understanding of a codebase without needing to search through source files.
The docs you produce are a **map, not the territory**. They should let an AI agent answer questions like "where does authentication happen?", "how does data flow from API to database?", or "what are the key abstractions?" — without reading every file. Optimize for **navigability and accuracy** over exhaustiveness.
Before writing anything, understand what you're documenting.
1. **Read the project root** — check for existing README, package.json/Cargo.toml/pyproject.toml, config files, and any existing `docs/` directory 2. **Map the directory structure** — identify source directories, test directories, config, scripts, assets 3. **Identify the tech stack** — languages, frameworks, key dependencies, build tools 4. **Find entry points** — main files, route definitions, CLI entry points, exported modules 5. **Detect patterns** — architecture style (MVC, microservices, monolith, plugin-based), state management, data layer
If a `docs/` directory already exists, read it first. You'll be updating, not starting from scratch.
Create the `docs/` directory with the files described below. Not every project needs every file — use judgment. A small CLI tool doesn't need `DATA_MODEL.md`, and a pure library doesn't need `DEPLOYMENT.md`.
Refer to `references/doc-templates.md` for the exact templates and structure for each file. Read that file before writing any documentation.
| File | Purpose | |------|---------| | `docs/OVERVIEW.md` | Project purpose, tech stack, architecture style, key concepts. This is the **entry point** — an AI agent should read this first. | | `docs/STRUCTURE.md` | Annotated directory tree showing what lives where and why. Maps directories to responsibilities. | | `docs/ARCHITECTURE.md` | How components connect. Data flow, request lifecycle, key abstractions, dependency graph between modules. |
| File | When to Include | Purpose | |------|-----------------|---------| | `docs/DATA_MODEL.md` | Project has a database, ORM, or significant data structures | Schema overview, entity relationships, key types/interfaces | | `docs/API.md` | Project exposes or consumes APIs | Endpoints, request/response shapes, auth patterns | | `docs/CONFIGURATION.md` | Non-trivial config (env vars, feature flags, multi-environment) | All configuration knobs, defaults, and where they're used | | `docs/PATTERNS.md` | Project uses recurring patterns worth documenting | Design patterns, conventions, error handling strategy, logging approach | | `docs/DEPLOYMENT.md` | Project has deployment infrastructure | Build process, environments, CI/CD, infrastructure overview | | `docs/DEVELOPMENT.md` | Project has non-obvious dev setup or workflow | Local setup, testing strategy, debugging tips, contribution workflow | | `docs/GLOSSARY.md` | Domain-specific or project-specific terminology | Term definitions that an AI agent needs to understand the codebase |
Always generate `docs/INDEX.md` as the last file. This is a table of contents linking all other docs with one-line descriptions. An AI agent uses this to decide which file to read for a given question.
Follow these principles for every file:
This repository is my Pi coding agent home directory. I keep it under version control and symlink it to ~/.pi/agent so Pi loads configuration, extensions, skills, and runtime state from here.
Configure periodic health checks via HEARTBEAT.md and the /heartbeat command.
Manage persistent memory across sessions. Use when asked to remember, recall, forget, or review what was stored. Covers long-term…
Track and manage projects with git status via dashboard and tool.
Delegate tasks to specialized subagents for parallel or sequential execution.
Audit, generate, update, and lint AGENTS.md files across all projects. Use when asked to check project context files, scaffold…