Claude-skill-registry living-context
This skill should be used when the user asks about "snapshot.md", "constraints.md", "decisions.md", "debt.md", ".ctx/", "living context", "documentation freshness", "stale docs", "ADR", "architecture decision", "technical debt", "system context", "co-located documentation", "context health", "validation", or needs help managing co-located documentation that stays synchronized with code.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/living-context" ~/.claude/skills/majiayu000-claude-skill-registry-living-context && rm -rf "$T"
skills/data/living-context/SKILL.mdLiving Context System
Co-located documentation that stays synchronized with code. No more archaeological digs through outdated wikis. Context lives where the code lives.
Overview
Living Context provides a structured approach to keeping documentation synchronized with code through:
- System-level context - Each system has its own
directory with standardized files.ctx/ - Global context - Project-wide knowledge database and dependency graph
- Validation engine - Automated freshness checking and health validation
- ADR tracking - Architecture Decision Records with full lifecycle management
Commands Reference
All commands use the
uv run cctx prefix.
Initialize Project Context
uv run cctx init [PATH]
Create
.ctx/ directory structure including knowledge.db, graph.json, templates/, and README.md. Defaults to current directory if no path specified.
Options:
- Override context directory name (default: .ctx)--ctx-dir, -c
- Output as JSON--json
- Minimal output for CI--quiet, -q
Check Context Health
uv run cctx health [--deep]
Run health checks on Living Context documentation. Validates file presence, formatting, and synchronization.
Validators run:
- Snapshot validator - Checks file existence and dependencies
- ADR validator - Validates ADR consistency and indexing
- Debt auditor - Audits technical debt tracking
- Freshness checker - Detects stale documentation
Options:
- Include constraint checking in health validation--deep, -d
- Output as JSON--json
- Minimal output for CI--quiet, -q
Show Status Summary
uv run cctx status
Display overview of documented systems, ADR count and status breakdown, technical debt items, and last sync timestamp.
Sync Documentation
uv run cctx sync [--dry-run]
Analyze codebase for changes requiring documentation updates. Uses freshness checker to identify stale documentation.
Options:
- Preview changes without applying them--dry-run, -n
Pre-commit Validation
uv run cctx validate
Run validation suitable for pre-commit hooks. Checks context file integrity, ADR format, required fields, and system registrations. Exits with code 2 if validation fails.
Add System Context
uv run cctx add-system <PATH> [--name NAME]
Create
.ctx/ directory structure for a system/module with:
- snapshot.md - System overview and public API
- constraints.md - System invariants and boundaries
- decisions.md - Index of ADRs for this system
- debt.md - Technical debt tracking
- adr/ - Directory for Architecture Decision Records
Options:
- Human-readable system name (defaults to directory name)--name, -n
Create ADR
uv run cctx adr <TITLE> [--system PATH]
Create a new Architecture Decision Record from template with next available number. Creates in system's
.ctx/adr/ if system specified, otherwise in global .ctx/adr/.
Options:
- System path to create ADR in--system, -s
List Entities
uv run cctx list [systems|adrs|debt]
List registered entities. Defaults to systems if no entity type specified.
Context File Structure
Global Context (project-wide)
.ctx/ ├── knowledge.db # SQLite - ADRs, systems, dependencies ├── graph.json # Generated dependency graph ├── schema.sql # Database schema ├── templates/ # Documentation templates └── README.md # System documentation
System-level Context (per system)
src/systems/<name>/.ctx/ ├── snapshot.md # Purpose, public API, dependencies ├── constraints.md # Invariants and boundaries ├── decisions.md # Index of ADRs for this system ├── debt.md # Known technical debt └── adr/ # Architecture Decision Records └── ADR-NNN.md
Workflow Guidance
When to Use Each Command
| Task | Command |
|---|---|
| Start a new project with Living Context | |
| Add context tracking to existing system | |
| Check if documentation is current | |
| Deep validation including constraints | |
| Quick status overview | |
| Find stale documentation | |
| Pre-commit validation | |
| Record architectural decision | |
| List all documented systems | |
| Review all ADRs | |
| Audit technical debt | |
File Update Guidelines
| File | Update When |
|---|---|
| Public API changes (exports, function signatures) |
| Adding/removing invariants, changing boundaries |
| New ADR added or status changed |
| New debt incurred, debt resolved, or status changed |
| New architectural decision made |
Agent Behavior Rules
These rules define how AI agents should interact with Living Context.
Before Modifying a System
- Read
to understand purpose, API, and constraintssrc/systems/<name>/.ctx/snapshot.md - Check
for invariants that must not be violatedconstraints.md - Review
for known issues that might affect the workdebt.md
After Modifying a System's Public API
- Update
with new/changed/removed exportssnapshot.md - If a dependency was added, update the Dependencies section
When Making Architectural Decisions
- Create an ADR in
explaining context, options, and rationale.ctx/adr/ - Update
to index the new ADRdecisions.md - Register in
knowledge.db
When Introducing Technical Debt
- Document it in
with description and rationaledebt.md - Never leave undocumented shortcuts
Before Completing Work on a System
- Run
to verify documentation is currentuv run cctx health - Fix any issues before considering work complete
Common Workflows
Creating a New System with Context
# Create system directory mkdir -p src/systems/auth # Add context structure uv run cctx add-system src/systems/auth --name "Authentication System" # Fill in snapshot.md with purpose, API, dependencies # Add constraints to constraints.md # Document any initial debt in debt.md
Adding an Architecture Decision Record
# Create ADR for a system uv run cctx adr "Use JWT for session tokens" --system src/systems/auth # Or create global ADR uv run cctx adr "Adopt monorepo structure" # Update decisions.md to index the new ADR # Register in knowledge.db
Pre-commit Workflow
# Quick validation uv run cctx validate # If issues found, check health for details uv run cctx health # Find what needs updating uv run cctx sync --dry-run