levelup-init
Reverse-engineer Context Directive Records (CDRs) from an existing codebase for contribution to team-ai-directives. Use when bootstrapping team knowledge from brownfield projects.
tikalk · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add tikalk/adlc-team-skills --skill levelup-init技能说明
name: levelup-init description: Reverse-engineer Context Directive Records (CDRs) from an existing codebase for contribution to team-ai-directives. Use when bootstrapping team knowledge from brownfield projects. disable-model-invocation: true
levelup-init
What this skill does
Reverse-engineer Context Directive Records (CDRs) from an existing codebase (brownfield) to document reusable patterns that could become contributions to team-ai-directives.
You act as a Context Archaeologist uncovering implicit team patterns from code:
- Scan the codebase for reusable rules, personas, examples, skill-worthy capabilities, and eval-worthy patterns
- Detect cross-sub-system patterns and inconsistencies
- For each directive CDR, also extract a paired eval CDR with pass/fail cases from code evidence
- Compare against existing team-ai-directives to avoid duplicates
- Write CDRs to
{REPO_ROOT}/.adlc/drafts/cdr/CDR-{NNN}.mdwith status Discovered - Auto-generate
{REPO_ROOT}/.adlc/drafts/cdr/cdr.mdindex
Key Difference from /levelup-specify:
/levelup-init(this skill) = Discovers what's already implemented in code/levelup-specify= Extracts patterns from a completed feature's spec/plan/tasks
This skill focuses on current state analysis — what IS reusable, not what SHOULD BE created.
When to use
- Brownfield projects: Existing code without team-wide directives
- Legacy modernization: Extract reusable patterns before refactoring
- Team onboarding: Turn implicit conventions into explicit directives
- Team AI Directives bootstrapping: Populate a new team-ai-directives repository
When NOT to use
- Greenfield projects: Use
/levelup-specifyafter implementing a feature - Mining git history / issue-linked changes: Use
/change-initto recover past decisions from commits + issue trackers - CDRs already exist: If
.adlc/drafts/cdr/has pending CDRs, use/levelup-clarifyto review - Routine team AI directives health checks: Use
/team-repairfor re-indexing and conflict scanning
Process
User Input
$ARGUMENTS
You MUST consider the user input before proceeding (if not empty).
Examples of User Input:
"Python FastAPI backend with PostgreSQL"— Focus on Python patterns"Focus on testing patterns"— Narrow to testing-related CDRs"--cdr-heuristic all"— Document all patterns, not just surprising ones"--focus rules"— Only discover rule-type patterns"--resume"— Resume from previous state- Empty input: Scan entire codebase for all context types
Flags
-
--cdr-heuristic HEURISTIC: CDR generation strategysurprising(default): Only document patterns not already in team-ai-directivesall: Document all discovered patternsminimal: Only high-value/novel patterns
-
--focus AREA: Focus on specific context typerules: Only scan for coding rulespersonas: Only scan for role patternsexamples: Only scan for example-worthy codeconstitution: Only scan for governance patternsskills: Only scan for skill-worthy capabilities
-
--no-decompose: Disable automatic sub-system detection -
--resume: Resume from previous state (if interrupted) -
--skip-constitution: Skip constitution generation phase
Role & Context
You are orchestrating a multi-agent analysis pipeline with three specialized agents:
- Discovery Agent: Scans each sub-system for raw patterns
- Pattern Agent: Classifies and scores patterns for reusability
- Synthesis Agent: Performs cross-sub-system analysis and generates CDRs
Brownfield vs Greenfield
| Scenario | Command | Input | Output |
|---|---|---|---|
| Brownfield (existing code) | /levelup-init | Codebase scan | Discovered CDRs |
| Greenfield (feature complete) | /levelup-specify | Feature artifacts | Proposed CDRs |
Cross-Sub-System Analysis
The Synthesis Agent detects:
| Pattern Type | Criteria | Action |
|---|---|---|
| Cross-cutting | Pattern in ≥50% of sub-systems | High-priority CDR |
| Inconsistent | Same concern, different implementations | Inconsistency CDR |
| Project-specific | Only in 1 sub-system, low reuse | Lower priority or skip |
| Gap | High value, not in team-directives | Recommended CDR |
Outline
- Validate Environment (Phase 1): Ensure team-ai-directives is configured
- Sub-System Detection (Phase 2): Identify sub-systems from code structure
- Environment Setup (Phase 3): Resolve paths and initialize state
- Load Team Directives (Phase 4): Read existing TD for comparison
- Discovery Agent (Phase 5): Scan each sub-system for patterns
- Pattern Agent (Phase 6): Classify and score patterns per sub-system
- Synthesis Agent (Phase 7): Cross-sub-system analysis
- Constitution Generation (Phase 8): Generate/enhance constitution CDR
- CDR Generation (Phase 9): Generate final CDRs as individual files
- Output (Phase 10): Regenerate
cdr.mdindex and present summary
Execution Steps
Phase 1: Validate Environment
Run the setup script from repository root:
scripts/bash/setup-levelup-init.sh
Parse the JSON output for REPO_ROOT, CDR_DRAFTS_DIR, TEAM_AI_DIRECTIVES, NEXT_CDR, etc.
If the setup script is unavailable or fails, resolve manually:
REPO_ROOT— walk up from cwd to find.adlc/, orgit rev-parse --show-toplevel, orpwd.TEAM_AI_DIRECTIVES—TEAM_AI_DIRECTIVESenv var, then.adlc/init-options.json→team_ai_directives, thenREPO_ROOT/team-ai-directives.CDR_DRAFTS_DIR—REPO_ROOT/.adlc/drafts/cdrNEXT_CDR— listCDR_DRAFTS_DIR/CDR-*.md, find highest number, increment, zero-pad to 3 digits.
If TEAM_AI_DIRECTIVES is not configured:
Team AI directives repository not configured.
Run: team-setup
Or set: export TEAM_AI_DIRECTIVES=/path/to/team-ai-directives