@eltonssouza/development-utility-kit 1.0.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 (137) hide show
  1. package/.claude/agents/analyst.md +198 -0
  2. package/.claude/agents/backend-developer.md +126 -0
  3. package/.claude/agents/brain-keeper.md +229 -0
  4. package/.claude/agents/code-reviewer.md +181 -0
  5. package/.claude/agents/database-engineer.md +94 -0
  6. package/.claude/agents/devops-engineer.md +141 -0
  7. package/.claude/agents/frontend-developer.md +97 -0
  8. package/.claude/agents/gate-keeper.md +118 -0
  9. package/.claude/agents/migrator.md +291 -0
  10. package/.claude/agents/mobile-developer.md +80 -0
  11. package/.claude/agents/n8n-specialist.md +94 -0
  12. package/.claude/agents/product-owner.md +115 -0
  13. package/.claude/agents/qa-engineer.md +232 -0
  14. package/.claude/agents/release-engineer.md +204 -0
  15. package/.claude/agents/scaffold.md +87 -0
  16. package/.claude/agents/security-engineer.md +199 -0
  17. package/.claude/agents/sprint-runner.md +44 -0
  18. package/.claude/agents/stack-resolver.md +84 -0
  19. package/.claude/agents/tech-lead.md +182 -0
  20. package/.claude/agents/update-template.md +54 -0
  21. package/.claude/agents/ux-designer.md +118 -0
  22. package/.claude/settings.json +44 -0
  23. package/.claude/skills/README.md +332 -0
  24. package/.claude/skills/active-project/SKILL.md +129 -0
  25. package/.claude/skills/api-integration-test/SKILL.md +64 -0
  26. package/.claude/skills/auto-test-guard/SKILL.md +237 -0
  27. package/.claude/skills/auto-test-guard/resources/backend-tests.md +20 -0
  28. package/.claude/skills/auto-test-guard/resources/e2e-tests.md +24 -0
  29. package/.claude/skills/auto-test-guard/resources/execution-report.md +49 -0
  30. package/.claude/skills/auto-test-guard/resources/frontend-tests.md +18 -0
  31. package/.claude/skills/auto-test-guard/resources/initial-setup.md +108 -0
  32. package/.claude/skills/auto-test-guard/resources/run-suite.md +48 -0
  33. package/.claude/skills/auto-test-guard/resources/senior-gate.md +19 -0
  34. package/.claude/skills/brain-keeper/SKILL.md +60 -0
  35. package/.claude/skills/brain-keeper/obsidian/app.json +9 -0
  36. package/.claude/skills/brain-keeper/obsidian/appearance.json +4 -0
  37. package/.claude/skills/brain-keeper/obsidian/core-plugins.json +20 -0
  38. package/.claude/skills/brain-keeper/obsidian/daily-notes.json +5 -0
  39. package/.claude/skills/brain-keeper/obsidian/graph.json +32 -0
  40. package/.claude/skills/brain-keeper/obsidian/snippets/folder-colors.css +90 -0
  41. package/.claude/skills/brain-keeper/obsidian/templates.json +5 -0
  42. package/.claude/skills/brain-keeper/templates/README.md +51 -0
  43. package/.claude/skills/brain-keeper/templates/adr.md +40 -0
  44. package/.claude/skills/brain-keeper/templates/bug.md +35 -0
  45. package/.claude/skills/brain-keeper/templates/daily.md +38 -0
  46. package/.claude/skills/brain-keeper/templates/feature.md +62 -0
  47. package/.claude/skills/brain-keeper/templates/meeting.md +34 -0
  48. package/.claude/skills/brain-keeper/templates/tech-debt.md +21 -0
  49. package/.claude/skills/caveman/SKILL.md +187 -0
  50. package/.claude/skills/create-stack-pack/SKILL.md +281 -0
  51. package/.claude/skills/grill-me/SKILL.md +79 -0
  52. package/.claude/skills/honcho-memory/SKILL.md +207 -0
  53. package/.claude/skills/honcho-memory/docs/api-endpoints-verified.md +75 -0
  54. package/.claude/skills/honcho-memory/hooks/on-prompt-submit.js +221 -0
  55. package/.claude/skills/honcho-memory/hooks/on-stop.js +193 -0
  56. package/.claude/skills/honcho-memory/lib/honcho-client.js +363 -0
  57. package/.claude/skills/honcho-memory/lib/memory-injector.js +93 -0
  58. package/.claude/skills/honcho-memory/package.json +32 -0
  59. package/.claude/skills/honcho-memory/scripts/cli.js +370 -0
  60. package/.claude/skills/honcho-memory/scripts/setup.js +109 -0
  61. package/.claude/skills/honcho-memory/tests/t001-api-endpoints-verified.test.js +89 -0
  62. package/.claude/skills/honcho-memory/tests/t002-structure.test.js +97 -0
  63. package/.claude/skills/honcho-memory/tests/t003-honcho-client.test.js +162 -0
  64. package/.claude/skills/honcho-memory/tests/t004-soft-delete.test.js +259 -0
  65. package/.claude/skills/honcho-memory/tests/t005-memory-injector.test.js +175 -0
  66. package/.claude/skills/honcho-memory/tests/t006-on-prompt-submit.test.js +215 -0
  67. package/.claude/skills/honcho-memory/tests/t007-on-stop.test.js +165 -0
  68. package/.claude/skills/honcho-memory/tests/t008-cli.test.js +214 -0
  69. package/.claude/skills/honcho-memory/tests/t009-setup.test.js +232 -0
  70. package/.claude/skills/honcho-memory/tests/t010-skill-md.test.js +114 -0
  71. package/.claude/skills/honcho-memory/tests/t011-settings-hooks.test.js +105 -0
  72. package/.claude/skills/honcho-memory/tests/t012-docs-update.test.js +106 -0
  73. package/.claude/skills/honcho-memory/tests/t013-smoke-e2e.test.js +90 -0
  74. package/.claude/skills/pair-debug/SKILL.md +288 -0
  75. package/.claude/skills/prd-ready-check/SKILL.md +58 -0
  76. package/.claude/skills/project-manager/SKILL.md +167 -0
  77. package/.claude/skills/quality-standards/SKILL.md +201 -0
  78. package/.claude/skills/quick-feature/SKILL.md +264 -0
  79. package/.claude/skills/run-sprint/SKILL.md +342 -0
  80. package/.claude/skills/scaffold/SKILL.md +58 -0
  81. package/.claude/skills/stack-discovery/SKILL.md +159 -0
  82. package/.claude/skills/test-coverage-auditor/SKILL.md +59 -0
  83. package/.claude/skills/to-issues/SKILL.md +163 -0
  84. package/.claude/skills/to-prd/SKILL.md +130 -0
  85. package/.claude/skills/update-template/SKILL.md +254 -0
  86. package/.claude/stacks/CODEOWNERS +30 -0
  87. package/.claude/stacks/README.md +88 -0
  88. package/.claude/stacks/_template.md +116 -0
  89. package/.claude/stacks/java/spring-boot-3.md +376 -0
  90. package/.claude/stacks/java/spring-boot-4.md +438 -0
  91. package/.claude/stacks/typescript/angular-18.md +420 -0
  92. package/.claude/stacks/typescript/angular-19.md +397 -0
  93. package/.claude/stacks/typescript/angular-21.md +494 -0
  94. package/CLAUDE.md +453 -0
  95. package/README.md +391 -0
  96. package/bin/cli.js +773 -0
  97. package/bin/lib/backup.js +62 -0
  98. package/bin/lib/detect-stack.js +476 -0
  99. package/bin/lib/help.js +233 -0
  100. package/bin/lib/identity.js +108 -0
  101. package/bin/lib/local-dir.js +69 -0
  102. package/bin/lib/manifest.js +236 -0
  103. package/bin/lib/sync-all.js +394 -0
  104. package/bin/lib/version-check.js +398 -0
  105. package/dashboard/db.js +199 -0
  106. package/dashboard/package.json +22 -0
  107. package/dashboard/public/app.js +709 -0
  108. package/dashboard/public/content/docs/agents-reference.en.md +911 -0
  109. package/dashboard/public/content/docs/architecture-overview.en.md +260 -0
  110. package/dashboard/public/content/docs/autonomy-matrix.en.md +186 -0
  111. package/dashboard/public/content/docs/git-flow.en.md +525 -0
  112. package/dashboard/public/content/docs/honcho-memory.en.md +394 -0
  113. package/dashboard/public/content/docs/hooks-reference.en.md +420 -0
  114. package/dashboard/public/content/docs/pipeline.en.md +400 -0
  115. package/dashboard/public/content/docs/quality-gate.en.md +315 -0
  116. package/dashboard/public/content/docs/skills-reference.en.md +500 -0
  117. package/dashboard/public/content/docs/stack-rules.en.md +362 -0
  118. package/dashboard/public/content/docs/troubleshooting.en.md +637 -0
  119. package/dashboard/public/content/manifest.json +102 -0
  120. package/dashboard/public/content/manual/backend.en.md +1138 -0
  121. package/dashboard/public/content/manual/existing-project.en.md +831 -0
  122. package/dashboard/public/content/manual/frontend.en.md +1065 -0
  123. package/dashboard/public/content/manual/fullstack.en.md +1508 -0
  124. package/dashboard/public/content/manual/mobile.en.md +866 -0
  125. package/dashboard/public/index.html +108 -0
  126. package/dashboard/public/style.css +610 -0
  127. package/dashboard/public/vendor/marked.min.js +69 -0
  128. package/dashboard/rtk.js +143 -0
  129. package/dashboard/server-app.js +403 -0
  130. package/dashboard/server.js +104 -0
  131. package/dashboard/test/sprint1.test.js +406 -0
  132. package/dashboard/test/sprint2.test.js +571 -0
  133. package/dashboard/test/sprint3.test.js +560 -0
  134. package/package.json +33 -0
  135. package/scripts/hooks/subagent-telemetry.sh +14 -0
  136. package/scripts/hooks/telemetry-writer.js +250 -0
  137. package/scripts/latest-versions.json +56 -0
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: api-integration-test
3
+ description: Use to validate that backend and frontend talk correctly BEFORE the production gate. Triggers on phrases like "test the integration", "validate that the front is calling the API", "spin everything up and test the flow", "smoke test", "verify that the screen actually works", "open the browser and test", "do the quick E2E". This skill brings up the backend (mvn spring-boot:run or docker compose), brings up the frontend (ng serve), hits the endpoints with curl, opens a headless browser via Chrome MCP, runs the main flows, validates the console has no errors, and validates the network has no failing requests. It does not replace prd-ready-check (which is the formal gate); it serves to shorten the feedback loop during implementation. Do NOT use for unit tests (use auto-test-guard) nor for the final production gate (use prd-ready-check). PT triggers: 'testa a integração', 'valida que o front tá chamando a API', 'sobe tudo e testa', 'smoke test', 'verifica se a tela funciona', 'abre o browser e testa', 'faz o E2E rápido'.
4
+ ---
5
+
6
+ # API Integration Test — End-to-End Validation
7
+
8
+ Skill that invokes the `api-integration-test` agent. Always reply in **American English**.
9
+
10
+ ---
11
+
12
+ ## When to trigger
13
+
14
+ - "test the integration", "validate that the front is calling the API"
15
+ - "spin everything up and test the flow", "smoke test"
16
+ - "verify that the screen actually works", "open the browser and test"
17
+ - "do the quick E2E"
18
+ - PT: "testa a integração", "sobe tudo e testa", "verifica se a tela funciona", "faz o E2E rápido"
19
+
20
+ ## 2. When NOT to trigger
21
+
22
+ ## Prerequisites
23
+
24
+ - `gate-keeper` (auto-test-guard) has run and returned GREEN on the current code.
25
+ - Backend and frontend code compile locally without errors.
26
+ - Docker (or local Postgres/Redis) is available for dependent services.
27
+ - Chrome MCP extension is installed and connected (for browser validation).
28
+
29
+ ---
30
+
31
+ ## Do NOT use for
32
+
33
+ - Unit or integration tests — use `gate-keeper` (auto-test-guard skill).
34
+ - The final production gate — use `prd-ready-check`.
35
+ - Writing test code — use `qa-engineer` / `backend-developer` / `frontend-developer`.
36
+
37
+ 1. `navigate` to each main screen.
38
+ 2. `read_console_messages` — assert zero errors.
39
+ 3. `read_network_requests` — assert zero unexpected 4xx/5xx, zero asset 404.
40
+ 4. Run minimum CRUD flow: create → list → edit → delete.
41
+
42
+ ## Dispatch
43
+
44
+ ```
45
+ Task(
46
+ subagent_type: "api-integration-test",
47
+ description: "Boot backend and frontend, fire curl against main endpoints, open browser via Chrome MCP, validate console and network. Report OK/FAIL per check.",
48
+ prompt: "<full user message + list of endpoints and flows to validate>"
49
+ )
50
+ ```
51
+
52
+ 1. **Never "prove it's OK" by reading code only** — must boot and observe live.
53
+ 2. **Zero console errors** is a hard requirement.
54
+ 3. **Tear down processes on exit** (even on failure — use `trap`).
55
+ 4. **Document tested URLs, methods, responses** in the report.
56
+ 5. **Failure returns to specialist**, not to human — dispatch `backend-developer` or `frontend-developer` based on which side failed.
57
+
58
+ ## Handoff
59
+
60
+ The `api-integration-test` agent (`.claude/agents/api-integration-test.md`, model: sonnet) owns the complete execution contract:
61
+ - Boot sequence (backend, frontend, dependent services).
62
+ - Curl smoke test scripts and per-endpoint assertions.
63
+ - Chrome MCP browser flows and console/network validation.
64
+ - Final integration report format and failure handling.
@@ -0,0 +1,237 @@
1
+ ---
2
+ name: auto-test-guard
3
+ description: Use ALWAYS at the end of every implemented task/feature to (1) AUTOMATICALLY GENERATE missing tests for the new code, (2) RUN the project's full regression suite, and (3) VALIDATE the senior+ quality gate (coverage >= 85%, PIT mutation score >= 70%, SpotBugs/SonarLint with no CRITICAL/HIGH, OWASP dependency-check with no CVSS >= 7.0). Triggers when the user says "run the tests", "generate the tests", "make sure nothing broke", "validate the task", "run the regression", "test everything", "full suite", "check that I didn't break anything", "end of task", "auto-test", "create tests for this feature", "validate the senior+ gate" — OR when a task/sprint finishes inside run-sprint and run-sprint. Generates JUnit 5 + Mockito + Testcontainers (backend), Jest + Testing Library (frontend), and Playwright (E2E) for the new code; then executes mvn verify (test + jacoco + pitest) + spotbugs + owasp + npm test + playwright across the WHOLE project. DO NOT use to audit technical debt (use test-coverage-auditor). DO NOT use as the final production gate (use prd-ready-check, which assumes this skill already passed). PT triggers: 'roda os testes', 'gera os testes', 'garante que nada quebrou', 'valida a tarefa', 'roda a regressão', 'testa tudo', 'suite completa', 'confere se não quebrei nada', 'fim de tarefa', 'cria testes pra essa feature'.
4
+ ---
5
+
6
+ # Auto-Test Guard — Generate tests + run full regression + senior+ gate
7
+
8
+ > **Subagent dispatch (mandatory).** Do NOT execute this skill inline in the calling session. Use the Task tool with `subagent_type: "gate-keeper"` so the gate runs in the Sonnet subagent declared in `.claude/agents/gate-keeper.md`. Test-writing delegations to `backend-developer` / `frontend-developer` MUST also use the Task tool with the matching `subagent_type`. Inline execution bills the parent (Opus) and violates the routing matrix in CLAUDE.md.
9
+
10
+ You are the automated testing safety net — operating at the **senior+** level.
11
+
12
+ Your mission, in one line: **every completed task ships with automated tests generated for the new code, a green regression suite across the whole project, AND the senior+ quality gate approved** (coverage >= 85%, mutation score >= 70%, clean static analysis, no high-risk CVEs). If any item fails — test, threshold, lint, security — the task **is not done**.
13
+
14
+ Principle: *"senior+ quality is non-negotiable; debt becomes an ADR with a deadline, never silent tolerance."* The difference vs. `test-coverage-auditor`: **this skill writes, executes, and validates the gate**; the other audits what was missing.
15
+
16
+ ---
17
+
18
+ ## Step 0 — Stack pre-resolution (NON-NEGOTIABLE, per ADR-026 Layer 1)
19
+
20
+ **Runs BEFORE every other phase in this skill.** Determines which stack pack must be injected into the prompt of every downstream agent spawned by this skill (`qa-engineer`, `backend-developer`, `frontend-developer`, `gate-keeper`). Without this step, downstream agents fall back to baked-in defaults (e.g. JUnit 5 + Maven assumptions) that may not match the project's actual stack (e.g. JUnit 4, Gradle, pytest, vitest, etc.).
21
+
22
+ ### 0.a — Invoke `stack-resolver`
23
+
24
+ ```
25
+ Task(
26
+ subagent_type="stack-resolver",
27
+ description="resolve stack for project",
28
+ prompt="Resolve the stack for the project at the current working directory. Read CLAUDE.md > Project Identity, identify primary stack (lang + framework + major version), check whether the matching pack exists under .claude/stacks/<lang>/<framework>-<major>.md, and emit the canonical STACK CONTEXT block as your output."
29
+ )
30
+ ```
31
+
32
+ ### 0.b — Parse the resolver output
33
+
34
+ The resolver's first line is the marker:
35
+
36
+ - `[STACK: <lang>/<framework>-<major> | PACK: loaded]` — extract the full **STACK CONTEXT** block (versions, build commands, test runners, coverage tooling, lint commands, static analysis plugins, dependency scanners) from the body and keep it in memory for Steps 3.2 onward. Proceed to Step 1.
37
+ - `[STACK: <lang>/<framework>-<major> | PACK: none]` — the project's declared stack has no pack yet. **Stop the gate** and dispatch the `create-stack-pack` skill:
38
+ ```
39
+ Skill(name="create-stack-pack")
40
+ ```
41
+ Once the pack has been generated and committed, **repeat Step 0.a**. Do NOT proceed — running `gate-keeper` with stale defaults will run the wrong commands and produce a false GREEN.
42
+ - `[STACK: unknown | ...]` or no marker — the resolver could not parse `Project Identity`. Report this back to the caller and ask the user to populate `## Project Identity` in `CLAUDE.md`. Do not proceed.
43
+
44
+ ### 0.c — Capture the STACK CONTEXT for downstream injection
45
+
46
+ Store the entire STACK CONTEXT block returned by the resolver. It will be **prepended to every downstream Task prompt** spawned by this skill — `qa-engineer`, `backend-developer`, `frontend-developer`, and the recursive `gate-keeper` self-dispatch (when applicable).
47
+
48
+ > Stage 0 runs before any of the flows described in Section 1 onward and before the example in Section 8 — those examples assume `<STACK CONTEXT>` has already been captured.
49
+
50
+ ---
51
+
52
+ ## 1. When it triggers
53
+
54
+ ### 1.1. Automatically (inside pipelines)
55
+
56
+ This skill is **always invoked via `Task(subagent_type="gate-keeper", ...)`**, never inline. The orchestrator (`run-sprint` skill or `sprint-runner` agent) spawns this agent so the senior+ gate runs on the Sonnet model and isolates token cost from the orchestrator session. The orchestrator is responsible for prepending the STACK CONTEXT (captured in its own Step 0) to the prompt of this dispatch.
57
+
58
+ - **`run-sprint`** — spawns at the end of **each task** in the sprint, before marking it complete.
59
+ - **`run-sprint`** — spawns right after Stage 3 (Implementation), before entering Stage 4 (Integration).
60
+
61
+ This is the hard line: **no task is "done" without going through here**.
62
+
63
+ ### 1.1.1. Sub-spawn rules (inside this skill)
64
+
65
+ When generating tests, this skill MAY further spawn the agents below. Every prompt MUST be prefixed with the STACK CONTEXT captured in Step 0.c:
66
+
67
+ - `Task(subagent_type="backend-developer", prompt="""<STACK CONTEXT>\n\n---\n\nwrite integration test for <class> covering <scenarios> using the test infra declared in STACK CONTEXT""")` — non-trivial integration test details.
68
+ - `Task(subagent_type="frontend-developer", prompt="""<STACK CONTEXT>\n\n---\n\nwrite spec for <component> covering <scenarios> using the test runner declared in STACK CONTEXT""")` — non-trivial component test details.
69
+ - `Task(subagent_type="qa-engineer", prompt="""<STACK CONTEXT>\n\n---\n\nwrite E2E for user story <slug> using the E2E runner declared in STACK CONTEXT""")` — E2E scenarios.
70
+
71
+ Every spawned agent's first output line MUST be `[STACK: <lang>/<framework>-<major> | PACK: loaded]` (ADR-026 Layer 3 post-hoc validation). If absent, re-invoke once with an enforcing reminder.
72
+
73
+ Bash for build/test/coverage runs uses the commands declared in the STACK CONTEXT pack — deterministic execution, not authoring.
74
+
75
+ ### 1.2. Explicitly by the user
76
+
77
+ Triggers: "run the tests", "generate tests for task X", "test everything", "validate the regression", "check that I didn't break anything", "full suite", "auto-test", "safety net", "run the auto-test-guard", "validate the senior+ gate".
78
+
79
+ ### 1.3. When it does NOT trigger
80
+
81
+ - **Trivial fix to documentation, comment, typo in README** -> doesn't change behavior, skip.
82
+ - **Pure formatting change** (prettier, spotless) -> run lint only, no need for the full suite.
83
+ - **WIP/draft branch** -> the user is explicit: "not ready yet". Run only at the end.
84
+
85
+ ---
86
+
87
+ ## 2. Required inputs
88
+
89
+ - Project type (`CLAUDE.md` -> `> **Project type**:` block).
90
+ - STACK CONTEXT (captured in Step 0.c).
91
+ - Scope of the latest task: obtain via `git status` + `git diff --name-only HEAD~1..HEAD` (or against base branch if there's no commit yet).
92
+ - List of new/modified files in the source paths declared in STACK CONTEXT (e.g. backend source dir, frontend app dir).
93
+
94
+ ---
95
+
96
+ ## 3. Step by step
97
+
98
+ ### 3.1. Detect the task scope
99
+
100
+ ```bash
101
+ # Inside the project
102
+ git diff --name-only HEAD~1..HEAD 2>/dev/null \
103
+ || git diff --name-only --cached \
104
+ || git status --porcelain | awk '{print $2}'
105
+ ```
106
+
107
+ Split into three lists, using the source paths declared in the STACK CONTEXT pack:
108
+
109
+ - **backend_changed** — backend source files + migration files (paths per STACK CONTEXT)
110
+ - **frontend_changed** — frontend source files excluding spec files (paths per STACK CONTEXT)
111
+ - **e2e_flow** — inferred from the BDD user stories of the current plan (if any) and from the screens/endpoints touched
112
+
113
+ If no production file changed, **stop** and report: "nothing new to test; running only the existing suite + senior+ gate".
114
+
115
+ ### 3.2. Generate backend tests
116
+
117
+ See [`resources/backend-tests.md`](resources/backend-tests.md) — universal rules per architectural layer (controller, service, repository, domain), naming convention, validation cases, error-response assertions, mutant-killer mindset. **The concrete test framework, assertion library, and integration-test infra come from the STACK CONTEXT pack** (e.g. JUnit 5 + Mockito + Testcontainers for Java/Spring; pytest + httpx for FastAPI; Jest + supertest for Node). Spawn `backend-developer` for non-trivial cases, with STACK CONTEXT prepended.
118
+
119
+ ### 3.3. Generate frontend tests
120
+
121
+ See [`resources/frontend-tests.md`](resources/frontend-tests.md) — universal matrix per component type, state, a11y selectors, coverage targets. **The concrete test runner and component-testing library come from the STACK CONTEXT pack** (e.g. Jest + Testing Library for Angular/React; vitest for Vite-based apps). Spawn `frontend-developer` for non-trivial cases, with STACK CONTEXT prepended.
122
+
123
+ ### 3.4. Generate E2E test (Playwright)
124
+
125
+ See [`resources/e2e-tests.md`](resources/e2e-tests.md) — Playwright spec template, 1-test-per-BDD-user-story rule, stable selectors, real-login policy, Chrome MCP console capture. Spawn `qa-engineer` for the spec, with STACK CONTEXT prepended.
126
+
127
+ ### 3.5. Run the FULL regression suite + senior+ gate
128
+
129
+ See [`resources/run-suite.md`](resources/run-suite.md) — the 8-stage execution order. The **concrete commands** for each stage (build, test, coverage, mutation, static analysis, dependency scan, lint, prod build, E2E) come from the STACK CONTEXT pack. Stop at the first red.
130
+
131
+ ### 3.6. Senior+ gate — REQUIRED thresholds
132
+
133
+ See [`resources/senior-gate.md`](resources/senior-gate.md) — complete threshold table for coverage, mutation, static analysis, CVEs, lint, E2E and browser console. **Thresholds are universal (ADR-007); the tools that produce the numbers come from the STACK CONTEXT pack.**
134
+
135
+ ### 3.7. Initial setup (first time on the project)
136
+
137
+ See [`resources/initial-setup.md`](resources/initial-setup.md) — plugin/config bootstrap. The exact files and plugins to add depend on the STACK CONTEXT pack (e.g. `pom.xml` + JaCoCo/PIT/SpotBugs/OWASP DC for Java/Maven; `package.json` + jest/vitest coverage config + `npm audit` for Node; `pyproject.toml` + coverage.py + bandit + pip-audit for Python). Install without asking — it's a standard senior+ technical decision; record as a `tech-lead` ADR.
138
+
139
+ ### 3.8. Execution report
140
+
141
+ See [`resources/execution-report.md`](resources/execution-report.md) — exact markdown block format with tests-generated / files-created / regression-suite / senior+ gate table / GREEN-or-RED verdict. Include the resolved stack at the top of the report.
142
+
143
+ ---
144
+
145
+ ## 4. If it breaks — fix it, don't mask
146
+
147
+ If any test fails (new or old) or any gate threshold fails:
148
+
149
+ 1. **NEVER** mark the task as done.
150
+ 2. **NEVER** comment/`@Disable`/`.skip()` to "make it pass".
151
+ 3. **NEVER** lower the coverage threshold, mutation score, or accept a high CVE without an explicit ADR.
152
+ 4. Classify the failure:
153
+ - **New test failing** -> real bug in the new code -> send back to `backend-developer` / `frontend-developer` (with STACK CONTEXT prepended) to fix.
154
+ - **Old test failing** -> the new task **broke regression** -> fixing the regression is part of the task, period.
155
+ - **Surviving mutant** -> weak test -> reinforce with boundary assertions, negative conditions, swapped returns.
156
+ - **HIGH/CRITICAL CVE in the dependency scanner declared in STACK CONTEXT** -> bump the lib OR record a suppression with **a justifying ADR** (rare: only if confirmed false positive).
157
+ - **CRITICAL static-analysis finding** -> fix the flagged code, no exception.
158
+ 5. **You decide the fix and hand it back to the specialist**, do not ask the human.
159
+ 6. When fixing, **rerun the suite from scratch** using the STACK CONTEXT commands. Don't assume that just rerunning the specific test is enough.
160
+
161
+ ---
162
+
163
+ ## 5. Required outputs
164
+
165
+ 1. **New test files** committed (even if the task hasn't made the final commit yet — they're part of the diff).
166
+ 2. **Green suite + green senior+ gate** across the whole project.
167
+
168
+ ```markdown
169
+ ### Auto-test guard — <HH:MM>
170
+ - Stack: <lang>/<framework>-<major> (pack: loaded)
171
+ - Task: <title>
172
+ - Tests generated: N (backend), M (frontend), K (E2E)
173
+ - Suite: OK build, OK test, OK coverage, OK mutation, OK static analysis, OK dep scan, OK E2E
174
+ - Coverage: backend=X% (mutation Y%), frontend=Z%
175
+ - Vulnerabilities: 0 high/critical
176
+ ```
177
+
178
+ ---
179
+
180
+ ## 6. Interface with other skills
181
+
182
+ | Skill | Role |
183
+ |---|---|
184
+ | `run-sprint` | **Calls this skill at the end of each task.** If this returns RED, the sprint does not advance. `run-sprint` is responsible for prepending STACK CONTEXT to the dispatch. |
185
+ | `run-sprint` | Calls in Stage 3 (at the end of implementation) before moving on to integration. |
186
+ | `backend-developer` | This skill **delegates writing complex backend tests** here when it needs detail specific to the test infra declared in STACK CONTEXT. |
187
+ | `frontend-developer` | This skill **delegates writing frontend tests** here when it needs detail specific to the test runner declared in STACK CONTEXT. |
188
+ | `stack-resolver` | Invoked in Step 0 to resolve the active stack pack. |
189
+ | `create-stack-pack` | Invoked from Step 0.b when the project's declared stack has no pack yet. |
190
+ | `api-integration-test` | **Real** integration validation (curl + Chrome MCP in dev environment). This skill handles **automated** tests; the other handles **automatable exploratory** tests in a real environment. |
191
+ | `test-coverage-auditor` | Complementary. This one generates+runs+validates the gate; the other **audits** what was left without an automated test and what became "recurring manual". |
192
+ | `prd-ready-check` | Assumes this skill **already ran** and went green. If it didn't run, the gate automatically returns NO-GO. |
193
+
194
+ ---
195
+
196
+ ## 7. Inviolable rules
197
+
198
+ 1. **Stage 0 (Stack pre-resolution) is non-skippable.** No Task dispatch or `Bash` run happens before STACK CONTEXT is captured. Pack missing -> `create-stack-pack` first.
199
+ 2. **Every downstream Task dispatch carries STACK CONTEXT as the first block of its prompt.** No exceptions.
200
+ 3. **Task without green suite + green senior+ gate = task not done.** No exceptions.
201
+ 4. **NEVER delete, disable (`@Disabled`/`.skip()`), comment out, or move a test to make the gate pass — NON-NEGOTIABLE.** A red test is fixed (production code or the test itself, the latter with an ADR) or reported as a real failure. Disabling requires a formal ADR + deadline to reactivate. Deleting a test to "go green" is a silent gate bypass — the hook `block-test-deletion.sh` enforces this at the filesystem level.
202
+ 5. **Never generate a "just-passing" test** (without real assertions or duplicating the code under test). A test that can't break = a useless test.
203
+ 6. **Never generate a test without naming the behavior** in descriptive English.
204
+ 7. **The suite runs across the WHOLE project**, not just the touched modules. Regression catches what you didn't anticipate.
205
+ 8. **Chrome MCP for E2E console**: zero console errors is a requirement, not optional.
206
+ 9. **Once coverage goes up, never down.** If the task lowered %, the reason goes into `tech-debt.md` P0 with a deadline.
207
+ 10. **Mutation score never goes down.** Surviving mutant = weak test to fix, not debt.
208
+ 11. **HIGH/CRITICAL CVE never passes.** Bump the lib or record a suppression with an ADR.
209
+ 12. **You decide and hand it back to the specialist** — never ask the human if "it can pass anyway".
210
+ 13. **English** in test names and descriptions.
211
+
212
+ ---
213
+
214
+ ## 8. Example interaction (inside `run-sprint`)
215
+
216
+ **Context**: `run-sprint` just implemented the "create-product-backend" task. Assume Step 0 already resolved the stack as `java/spring-boot-4` with pack loaded; STACK CONTEXT is in memory. (Stage 0 runs before this example.)
217
+
218
+ **This skill**:
219
+ 1. `git diff --name-only` -> detects 6 new files in the backend source dir declared in STACK CONTEXT.
220
+ 2. For each class, generates the corresponding test file using the test infra from STACK CONTEXT. `qa-engineer` / `backend-developer` spawns receive STACK CONTEXT prepended.
221
+ 3. Runs the build+test+coverage command from STACK CONTEXT -> **124/124 OK** | coverage 87% | mutation 73%.
222
+ 4. Runs the static-analysis command from STACK CONTEXT -> **OK 0 critical**.
223
+ 5. Runs the dependency-scan command from STACK CONTEXT -> **OK 0 CVE >= 7.0**.
224
+ 6. Runs the frontend test command from STACK CONTEXT -> **87/87 OK** | coverage 89%.
225
+ 7. Runs the E2E command from STACK CONTEXT (Playwright) -> **12/12 OK**, clean console.
226
+ 8. Returns **GREEN** -> `run-sprint` marks the task as done.
227
+
228
+ ---
229
+
230
+ ## 9. When NOT to use this skill
231
+
232
+ - **Audit of technical debt / recurring manual** -> `test-coverage-auditor`.
233
+ - **Bring up backend+frontend and click through real screens** -> `api-integration-test`.
234
+ - **Final release gate to PRD** -> `prd-ready-check`.
235
+ - **Write a specific complex test that was already requested in isolation** -> `backend-developer` or `frontend-developer` directly.
236
+ - **Project still without scaffolding** -> `bootstrap-*` first.
237
+
@@ -0,0 +1,20 @@
1
+ # Backend tests (auto-test-guard)
2
+
3
+ For each **new or modified class** in `backend/src/main/java`:
4
+
5
+ | Layer | Required test | Tool | Structure |
6
+ |---|---|---|---|
7
+ | `domain/` (entities, VOs, domain services) | Invariant and behavior tests | Pure JUnit 5 | `backend/src/test/java/<package>/<Class>Test.java` |
8
+ | `application/` (use cases, services, mappers) | Unit tests with port mocks | JUnit 5 + Mockito | `backend/src/test/java/<package>/<Class>Test.java` |
9
+ | `infrastructure/` (JPA adapters, HTTP clients) | Integration tests with Testcontainers | JUnit 5 + Testcontainers (Postgres) | `backend/src/test/java/<package>/<Class>IT.java` |
10
+ | `web/` (controllers, @ControllerAdvice) | `@WebMvcTest` + `MockMvc` | Spring Test | `backend/src/test/java/<package>/<Controller>Test.java` |
11
+
12
+ Rules:
13
+
14
+ - **Descriptive English naming** in the test method: `@DisplayName("should return 404 when product does not exist")`, method `shouldReturn404WhenProductDoesNotExist()`.
15
+ - **Given / When / Then** in comments (or using `// given`, `// when`, `// then`).
16
+ - **Bean Validation**: for each `@NotBlank`, `@NotNull`, `@Email`, `@Size` on the request DTO, a negative case.
17
+ - **ProblemDetail**: controller tests validate `application/problem+json` with the RFC 9457 fields.
18
+ - **No `Thread.sleep`**, no silent `@Disabled`.
19
+ - **Delegate** detailed implementation via `Task(subagent_type="backend-developer", ...)` if the tests are complex — but the responsibility for **deciding what to test** is `auto-test-guard`'s.
20
+ - **Mutant-killer**: when generating a test, think "what mutation does this test catch?" — boundary, negation, swapped return, inverted conditional. Each surviving mutant is a weak test.
@@ -0,0 +1,24 @@
1
+ # E2E tests (auto-test-guard)
2
+
3
+ For each new **BDD user story** in the current plan, create a file `frontend/e2e/<slug>.spec.ts` (or `e2e/` at the root, depending on the project):
4
+
5
+ ```ts
6
+ import { test, expect } from '@playwright/test';
7
+
8
+ test.describe('<feature slug>', () => {
9
+ test('<Given/When/Then of the user story>', async ({ page }) => {
10
+ // given
11
+ // when
12
+ // then
13
+ });
14
+ });
15
+ ```
16
+
17
+ Rules:
18
+
19
+ - **1 E2E test per critical BDD user story** (not per screen).
20
+ - Use the **real login** of the dev environment (or authenticated fixture). No mocks.
21
+ - **Stable selector**: role/label/text, never CSS class.
22
+ - Assert against the **final backend state** when possible (e.g., after creating a product, navigate to the listing and see the item).
23
+ - Happy path + 1 expected error scenario per user story.
24
+ - During E2E execution, use **Chrome MCP** to capture browser console errors (`mcp__Claude_in_Chrome__read_console_messages`). Any console error = NO-GO.
@@ -0,0 +1,49 @@
1
+ # Execution report (auto-test-guard §3.8)
2
+
3
+ At the end of every run, print a block exactly in this format:
4
+
5
+ ```
6
+ ## Auto-Test Guard — Task: <title>
7
+
8
+ ### Tests generated
9
+ - Backend: N new files (domain: A, application: B, web: C, infra: D)
10
+ - Frontend: M new files (component: X, service: Y, guard: Z)
11
+ - E2E: K new Playwright scenarios
12
+
13
+ ### Files created
14
+ - backend/src/test/java/.../ProductServiceTest.java
15
+ - frontend/src/app/features/product/product.component.spec.ts
16
+ - frontend/e2e/create-product.spec.ts
17
+ - ...
18
+
19
+ ### Regression suite — FULL PROJECT
20
+ - mvn verify (test+jacoco+pit): N/N OK
21
+ - spotbugs:check: OK 0 critical / 0 high
22
+ - owasp dependency-check: OK 0 CVE >= 7.0
23
+ - npm test: M/M OK
24
+ - npm audit (high): OK
25
+ - eslint: OK 0 errors / 0 warnings
26
+ - mvn package: OK
27
+ - ng build prod: OK bundle: N KB gzipped
28
+ - playwright: K/K OK 0 console errors
29
+
30
+ ### Senior+ gate
31
+ | Metric | Value | Threshold | Status |
32
+ |--------------------|---------|-----------|--------|
33
+ | Back coverage (L) | 87.3% | >= 85% | OK |
34
+ | Back coverage (B) | 82.1% | >= 80% | OK |
35
+ | PIT mutation | 73.5% | >= 70% | OK |
36
+ | Front coverage S | 89.4% | >= 85% | OK |
37
+ | Front coverage B | 81.0% | >= 80% | OK |
38
+ | SpotBugs | 0/0 | 0 C / 0 H | OK |
39
+ | OWASP | 0 | < CVSS 7 | OK |
40
+ | npm audit | 0 | 0 H / 0 C | OK |
41
+
42
+ ### Result: GREEN — task done
43
+ OR
44
+ ### Result: RED — task NOT done
45
+ #### Failures
46
+ - <file>:<line> <class>#<test> -> <short cause> -> <next action>
47
+ - Mutation: 12 mutants survived in ProductService -> reinforce boundary tests
48
+ - OWASP: CVE-2024-XXXX in lib Y (CVSS 8.1) -> bump lib Y to v3.2.1
49
+ ```
@@ -0,0 +1,18 @@
1
+ # Frontend tests (auto-test-guard)
2
+
3
+ For each **new or modified component/service/guard** in `frontend/src/app`:
4
+
5
+ | Type | Test | Tool | File |
6
+ |---|---|---|---|
7
+ | Standalone component | Render + interactions with signals + OnPush | Jest + Testing Library (`@testing-library/angular`) | `<name>.component.spec.ts` |
8
+ | Service | HTTP calls with `HttpTestingController`, error mapping | Jest + Angular HTTP testing | `<name>.service.spec.ts` |
9
+ | Guard / Interceptor | Authorization scenarios, 401/403, redirect | Jest | `<name>.guard.spec.ts` / `<name>.interceptor.spec.ts` |
10
+ | Pipe / Directive | Direct input -> output | Jest | `<name>.pipe.spec.ts` |
11
+
12
+ Rules:
13
+
14
+ - **Never use `any`** even in tests. Explicit types.
15
+ - **Signals**: test initial state, after effect, and after reset.
16
+ - **Accessibility**: use `getByRole`, `getByLabelText` (not `getByTestId` when an accessible alternative exists).
17
+ - **Coverage target**: features + core >= **85%** statements, >= **80%** branches.
18
+ - **Delegate** complex component details via `Task(subagent_type="frontend-developer", ...)`, but decide here what needs testing.
@@ -0,0 +1,108 @@
1
+ # Initial setup (auto-test-guard §3.7) — first time on a project
2
+
3
+ If the project doesn't yet have PIT, SpotBugs, or OWASP DC configured, **you install** without asking (standard senior+ technical decision) — add to `pom.xml`:
4
+
5
+ ```xml
6
+ <plugins>
7
+ <!-- JaCoCo: coverage -->
8
+ <plugin>
9
+ <groupId>org.jacoco</groupId>
10
+ <artifactId>jacoco-maven-plugin</artifactId>
11
+ <version>0.8.12</version>
12
+ <executions>
13
+ <execution><goals><goal>prepare-agent</goal></goals></execution>
14
+ <execution><id>report</id><phase>verify</phase><goals><goal>report</goal></goals></execution>
15
+ <execution>
16
+ <id>check</id><phase>verify</phase><goals><goal>check</goal></goals>
17
+ <configuration>
18
+ <rules>
19
+ <rule>
20
+ <element>BUNDLE</element>
21
+ <limits>
22
+ <limit><counter>LINE</counter><value>COVEREDRATIO</value><minimum>0.85</minimum></limit>
23
+ <limit><counter>BRANCH</counter><value>COVEREDRATIO</value><minimum>0.80</minimum></limit>
24
+ </limits>
25
+ </rule>
26
+ </rules>
27
+ </configuration>
28
+ </execution>
29
+ </executions>
30
+ </plugin>
31
+
32
+ <!-- PIT: mutation testing -->
33
+ <plugin>
34
+ <groupId>org.pitest</groupId>
35
+ <artifactId>pitest-maven-plugin</artifactId>
36
+ <version>1.17.0</version>
37
+ <dependencies>
38
+ <dependency>
39
+ <groupId>org.pitest</groupId>
40
+ <artifactId>pitest-junit5-plugin</artifactId>
41
+ <version>1.2.1</version>
42
+ </dependency>
43
+ </dependencies>
44
+ <configuration>
45
+ <targetClasses>
46
+ <param>com.empresa.projeto.domain.*</param>
47
+ <param>com.empresa.projeto.application.*</param>
48
+ </targetClasses>
49
+ <mutationThreshold>70</mutationThreshold>
50
+ <coverageThreshold>85</coverageThreshold>
51
+ <outputFormats><outputFormat>HTML</outputFormat><outputFormat>XML</outputFormat></outputFormats>
52
+ </configuration>
53
+ <executions>
54
+ <execution><phase>verify</phase><goals><goal>mutationCoverage</goal></goals></execution>
55
+ </executions>
56
+ </plugin>
57
+
58
+ <!-- SpotBugs -->
59
+ <plugin>
60
+ <groupId>com.github.spotbugs</groupId>
61
+ <artifactId>spotbugs-maven-plugin</artifactId>
62
+ <version>4.8.6.4</version>
63
+ <configuration>
64
+ <effort>Max</effort>
65
+ <threshold>Low</threshold>
66
+ <failOnError>true</failOnError>
67
+ </configuration>
68
+ </plugin>
69
+
70
+ <!-- OWASP Dependency Check -->
71
+ <plugin>
72
+ <groupId>org.owasp</groupId>
73
+ <artifactId>dependency-check-maven</artifactId>
74
+ <version>10.0.4</version>
75
+ <configuration>
76
+ <failBuildOnCVSS>7</failBuildOnCVSS>
77
+ <suppressionFiles>
78
+ <suppressionFile>owasp-suppressions.xml</suppressionFile>
79
+ </suppressionFiles>
80
+ </configuration>
81
+ </plugin>
82
+ </plugins>
83
+ ```
84
+
85
+ For the frontend, update `jest.config.ts`:
86
+
87
+ ```ts
88
+ coverageThreshold: {
89
+ global: {
90
+ statements: 85,
91
+ branches: 80,
92
+ functions: 85,
93
+ lines: 85,
94
+ },
95
+ },
96
+ ```
97
+
98
+ And add to `package.json`:
99
+
100
+ ```json
101
+ "scripts": {
102
+ "lint": "eslint \"src/**/*.{ts,html}\" --max-warnings 0",
103
+ "test:coverage": "jest --ci --watchAll=false --coverage",
104
+ "audit:high": "npm audit --audit-level=high"
105
+ }
106
+ ```
107
+
108
+ Record this initial setup as a **technical ADR** (by the `tech-lead`): "ADR-NNN — Adoption of the senior+ gate (85% coverage, PIT 70%, SpotBugs, OWASP)".
@@ -0,0 +1,48 @@
1
+ # Run FULL regression suite + senior+ gate (auto-test-guard §3.5)
2
+
3
+ Mandatory order — **stop at the first red**:
4
+
5
+ ```bash
6
+ # 1) Backend - tests + JaCoCo coverage + PIT mutation testing (Pitest)
7
+ cd backend && ./mvnw clean verify
8
+ # -> executes: test + jacoco:report + pitest:mutationCoverage
9
+ # -> fails if: tests red, coverage < threshold, mutation score < 70%
10
+
11
+ # 2) Backend static analysis
12
+ ./mvnw spotbugs:check
13
+ # -> fails if: CRITICAL or HIGH bug
14
+
15
+ # 3) Dependency security (OWASP)
16
+ ./mvnw org.owasp:dependency-check-maven:check -DfailBuildOnCVSS=7
17
+ # -> fails if: CVE with CVSS >= 7.0 (HIGH or CRITICAL)
18
+
19
+ # 4) Frontend unit/integration + coverage
20
+ cd ../frontend && npm ci --prefer-offline
21
+ npm test -- --ci --watchAll=false --coverage
22
+ # -> fails if: tests red OR coverage < 85%/80%
23
+
24
+ # 5) Frontend lint (zero errors, zero warnings on new code)
25
+ npx eslint "src/**/*.{ts,html}" --max-warnings 0
26
+
27
+ # 6) npm audit (vulnerabilities)
28
+ npm audit --audit-level=high
29
+ # -> fails if: HIGH or CRITICAL vuln
30
+
31
+ # 7) Production build (catches errors that tests don't)
32
+ ./mvnw -f ../backend package -DskipTests
33
+ npm run build -- --configuration=production
34
+
35
+ # 8) E2E with backend + frontend running
36
+ # (Bring up via docker compose or the 2 processes; then:)
37
+ npx playwright test --project=chromium
38
+
39
+ # 9) Design anti-pattern gate (Impeccable detector — deterministic, no LLM) — per ADR-010
40
+ # (cwd is frontend/ from step 4; wrapper vendored by scaffold)
41
+ # PHASE WARN (default): report only, never blocks. Establish a baseline first.
42
+ node scripts/impeccable-gate.mjs src --mode=warn
43
+ # PHASE BLOCK (after baseline stable — see PLAN_impeccable-adoption P2):
44
+ # node scripts/impeccable-gate.mjs src --mode=block --changed-only --base=origin/develop
45
+ # Default block policy: severity === 'error'. Widen via IMPECCABLE_BLOCK_ANTIPATTERNS.
46
+ ```
47
+
48
+ During E2E, use **Chrome MCP** to capture browser console errors (`mcp__Claude_in_Chrome__read_console_messages`). Any console error = NO-GO.
@@ -0,0 +1,19 @@
1
+ # Senior+ gate — REQUIRED thresholds (auto-test-guard §3.6)
2
+
3
+ All must pass. Failure on any one = task NOT done.
4
+
5
+ | Metric | Threshold | Tool | How to measure |
6
+ |---|---|---|---|
7
+ | Backend coverage (lines) | >= **85%** | JaCoCo | `target/site/jacoco/index.html` or `jacoco.xml` |
8
+ | Backend coverage (branches) | >= **80%** | JaCoCo | Same |
9
+ | Backend mutation score | >= **70%** | PIT (Pitest) | `target/pit-reports/index.html` (focus on `domain/` and `application/`) |
10
+ | Frontend coverage (statements) | >= **85%** | Jest --coverage | `coverage/lcov-report/index.html` |
11
+ | Frontend coverage (branches) | >= **80%** | Jest --coverage | Same |
12
+ | SpotBugs (backend) | 0 CRITICAL, 0 HIGH | SpotBugs Maven plugin | `target/spotbugsXml.xml` |
13
+ | SonarLint/SonarQube (if configured) | 0 CRITICAL, 0 HIGH, 0 unreviewed hotspot | Sonar | Dashboard / `mvn sonar:sonar` |
14
+ | OWASP dependency-check | 0 CVE with CVSS >= 7.0 | OWASP DC plugin | `target/dependency-check-report.html` |
15
+ | npm audit | 0 HIGH, 0 CRITICAL | Npm | `npm audit --audit-level=high` |
16
+ | Frontend ESLint | 0 errors, 0 warnings on new code | ESLint | `eslint --max-warnings 0` |
17
+ | Playwright E2E | 100% green | Playwright | HTML report |
18
+ | Browser console during E2E | 0 errors | Chrome MCP | `read_console_messages` |
19
+ | Design anti-patterns (Impeccable) | WARN baseline → 0 blocking (severity `error` + ids) in changed files at BLOCK | `impeccable detect` via `scripts/impeccable-gate.mjs` | `node scripts/impeccable-gate.mjs src --mode=warn` → `impeccable-report.json` (ADR-010) |