@orchestrator-claude/definitions 3.30.1 → 3.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/agents/adversarial-reviewer.md +217 -0
  2. package/agents/azure-devops-engineer.md +805 -0
  3. package/agents/methodology-researcher.md +190 -0
  4. package/agents/operational-artifact-builder.md +173 -0
  5. package/agents/presentation-engineer.md +605 -0
  6. package/dist/scripts/generate-manifest.js +3 -3
  7. package/dist/scripts/generate-manifest.js.map +1 -1
  8. package/hooks/mailbox-listener.ts +246 -0
  9. package/hooks/pre-agent-dispatch.ts +57 -0
  10. package/hooks/sprint-registry.ts +85 -0
  11. package/hooks/verification-before-completion.ts +97 -0
  12. package/manifest.json +276 -3
  13. package/package.json +1 -1
  14. package/skills/artifact-generator/SKILL.md +385 -0
  15. package/skills/brainstorm-formalize/SKILL.md +272 -0
  16. package/skills/brainstorming/SKILL.md +167 -0
  17. package/skills/brainstorming/scripts/frame-template.html +214 -0
  18. package/skills/brainstorming/scripts/helper.js +88 -0
  19. package/skills/brainstorming/scripts/server.cjs +354 -0
  20. package/skills/brainstorming/scripts/start-server.sh +148 -0
  21. package/skills/brainstorming/scripts/stop-server.sh +56 -0
  22. package/skills/brainstorming/visual-companion.md +139 -0
  23. package/skills/compositional-intelligence/SKILL.md +93 -0
  24. package/skills/design-system-validated-loop/SKILL.md +366 -0
  25. package/skills/finishing-branch/SKILL.md +184 -0
  26. package/skills/orchestrator/SKILL.md +141 -0
  27. package/skills/persona-library/SKILL.md +365 -0
  28. package/skills/project-management-enterprise/SKILL.md +304 -0
  29. package/skills/receiving-code-review/SKILL.md +186 -0
  30. package/skills/sprint-launch/SKILL.md +176 -0
  31. package/skills/sprint-teammate/sprint-teammate.md +107 -0
  32. package/skills/systematic-debugging/SKILL.md +262 -0
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: compositional-intelligence
3
+ description: Routing decisions + plugin coexistence protocol. Load when [CAPABILITY-MATRIX] routing hints are insufficient for a dispatch decision, or when plugin vs sub-agent choice is ambiguous.
4
+ ---
5
+
6
+ # Compositional Intelligence — Routing & Coexistence
7
+
8
+ ## Routing Table (defaults — overridden by [CAPABILITY-MATRIX] routing hints)
9
+
10
+ | Activity | Primary | Fallback |
11
+ |----------|---------|----------|
12
+ | Exploratory design | brainstorming (native skill) | Main inline |
13
+ | Codebase analysis | feature-dev:code-explorer | researcher sub-agent |
14
+ | Formal spec | specifier sub-agent | Main inline |
15
+ | Sprint plan | planner sub-agent | Main inline |
16
+ | Task decomposition | task-generator sub-agent | Main inline |
17
+ | Code review | reviewer sub-agent | feature-dev:code-reviewer |
18
+ | PR review (parallel) | code-review command | coderabbit:review |
19
+ | PR review (autofix) | coderabbit:autofix | Manual |
20
+ | Implementation | implementer sub-agent | N/A |
21
+ | Technical research | researcher sub-agent | perplexity MCP |
22
+ | Debug | systematic-debugging (native skill) | Main inline |
23
+
24
+ ## Decision Criteria
25
+
26
+ 1. **Delegation > Inline** — preserve Main context window
27
+ 2. **Sub-agent > Plugin agent** — sub-agents respect gates, use MCP, store artifacts
28
+ 3. **Plugin for read-only analysis** — no side-effects (no advancePhase, no artifactStore)
29
+ 4. **Opus (Main) only for heavy intellectual work** — brainstorm, architectural decisions
30
+ 5. **Vault tier < 2 → simplify** — fewer phases, less ceremony
31
+ 6. **Plugin not installed → automatic fallback** — use the fallback column
32
+
33
+ ## Plugin Decision Matrix
34
+
35
+ When multiple plugins could handle a task, use these rules:
36
+
37
+ ### 1. Code Review
38
+ - General quality/bugs → `pr-review-toolkit` (6 specialized agents: types, comments, silent-failures, tests, simplification, code-review)
39
+ - Fix PR comments → `coderabbit:autofix` (unique automated fix workflow)
40
+ - Full PR review for GitHub → `code-review` command (5-parallel-agent, confidence scoring, posts comments)
41
+ - During workflow review phase → native `reviewer` agent (governance + artifact validation)
42
+
43
+ ### 2. Symbol Navigation
44
+ - Local file/symbol → `serena` (LSP, precise, semantic)
45
+ - Cross-repo or pattern search → `sourcegraph` (broad, enterprise)
46
+
47
+ ### 3. Documentation
48
+ - External library (React, Prisma, etc.) → `context7` (upstream, version-specific)
49
+ - Project conventions/architecture → `/kb-lookup` (vault KB)
50
+
51
+ ### 4. Creating Extensions
52
+ - New plugin/skill/agent → `plugin-dev` (structure + creation, 7 skills + 3 agents)
53
+ - Eval/benchmark existing skill → `skill-creator` (metrics, triggering optimization)
54
+ - Interactive hook from conversation → `hookify` (conversation analyzer)
55
+ - Programmatic hook → native `.claude/hooks/` (TypeScript, DI pattern)
56
+
57
+ ### 5. Design/Planning
58
+ - Explore what to build → `brainstorming` (native skill)
59
+ - How to execute → `/orchestrator` workflow
60
+ - NEVER follow writing-plans or executing-plans pipelines
61
+
62
+ ### 6. Web/Research
63
+ - Web scraping/crawling → `firecrawl` (LLM-optimized output)
64
+ - Technical research → `perplexity` MCP
65
+ - Library docs → `context7`
66
+
67
+ ## Coexistence Protocol
68
+
69
+ ### Rule 1 — Plugins DO NOT pass through gates
70
+ Plugin agents execute and terminate. They do not call `advancePhase`, do not store artifacts in MinIO, do not create checkpoints. For gate-aware tasks, always use built-in sub-agents.
71
+
72
+ ### Rule 2 — Plugins for read-only analysis
73
+ Plugin output is INPUT for a sub-agent, not a final artifact:
74
+ - `feature-dev:code-explorer` → explore codebase (input for specifier)
75
+ - `feature-dev:code-architect` → blueprints (input for planner)
76
+ - `coderabbit:review` → PR review (complements reviewer)
77
+
78
+ ### Rule 3 — Native Skills at Level 1 (Behavioral Disciplines)
79
+ Native behavioral skills operate at the strategic level:
80
+ - `brainstorming` → design exploration (terminal state: `/orchestrator`)
81
+ - `systematic-debugging` → root cause investigation (loaded in implementer via frontmatter)
82
+ - `receiving-code-review` → technical rigor for review feedback (loaded in reviewer via frontmatter)
83
+ - `finishing-branch` → branch completion guide (invoked at `completeWorkflow`)
84
+ - `verification-before-completion` → PreToolUse hook (evidence before git commit/push)
85
+ - `tdd-discipline` → TDD protocol (loaded in implementer via frontmatter)
86
+
87
+ ### Rule 4 — Gap Detection
88
+ Hook detects installed plugins vs stack profile. Missing `core` = warning in greeting. Missing `recommended` = suggestion. The user decides whether to install.
89
+
90
+ ## When to Load This Skill
91
+ - On first dispatch decision of the session IF [CAPABILITY-MATRIX] routing hints are unclear
92
+ - When plugin vs sub-agent choice is ambiguous (e.g., two plugins both do code review)
93
+ - DO NOT load for every dispatch — routing hints in [CAPABILITY-MATRIX] suffice for standard decisions
@@ -0,0 +1,366 @@
1
+ ---
2
+ name: design-system-validated-loop
3
+ description: Use BEFORE writing markdown patches in design-system docs that drive LLM-rendered UI (Bolt, v0, Lovable, Cursor design rules, Replit Agent). Triggers on "design system patch", "responsive change", "Bolt sync", "v0 update", "high-fidelity screen", "design-system markdown", or any rendering-decision change (layout, palette, spacing, density, hierarchy). Provides 6-step canary-validated loop optimizing token economy + audit trail + design quality. Skip for typo fixes or namespace renames.
4
+ ---
5
+
6
+ # Design-System Validated Loop (DSVL)
7
+
8
+ Empirically validated process for evolving markdown design-systems consumed by downstream LLM tools (Bolt/v0/Lovable/Cursor/Replit). Canonical reference: `project-guidelines/processes/design-system-validated-loop.md` (354L). Empirical base: **5 consecutive applications** (S163b 11/11 PASS · S164 ~98% single-shot · S165 15/15 PASS · S166 18/19 PASS single-shot · S167 18/18 PASS post-route-around-Bolt). Production-ready for Bolt + TRC + design-system-v5; universal generalization still requires application in a distinct LLM tool + tier + non-pt-BR i18n.
9
+
10
+ ## When to use
11
+
12
+ USE when:
13
+ - Design-system markdown drives downstream LLM-rendered UI
14
+ - Change involves rendering decisions: layout, responsive, palette, spacing, density rhythm, hierarchy
15
+ - Downstream tool charges tokens per render (Bolt $0.x/k, v0 credits, etc.)
16
+ - Multiple iteration expected (design-sensitive work never lands first try)
17
+
18
+ DO NOT use when:
19
+ - Text-only spec changes without rendering implications
20
+ - Namespace fixes (token rename, link cross-doc) — referential integrity (substituto #5) covers
21
+ - One-off prototypes (canary overhead > value)
22
+ - Spec exploration phase (DSVL is for evolution, not creation from scratch)
23
+
24
+ ## Mandatory enforcement (S165 lesson)
25
+
26
+ T-001 = canary HTML creation. **NOT optional, NOT post-Bolt recovery.** Per `feedback_dsvl_canary_must_be_t001_not_optional`:
27
+ - specifier MUST list canary as ARTIFACT REQUIRED in spec.md (skip requires explicit justification)
28
+ - planner MUST cover all 6 etapas in plan.md (skip requires explicit justification)
29
+ - task-generator MUST emit T-001 as canary creation with gate
30
+ - reviewer MUST audit DSVL conformance, not only the final artifact
31
+
32
+ If working a feature_development workflow where DSVL applies and T-001 is not canary, **stop and fix the workflow** before implementing.
33
+
34
+ ## The 6 etapas (with Etapa 2.5 — added in v2 post-S166)
35
+
36
+ ```
37
+ [LOCAL, zero downstream tokens] [REMOTE, billing tokens]
38
+ ┌─────────────────────────────────────┐ ┌──────────────────────────────────┐
39
+ │ 1. Canary HTML preview │ │ 2.5. Storybook validation │
40
+ │ 2. Markdown patches + 7 substitutos │ │ (post-push, parallel ingest, │
41
+ │ 3. Push design-system repo (HUMAN) │ ─→ │ Bolt-hosted, free, NEW S166) │
42
+ │ │ │ 4. Bolt/v0/Lovable re-ingest + │
43
+ │ │ │ re-render + publish │
44
+ │ │ │ 5. Playwright autonomous validate│
45
+ │ │ │ 6. Session closure (memorias + │
46
+ │ │ │ BACKLOG + commit) │
47
+ └─────────────────────────────────────┘ └──────────────────────────────────┘
48
+ ```
49
+
50
+ ### Etapa 1 — Canary HTML preview (LOCAL)
51
+
52
+ **What:** Self-contained HTML rendering N viewports stacked with the same container queries / tokens / layouts that will become markdown patches.
53
+
54
+ **Where:** consumer-project repo, NOT design-system repo. TRC convention: `~/desenvolvimento/trc/trc-platform/docs/assets/preview/[tela]-v[N]-preview.html`.
55
+
56
+ **Properties:**
57
+ - Single file, vanilla CSS, zero deps, zero build
58
+ - Identical content to prior remote render for direct comparison
59
+ - Viewport widths fixed via attribute selectors or inline style
60
+ - Real container queries
61
+ - Toggleable patch debug overlays (`<body class="show-tags">`)
62
+
63
+ **Gate 1:** human visually validates N viewports. PASS → Etapa 2. FAIL → orchestrator iterates local CSS until PASS (zero token cost).
64
+
65
+ ### Etapa 2 — Markdown patches + pre-push verification
66
+
67
+ **What:** translate validated canary CSS into prescriptive markdown in design-system files.
68
+
69
+ **Prescriptive pattern (proven empirically S162→S163):**
70
+ - Intent-driven naming (`--column-decision`, NOT `--max-w-720`)
71
+ - Concept × forbidden × required-substitute tables for anti-patterns (positive-prescriptive > negative-generic for LLM-ingest)
72
+ - Audit-trail line at top of each section: "Validated via canary [path] section [N]"
73
+ - Specific px/rem values, NOT "subtle" or "comfortable"
74
+ - Inline "Why" for threshold rules
75
+
76
+ **9 substitutos verification (ALL mandatory; #8 + #9 added post-S167):**
77
+
78
+ | # | Check | How |
79
+ |---|---|---|
80
+ | 1 | Completeness | N patches written per declared scope |
81
+ | 2 | Consistency | Terminology consistent cross-files |
82
+ | 3 | Integrity | Code-fences paired (`grep -c '^\`\`\`'` returns even per file) |
83
+ | 4 | Mapping documented | Each patch maps explicitly to canary section |
84
+ | 5 | Referential integrity | `grep -hoE 'var\(--[a-z-]+\)'` cross-checked vs tokens.md `:root {}` block (NOT just markdown tables — S166 caught typography gap here; S167 caught broken token chain `--pivot-hover-bg` aliased to undefined `--hover-overlay-light`) |
85
+ | 6 | Visual smoke test post-render | Etapa 5 — covers structure + rendering + density rhythm + audience-fit (4 layers, S163b v3) |
86
+ | 7 | Visual decision pre-validation | Canary HTML approved at Gate 1 |
87
+ | 8 | **Sort order verification (NEW post-S167)** | `grep -nE '\.sort\(\)' [files]` em prompt/spec. Para keys com semantic order (months, weekdays, status sequence, priority), `.sort()` default JS e lexicografico — REQUER comparator explicito (e.g., `.sort((a,b) => MONTHS.indexOf(a) - MONTHS.indexOf(b))`) ou keys lex-friendly (zero-padded/ISO). Output PASS/FAIL binario. ROI: 30s grep evita ~50k tokens recovery + delay sessao. Generalizable beyond DSVL para qualquer LLM-codegen com time/enum-keyed strings (Bolt/v0/Lovable/Cursor/Replit). Per `dsvl_substituto_8_spec_sort_order_verification` (S167). |
88
+ | 9 | **Route-around-Bolt for trivial fixes (NEW post-S167)** | Para fixes triviais post-G3 (CSS, 1-line JS, token chain repairs, sub-rounds DSVL onde score esta perto do target): dispatchar implementer para fix DIRETO no consumer-project repo + push GitHub + **F5 manual no Bolt UI** = sync gratis. Economia empirica S167: ~500k-1M tokens vs full Bolt re-render. NAO usar para refactor estrutural, mudancas que requerem Bolt AI, adicao de funcionalidade, codigo do design-system (mecanismo ingest diferente). Ver Etapa 6.5 detalhada. Per `dsvl_route_around_bolt_for_trivial_fixes` (S167). |
89
+
90
+ **Gate 2:** all 9 substitutos PASS (or N/A justified). Bug catched here (undefined token, sort order trap, etc.) is fixed before push, preventing broken downstream render.
91
+
92
+ **Note:** Storybook visual confirmation is NOT a substituto — it is **Etapa 2.5** (a separate phase, post-push, free Bolt-hosted). Earlier numbering in v1 conflated them; v2 separates clearly.
93
+
94
+ ### Etapa 2.5 — Storybook validation (NEW v2, post-S166)
95
+
96
+ **What:** post-push, paralelo a re-ingest (Etapa 4), Bolt auto-builda Storybook revision tied to design-system commit. Use Playwright para validar specs INDEPENDENTEMENTE de canary local + ANTES de queimar tokens em Bolt re-render. Disambigua "spec bug" de "Bolt codegen bug" antes de Etapa 5.
97
+
98
+ **URL pattern (Bolt-hosted):** `https://bolt.new/api/design-systems/{id}/revisions/{revId}/storybook-build/?path=/docs/{kebab-component}--docs&_t={auth-token}`
99
+
100
+ **O que Storybook valida:**
101
+ - Wrapper anatomy (header + body + footer) + spacing/padding/radius/shadow
102
+ - Props TypeScript signature derivada do markdown (variants, types, optional)
103
+ - Tokens var() resolvidos (--badge-*, --chart-*, --status-*, --text-*)
104
+ - Auto-generated interactive controls (sliders/dropdowns/booleans dos props)
105
+ - Sub-stories auto-extracted (e.g., variant=bar/line/stacked/alerts → 4 stories individuais)
106
+
107
+ **O que Storybook NAO valida (vai para Etapa 5):**
108
+ - Charts SVG real (children prop = placeholder no Storybook)
109
+ - List rendering com mock data real
110
+ - Composition cross-component (Card 3 + 5 FoundryPatternBadges inline)
111
+ - Layout grid em viewport breakpoints
112
+ - Click handlers, hover states, deep-links
113
+ - Console errors, BrowserRouter F5 SPA routing
114
+
115
+ **Disambiguation power:**
116
+ - Storybook PASS + Bolt deploy FAIL → Bolt codegen bug (LLM mistraduce spec)
117
+ - Storybook FAIL + Bolt deploy FAIL → spec markdown ambiguo/inconsistente
118
+ - Storybook PASS + Bolt deploy PASS → spec + codegen ambos corretos (case S166: 18/19 AC)
119
+
120
+ **Operational caveats (auth):**
121
+ - URL token `_t=` expira em ~minutos. Automation autonoma orchestrator NAO pode cachear nem agendar
122
+ - **Cenario A (S166 validated):** Playwright headed mode, CMAC loga em Bolt no Playwright browser, navega para Storybook, orchestrator usa browser_* tools com session auth persistente
123
+ - **Cenario B fallback:** CMAC copia URL com token fresh do browser pessoal e cola para orchestrator navegar dentro de ~30s window
124
+ - **Cenario C theoretical:** storage_state JSON com cookies Bolt — mais setup mas persistente cross-sessao
125
+
126
+ **Wall-clock:** ~5-10min para 2-3 components novos. Cost: 0 tokens (Bolt auto-builds Storybook free).
127
+
128
+ **Gate 2.5:** Storybook PASS (components docs renderizam, sub-stories funcionam, tokens resolvidos, interactive controls ok) → continua Etapa 3 push (or Etapa 4 if push ja feito). FAIL → forward-fix patches + re-validar.
129
+
130
+ **Generalization:** Bolt-hosted only validated empirically. Outros LLM codegen tools podem ter equivalentes:
131
+ - v0 (Vercel): preview deployments tied to PR (similar pattern provavel)
132
+ - Lovable: a verificar empirico
133
+ - Cursor design rules: NAO tem preview equivalente nativo (gap real)
134
+ - Replit: a verificar
135
+ - Standalone: design-system com CI/CD Storybook deploy (Vercel/Netlify/Chromatic auto)
136
+
137
+ **Per memoria evidence:** `feedback_storybook_dsvl_etapa_2_5_validates_spec_not_composition` (S166 NEW).
138
+
139
+ ### Etapa 3 — Push design-system repo (HUMAN executes)
140
+
141
+ Push to design-system repo is HUMAN action. Orchestrator NEVER pushes external repos (Universal Invariant #1).
142
+
143
+ Commit message format:
144
+ ```
145
+ feat(vN): [round] [scope-summary] (sessionID)
146
+
147
+ P_M [file] [type: NEW/REFINE/EXTEND]: [short description]
148
+ P_M+1 ...
149
+
150
+ Validated via canary HTML preview pre-push (substituto #7).
151
+ Catches: [bugs catched in substituto #5 etc].
152
+
153
+ Co-Authored-By: Claude (orchestrator) <noreply@anthropic.com>
154
+ ```
155
+
156
+ ### Etapa 4 — Human syncs Bolt + prompts + publishes
157
+
158
+ Manual SaaS operation by human:
159
+ 1. Tool re-ingest auto-detected (~12min Bolt for ~1.4kL design-system, 0 tokens billing)
160
+ 2. Human prompts re-render (~2k tokens Bolt per complex screen)
161
+ 3. Tool publishes new version
162
+
163
+ **Critical caveats (empirically catched):**
164
+ - **Bolt re-ingest is ADDITIVE, not destructive** — patches that REMOVE/REPLACE existing rendered code DO NOT regenerate. Force removal via explicit prompt: "remove X" / "regenerate from scratch using latest specs". Per `feedback_bolt_reingest_additive_not_destructive`.
165
+ - **Bolt deploy ≠ Bolt-state** — `git push` triggers source sync (~30s) but NOT deploy. Human must click Publish in Bolt UI (~1-2min Vite build). Per `feedback_bolt_deploy_requires_manual_publish_after_git_sync`.
166
+ - **Bolt GitHub sync is ASYMMETRIC (S167 discovered)** — push (Bolt → GitHub) auto on Bolt-side changes; pull (GitHub → Bolt) NAO e auto for `trc-platform-app` consumer-project code — **requires F5 manual in Bolt UI** to trigger lazy sync. Vite re-build subsequente serves new code (~30s). DIFFERENT from design-system repo which has bidirectional auto ~12min. Implication: any flow that pushes consumer-project code (Etapa 6.5 route-around-Bolt, external commits) DEPENDS on human F5; silent failure if forgotten (deploy serves old build). Per `bolt_github_pull_requires_f5_refresh_to_resync`.
167
+ - **Bolt rollback loses forward versions** — operates as `git reset --hard`, not `git revert`. NEVER rollback without (a) git push backup branch + (b) Bolt UI Export ZIP. Per `feedback_bolt_rollback_loses_forward_versions`.
168
+ - **Bolt deploy URL changes when re-publish** — human provides updated URL.
169
+
170
+ ### Etapa 5 — Playwright autonomous validation
171
+
172
+ Orchestrator validates published render independently:
173
+
174
+ ```
175
+ 1. mcp__plugin_playwright_playwright__browser_navigate(url)
176
+ 2. For each viewport [1920, 768, 412]:
177
+ a. browser_resize(width=N, height=...)
178
+ b. browser_take_screenshot(fullPage=true, filename=`r[N]-[viewport].png`)
179
+ 3. browser_close()
180
+ 4. Cross-check screenshots vs pre-defined R-N criteria
181
+ 5. Output: PASS/PARTIAL/FAIL table with root-cause analysis per FAIL
182
+ ```
183
+
184
+ **Gate 3:** complete PASS (all R-criteria PASS) → continue Etapa 6. PARTIAL/FAIL → branch decision: trivial fix (CSS/1-line JS/token repair) → **Etapa 6.5 route-around-Bolt** (cheap). Structural refactor, new functionality, design-system code → second round full Bolt re-render (Etapa 4 → 5 again, expensive).
185
+
186
+ ### Etapa 6.5 — Route-around-Bolt for trivial post-G3 fixes (NEW post-S167)
187
+
188
+ **When:** Gate 3 returns PARTIAL/FAIL with score close to target AND the failures are trivial (CSS one-liners, 1-line JS fixes, token chain repairs, sort comparator additions, hover state tweaks).
189
+
190
+ **Why:** Full Bolt re-render costs ~500k-1M tokens for a complex screen. A 2-line CSS fix does not justify that spend. Edit the consumer-project repo directly + push + F5 in Bolt UI → free sync.
191
+
192
+ **Flow (S167 empirical, validated):**
193
+ 1. **Diagnose** — orchestrator pinpoints the offending file/line in the consumer-project repo (e.g., `trc-platform-app/src/components/X.tsx` or `src/styles/Y.css`).
194
+ 2. **Dispatch implementer** with surgical scope: file path, line range, exact change. NO refactor, NO new features. Implementer writes a focused commit.
195
+ 3. **Push to GitHub** — implementer pushes to consumer-project main (or hotfix branch). Skip if push permission requires human authorization.
196
+ 4. **HUMAN F5 in Bolt UI** — orchestrator MUST explicitly remind the human: "Please F5 the Bolt UI now to trigger lazy GitHub pull. Vite will re-build (~30s)." Failure to F5 = silent stale-build failure.
197
+ 5. **Re-validate Etapa 5** — Playwright re-runs failing R-criteria only, not full screen.
198
+ 6. **Update Gate 3 status** — PARTIAL becomes PASS or escalates.
199
+
200
+ **DO use for:**
201
+ - CSS triviais (color, spacing, hover states)
202
+ - 1-line JS bug fixes (sort comparator, conditional check)
203
+ - Token chain repairs (e.g., `--pivot-hover-bg` aliased to wrong token)
204
+ - Sub-rounds DSVL where final score is just shy of target
205
+
206
+ **DO NOT use for:**
207
+ - Structural refactors (component re-architecture)
208
+ - New functionality (new components, new routes, new flows)
209
+ - Changes that require Bolt AI re-reasoning (e.g., layout strategy shift)
210
+ - Code in the design-system repo (different ingest mechanism, ~12min bidirectional auto-sync — use Etapa 4 normal flow)
211
+
212
+ **Risk residual:** F5 is a human-action point of failure. Orchestrator MUST emit an explicit F5 reminder; ideally as an `AskUserQuestion` confirmation step before re-validating.
213
+
214
+ **Token economy S167:** 2 commits (8f4dad0 + ab8858a) on `trc-platform-app` repaired AC-02 (sort) + AC-03 (hover token) → **~500k-1M Bolt tokens preserved** vs. full re-render. Wall-clock: ~5min implementer + 30s Vite build + ~30s Playwright re-validation = ~7min total vs. ~15-20min Bolt full re-render path.
215
+
216
+ Per `dsvl_route_around_bolt_for_trivial_fixes` (S167) and `bolt_github_pull_requires_f5_refresh_to_resync` (S167).
217
+
218
+ ### Etapa 6 — Session closure (orchestrator self-driven)
219
+
220
+ 1. Create memorias for session learnings (type=feedback, frontmatter complete with claude_session + orchestrator_session)
221
+ 2. Update `memory-index.yaml` (project override; NOT MEMORY.md which is read-only legacy per RFC-027 Sprint 3)
222
+ 3. Update `BACKLOG.md` (bump version, update last_session, add closure paragraph, update tech-debt counters)
223
+ 4. Commit orchestrator repo (do NOT push — human authorizes separately)
224
+
225
+ **Gate 4:** working tree clean, memorias indexed, BACKLOG up-to-date, commit pending for human push.
226
+
227
+ ## Token economics
228
+
229
+ | Etapa | Wall-clock | Downstream tokens | Frequency |
230
+ |---|---|---|---|
231
+ | 1. Canary | ~10min initial + ~10s/iter | 0 | 1× (iters until PASS) |
232
+ | 2. Markdown patches | ~5-10min | 0 | 1× |
233
+ | 2.5. Storybook validate | ~5-10min | 0 (Bolt-hosted free) | 1× post-push |
234
+ | 3. Push design-system | ~30s | 0 | 1× |
235
+ | 4. Bolt re-ingest | ~12min | 0 (free) | 1× |
236
+ | 4. Bolt re-render | ~30s | see capacity table below | 1× / screen |
237
+ | 5. Playwright validate | ~30s | 0 | 1× |
238
+ | 6.5. Route-around-Bolt fix | ~7min (if triggered) | 0 (Bolt) + ~5k Claude implementer | optional, post-G3 trivial |
239
+ | 6. Closure | ~5min | 0 | 1× |
240
+
241
+ ### Bolt token capacity per screen (empirically refined S164→S167)
242
+
243
+ | Screen complexity | Bolt tokens / render | Empirical sample | Plan Team 10M/month |
244
+ |---|---|---|---|
245
+ | **Simple** (<3 new components, no new tokens, reuse layout A/B/C) | ~700k | S163b, S165 | ~14 screens/month |
246
+ | **Complex** (multiple new components OR new tokens OR new layout) | ~900k | S164, S166 | ~11 screens/month |
247
+ | **Novel pattern** (external lib like TanStack Table v8 + new layout + many new tokens + new stories) | ~2M | S167 (pivot cross-tab) | ~5 screens/month |
248
+ | Pristine project (1st screen) | ~500k | S162 outlier | n/a |
249
+ | Incremental design-system fix | ~3k | S163b mid-fix | n/a |
250
+
251
+ **Capacity planning rule of thumb (TRC Phase 1 Plan Team 10M/month):** mix profile 14 simple / 11 complex / 5 novel = ceiling. Overrun → request token bump or split screens across months. Per `feedback_bolt_tokens_per_screen_context_dependent` + S167 update with novel-pattern tier.
252
+
253
+ **Total wall-clock per screen:** ~30-45min (simple) up to ~60-90min (novel pattern with route-around-Bolt sub-round).
254
+
255
+ **Break-even vs naive flow:** ~2 issues. Above 2 issues, DSVL saves materially.
256
+ - S163b: 3 issues catched in canary = ~6-12k Bolt tokens saved.
257
+ - S164 + S165: single-shot ≥98% / 15-15 PASS confirmed canary catches issues that would cost render iterations.
258
+ - S167: 2 PARTIAL post-G3 routed via Etapa 6.5 = ~500k-1M Bolt tokens preserved vs. full re-render.
259
+
260
+ ## Roles
261
+
262
+ | Role | Responsibilities | Restrictions |
263
+ |---|---|---|
264
+ | Orchestrator | Canary write/iterate, markdown patches, pre-push verify, Playwright validate, closure (memorias + BACKLOG + local commit) | NO push external repos; NO prompt Bolt; NO unilateral palette/aesthetic decisions |
265
+ | Human (CMAC) | Canary visual approval (Gate 1), push authorization (Gate 2 confirm + execute), Bolt sync prompt (Etapa 4), strategic audience-fit decisions | n/a — product owner + brand decisions |
266
+ | Bolt/v0/Lovable | Ingest design-system markdown, render UI per spec, publish | NO self-validation; NO regeneration of existing code in re-ingest (additive caveat) |
267
+
268
+ ## Routing inside orchestrator workflow
269
+
270
+ When dispatching a feature_development workflow that triggers this skill:
271
+
272
+ | Phase | DSVL alignment |
273
+ |---|---|
274
+ | specifier | spec.md MUST list canary HTML as REQUIRED artifact (Etapa 1 deliverable). Justify if skipped. Sort-keyed semantic data MUST list comparator strategy upfront (substituto #8 prevention). |
275
+ | planner | plan.md MUST address all 6 etapas (+ Etapa 2.5 if Bolt-hosted Storybook applies, + Etapa 6.5 fallback for trivial post-G3 fixes) explicitly. Justify if any skipped. |
276
+ | task-generator | T-001 = canary HTML creation with explicit gate. NEVER optional. T-N (pre-push gate task) MUST run all 9 substitutos including #8 grep `.sort()` and #9 route-around-Bolt readiness check. |
277
+ | implementer | Iterates Etapa 1 (canary CSS) until Gate 1 PASS, then Etapa 2 markdown patches with substituto #1-#5 + #8 self-check. Substitutos #6-#7 covered by Gate 1. Substituto #9 only invoked post-G3. |
278
+ | reviewer | Audits BOTH artifact correctness AND DSVL conformance per etapa. Flag missing canary, missing substituto runs (including #8 sort verification), missing audit-trail lines, missing Etapa 2.5 Storybook validation when Bolt-hosted Storybook applies. |
279
+
280
+ If workflow violates this contract, escalate to orchestrator (you) — recovery via secondary workflow costs ~80k tokens + ~7min wall-clock (S165 empirical). Prevention >> recovery.
281
+
282
+ ## Pair with frontend-design skill
283
+
284
+ For markdown patches in responsive / aesthetic-sensitive work, invoke `frontend-design:frontend-design` skill explicitly. Default orchestrator heuristics drift toward "Tailwind generic defaults" (Inter universal, purple gradients, neumorphism) — exactly the AI-aesthetic anti-pattern DSVL prevents. Skill load ~5-30s avoids ~1h rework. Per `feedback_frontend_design_skill_for_responsive_work`.
285
+
286
+ ## Canary HTML skeleton
287
+
288
+ ```html
289
+ <!DOCTYPE html>
290
+ <html lang="pt-BR">
291
+ <head>
292
+ <meta charset="UTF-8">
293
+ <title>[Tela] vN canary preview</title>
294
+ <style>
295
+ /* design-system tokens copied verbatim from tokens.md */
296
+ :root { --column-decision: 720px; /* etc */ }
297
+ body { margin: 0; background: #FAFAF9; font-family: 'Inter Tight', system-ui; }
298
+ .viewport-frame { margin: 24px auto; border: 1px solid #ccc; resize: horizontal; overflow: auto; }
299
+ .viewport-frame[data-w="1920"] { width: 1920px; }
300
+ .viewport-frame[data-w="768"] { width: 768px; }
301
+ .viewport-frame[data-w="412"] { width: 412px; }
302
+ body.show-tags .patch-region { outline: 2px dashed magenta; }
303
+ /* component CSS — IDENTICAL to what will go into markdown patches */
304
+ </style>
305
+ </head>
306
+ <body>
307
+ <div class="viewport-frame" data-w="1920"><!-- desktop render --></div>
308
+ <div class="viewport-frame" data-w="768"><!-- tablet render --></div>
309
+ <div class="viewport-frame" data-w="412"><!-- mobile render --></div>
310
+ </body>
311
+ </html>
312
+ ```
313
+
314
+ ## Generalization caveats
315
+
316
+ 5 applications all share: same project (TRC) + same tool (Bolt) + same design-system tier (v5) + same i18n (pt-BR). **Generalization to v0/Lovable/Cursor/Replit requires ≥1 empirical application in a distinct tool before declaring universal pattern.** Young design-systems (<5 components) may behave differently. Apply skill faithfully but treat tool-specific caveats as Bolt-anchored until empirically validated elsewhere.
317
+
318
+ **Sub-patterns with stronger universal claim (validated reasoning, NOT cross-tool empirical):**
319
+ - Substituto #8 sort order — applies to any LLM-codegen tool that translates spec markdown to JS sort logic. Lexicographic-default trap is JS-language behavior, not Bolt-specific.
320
+ - Etapa 1 canary HTML — applies to any LLM-rendered UI tool. Local visual gate is tool-agnostic by design.
321
+
322
+ **Sub-patterns Bolt-anchored (require re-validation per tool):**
323
+ - Etapa 2.5 Storybook (Bolt-hosted Storybook URL pattern is Bolt-specific; equivalents in v0 / Lovable / Cursor / Replit unknown)
324
+ - Etapa 6.5 route-around-Bolt (sync mechanism is Bolt-specific; F5 manual step is Bolt UI-specific)
325
+ - Capacity baselines (700k/900k/2M token tiers are Bolt-billing-specific)
326
+
327
+ ## Evidence base (memorias)
328
+
329
+ **Foundation (S163-S165):**
330
+ - `feedback_html_canary_preview_before_remote_design_render` — Pattern principal Etapa 1 (S163b origin)
331
+ - `feedback_dsvl_2nd_application_98pct_single_shot` — S164 KPICard ~98% single-shot validation
332
+ - `feedback_dsvl_3rd_application_skill_conversion_ready` — S165 Drilldown 15/15 PASS, gate ≥3 met
333
+ - `feedback_dsvl_canary_must_be_t001_not_optional` — S165 methodology violation + recovery, T-001 enforcement
334
+ - `feedback_smoke_test_must_include_visual_rhythm_not_just_structure` — Substituto #6 v3 (4 layers)
335
+
336
+ **Skill conversion (S166):**
337
+ - `feedback_dsvl_skill_conversion_executed` — S166 Fase A skill conversion governance pattern
338
+ - `feedback_dsvl_4th_application_s166_18_of_19` — S166 4th application validates skill v1 auto-enforcement
339
+ - `feedback_storybook_dsvl_etapa_2_5_validates_spec_not_composition` — S166 NEW pattern (Etapa 2.5 Storybook)
340
+ - `feedback_design_system_git_backup_documentary_not_recovery_vector` — S166 architectural distinction
341
+
342
+ **S167 expansion (this update):**
343
+ - `dsvl_5th_application_s167_admin_pivot_18_of_18` — S167 5th application, 2M token novel-pattern baseline
344
+ - `dsvl_substituto_8_spec_sort_order_verification` — S167 NEW Substituto #8 (sort order)
345
+ - `dsvl_route_around_bolt_for_trivial_fixes` — S167 NEW Etapa 6.5 + Substituto #9
346
+ - `bolt_github_pull_requires_f5_refresh_to_resync` — S167 Bolt sync asymmetric F5 caveat
347
+
348
+ **Bolt platform caveats:**
349
+ - `feedback_bolt_reingest_additive_not_destructive` — Etapa 4 caveat (REMOVE/REPLACE prompts)
350
+ - `feedback_bolt_deploy_requires_manual_publish_after_git_sync` — Etapa 4 caveat (Publish manual)
351
+ - `feedback_bolt_rollback_loses_forward_versions` — Etapa 4 caveat (rollback destructive)
352
+ - `feedback_bolt_deploy_supports_spa_routing_natively` — Etapa 4 fact (BrowserRouter default)
353
+ - `feedback_bolt_prompt_template_v2_multi_route_clauses` — Etapa 4 prompt template (no opt-outs)
354
+ - `feedback_bolt_tokens_per_screen_context_dependent` — Capacity planning (refined here with S167 novel tier)
355
+
356
+ **Workflow / pairing:**
357
+ - `feedback_external_ai_as_clarity_validator_not_designer` — Mining pattern for external AI feedback
358
+ - `feedback_self_critique_beats_retroactive_defense` — receiving-code-review when render contradicts smoke test
359
+ - `feedback_frontend_design_skill_for_responsive_work` — Skill pairing for markdown patches
360
+
361
+ ## Related
362
+
363
+ - **Canonical doc:** `project-guidelines/processes/design-system-validated-loop.md` (354L narrative + token economics + appendix)
364
+ - **RFC-022:** Skill-based orchestration (skill conversion target spec)
365
+ - **ADR-019:** Three-layer orchestrator identity (this skill is Layer B — loaded on demand)
366
+ - **CLAUDE.md Universal Invariants:** Memory protocol + workflow start rule
@@ -0,0 +1,184 @@
1
+ ---
2
+ name: finishing-branch
3
+ description: "Use when implementation is complete and all tests pass — guides the decision and execution of merge, PR, or branch cleanup."
4
+ triggers:
5
+ - "When implementation work is done"
6
+ - "When the user says 'we're done' or 'ship it'"
7
+ - "After all tasks in a workflow are complete"
8
+ - "When asked how to integrate completed work"
9
+ ---
10
+
11
+ # Finishing a Development Branch
12
+
13
+ ## Overview
14
+
15
+ Guide completion of development work by presenting clear options and handling chosen workflow.
16
+
17
+ **Core principle:** Verify tests → Present options → Execute choice → Clean up.
18
+
19
+ **Announce at start:** "I'm using the finishing-branch skill to complete this work."
20
+
21
+ ## The Process
22
+
23
+ ### Step 1: Verify Tests
24
+
25
+ **Before presenting options, verify tests pass:**
26
+
27
+ ```bash
28
+ # Run project's test suite
29
+ npm test / cargo test / pytest / go test ./...
30
+ ```
31
+
32
+ **If tests fail:**
33
+ ```
34
+ Tests failing (<N> failures). Must fix before completing:
35
+
36
+ [Show failures]
37
+
38
+ Cannot proceed with merge/PR until tests pass.
39
+ ```
40
+
41
+ Stop. Don't proceed to Step 2.
42
+
43
+ **If tests pass:** Continue to Step 2.
44
+
45
+ ### Step 2: Determine Base Branch
46
+
47
+ ```bash
48
+ git merge-base HEAD main 2>/dev/null || git merge-base HEAD master 2>/dev/null
49
+ ```
50
+
51
+ Or ask: "This branch split from main — is that correct?"
52
+
53
+ ### Step 3: Present Options
54
+
55
+ Present exactly these 4 options:
56
+
57
+ ```
58
+ Implementation complete. What would you like to do?
59
+
60
+ 1. Merge back to <base-branch> locally
61
+ 2. Push and create a Pull Request
62
+ 3. Keep the branch as-is (I'll handle it later)
63
+ 4. Discard this work
64
+
65
+ Which option?
66
+ ```
67
+
68
+ **Don't add explanation** — keep options concise.
69
+
70
+ ### Step 4: Execute Choice
71
+
72
+ #### Option 1: Merge Locally
73
+
74
+ ```bash
75
+ git checkout <base-branch>
76
+ git pull
77
+ git merge <feature-branch>
78
+ <test command>
79
+ git branch -d <feature-branch>
80
+ ```
81
+
82
+ Then: Cleanup worktree (Step 5)
83
+
84
+ #### Option 2: Push and Create PR
85
+
86
+ ```bash
87
+ git push -u origin <feature-branch>
88
+
89
+ gh pr create --title "<title>" --body "$(cat <<'EOF'
90
+ ## Summary
91
+ <2-3 bullets of what changed>
92
+
93
+ ## Test Plan
94
+ - [ ] <verification steps>
95
+ EOF
96
+ )"
97
+ ```
98
+
99
+ Then: Cleanup worktree (Step 5)
100
+
101
+ #### Option 3: Keep As-Is
102
+
103
+ Report: "Keeping branch <name>. Worktree preserved at <path>."
104
+
105
+ **Don't cleanup worktree.**
106
+
107
+ #### Option 4: Discard
108
+
109
+ **Confirm first:**
110
+ ```
111
+ This will permanently delete:
112
+ - Branch <name>
113
+ - All commits: <commit-list>
114
+ - Worktree at <path>
115
+
116
+ Type 'discard' to confirm.
117
+ ```
118
+
119
+ Wait for exact confirmation.
120
+
121
+ If confirmed:
122
+ ```bash
123
+ git checkout <base-branch>
124
+ git branch -D <feature-branch>
125
+ ```
126
+
127
+ Then: Cleanup worktree (Step 5)
128
+
129
+ ### Step 5: Cleanup Worktree
130
+
131
+ **For Options 1, 2, 4:**
132
+
133
+ Check if in worktree:
134
+ ```bash
135
+ git worktree list | grep $(git branch --show-current)
136
+ ```
137
+
138
+ If yes:
139
+ ```bash
140
+ git worktree remove <worktree-path>
141
+ ```
142
+
143
+ **For Option 3:** Keep worktree.
144
+
145
+ ## Quick Reference
146
+
147
+ | Option | Merge | Push | Keep Worktree | Cleanup Branch |
148
+ |--------|-------|------|---------------|----------------|
149
+ | 1. Merge locally | Yes | - | - | Yes |
150
+ | 2. Create PR | - | Yes | Yes | - |
151
+ | 3. Keep as-is | - | - | Yes | - |
152
+ | 4. Discard | - | - | - | Yes (force) |
153
+
154
+ ## Common Mistakes
155
+
156
+ **Skipping test verification**
157
+ - Problem: Merge broken code, create failing PR
158
+ - Fix: Always verify tests before offering options
159
+
160
+ **Open-ended questions**
161
+ - Problem: "What should I do next?" — ambiguous
162
+ - Fix: Present exactly 4 structured options
163
+
164
+ **Automatic worktree cleanup**
165
+ - Problem: Remove worktree when might need it (Option 2, 3)
166
+ - Fix: Only cleanup for Options 1 and 4
167
+
168
+ **No confirmation for discard**
169
+ - Problem: Accidentally delete work
170
+ - Fix: Require typed "discard" confirmation
171
+
172
+ ## Red Flags
173
+
174
+ **Never:**
175
+ - Proceed with failing tests
176
+ - Merge without verifying tests on result
177
+ - Delete work without confirmation
178
+ - Force-push without explicit request
179
+
180
+ **Always:**
181
+ - Verify tests before offering options
182
+ - Present exactly 4 options
183
+ - Get typed confirmation for Option 4
184
+ - Clean up worktree for Options 1 and 4 only