Auto-generate a structured project knowledge base from codebase analysis. Zero dependencies, pure markdown.
AI agents dropped into projects waste 30-50% of context just understanding the codebase. Developers repeat the same explanations every session. Architectural decisions get lost in git history.
One file: CONTEXT.md. A structured knowledge base that makes every agent session smart from message #1.
What it generates:
- Project overview & tech stack detection
- Module map with purpose & key files
- Shared domain language (inspired by mattpocock's 52K-star approach)
- Coding conventions (naming, patterns, rules)
- Architecture Decision Records (ADR)
- Gotchas & traps that trip up newcomers
- Common commands reference
| Project | Stars | Key Insight |
|---|---|---|
| mattpocock/skills | 52K+ | Shared language = #1 productivity booster |
| jcode | 2.4K | Semantic memory is the killer feature |
| context-mode | 12K+ | Context optimization is critical |
# 1. Copy the skill
npx skills add aptratcn/skill-project-knowledge
# 2. Point your agent at any project
cd /your/project
# Tell your agent: "Build a knowledge base for this project"
# 3. Get CONTEXT.md
# Your agent analyzes the codebase and generates a structured knowledge baseOr manually:
# Clone the skill
git clone https://github.com/aptratcn/skill-project-knowledge.git
# Copy SKILL.md to your agent's skills directory# CONTEXT.md — Project Knowledge Base
## Project Overview
**Purpose:** E-commerce API with real-time inventory
**Domain:** REST API
## Tech Stack
| Category | Technology |
|----------|-----------|
| Language | TypeScript 5.4 |
| Framework | Fastify |
| Database | PostgreSQL 16 |
## Architecture
### Module Map
| Module | Purpose | Key Files |
|--------|---------|-----------|
| src/auth/ | JWT auth & RBAC | auth.ts, middleware.ts |
| src/inventory/ | Real-time stock | websocket.ts, sync.ts |
| src/orders/ | Order lifecycle | cart.ts, checkout.ts |
## Shared Language
| Term | Meaning |
|------|---------|
| SKU | Stock Keeping Unit — unique product identifier |
| Wave | Batch of orders processed together |
## Coding Conventions
- Files: kebab-case.ts
- Errors: custom AppError class with error codes
- All routes: input validation via zod schemas
## Key Decisions
### ADR-001: WebSocket over SSE for inventory
- Real-time bidirectional updates needed
- SSE would require separate channels for updates
## Gotchas
- Inventory service requires Redis to be running
- Don't modify prisma/schema.prisma without migration| Phase | Time | What Happens |
|---|---|---|
| Discover | 5 min | Scan project structure, detect tech stack |
| Analyze | 10 min | Extract patterns, conventions, dependencies |
| Generate | 5 min | Create structured CONTEXT.md from template |
| Validate | 2 min | Review accuracy, fix incorrect assumptions |
- 30-50% fewer "what does this file do?" questions
- Instant onboarding for new agents and developers
- Living documentation that stays current with the codebase
- Shared language prevents miscommunication
- ADR tracking preserves architectural decisions
- Cognitive Debt Guard — Track tech debt with CONTEXT.md
- Decision Archaeology — Dig into decision history
- Think in Code — 700x context savings on data tasks
MIT
Zero dependencies • Pure markdown • Works with any agent