Discover and contribute context modules (rules, personas, examples, skills) to team-ai-directives using Context Directive Records (CDRs).
The LevelUp extension helps brownfield projects analyze their codebase and contribute reusable context modules back to the team's shared AI directives repository. It introduces Context Directive Records (CDRs) - similar to Architecture Decision Records (ADRs) - for tracking what, why, and how context is being contributed.
| Command | Purpose |
|---|---|
/levelup.init |
Scan codebase and discover CDRs (like /architect.init) |
/levelup.clarify |
Resolve ambiguities in discovered CDRs (like /architect.clarify) |
/levelup.specify |
Refine CDRs using current feature spec context |
/levelup.skills |
Build a single skill from accepted CDRs |
/levelup.implement |
Compile accepted CDRs into a PR to team-ai-directives |
/levelup.trace |
Generate and validate AI session execution traces |
/levelup.validate |
Scan team-ai-directives for rule conflicts |
After implementing a feature, generate a trace to document the session:
/levelup.traceThis creates specs/{BRANCH}/trace.md with execution summary.
Scan your codebase for patterns that could become team-wide directives:
/levelup.initThis creates proposed CDRs in {PROJECT}/.specify/drafts/cdr.md with status "Discovered" or "Proposed".
Review discovered CDRs and resolve ambiguities:
/levelup.clarifyThis validates patterns and updates CDR statuses to "Accepted" or "Rejected".
Build a skill from accepted CDRs:
/levelup.skills python-error-handlingThis creates a skill in .specify/drafts/skills/.
Compile accepted CDRs into a PR to team-ai-directives:
/levelup.implementThis creates a draft PR with all accepted contributions.
CDRs are stored in markdown format:
- Local:
{PROJECT}/.specify/drafts/cdr.md- Working copy during discovery/clarification - Approved:
{TEAM_DIRECTIVES}/CDR.md- Approved contributions tracked in team-ai-directives
CDRs define:
- Target Module: Where the contribution goes in team-ai-directives
- Context Type: Rule, Persona, Example, or Skill
- Status: Discovered → Proposed → Accepted | Rejected
| Status | Description |
|---|---|
| Discovered | Inferred from codebase during brownfield analysis |
| Proposed | Suggested for review, awaiting validation |
| Accepted | Approved for implementation |
| Rejected | Not approved (reason documented in CDR) |
When discovering skills, classify them using Anthropic's 9-category taxonomy from "Lessons from Building Claude Code: How We Use Skills". This helps teams build better skills by guiding CDR classification during discovery.
| Type | Purpose | Example Triggers |
|---|---|---|
| Library & API Reference | Documentation and API usage guidance | "how do I use X library", "API for Y service" |
| Product Verification | Testing and validation of product behavior | "verify product", "check behavior", "validate output" |
| Data Fetching & Analysis | Data retrieval and processing | "fetch data", "analyze logs", "query database" |
| Business Process Automation | Workflow and business process automation | "automate process", "workflow", "orchestrate" |
| Code Scaffolding & Templates | Project and code generation | "create project", "scaffold", "generate boilerplate" |
| Code Quality & Review | Code review and quality improvement | "review code", "quality check", "refactor" |
| CI/CD & Deployment | Build, test, and deployment pipelines | "deploy", "CI/CD pipeline", "build artifact" |
| Runbooks | Operational procedures and troubleshooting | "troubleshoot", "runbook", "incident response" |
| Infrastructure Operations | Infrastructure as Code and provisioning | "provision", "infrastructure", "terraform", "kubernetes" |
- Library & API Reference: When the skill provides documentation or guidance for using a specific library or API
- Product Verification: When the skill checks or validates product behavior against expected outputs
- Data Fetching & Analysis: When the skill retrieves, processes, or analyzes data from external sources
- Business Process Automation: When the skill orchestrates multi-step workflows or business processes
- Code Scaffolding & Templates: When the skill generates project structure or code templates
- Code Quality & Review: When the skill reviews code quality or suggests improvements
- CI/CD & Deployment: When the skill handles building, testing, or deploying applications
- Runbooks: When the skill provides troubleshooting or operational guidance
- Infrastructure Operations: When the skill manages infrastructure provisioning or configuration
The extension resolves the team-ai-directives path in this order:
SPECIFY_TEAM_DIRECTIVESenvironment variable.specify/team-ai-directives(submodule - recommended).specify/memory/team-ai-directives(clone - legacy)
Optional configuration in .specify/extensions/levelup/levelup-config.yml:
cdr:
heuristic: "surprising" # surprising | all | minimal
# CDR file location (local project)
location: ".specify/drafts/cdr.md"
skills:
drafts_location: ".specify/drafts/skills"
discovery:
rules: true
personas: true
examples: true
constitution: true
skills: true
pull_request:
draft: true
branch_prefix: "levelup/"
target_branch: "main"levelup.init levelup.clarify levelup.skills levelup.implement
(Discover CDRs) ───▶ (Resolve Ambiguities) ───▶ (Build Skills) ───▶ (Create PR)
│ │ │ │
│ [handoff] │ [handoff] │ │
└──▶ levelup.specify ◀────┘ │ │
(Refine from │ │
feature context) │ │
│ │
┌───────────────────────────────┘ │
│ │
▼ │
levelup.trace ◀───────────────────────────────────────────────┘
(Generate Trace)
│
│ [handoff]
▼
levelup.specify
(Extract CDRs with
trace enrichment)
┌──────────────────────────────────────────────────────┐
│ │
▼ │
levelup.validate ◀────────────────────────────────────────────┘
(Scan for Conflicts)
│
│ [creates CDRs]
▼
levelup.clarify
(Resolve conflicts)
- #56 - Feature request for this extension
- #49 - Skills discovery (format compatibility)
- #53 - Git submodule for team-ai-directives
- #36 - Convert architect commands to extension (pattern reference)
MIT