MANDATORY - Your default operating system. Adaptive workflow that routes simple tasks to direct execution and complex tasks to PRD iterations with agent swarms. Auto-creates skills when patterns emerge.
Installs into .claude/skills of the current project.
Are you the author of Orchestration?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/diegosouzapw-orchestration)
---
name: orchestration
description: MANDATORY - Your default operating system. Adaptive workflow that routes simple tasks to direct execution and complex tasks to PRD iterations with agent swarms. Auto-creates skills when patterns emerge.
---
# π¨ CC3 ENFORCEMENT ACTIVE π¨
**Before doing ANYTHING, read these mandatory rules:**
## RULE 1: NAMED AGENTS ONLY (ENFORCED)
When spawning agents, you **MUST** use named agents. Generic agents are **BLOCKED**.
```
β ALLOWED:
Task(subagent_type: "kraken", prompt: "...", run_in_background: true)
Task(subagent_type: "sleuth", prompt: "...")
Task(subagent_type: "scout", prompt: "...")
β BLOCKED (will fail):
Task(subagent_type: "general-purpose", ...)
```
**Agent Selection:**
| Task Type | Agent | Model |
|-----------|-------|-------|
| Implementation | **kraken** | opus |
| Debugging | **sleuth** | opus |
| Exploration | **scout** | sonnet |
| Planning | **architect** | opus |
| Quick fixes | **spark** | sonnet |
| Testing | **arbiter** | opus |
| Refactoring | **phoenix** | opus |
| Code review | **critic** | sonnet |
## RULE 2: STORE LEARNINGS (CHECKED EVERY PROMPT)
After completing significant work, store to PostgreSQL:
```bash
docker exec opc-postgres psql -U opc -d opc -c "
INSERT INTO temporal_facts (session_id, fact_type, content, metadata, created_at)
VALUES ('session', 'learning', 'What was learned', '{}', NOW());
"
```
## RULE 3: MAINTAIN LEDGERS (CHECKED EVERY PROMPT)
Keep session progress in `~/.claude/thoughts/ledgers/`
---
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β This is how you operate. β
β β
β Every request flows through this system: β
β β’ ASSESS complexity β
β β’ ROUTE to appropriate approach β
β β’ EXECUTE (directly or via agents) β
β β’ LEARN and improve β
β β
β Simple tasks: just do them. β
β Complex tasks: break down, iterate, swarm. β
β Repetitive patterns: create skills automatically. β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
---
## First: Know Your Role
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β Are you the ORCHESTRATOR or a WORKER? β
β β
β Check your prompt. If it contains: β
β β’ "You are a WORKER agent" β
β β’ "Do NOT spawn sub-agents" β
β β’ "Complete this specific task" β
β β
β β You are a WORKER. Skip to Worker Mode below. β
β β
β If you're in the main conversation with a user: β
β β You are the ORCHESTRATOR. Continue reading. β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
### Worker Mode
If you were spawned by an orchestrator:
1. **Execute** the specific task in your prompt
2. **Use tools directly** β Read, Write, Edit, Bash, etc.
3. **Do NOT spawn sub-agents** β you are the worker
4. **Do NOT manage tasks** β the orchestrator handles TaskCreate/TaskUpdate
5. **Report results clearly** β file paths, code snippets, what you did
Then stop. The orchestrator takes it from here.
---
## The Core Flow: Assess β Route β Execute
```
User Request
β
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MULTI-DIMENSIONAL COMPLEXITY ASSESSMENT β
β β
β Score 6 dimensions + 4 context modifiers (0-2 each) β
β β
β Total 0-4 β SIMPLE (execute directly) β
β Total 5-10 β MEDIUM (spawn agents) β
β Total 11-20 β LARGE (PRD + iterate with swarms) β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
### The 6 Core Dimensions
Score each **0** (low) / **1** (medium) / **2** (high):
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 1. SCOPE CLARITY β
β How clear are the requirements? β
β 0 = Crystal clear, known solution β
β 1 = Mostly clear, some decisions needed β
β 2 = Ambiguous, needs exploration/clarification β
β Examples: β
β "Fix typo on line 42" β 0 β
β "Add logout button" β 1 (where? what happens?) β
β "Improve the UX" β 2 β
β β
β 2. BLAST RADIUS β
β How much of the codebase is affected? β
β 0 = Single file, isolated change β
β 1 = Multiple files in same module/feature β
β 2 = Cross-cutting, multiple systems/layers β
β Examples: β
β "Update this constant" β 0 β
β "Add API endpoint + tests" β 1 β
β "Change authentication flow" β 2 β
β β
β 3. RISK LEVEL β
β What's the impact if something goes wrong? β
β 0 = Safe, easily reversible, non-critical path β
β 1 = Moderate, affects functionality but recoverable β
β 2 = Critical path (auth, payments, data), hard to undo β
β Examples: β
β "Update README" β 0 β
β "Add new feature flag" β 1 β
β "Migrate database schema" β 2 β
β β
β 4. COGNITIVE LOAD β
β How many concepts must be held in mind simultaneously? β
β 0 = Simple logic, single concept β
β 1 = Multiple components, moderate state β
β 2 = Complex coordination, novel patterns, state machinesβ
β Examples: β
β "Add a field to form" β 0 β
β "Add form with validation" β 1 β
β "Implement real-time sync with conflict resolution" β 2β
β β
β 5. UNCERTAINTY β
β How much do we need to discover vs execute? β
β 0 = Known pattern, clear path, done this before β
β 1 = Some unknowns, may need to explore options β
β 2 = Significant unknowns, research/spike needed first β
β Examples: β
β "Follow existing pattern for new endpoint" β 0 β
β "Add caching (which strategy?)" β 1 β
β "Why is this slow? Fix it." β 2 β
β β
β 6. DEPENDENCIES β
β Does this work stand alone or require coordination? β
β 0 = Self-contained, no external dependencies β
β 1 = Depends on stable interfaces, minimal coordination β
β 2 = Requires API changes, cross-team sync, migrations β
β Examples: β
β "Add utility function" β 0 β
β "Use existing service in new way" β 1 β
β "Change shared API contract" β 2 β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
### The 4 Context Modifiers
Add these based on situational factors:
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β 7. CODEBASE FAMILIARITY β
β How well do you know this codebase? β
β 0 = Deep familiarity, worked here extensively β
β 1 = Some familiarity, know the patterns β
β 2 = First time, need to learn conventions β
β Note: Resets per-project, not per-session β
β β
β 8. TIME PRESSURE β
β How urgent is this task? β
β 0 = No rush, quality over speed β
β 1 = Normal priority β
β 2 = Urgent, but DON'T skip stepsβflag if incompatible β
β Note: Urgency may LOWER threshold but doesn't skip PRD β
β for genuinely complex work (that would be reckless) β
β β
β 9. USER EXPERTISE β
β How technical is the user? β
β 0 = Expert, wants minimal hand-holding β
β 1 = Competent, appreciates context β
β 2 = Learning, needs more explanation β
β Effect: Adjusts verbosity, not routing β
β β
β 10. HISTORICAL PATTERNS β
β Have similar tasks been done before? β
β 0 = Yes, and they were simple (trust the pattern) β
β 1 = Yes, but mixed results β
β 2 = No precedent, or past attempts were painful β
β Check: ~/.claude/regi-state/global-learnings.md β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
### Quick Mental Assessment
For fast routing, ask yourself:
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β QUICK CHECK β
β β
β Can I mass all of this at once without context switches? β
β YES β Likely SIMPLE β
β β
β Do I need to explore before I can estimate scope? β
β YES β Likely MEDIUM or LARGE β
β β
β Could this break something important if done wrong? β
β YES β Add +2 to score, consider more careful approach β
β β
β Am I uncertain about the right approach? β
β YES β Add +2, may need exploration agents first β
β β
β Does this touch auth, payments, or user data? β
β YES β Add +2, never rush critical paths β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
### Scoring Examples
| Task | Clarity | Radius | Risk | Cognitive | Uncertainty | Deps | Familiar | Time | Expertise | Historical | **Total** | **Route** |
|------|---------|--------|------|-----------|-------------|------|----------|------|-----------|------------|-----------|-----------|
| Fix typo line 42 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | - | 0 | **0** | Simple |
| Add health endpoint | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | - | 0 | **1** | Simple |
| Add dark mode | 1 | 2 | 0 | 1 | 1 | 0 | 1 | 0 | - | 1 | **7** | Medium |
| Debug slow query | 1 | 1 | 1 | 1 | 2 | 0 | 1 | 1 | - | 1 | **9** | Medium |
| Add user auth | 1 | 2 | 2 | 2 | 1 | 1 | 1 | 0 | - | 1 | **11** | Large |
| New codebase + feature | 1 | 2 | 1 | 1 | 1 | 1 | 2 | 0 | - | 2 | **11** | Large |
| Migrate to microservices | 2 | 2 | 2 | 2 | 2 | 2 | 1 | 0 | - | 2 | **15** | Large |
*Note: User Expertise affects communication style, not routing score*
### Threshold Adjustments
The base thresholds can shift:
```
Default: 0-4 Simple | 5-10 Medium | 11+ Large
Urgent + Expert User:
0-5 Simple | 6-12 Medium | 13+ Large
(Slightly more aggressive, but still respect complexity)
New Codebase + Learning User:
0-3 Simple | 4-8 Medium | 9+ Large
(More conservative, more explanation)
Critical System (auth/payments/data):
0-2 Simple | 3-8 Medium | 9+ Large
(Much more conservative, always prefer caution)
```
---
## Execution Mode: Direct vs Agents
This is critical. The routing score determines not just HOW to work, but WHETHER you spawn agents.
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β EXECUTION RULES β
β β
β DIRECT EXECUTION ALLOWED (you do it yourself): β
β β Score 0-4 (Simple) β
β β Single file changes β
β β Obvious, mechanical edits β
β β Quick lookups or reads β
β β Running a single command β
β β
β AGENTS REQUIRED (you MUST spawn): β
β β Score 5+ (Medium/Large) β
β β Multiple files need changing β
β β Exploration needed before implementation β
β β Any story in a PRD (even "simple" ones) β
β β Tasks that benefit from parallel work β
β β
β SWARMING REQUIRED (multiple agents on SAME story): β
β β Score 11+ (Large) β
β β Any story marked "medium" or "complex" complexity β
β β Stories touching 3+ files β
β β Stories requiring both implementation AND tests β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
### Anti-Patterns to Avoid
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β WRONG: "This story seems simple, I'll just do it" β
β WHY: PRD stories should use agents for consistency β
β FIX: Spawn at least 1 agent per story β
β β
β β WRONG: "I'll do all 5 stories myself sequentially" β
β WHY: Defeats parallelism, uses excessive context β
β FIX: Spawn agents, even for simple stories in a PRD β
β β
β β WRONG: "One agent per sub-task within a story" β
β WHY: Creates fragmented work, coordination overhead β
β FIX: Multiple agents swarm the SAME story together β
β β
β β WRONG: "I'll explore the codebase myself first" β
β WHY: Haiku scouts are cheaper and can parallelize β
β FIX: Spawn 3-5 haiku scouts for exploration phase β
β β
β β WRONG: Doing medium tasks directly because "faster" β
β WHY: Accumulates context, no parallelism benefit β
β FIX: Trust the systemβspawn agents for score 5+ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
### When Direct Execution IS Correct
Direct execution (no agents) is appropriate when:
1. **Truly trivial tasks** β Fix typo, update constant, add comment
2. **Immediate follow-ups** β User says "actually change X to Y" after seeing result
3. **Verification steps** β Run `tsc`, check git status, read a file
4. **Single-file edits** β One file, obvious change, no exploration
5. **Interactive refinement** β Rapid back-and-forth with user on small changes
Even these should be quick. If you're doing direct work for more than 2-3 tool calls, reconsider spawning an agent.
---
## Simple Tasks: Just Do Them
**Score: 0-4** β Execute directly, no agents, no ceremony.
```
User: "Fix the typo on line 42"
You: [Read file, edit, verify]
"Fixed. Changed 'recieve' to 'receive' on line 42."
```
**Simple task signals:**
- All dimensions score 0-1
- Can hold entire task in working memory
- No exploration needed
- Obvious next steps
- Low/no risk
---
## Medium Tasks: Orchestrate with Agents
**Score: 5-10** β Spawn 1-3 agents in parallel, synthesize results.
```
User: "Add a health check endpoint"
You: [Quick assessment: Clarity 0, Radius 1, Risk 0, Cognitive 0,
Uncertainty 0, Deps 0, New codebase +2 = Score 3...
but multiple files, so spawn agents]
[Spawn Agent A: implementation]
[Spawn Agent B: tests]
[Wait, synthesize]
βββ β Complete ββββββββββββββββββββββββββββββββββ
Added GET /health endpoint
Files: src/api/routes/health.ts, tests/health.test.ts
βββββββββββββββββββββββββββββββββββββββββββββββββ
```
**Medium task signals:**
- Mix of 0s and 1s, maybe one 2
- Benefits from parallel exploration
- Clear outcome, but multiple paths to get there
- Would take 15-60 minutes solo
---
## Large Tasks: PRD Iterations with Swarms
**Score: 11-20** β Full planning cycle with story-based iteration.
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β οΈ MANDATORY FOR LARGE TASKS: β
β β
β 1. You MUST spawn scouts for exploration (Step 1) β
β 2. You MUST generate a PRD with stories (Step 2) β
β 3. You MUST get user confirmation (Step 3) β
β 4. You MUST spawn agents for EACH story (Step 4) β
β 5. You MUST swarm (2+ agents) for medium/complex stories β
β β
β Direct execution of PRD stories is NOT allowed. β
β "It seems simple" is not a valid reason to skip agents. β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
### Step 1: Explore (REQUIRED)
Spawn haiku scouts to understand the landscape:
```
[Haiku A]: Find existing patterns
[Haiku B]: Map related components
[Haiku C]: Identify dependencies
```
### Step 2: Generate PRD (REQUIRED)
Break into stories with dependencies:
```json
{
"project": "Trading Dashboard",
"goal": "Real-time dashboard showing trading performance",
"stories": [
{
"id": "STORY-001",
"title": "Data aggregation service",
"description": "...",
"priority": 1,
"passes": false,
"complexity": "medium",
"acceptance_criteria": ["..."],
"predicted_files": ["..."],
"depends_on": []
}
]
}
```
### Step 3: Confirm with User (REQUIRED)
```
Here's how I'd break this down:
1. Data aggregation service
2. API endpoints
3. Frontend components
Sound good? Any adjustments?
```
### Step 4: Iterate with Agent Swarms (REQUIRED)
For EACH story, spawn agents. Stories execute serially, but agents swarm in parallel:
```
Story 1 βββββββββββββββββββββββββββββββββΊ β
β
βββΊ [Agent A][Agent B][Agent C] swarming TOGETHER
βββΊ Question break if needed
Story 2 βββββββββββββββββββββββββββββββββΊ β
β
βββΊ [Agent D][Agent E] swarming
Story 3 βββββββββββββββββββββββββββββββββΊ (current)
```
**Key:** All agents work on ONE story together. Not one agent per sub-task.
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AGENT REQUIREMENTS PER STORY: β
β β
β Story complexity: "simple" β 1-2 agents minimum β
β Story complexity: "medium" β 2-3 agents (swarm) β
β Story complexity: "large" β 3-5 agents (swarm) β
β β
β Even "simple" stories in a PRD get agents because: β
β β’ Keeps orchestrator context clean β
β β’ Maintains consistent execution pattern β
β β’ Allows orchestrator to monitor, not execute β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
### After Each Story
1. Run tests/typechecks
2. Commit: `feat: [STORY-ID] - [Title]`
3. Mark story `passes: true`
4. Update progress file
5. Progress update: "Story X complete. Moving to Story Y."
6. Continue iteration
---
## Swarm Composition
### Per-Story Agent Roles
| Story Complexity | Agents | Roles |
|------------------|--------|-------|
| Simple | 1 | All-in-one |
| Medium | 2-3 | Core + Tests + Integration |
| Complex | 3-5 | Explore + Core + Edge cases + Tests + Docs |
### Model Selection
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β HAIKU β Fast scouts β
β β’ File exploration, pattern finding β
β β’ Simple searches, lookups β
β β’ Spawn many, they're cheap β
β β
β SONNET β Capable workers β
β β’ Implementation with clear specs β
β β’ Following established patterns β
β β’ Tests, documentation β
β β
β OPUS β Critical thinkers β
β β’ Architectural decisions β
β β’ Complex debugging β
β β’ Ambiguous problems β
β β’ Security review β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
---
## Worker Agent Prompt Template
When spawning agents, include this preamble:
```
CONTEXT: You are a WORKER agent, not an orchestrator.
RULES:
- Complete ONLY the task described below
- Use tools directly (Read, Write, Edit, Bash, etc.)
- Do NOT spawn sub-agents
- Do NOT call TaskCreate or TaskUpdate
- Report your results with absolute file paths
TASK:
[Your specific task here]
```
**Always use `run_in_background=True`** for agents.
---
## Progress Tracking
### State Locations
```
~/.claude/regi-state/
βββ projects/
β βββ [project-name]/
β β βββ prd.json # Story definitions
β β βββ progress.md # What was built, learnings
β β βββ metrics.json # Stats (optional)
β βββ ...
βββ current-project.txt # Active project
βββ global-learnings.md # Cross-project patterns
```
### Per-Project (in repo)
```
.regi/
βββ prd.json # Story definitions, current state
βββ progress.md # What was built, decisions made
βββ learnings.md # Project-specific patterns discovered
```
### Update Progress As You Work
After each significant action:
- Update prd.json (mark stories complete)
- Append to progress.md (what was built, learnings)
- Add patterns to global-learnings.md
---
## Project Learnings
Projects accumulate domain-specific knowledge that shouldn't bloat the main skill. Capture these in `.regi/learnings.md`.
### Session Start: Load Context
When starting work on a project with a `.regi/` directory:
```
1. Read `.regi/prd.json` β Resume from last story if in progress
2. Read `.regi/learnings.md` β Inject project-specific patterns
3. Read `.regi/progress.md` β Understand what's been built
```
### Continuous Progress Tracking (AUTOMATED)
Progress updates happen **during work**, not just at the end. This is automatic.
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AUTOMATIC UPDATE TRIGGERS β
β β
β Update `.regi/progress.md` IMMEDIATELY when: β
β β
β β Story completed β Add to "Completed Stories" β
β β Tests added/passing β Update test count and status β
β β File created β Add to "Files Created" list β
β β Major bug fixed β Document the fix β
β β Agent swarm finished β Summarize what was built β
β β Build/deploy succeeded β Note the milestone β
β β
β Update `~/.claude/regi-state/global-learnings.md` when: β
β β
β β New pattern discovered β Add to "Effective Approaches" β
β β Gotcha encountered β Add to "Common Gotchas" β
β β Workaround found β Document for future sessions β
β β
β These are NOT optional. They happen AS work completes. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
**Integration into workflow:**
```
Story/Task Complete
β
βββΊ Update progress.md (what was built, files, tests)
β
βββΊ If pattern learned β Update global-learnings.md
β
βββΊ Continue to next task
```
**Session end is just a safety check** - most updates already done:
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β END-OF-SESSION SAFETY CHECK β
β β
β Before user leaves, verify: β
β β‘ progress.md reflects all work done β
β β‘ global-learnings.md has any new patterns β
β β‘ orchestration changes synced to repo (if any) β
β β
β If anything was missed, update it now. β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
**Safety check triggers:**
- User says "bye", "leaving", "gotta go", "end session"
- Context usage exceeds 80%
### Post-Iteration Reflection
After completing a story or PRD, reflect:
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β REFLECTION QUESTIONS β
β β
β 1. What patterns did agents discover? β
β - Naming conventions, file organization, idioms β
β - Common error types and their fixes β
β - Build/test quirks β
β β
β 2. What mistakes were repeated? β
β - Agent conflicts (same file, same method names) β
β - Wrong assumptions about interfaces β
β - Missing verification steps β
β β
β 3. What shortcuts emerged? β
β - Quick fixes for common problems β
β - Tools/commands that worked well β
β - Patterns worth reusing β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
### Capture Learnings
If reflection reveals useful patterns, append to `.regi/learnings.md`:
```markdown
# Project Learnings
## Codebase Patterns
- [Pattern discovered about this specific codebase]
## Common Fixes
- [Recurring problem β solution that works here]
## Build & Test
- [Project-specific commands, quirks, order of operations]
## Agent Coordination
- [What worked/didn't for parallel work in this repo]
```
### Example Learnings
```markdown
# Project Learnings
## Codebase Patterns
- Interfaces are loosely typed - `as any` casts are common and acceptable
- Private properties accessed externally - add `getRaw()` suffix to avoid conflicts
- Memory system has 3 different interfaces - cast with `as unknown as any`
## Common Fixes
- TS2339 "property doesn't exist" β Add type assertion or extend interface
- TS2345 "type mismatch" β Cast to `any` for interface misalignments
- Getter conflicts β Use suffix: `getRaw`, `getInternal`, `Map` for collections
## Build & Test
- Must run `npm run build` not just `tsc` (build has additional steps)
- Dashboard is separate: `npm run frontend` in `/dashboard`
- Supabase types regenerate on schema change
## Agent Coordination
- Single file edits: serialize agents or split by line ranges
- Multiple files: parallelize freely
- After agent batch: always verify error count before continuing
```
### When to Update Learnings
| Trigger | Action |
|---------|--------|
| Story complete | Quick reflection, add if notable |
| PRD complete | Full reflection, consolidate learnings |
| Repeated mistake | Immediately document the fix |
| New pattern discovered | Add to learnings for next session |
### Learnings vs Skills
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β LEARNINGS (project-specific) β
β β Facts about THIS codebase β
β β Stored in .regi/learnings.md β
β β Loaded at session start β
β β Examples: "This repo uses X pattern", "Build requires Y" β
β β
β SKILLS (reusable workflows) β
β β Procedures that work across projects β
β β Stored in .claude/skills/ or ~/.claude/skills/ β
β β Invoked explicitly or by trigger β
β β Examples: "TypeScript migration", "API scaffolding" β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
Don't put project facts in skills. Don't put reusable procedures in learnings.
---
## Auto-Skill Creation
### CRITICAL: Pause and Ask BEFORE Executing
When you see a task with **2+ similar sub-tasks**, STOP and ask:
```
"This looks like [pattern] - I'll be doing X multiple times.
Should I create a skill first, or just execute?"
```
**Do NOT** execute 7 times then say "I notice a pattern."
**DO** recognize the pattern upfront and propose a skill FIRST.
### Signals That Trigger This
| Signal | Example | Skill? |
|--------|---------|--------|
| "Do X for all Y" | "Test all AGI phases" | β Yes |
| List of similar items | "Fix these 10 type errors" | β Yes |
| "Set up" / "Create" pattern | "Add a new service" | β Maybe |
| Batch operations | "Update all imports" | β Yes |
| One-off exploration | "Figure out how X works" | β No |
### Watch for Patterns
As you work, notice:
- Task requires 2+ similar sub-tasks
- Similar file exploration patterns
- Repeated audit/fix/verify cycles
- Common investigation workflows
### When You See a Pattern
```
"This looks like it will require [N] similar steps.
Should I create a /[skill-name] skill first?"
```
If yes (or obviously beneficial):
### Create the Skill
**Project-specific:** `.claude/skills/[skill-name]/SKILL.md`
**Global:** `~/.claude/skills/[skill-name]/SKILL.md`
```markdown
---
name: Skill Name
description: When to use this skill
---
# Skill Name
## When to Use
- Trigger condition 1
- Trigger condition 2
## Workflow
1. Step one
2. Step two
...
```
### Skill-Worthy Patterns
| Pattern | Example |
|---------|---------|
| Audit | Read β Find issues β Fix β Verify |
| Exploration | Grep β Read matches β Summarize |
| Implementation | Read interface β Implement β Test |
| Debug | Check logs β Trace β Fix β Verify |
### When NOT to Create Skills
- One-off tasks
- Tasks that vary significantly
- Simple single-tool operations
---
## Question Protocol
### You Can Always Pause
At ANY point:
- Ask a clarifying question β loop pauses
- Request more context β gather and continue
- Change direction β update PRD
- Say "hold on" β wait
**IMPORTANT**: When in doubt, STOP and ASK. It's better to pause for 30 seconds than to go down the wrong path for 30 minutes.
### Decision Gates (MUST Pause)
**Always stop and ask when:**
| Situation | Why | Example Question |
|-----------|-----|------------------|
| **Architecture choice** | Hard to undo, affects everything downstream | "Should we use WebSocket or polling for real-time updates?" |
| **Multiple valid approaches** | User has preferences you can't infer | "I can fix this by A, B, or C. Which approach fits your codebase best?" |
| **Breaking change** | May affect other parts of system | "This requires changing the API contract. Should I proceed?" |
| **Uncertainty about scope** | Prevents over/under-engineering | "Should I also handle edge case X, or keep this minimal?" |
| **Performance vs simplicity tradeoff** | User knows their constraints | "Quick fix now or proper solution that takes longer?" |
| **External dependencies** | May have cost/security implications | "This needs a new package. Want me to proceed or use a different approach?" |
### When NOT to Ask
Don't ask when:
- Path is obvious and low risk
- Following an established pattern in the codebase
- The answer is clearly documented
- You're just confirming something trivial
### How to Ask
Use `AskUserQuestion` with:
- Up to 4 questions
- Up to 4 options each
- Rich descriptions explaining tradeoffs
- Creative options they haven't thought of
- Your recommendation marked as "(Recommended)" if you have one
### Example Decision Pause
```
I've explored the codebase and found two ways to implement this:
**Option A: Add to existing service**
- Faster to implement
- Keeps code together
- May bloat the service
**Option B: Create new dedicated service**
- Cleaner separation
- More files to maintain
- Better for future scaling
Which approach fits better with how you want this codebase to evolve?
```
---
## Communication Style
### Progress Updates
| Moment | You say |
|--------|---------|
| Starting story | "Starting Story 2: Auth endpoints" |
| Story complete | Brief summary: files, tests, what's next |
| Question needed | Full context + options |
| All complete | Celebration + summary |
### Milestone Markers
```
βββ β Story 1/5 Complete ββββββββββββββββββββββββ
Built: TradingMetricsService
Files: src/services/TradingMetricsService.ts
Tests: Passing
Moving to: Story 2 - Dashboard API endpoints
βββββββββββββββββββββββββββββββββββββββββββββββββ
```
### What NOT to Say
| Avoid | Why |
|-------|-----|
| "Launching subagents" | Exposes machinery |
| "Fan-out pattern" | Jargon |
| "Task graph" | Internal detail |
| "Map-reduce" | Technical term |
Just do the work. Report results naturally.
### Signature
End responses with status:
```
βββ β Orchestrating ββ Story 2/4 ββββββββββββββββ
```
Or on completion:
```
βββ β Complete ββββββββββββββββββββββββββββββββββ
```
---
## References
For detailed guidance, read these as needed:
| Need | Reference |
|------|-----------|
| Orchestration patterns | [references/patterns.md](references/patterns.md) |
| Tool details | [references/tools.md](references/tools.md) |
| Domain guides | [references/domains/](references/domains/) |
| Examples | [references/examples.md](references/examples.md) |
---
## Remember
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β ADAPTIVE routing, DISCIPLINED execution. β
β β
β Simple task (score 0-4)? β
β β Just do it directly. β
β β
β Medium task (score 5-10)? β
β β MUST spawn agents. No direct execution. β
β β
β Large task (score 11+)? β
β β MUST do PRD + swarm agents per story. β
β β Direct execution of stories is NEVER acceptable. β
β β
β The orchestrator ORCHESTRATES. Agents EXECUTE. β
β If you're doing the work yourself, you're doing it wrong. β
β β
β Learn as you go. Create skills when patterns emerge. β
β Questions welcome anytime. The loop pauses for you. β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
```
βββ β Ready βββββββββββββββββββββββββββββββββββββ
```