ai-context-generator

star 65

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.

sopaco By sopaco schedule Updated 4/20/2026

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:

  1. Start with SKILL.md โ€” entry point with activation rules
  2. Generate references/PROJECT-ESSENCE.md โ€” core identity
  3. Generate references/ARCHITECTURE.md โ€” component map
  4. Generate references/DECISIONS.md โ€” design rationale
  5. Generate DYNAMICS.md โ€” active issues
  6. 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:

  1. Activate this skill
  2. Read AGENTS.md, README.md, package.json
  3. Scan directory structure
  4. Generate each file using templates
  5. 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.

Install via CLI
npx skills add https://github.com/sopaco/cowork-forge --skill ai-context-generator
Repository Details
star Stars 65
call_split Forks 8
navigation Branch main
article Path SKILL.md
More from Creator