| name | ai-context-generator |
| description | Generates .ai-context knowledge base for coding agents. Activate when: (1) setting up a new project for AI-assisted development, (2) user asks to "create project knowledge" or "setup ai-context", (3) existing .ai-context needs regeneration. Creates tiered documentation structure optimized for agent comprehension and token efficiency.
|
AI Context Generator
A reusable skill for creating project knowledge bases that help coding agents work faster and smarter.
šÆ When to Use This Skill
Activate when:
- Setting up a new project for AI-assisted development
- User requests: "create ai-context", "setup project knowledge", "generate .ai-context"
- Existing
.ai-context is outdated and needs regeneration
- After major project restructuring
Do NOT activate when:
- Project already has fresh
.ai-context (check SKILL.md date)
- User asks for unrelated documentation
- Simple code tasks with clear existing context
š What This Skill Generates
Creates a .ai-context/ directory with:
.ai-context/
āāā SKILL.md # Entry point with activation rules
āāā DYNAMICS.md # Active issues & constraints (Dynamic)
āāā references/
ā āāā PROJECT-ESSENCE.md # What & why (High stability)
ā āāā ARCHITECTURE.md # Component relationships (Medium stability)
ā āāā DECISIONS.md # Design decisions (Update on change)
āāā meta/
āāā MAINTENANCE.md # How to maintain this knowledge
āāā templates/ # (Optional) Custom templates
āāā scripts/ # (Optional) Maintenance scripts
Stability Tiers
| Tier | File | Update Frequency | Token Budget |
|---|
| 0 | PROJECT-ESSENCE.md | Quarterly / Major version | ~500 tokens |
| 1 | ARCHITECTURE.md | Monthly / Sprint | ~1000 tokens |
| 2 | DECISIONS.md | Per decision change | ~800 tokens |
| 3 | DYNAMICS.md | As needed (issues) | ~600 tokens |
š§ Generation Process
Step 1: Gather Project Intelligence
Before generating, collect:
ā” Read AGENTS.md (if exists) ā operational rules
ā” Read README.md ā user-facing description
ā” Read package.json ā dependencies, scripts, entry points
ā” Scan directory structure ā identify components
ā” Read docs/ or litho.docs/ ā existing documentation
ā” Identify key source files ā main entry points
ā” Note technology stack ā frameworks, languages, platforms
Step 2: Extract Knowledge
For PROJECT-ESSENCE.md:
- What is this project? (one sentence)
- Why does it exist? (problem/solution)
- Who is it for? (target users)
- What does it provide? (key features)
- Core constraints? (security, compatibility)
For ARCHITECTURE.md:
- System diagram (ASCII or Mermaid)
- Component responsibilities
- Data flow between components
- Key dependencies
- Important patterns
For DECISIONS.md:
- Non-obvious design choices
- Trade-offs made
- Constraints accepted
- Decisions that might be revisited
For DYNAMICS.md:
- Current blockers
- Known workarounds
- Temporary constraints
- Recently resolved issues (brief)
Step 3: Generate Files
Use templates from templates/ directory:
- Start with
SKILL.md ā entry point with activation rules
- Generate
references/PROJECT-ESSENCE.md ā core identity
- Generate
references/ARCHITECTURE.md ā component map
- Generate
references/DECISIONS.md ā design rationale
- Generate
DYNAMICS.md ā active issues
- Generate
meta/MAINTENANCE.md ā upkeep guide
Step 4: Validate Quality
ā” SKILL.md has clear activation triggers
ā” PROJECT-ESSENCE.md readable in 2 minutes
ā” ARCHITECTURE.md shows big picture (no code)
ā” DECISIONS.md justified with rationale
ā” DYNAMICS.md only contains current issues
ā” All files dated at top
ā” Total token budget < 4000 tokens
š Writing Principles
Do:
- ā
Write for someone who knows nothing about the project
- ā
Use diagrams over paragraphs
- ā
Focus on "why" not "how"
- ā
Keep files under 150 lines each
- ā
Link between related sections
- ā
Include "Last updated" dates
Don't:
- ā Copy-paste code snippets (link to files instead)
- ā Document every file/function
- ā Include details that change frequently
- ā Duplicate content across files
- ā Use jargon without context
š Integration with AGENTS.md
AGENTS.md = "How to work" (commands, style, rules)
.ai-context = "What the project is" (architecture, decisions, issues)
Both should be read at session start. They serve different purposes and should not overlap.
š Template Reference
Templates are provided in templates/:
| Template | Purpose |
|---|
skill.md.tmpl | SKILL.md with placeholder prompts |
essence.md.tmpl | PROJECT-ESSENCE.md structure |
architecture.md.tmpl | ARCHITECTURE.md with diagram prompts |
decisions.md.tmpl | DECISIONS.md with ADR format |
dynamics.md.tmpl | DYNAMICS.md with status tracking |
maintenance.md.tmpl | MAINTENANCE.md guide |
š ļø Automation Scripts
Scripts in scripts/ can help with:
| Script | Purpose |
|---|
generate.ts | Interactive generation from templates |
check-drift.ts | Compare documented vs actual structure |
audit-dynamics.ts | Flag stale issues (>30 days) |
š” Example Usage
User: "Setup ai-context for my project"
Agent:
- Activate this skill
- Read AGENTS.md, README.md, package.json
- Scan directory structure
- Generate each file using templates
- Ask clarifying questions if needed:
- "What's the main problem this project solves?"
- "Any non-obvious design decisions I should know about?"
- "Current blockers or workarounds?"
ā ļø Important Notes
- Generated knowledge is a starting point, not final truth
- Agent should verify against actual code during first session
- User should review generated content for accuracy
- Schedule regular audits (monthly recommended)
š References
This skill creates knowledge bases optimized for AI agents. For questions or improvements, see MAINTENANCE.md.