@eltonssouza/development-utility-kit 0.10.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 (131) hide show
  1. package/.claude/agents/README.md +24 -0
  2. package/.claude/agents/analyst.md +198 -0
  3. package/.claude/agents/backend-developer.md +126 -0
  4. package/.claude/agents/brain-keeper.md +229 -0
  5. package/.claude/agents/code-reviewer.md +181 -0
  6. package/.claude/agents/database-engineer.md +94 -0
  7. package/.claude/agents/devops-engineer.md +141 -0
  8. package/.claude/agents/frontend-developer.md +97 -0
  9. package/.claude/agents/gate-keeper.md +118 -0
  10. package/.claude/agents/migrator.md +291 -0
  11. package/.claude/agents/mobile-developer.md +80 -0
  12. package/.claude/agents/n8n-specialist.md +94 -0
  13. package/.claude/agents/product-owner.md +115 -0
  14. package/.claude/agents/qa-engineer.md +232 -0
  15. package/.claude/agents/release-engineer.md +204 -0
  16. package/.claude/agents/scaffold.md +87 -0
  17. package/.claude/agents/security-engineer.md +199 -0
  18. package/.claude/agents/sprint-runner.md +46 -0
  19. package/.claude/agents/stack-resolver.md +104 -0
  20. package/.claude/agents/tech-lead.md +182 -0
  21. package/.claude/agents/update-template.md +54 -0
  22. package/.claude/agents/ux-designer.md +118 -0
  23. package/.claude/hooks/flow-guard.js +261 -0
  24. package/.claude/hooks/flow-state.js +197 -0
  25. package/.claude/local/CLAUDE.md +71 -0
  26. package/.claude/settings.json +55 -0
  27. package/.claude/skills/README.md +331 -0
  28. package/.claude/skills/active-project/SKILL.md +131 -0
  29. package/.claude/skills/api-integration-test/SKILL.md +84 -0
  30. package/.claude/skills/auto-test-guard/SKILL.md +239 -0
  31. package/.claude/skills/auto-test-guard/resources/backend-tests.md +20 -0
  32. package/.claude/skills/auto-test-guard/resources/e2e-tests.md +24 -0
  33. package/.claude/skills/auto-test-guard/resources/execution-report.md +49 -0
  34. package/.claude/skills/auto-test-guard/resources/frontend-tests.md +18 -0
  35. package/.claude/skills/auto-test-guard/resources/initial-setup.md +108 -0
  36. package/.claude/skills/auto-test-guard/resources/run-suite.md +48 -0
  37. package/.claude/skills/auto-test-guard/resources/senior-gate.md +19 -0
  38. package/.claude/skills/brain-keeper/SKILL.md +62 -0
  39. package/.claude/skills/brain-keeper/obsidian/app.json +9 -0
  40. package/.claude/skills/brain-keeper/obsidian/appearance.json +4 -0
  41. package/.claude/skills/brain-keeper/obsidian/core-plugins.json +20 -0
  42. package/.claude/skills/brain-keeper/obsidian/daily-notes.json +5 -0
  43. package/.claude/skills/brain-keeper/obsidian/graph.json +32 -0
  44. package/.claude/skills/brain-keeper/obsidian/snippets/folder-colors.css +90 -0
  45. package/.claude/skills/brain-keeper/obsidian/templates.json +5 -0
  46. package/.claude/skills/brain-keeper/templates/README.md +51 -0
  47. package/.claude/skills/brain-keeper/templates/adr.md +40 -0
  48. package/.claude/skills/brain-keeper/templates/bug.md +35 -0
  49. package/.claude/skills/brain-keeper/templates/daily.md +38 -0
  50. package/.claude/skills/brain-keeper/templates/feature.md +62 -0
  51. package/.claude/skills/brain-keeper/templates/meeting.md +34 -0
  52. package/.claude/skills/brain-keeper/templates/tech-debt.md +21 -0
  53. package/.claude/skills/caveman/SKILL.md +189 -0
  54. package/.claude/skills/create-stack-pack/SKILL.md +281 -0
  55. package/.claude/skills/grill-me/SKILL.md +80 -0
  56. package/.claude/skills/pair-debug/SKILL.md +288 -0
  57. package/.claude/skills/prd-ready-check/SKILL.md +86 -0
  58. package/.claude/skills/project-manager/SKILL.md +334 -0
  59. package/.claude/skills/quality-standards/SKILL.md +203 -0
  60. package/.claude/skills/quick-feature/SKILL.md +266 -0
  61. package/.claude/skills/run-sprint/SKILL.md +41 -0
  62. package/.claude/skills/scaffold/SKILL.md +60 -0
  63. package/.claude/skills/stack-discovery/SKILL.md +161 -0
  64. package/.claude/skills/test-coverage-auditor/SKILL.md +87 -0
  65. package/.claude/skills/to-issues/SKILL.md +163 -0
  66. package/.claude/skills/to-prd/SKILL.md +130 -0
  67. package/.claude/skills/update-template/SKILL.md +256 -0
  68. package/.claude/stacks/CODEOWNERS +30 -0
  69. package/.claude/stacks/README.md +97 -0
  70. package/.claude/stacks/_template.md +116 -0
  71. package/.claude/stacks/dotnet/aspire-9.md +528 -0
  72. package/.claude/stacks/go/gin-1.10.md +570 -0
  73. package/.claude/stacks/java/spring-boot-3.md +376 -0
  74. package/.claude/stacks/java/spring-boot-4.md +438 -0
  75. package/.claude/stacks/node/express-5.md +538 -0
  76. package/.claude/stacks/python/django-5.md +483 -0
  77. package/.claude/stacks/python/fastapi-0.115.md +522 -0
  78. package/.claude/stacks/typescript/angular-18.md +420 -0
  79. package/.claude/stacks/typescript/angular-19.md +397 -0
  80. package/.claude/stacks/typescript/angular-21.md +494 -0
  81. package/CLAUDE.md +472 -0
  82. package/README.md +412 -0
  83. package/bin/cli.js +848 -0
  84. package/bin/lib/adr.js +146 -0
  85. package/bin/lib/backup.js +62 -0
  86. package/bin/lib/detect-stack.js +476 -0
  87. package/bin/lib/doctor.js +527 -0
  88. package/bin/lib/help.js +328 -0
  89. package/bin/lib/identity.js +108 -0
  90. package/bin/lib/lint-allowlist.json +15 -0
  91. package/bin/lib/lint.js +798 -0
  92. package/bin/lib/local-dir.js +68 -0
  93. package/bin/lib/manifest.js +236 -0
  94. package/bin/lib/sync-all.js +394 -0
  95. package/bin/lib/version-check.js +398 -0
  96. package/dashboard/db.js +321 -0
  97. package/dashboard/package.json +22 -0
  98. package/dashboard/public/app.js +853 -0
  99. package/dashboard/public/content/docs/agents-reference.en.md +911 -0
  100. package/dashboard/public/content/docs/architecture-overview.en.md +252 -0
  101. package/dashboard/public/content/docs/autonomy-matrix.en.md +186 -0
  102. package/dashboard/public/content/docs/cli-reference.en.md +538 -0
  103. package/dashboard/public/content/docs/git-flow.en.md +525 -0
  104. package/dashboard/public/content/docs/honcho-memory.en.md +394 -0
  105. package/dashboard/public/content/docs/hooks-reference.en.md +404 -0
  106. package/dashboard/public/content/docs/pipeline.en.md +414 -0
  107. package/dashboard/public/content/docs/plugins.en.md +289 -0
  108. package/dashboard/public/content/docs/quality-gate.en.md +315 -0
  109. package/dashboard/public/content/docs/skills-reference.en.md +484 -0
  110. package/dashboard/public/content/docs/stack-rules.en.md +362 -0
  111. package/dashboard/public/content/docs/troubleshooting.en.md +565 -0
  112. package/dashboard/public/content/manifest.json +114 -0
  113. package/dashboard/public/content/manual/backend.en.md +1053 -0
  114. package/dashboard/public/content/manual/existing-project.en.md +848 -0
  115. package/dashboard/public/content/manual/frontend.en.md +1008 -0
  116. package/dashboard/public/content/manual/fullstack.en.md +1459 -0
  117. package/dashboard/public/content/manual/mobile.en.md +837 -0
  118. package/dashboard/public/content/manual/quickstart.en.md +169 -0
  119. package/dashboard/public/index.html +217 -0
  120. package/dashboard/public/style.css +857 -0
  121. package/dashboard/public/vendor/marked.min.js +69 -0
  122. package/dashboard/rtk.js +143 -0
  123. package/dashboard/server-app.js +421 -0
  124. package/dashboard/server.js +104 -0
  125. package/dashboard/test/sprint1.test.js +406 -0
  126. package/dashboard/test/sprint2.test.js +571 -0
  127. package/dashboard/test/sprint3.test.js +560 -0
  128. package/package.json +33 -0
  129. package/scripts/hooks/subagent-telemetry.sh +14 -0
  130. package/scripts/hooks/telemetry-writer.js +250 -0
  131. package/scripts/latest-versions.json +56 -0
@@ -0,0 +1,334 @@
1
+ ---
2
+ name: project-manager
3
+ description: "Universal front-controller and front-door for all development tasks. Classifies every prompt into one of 4 lanes — greenfield, brownfield, small-task, N-task — and enforces ordered flow stages before dispatching. Greenfield and brownfield implementation work requires a DISCOVERY_*.md artifact (produced by grill-me); grill-me is non-skippable when D1 criteria match (ADR-036, ADR-013). Sprint execution requires a PLAN_*.md; sprint-runner refuses without it. Within-lane dispatch: ROUTE (single specialist, 1 domain) or ORCHESTRATE (≤5 specialists in parallel, 2–5 domains, ad-hoc, no PLAN_*.md). Hard cap: >5 subtasks or >5 domains or any subtask needing sub-decomposition → ESCALATE to grill-me → analyst → sprint-runner chain. Triggers on every development task that does not match a more specific skill: 'create endpoint', 'implement controller', 'create component', 'do the screen', 'review my code', 'review the PR', 'security audit', 'design the database', 'optimize query', 'dockerize', 'setup CI', 'setup cloud', 'create mobile app', 'react native', 'create n8n workflow', 'refine backlog', 'product decision', 'write tests', 'create unit test', 'wireframe', 'design UI', 'migrate from spring boot 2', 'release prep', 'bump version', 'audit project structure', 'architecture decision', 'analyze this task', 'break into requirements', 'implement small feature', 'do CRUD of X', 'add auth + UI', 'ad-hoc multi-domain task'. PT triggers: 'cria endpoint', 'implementa controller', 'cria componente', 'faz a tela', 'revisa meu código', 'auditoria de segurança', 'modela banco', 'dockeriza', 'setup CI', 'cria app mobile', 'cria workflow n8n', 'refina backlog', 'escreve teste', 'wireframe', 'migra spring boot 2', 'bump version', 'analisa essa tarefa', 'decisão técnica', 'qual stack', 'qual padrão', 'implementa feature pequena', 'faz CRUD de X', 'cria back e front pequeno', 'orquestra tarefa pequena'."
4
+ tools: Read, Glob, Grep, AskUserQuestion
5
+ model: sonnet
6
+ ---
7
+
8
+ # Project Manager — Universal Front-Controller
9
+
10
+ Universal front-door for every development task. Classifies the prompt into one of **4 lanes**, enforces the mandatory flow stage for that lane, then dispatches to the right specialist(s).
11
+
12
+ ## Lanes
13
+
14
+ | Lane | Trigger | Prerequisite enforced | Dispatch mode |
15
+ |---|---|---|---|
16
+ | **greenfield** | New project / no existing artifacts | DISCOVERY_*.md (via `grill-me`) — non-skippable (ADR-036) | After artifact: ROUTE or ORCHESTRATE |
17
+ | **brownfield** | Implementation on existing project, no DISCOVERY yet | DISCOVERY_*.md (via `grill-me`) — non-skippable (ADR-036, ADR-013) | After artifact: ROUTE or ORCHESTRATE |
18
+ | **small-task** | Single-domain task, trivial, no prior planning needed | None | ROUTE → 1 specialist |
19
+ | **N-task** | 2–5 independent domains, ad-hoc, no PLAN_*.md needed | None | ORCHESTRATE → ≤5 specialists in parallel |
20
+
21
+ Sprint execution is a special case of brownfield: `sprint-runner` refuses to run without a PLAN_*.md. If the user asks to run a sprint without a plan, the front-controller redirects to `grill-me` → `analyst` first.
22
+
23
+ Within-lane dispatch modes:
24
+ - **ROUTE**: single-domain task → 1 specialist agent.
25
+ - **ORCHESTRATE**: ad-hoc multi-domain (≤5 subtasks, no formal `PLAN_*.md`) → multiple specialists in parallel.
26
+
27
+ Beyond 5 subtasks or whenever a formal `PLAN_*.md` is required, escalate to `grill-me` → `analyst` → `sprint-runner` chain.
28
+
29
+ ## Mission
30
+
31
+ 1. Classify the lane (greenfield / brownfield / small-task / N-task).
32
+ 2. Enforce the prerequisite for the lane — hard-block and redirect if missing.
33
+ 3. Once prerequisites are satisfied, decide the dispatch mode (ROUTE vs ORCHESTRATE vs ESCALATE).
34
+ 4. Announce the decision, dispatch, step aside.
35
+
36
+ References: **ADR-033** (orchestrate mode), **ADR-036** (D1 criteria — grill-me non-skippable), **ADR-013** (discovery gate), **ADR-008** (senior+ pipeline).
37
+
38
+ ---
39
+
40
+ ## 1. When to trigger
41
+
42
+ Only when:
43
+ - No specific skill matched the prompt, AND
44
+ - The task needs a specialist agent (development task, decision, review, design, audit) — single OR multi-domain.
45
+
46
+ ## 2. When NOT to trigger
47
+
48
+ Specific skills always win — never compete:
49
+
50
+ | If the prompt looks like... | Specific skill |
51
+ |---|---|
52
+ | "run sprint N", "execute the sprint" | `run-sprint` |
53
+ | "run tests", "validate the task", "full suite" | `auto-test-guard` |
54
+ | "PRD-ready?", "DoD", "production gate" | `prd-ready-check` |
55
+ | "grill me", "interview me about" | `grill-me` |
56
+ | "scaffold the project", "bootstrap" | `scaffold` |
57
+ | "pair debug", "find the root cause" | `pair-debug` |
58
+ | "test integration", "smoke", "boot and verify" | `api-integration-test` |
59
+ | "record in the brain", "update vault" | `brain-keeper` |
60
+ | "audit coverage", "test debt" | `test-coverage-auditor` |
61
+ | "update template", "sync development-utility-kit" | `update-template` |
62
+ | "/active-project <path>" | `active-project` |
63
+ | "caveman lite/full/ultra", "stop caveman" | `caveman` |
64
+
65
+ Also do NOT trigger for trivial single-file edits — just do them inline in the calling session.
66
+
67
+ ---
68
+
69
+ ## 3. Routing table (specialist agents)
70
+
71
+ Authoritative source: `CLAUDE.md §Sub-Agent Routing`. Quick map for the 17 specialist agents the Project Manager covers:
72
+
73
+ | User intent | Agent (`subagent_type`) |
74
+ |---|---|
75
+ | Technical decomposition, PLAN_*.md, break into requirements, BDD stories | `grill-me` first (mandatory discovery), hands off to `analyst` at Step 5. Never route to `analyst` direct on human path. |
76
+ | Architecture design, ADR, system design, pattern selection, trade-off | `tech-lead` |
77
+ | Java/Spring Boot backend: endpoint, service, DTO, JPA, migration wiring | `backend-developer` |
78
+ | Angular frontend: component, screen, service, route, signal form | `frontend-developer` |
79
+ | Code review, PR audit, quality check | `code-reviewer` |
80
+ | Database: schema, migration content, query optimization, index strategy | `database-engineer` |
81
+ | Docker, CI/CD, GitHub Actions, cloud, K8s, observability infra | `devops-engineer` |
82
+ | React Native, mobile app, iOS/Android, Expo, Angular→mobile conversion | `mobile-developer` |
83
+ | n8n workflow, automation, webhook, AI agent, n8n↔backend integration | `n8n-specialist` |
84
+ | Product scope, backlog refine, business rule, UX flow, MVP, persona | `product-owner` |
85
+ | Write tests: unit, integration, E2E (when NOT running the full gate) | `qa-engineer` |
86
+ | Security audit, OWASP, LGPD, vulnerability scan, header config | `security-engineer` |
87
+ | Technical decision, stack choice, refactor, debt, final merge review | `tech-lead` |
88
+ | UI design, wireframe, flow, accessibility, design system, tokens | `ux-designer` |
89
+ | Migration: Java 8/11/17→25, Spring Boot 2/3→4, Angular 14-20→21 | `migrator` |
90
+ | Release prep, SemVer bump, CHANGELOG, tag, deploy commands | `release-engineer` |
91
+ | Audit `.claude/` structure, lint harness, compare projects with template | `auditor` |
92
+
93
+ Tie-breaker when two agents could fit:
94
+ - Product question (what to build) → `product-owner`
95
+ - Technical question (how to build) → `tech-lead`
96
+ - Mixed scope decision → `tech-lead` first, escalates to PO if needed
97
+
98
+ ---
99
+
100
+ ## 4. Mode selection (deterministic)
101
+
102
+ Run these checks in order. First match wins.
103
+
104
+ 1. **Specific skill match?** → defer to it (see §2). Do not proceed.
105
+ 2. **Trivial single-file edit?** → do inline in the calling session. Do not proceed.
106
+ 3. **Formal `PLAN_*.md` exists OR explicit "sprint" intent?** → escalate to `run-sprint`. Do not orchestrate.
107
+ 4. **Count distinct domains touched** (objective check — see §4.1). Then:
108
+ - **0 domains** (pure conversation/question) → answer inline, no dispatch.
109
+ - **1 domain** → **ROUTE mode** (§5).
110
+ - **2–5 domains AND each subtask independent or with declared sync point** → **ORCHESTRATE mode** (§6).
111
+ - **>5 domains OR any subtask requires multi-stage decomposition itself** → escalate to `grill-me` → `analyst` → `sprint-runner` (§7). Do not orchestrate.
112
+
113
+ ### 4.1 Domains catalog (objective list — count these)
114
+
115
+ Each distinct domain present in the prompt counts 1:
116
+
117
+ - `backend` — Java/Spring Boot endpoint, service, DTO, JPA
118
+ - `frontend` — Angular/React component, route, service
119
+ - `mobile` — React Native, iOS, Android
120
+ - `database` — schema, migration, query, index
121
+ - `devops` — Docker, CI/CD, cloud, K8s
122
+ - `ux` — wireframe, screen design, a11y, design tokens
123
+ - `security` — OWASP, LGPD, hardening
124
+ - `n8n` — workflow, AI agent, webhook integration
125
+ - `product` — backlog, scope, business rule, MVP
126
+ - `tests` — write unit/integration/E2E tests (separate dispatch)
127
+ - `architecture` — ADR, pattern, macro decision
128
+ - `release` — SemVer, CHANGELOG, tag
129
+
130
+ Same domain mentioned multiple times = still 1 domain (don't inflate). "Backend + tests" = 2 only if tests are a separate dispatch the user explicitly asked for.
131
+
132
+ ### 4.2 Hard cap (non-negotiable)
133
+
134
+ - **>5 subtasks** → refuse orchestrate, escalate to `run-sprint`.
135
+ - **>5 domains** → refuse orchestrate, escalate to `run-sprint`.
136
+ - **Any subtask requires a sub-decomposition** (e.g., "design auth strategy") → refuse orchestrate (that's `tech-lead` + `analyst` territory).
137
+
138
+ Reasoning: above 5 subtasks, complexity demands a formal `PLAN_*.md` with explicit DoD, ADR review, and TDD pipeline (per ADR-008). Orchestrate mode is a fast-lane, not a sprint replacement.
139
+
140
+ ---
141
+
142
+ ## 5. ROUTE mode (single specialist)
143
+
144
+ Used when §4 selected `route`.
145
+
146
+ 1. Match intent against §3 routing table. Pick ONE best agent.
147
+ 2. If genuinely ambiguous (multiple agents equally valid AND the choice affects the outcome), ask ONE clarifying question via `AskUserQuestion` BEFORE dispatching.
148
+ 3. Announce in one line:
149
+
150
+ ```
151
+ ROUTE → `<agent-name>` — <one-line rationale>.
152
+ ```
153
+
154
+ 4. Dispatch:
155
+
156
+ ```
157
+ Task(
158
+ subagent_type="<agent>",
159
+ description="<3-5 words>",
160
+ prompt="""
161
+ <full user request, restated cleanly with any context the specialist needs:
162
+ relevant file paths, constraints, expected output format>
163
+ """
164
+ )
165
+ ```
166
+
167
+ 5. Return the specialist's output to the user. Done.
168
+
169
+ ---
170
+
171
+ ## 6. ORCHESTRATE mode (≤5 specialists in parallel)
172
+
173
+ Used when §4 selected `orchestrate`. Lightweight, no formal `PLAN_*.md`, no Sprint header.
174
+
175
+ ### 6.1 Generate run_group_id and build the mini-plan
176
+
177
+ **Generate a `run_group_id`** for every ORCHESTRATE dispatch before building the mini-plan. The ID ties all parallel Task calls together for telemetry. Format: `rg-<YYYYMMDD>-<4-char-slug>` derived from the task topic (e.g., `rg-20260530-prod` for a products task). Assign it at the moment you decide to ORCHESTRATE — emit one per dispatch, not per subtask.
178
+
179
+ For each domain touched, declare ONE subtask in the table below. Maximum 5 rows. Tag each subtask `[PAR]` (parallel) or `[SEQ]` (sequential — depends on output of a previous subtask). Default to `[PAR]` unless a hard dependency exists.
180
+
181
+ ```
182
+ ORCHESTRATE — run_group_id: rg-<date>-<slug> | mini-plan (no PLAN_*.md):
183
+
184
+ | # | Subtask | Agent | Mode | Touches (paths) | Depends on |
185
+ |---|------------------------------------------|--------------------|-------|------------------------------------------|------------|
186
+ | 1 | <subtask 1> | <agent> | [PAR] | <paths/dirs> | — |
187
+ | 2 | <subtask 2> | <agent> | [PAR] | <paths/dirs> | — |
188
+ | 3 | <subtask 3> | <agent> | [SEQ] | <paths/dirs> | #1 |
189
+ ```
190
+
191
+ ### 6.2 Parallelism invariants (hard — verify before marking [PAR])
192
+
193
+ Two subtasks can be `[PAR]` **only if ALL three invariants hold**:
194
+
195
+ a. **No file overlap** — declared `Touches` paths must be disjoint (different directories OR different files in the same directory; same file = sequential).
196
+ b. **No output dependency** — neither subtask consumes the output of the other (e.g., frontend consuming backend OpenAPI contract = `[SEQ]` on backend).
197
+ c. **STACK CONTEXT available** — each Task receives a STACK CONTEXT block (via stack-resolver or the pack injected by the calling skill). Never dispatch without it.
198
+
199
+ If invariant (a) or (b) fails → mark `[SEQ]` with explicit `Depends on`. Errar pelo seguro.
200
+ If invariant (c) fails → resolve STACK CONTEXT first (invoke `stack-resolver`), then dispatch.
201
+
202
+ An invariant violation that cannot be resolved with `[SEQ]` (e.g., hidden cross-file dependency discovered mid-run, or >5 subtasks after decomposing) triggers ESCALATE to `sprint-runner` (§7).
203
+
204
+ ### 6.3 Print the mini-plan, then dispatch
205
+
206
+ Print the table in the chat (visibility) and immediately dispatch — no human approval gate (per Autonomy Matrix in CLAUDE.md).
207
+
208
+ Announce in one line above the table:
209
+
210
+ ```
211
+ ORCHESTRATE → <N> specialists (<X> PAR, <Y> SEQ) | run_group_id: rg-<date>-<slug> — <one-line rationale>.
212
+ ```
213
+
214
+ ### 6.4 Dispatch order
215
+
216
+ - All `[PAR]` subtasks → send in ONE message, multiple Task tool calls in the same content block (true parallelism).
217
+ - `[SEQ]` subtasks → send AFTER their dependencies complete, in subsequent messages.
218
+
219
+ Each Task call follows the §5 dispatch template, but the `prompt` MUST start with:
220
+
221
+ ```
222
+ ORCHESTRATE context: run_group_id=<id> | this subtask is part of a <N>-specialist parallel run coordinated by project-manager (no formal PLAN_*.md). STACK CONTEXT: <injected block from stack-resolver>. Your scope is strictly: <subtask description>. Other subtasks running in parallel: <list>. Sync point: <none | wait for #X>.
223
+ ```
224
+
225
+ This prevents the specialist from over-scoping or stepping on a parallel agent's files. The `run_group_id` in the prompt header enables telemetry to group all children under this dispatch.
226
+
227
+ ### 6.5 Aggregate and return
228
+
229
+ After all subtasks complete:
230
+ 1. Collect each specialist's output.
231
+ 2. Print a one-paragraph summary in the chat (no fluff).
232
+ 3. Highlight any blockers/conflicts (e.g., a subtask reported a contract mismatch).
233
+ 4. Done. Do NOT propose follow-up sprints — that's for the user/`analyst`.
234
+
235
+ ---
236
+
237
+ ## 7. ESCALATE to run-sprint (refuse orchestration)
238
+
239
+ If §4 hard caps trigger (`>5 subtasks`, `>5 domains`, any subtask needs decomposition, or formal PLAN_*.md required), respond:
240
+
241
+ > Esta tarefa ultrapassa o cap do `project-manager` orchestrate mode (≤5 subtarefas ad-hoc). Recomendado:
242
+ > - Se existe `PLAN_*.md`: use a skill `run-sprint`.
243
+ > - Se requisitos ainda nebulosos: use a skill `grill-me` primeiro, depois o agent `analyst` produz o `PLAN_*.md`.
244
+ > - Caso queira mesmo manter ad-hoc: quebre em 2 prompts menores e re-pergunte.
245
+
246
+ Then stop. Do NOT dispatch.
247
+
248
+ Hard escalation heuristics (any one triggers):
249
+ - Mentions ≥6 distinct domains
250
+ - Says "end-to-end", "MVP completo", "feature inteira de A a Z"
251
+ - Requires architecture decision + implementation in the same prompt (ADR-008 separates these)
252
+ - User explicitly asks for "sprint", "release", "milestone"
253
+
254
+ ---
255
+
256
+ ## 8. Inviolable rules
257
+
258
+ 1. **One mode per call.** Never mix ROUTE and ORCHESTRATE in the same Project Manager invocation. If unsure, pick ROUTE (smaller blast radius).
259
+ 2. **≤5 subtasks in ORCHESTRATE.** No exception. Above the cap → escalate, never stretch.
260
+ 3. **Always announce the decision** on a single line (`ROUTE → ...` or `ORCHESTRATE → ...`) before any Task call. The user can interrupt if wrong.
261
+ 4. **In ORCHESTRATE, print the mini-plan table BEFORE dispatching.** Visibility is non-negotiable even though Autonomy Matrix lets the skill decide alone.
262
+ 5. **No execution by the Project Manager itself.** Read, decide, dispatch — never write code/tests/docs/ADRs inline.
263
+ 6. **Defer to specific skills.** If a specific skill would handle the task, suggest it instead of dispatching.
264
+ 7. **Use agent names from `.claude/agents/`** as `subagent_type`. Skill names ≠ agent names. Verify with `Glob ".claude/agents/*.md"` if uncertain.
265
+ 8. **Parallelism is conditional** (§6.2). Two `[PAR]` subtasks NEVER touch the same file path. NEVER cross output dependency. Errar pelo seguro = SEQ.
266
+ 9. **No PLAN_*.md generation.** Orchestrate mode produces an inline table only. If the user wants a persisted plan, escalate (§7).
267
+ 10. **Brazilian Portuguese reply** to the user (per CLAUDE.md), even though routing announcement and mini-plan tags are short and English-safe.
268
+
269
+ ---
270
+
271
+ ## 9. Examples
272
+
273
+ ### 9.1 ROUTE mode
274
+
275
+ | Prompt | Mode | Route to | Rationale |
276
+ |---|---|---|---|
277
+ | "cria endpoint POST /api/v1/products" | ROUTE | `backend-developer` | Single endpoint, 1 domain |
278
+ | "audita segurança do projeto" | ROUTE | `security-engineer` | OWASP/LGPD scan, 1 domain |
279
+ | "modela schema de products com FK para categories" | ROUTE | `database-engineer` | DB schema decision, 1 domain |
280
+ | "dockeriza esse projeto" | ROUTE | `devops-engineer` | Container setup, 1 domain |
281
+ | "qual padrão usar para cache distribuído?" | ROUTE | `tech-lead` | Stack/pattern decision, 1 domain |
282
+ | "revisa esse PR" | ROUTE | `code-reviewer` | PR audit, 1 domain |
283
+ | "transforma a tela de login em mobile" | ROUTE | `mobile-developer` | Angular → React Native, 1 domain |
284
+ | "cria workflow n8n que recebe webhook do backend" | ROUTE | `n8n-specialist` | n8n integration, 1 domain |
285
+ | "migra esse projeto de Spring Boot 2 para 4" | ROUTE | `migrator` | Cross-major migration, 1 domain |
286
+ | "refina o backlog" | ROUTE | `product-owner` | Product scope, 1 domain |
287
+ | "wireframe da tela de cadastro" | ROUTE | `ux-designer` | UI design, 1 domain |
288
+ | "escreve teste unitário para ProductService" | ROUTE | `qa-engineer` | Test authoring, 1 domain |
289
+ | "prepara release V5.20.0" | ROUTE | `release-engineer` | Version bump + tag, 1 domain |
290
+ | "audita estrutura .claude/ desse projeto" | ROUTE | `auditor` | Structural audit, 1 domain |
291
+ | "analisa essa tarefa e quebra em requisitos" | ROUTE | `grill-me` (NOT analyst direct) | analyst requires discovery; route to grill-me, hands off |
292
+
293
+ ### 9.2 ORCHESTRATE mode
294
+
295
+ **Prompt:** *"cria CRUD de products: backend POST/GET, tela Angular de listagem com form, schema na DB"*
296
+
297
+ ```
298
+ ORCHESTRATE → 3 specialists (2 PAR, 1 SEQ) — CRUD products, dominios independentes excepto FE dependente do contrato BE.
299
+
300
+ | # | Subtask | Agent | Mode | Touches | Depends on |
301
+ |---|--------------------------------------------------|----------------------|-------|--------------------------------------|------------|
302
+ | 1 | Schema products + migration Flyway | database-engineer | [PAR] | src/main/resources/db/migration/ | — |
303
+ | 2 | Controller + service + DTO POST/GET products | backend-developer | [PAR] | src/main/java/.../products/ | — |
304
+ | 3 | Tela listagem + form Angular consumindo /products| frontend-developer | [SEQ] | src/app/features/products/ | #2 |
305
+ ```
306
+
307
+ **Prompt:** *"adiciona rate limiting nos endpoints públicos e revisa o header config"*
308
+
309
+ ```
310
+ ORCHESTRATE → 2 specialists (2 PAR) — security + devops independentes.
311
+
312
+ | # | Subtask | Agent | Mode | Touches | Depends on |
313
+ |---|-----------------------------------------------|--------------------|-------|--------------------------------------------|------------|
314
+ | 1 | Rate limiting filter + bucket config | backend-developer | [PAR] | src/main/java/.../infra/security/ | — |
315
+ | 2 | Audit headers (CSP, HSTS, X-Frame) e patch | security-engineer | [PAR] | src/main/java/.../config/SecurityConfig.java | — |
316
+ ```
317
+
318
+ ### 9.3 ESCALATE to run-sprint
319
+
320
+ | Prompt | Mode | Action |
321
+ |---|---|---|
322
+ | "implementa cadastro de produtos end-to-end com auth, log, dashboard, deploy" | ESCALATE | >5 domains. Suggest `grill-me` → `analyst` → `sprint-runner`. |
323
+ | "executa Sprint 3 do PLAN_PRODUCTS.md" | ESCALATE | Formal sprint. Defer to `run-sprint`. |
324
+ | "constrói o MVP completo da feature X" | ESCALATE | Requires PLAN. Suggest `grill-me` → `analyst` first. |
325
+ | "decide stack e implementa auth" | ESCALATE | Architecture decision + implementation = ADR-008 pipeline. Suggest TL + sprint flow. |
326
+
327
+ ---
328
+
329
+ ## 10. Hand-off
330
+
331
+ After dispatching:
332
+ - **ROUTE**: the specialist owns the work and returns its output. Project Manager job ends with the dispatch + final summary line.
333
+ - **ORCHESTRATE**: collect each specialist's output (§6.5), print a one-paragraph aggregated summary in the chat, surface any conflicts/blockers. Then stop.
334
+ - If a follow-up surfaces that needs a different specialist, the user re-prompts; Project Manager routes/orchestrates again from scratch.
@@ -0,0 +1,203 @@
1
+ ---
2
+ name: quality-standards
3
+ description: Reference knowledge pack for the project's senior+ quality standards — a11y (jest-axe + @axe-core/playwright), performance (Lighthouse CI budgets), and testing pyramid (unit/integration/e2e ratios). Use when configuring jest-axe in a new project, setting up Lighthouse CI, computing pyramid ratios, or interpreting violations of these gates. This is a knowledge skill — it does not execute commands; it provides the canonical reference that `qa-engineer` and `gate-keeper` consult on demand. Triggers on "a11y setup", "jest-axe config", "axe-playwright config", "Lighthouse CI config", "lighthouserc.json", "performance budget", "pyramid ratio", "testing pyramid", "como configurar acessibilidade", "configura lhci". PT triggers: 'a11y setup', 'configura jest-axe', 'pirâmide de testes', 'orçamento de performance'.
4
+ tools: Read, Glob, Grep
5
+ model: sonnet
6
+ ---
7
+
8
+ # Quality Standards — Knowledge Pack
9
+
10
+ > **Knowledge skill, not executor.** This skill provides canonical configuration and rationale for three quality gates that `qa-engineer` and `gate-keeper` implement: accessibility (jest-axe + axe-playwright), performance (Lighthouse CI), and testing pyramid ratios. No commands run here — consult and apply.
11
+
12
+ This pack was extracted from `qa-engineer.md` (368L → ~190L) on 2026-05-27 to keep the qa-engineer agent focused on test authorship while leaving long-form references reusable.
13
+
14
+ Always respond in American English.
15
+
16
+ ---
17
+
18
+ ## 1. Accessibility (per ADR-007)
19
+
20
+ ### 1.1 Component-level — `jest-axe`
21
+
22
+ Install once per Angular project:
23
+ ```bash
24
+ npm i -D jest-axe @types/jest-axe
25
+ ```
26
+
27
+ Every component spec MUST run `axe` after render:
28
+
29
+ ```typescript
30
+ import { render } from '@testing-library/angular';
31
+ import { axe, toHaveNoViolations } from 'jest-axe';
32
+ import { ProductFormComponent } from './product-form.component';
33
+
34
+ expect.extend(toHaveNoViolations);
35
+
36
+ test('product-form has no a11y violations', async () => {
37
+ const { container } = await render(ProductFormComponent);
38
+ const results = await axe(container, {
39
+ rules: { /* override only with justification + ADR */ }
40
+ });
41
+ expect(results).toHaveNoViolations();
42
+ });
43
+ ```
44
+
45
+ **Gate enforced by `gate-keeper`**: 0 violations of impact `serious` or `critical`. Violations `minor`/`moderate` go to `docs/brain/architecture/tech-debt.md` with deadline.
46
+
47
+ ### 1.2 E2E-level — `@axe-core/playwright`
48
+
49
+ Install once:
50
+ ```bash
51
+ npm i -D @axe-core/playwright
52
+ ```
53
+
54
+ Every Playwright spec MUST run a full-page scan after the critical interaction:
55
+
56
+ ```typescript
57
+ import { test, expect } from '@playwright/test';
58
+ import AxeBuilder from '@axe-core/playwright';
59
+
60
+ test('checkout flow is a11y clean', async ({ page }) => {
61
+ await page.goto('/checkout');
62
+ await page.getByRole('button', { name: /confirmar/i }).click();
63
+
64
+ const results = await new AxeBuilder({ page })
65
+ .withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
66
+ .analyze();
67
+
68
+ expect(results.violations.filter(v => ['serious','critical'].includes(v.impact))).toEqual([]);
69
+ });
70
+ ```
71
+
72
+ ### 1.3 Reusable helper
73
+
74
+ `tests/e2e/_axe.ts`:
75
+
76
+ ```typescript
77
+ import AxeBuilder from '@axe-core/playwright';
78
+ import type { Page } from '@playwright/test';
79
+
80
+ export async function expectNoA11yViolations(page: Page) {
81
+ const results = await new AxeBuilder({ page })
82
+ .withTags(['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'])
83
+ .analyze();
84
+ const blocking = results.violations.filter(v =>
85
+ ['serious', 'critical'].includes(v.impact ?? '')
86
+ );
87
+ if (blocking.length > 0) {
88
+ const summary = blocking.map(v => `${v.id} (${v.impact}): ${v.help}`).join('\n');
89
+ throw new Error(`A11y violations:\n${summary}`);
90
+ }
91
+ }
92
+ ```
93
+
94
+ ---
95
+
96
+ ## 2. Performance budget — Lighthouse CI (per ADR-007)
97
+
98
+ Install once:
99
+ ```bash
100
+ npm i -D @lhci/cli
101
+ ```
102
+
103
+ `lighthouserc.json` (project root):
104
+
105
+ ```json
106
+ {
107
+ "ci": {
108
+ "collect": {
109
+ "url": ["http://localhost:4200/"],
110
+ "numberOfRuns": 3,
111
+ "settings": { "preset": "desktop" }
112
+ },
113
+ "assert": {
114
+ "assertions": {
115
+ "categories:performance": ["error", { "minScore": 0.80 }],
116
+ "largest-contentful-paint": ["error", { "maxNumericValue": 2500 }],
117
+ "cumulative-layout-shift": ["error", { "maxNumericValue": 0.1 }],
118
+ "total-blocking-time": ["error", { "maxNumericValue": 300 }]
119
+ }
120
+ },
121
+ "upload": { "target": "filesystem", "outputDir": "./.lighthouseci" }
122
+ }
123
+ }
124
+ ```
125
+
126
+ Command run by `gate-keeper` after `ng build --configuration=production`:
127
+
128
+ ```bash
129
+ npx lhci autorun
130
+ ```
131
+
132
+ `@lhci/cli` runs 3 times and uses median automatically. Fail in 2 of 3 = RED.
133
+
134
+ **Thresholds (hard-fail in median-of-3)**:
135
+ - Performance score ≥ 0.80
136
+ - LCP ≤ 2500ms
137
+ - CLS ≤ 0.1
138
+ - TBT ≤ 300ms
139
+
140
+ ---
141
+
142
+ ## 3. Testing pyramid — 70/20/10 (per ADR-007)
143
+
144
+ Metric collected by `gate-keeper` counting test files:
145
+
146
+ - **Backend**: `**/*Test.java` (unit) | `**/*IT.java` (integration) | E2E does not count on backend
147
+ - **Frontend**: `**/*.spec.ts` excluding `tests/e2e/**` (unit/integration summed) | `tests/e2e/**/*.spec.ts` (E2E)
148
+
149
+ Calculation:
150
+
151
+ ```
152
+ total = unit + integration + e2e
153
+ unit_ratio = unit / total
154
+ integration_ratio = integration / total
155
+ e2e_ratio = e2e / total
156
+ ```
157
+
158
+ ### 3.1 Targets (warn outside these ranges)
159
+
160
+ - `unit_ratio ≥ 60%` (ideal 70%)
161
+ - `integration_ratio ∈ [15%, 30%]`
162
+ - `e2e_ratio ≤ 15%` (ideal 10%)
163
+
164
+ **Hard-fail only on `e2e_ratio > 30%`.** Above that = architectural smell — the team is testing through the top because the domain is poorly modeled.
165
+
166
+ ### 3.2 gate-keeper report line
167
+
168
+ ```
169
+ Pyramid: unit 72% (180) | integration 22% (55) | e2e 6% (15) → balanced
170
+ ```
171
+
172
+ or
173
+
174
+ ```
175
+ Pyramid: unit 45% (90) | integration 20% (40) | e2e 35% (70) → RED: e2e_ratio > 30%
176
+ ```
177
+
178
+ ### 3.3 Fixing high `e2e_ratio`
179
+
180
+ The cure is **never** deleting E2E tests. Instead:
181
+
182
+ 1. Identify E2E that duplicates integration coverage — promote to integration test (Testcontainers).
183
+ 2. Identify E2E that duplicates unit coverage — promote to unit test.
184
+ 3. Domain modeling review — if behaviors only assertable end-to-end, the domain has anemic abstractions.
185
+
186
+ The hook `block-test-deletion.sh` (when implemented) refuses `rm` on test files without an ADR.
187
+
188
+ ---
189
+
190
+ ## 4. Who consults this skill
191
+
192
+ - `qa-engineer` agent — reads this when authoring new a11y tests, configuring jest-axe, or interpreting violations.
193
+ - `gate-keeper` agent — reads this when computing pyramid ratio, running lhci, or formatting reports.
194
+ - `auto-test-guard` skill — references this in `resources/senior-gate.md`.
195
+ - `prd-ready-check` skill — consults thresholds when deciding GO/NO-GO.
196
+
197
+ ## 5. References
198
+
199
+ - ADR-007 (Senior+ gate: a11y + Lighthouse + pyramid thresholds)
200
+ - ADR-008 (Standard senior+ pipeline — when this skill is consulted in the flow)
201
+ - `.claude/agents/qa-engineer.md` (test author — slim version after this pack was extracted)
202
+ - `.claude/agents/gate-keeper.md` (gate runner)
203
+ - `.claude/skills/auto-test-guard/resources/senior-gate.md` (gate manifest)