@groupby/ai-dev 0.5.10 → 0.5.11

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 (61) hide show
  1. package/package.json +1 -1
  2. package/teams/fhr-neowise/commands/address-pr.md +120 -0
  3. package/teams/fhr-neowise/commands/ready-pr.md +70 -0
  4. package/teams/fhr-neowise/commands/review-pr.md +111 -0
  5. package/teams/fhr-neowise/commands/tdd-implementation.md +86 -0
  6. package/teams/fhr-neowise/commands/write-plan.md +23 -0
  7. package/teams/fhr-neowise/commands/write-pr.md +21 -0
  8. package/teams/fhr-neowise/commands/write-spec.md +25 -0
  9. package/teams/fhr-neowise/skills/agent-routing/SKILL.md +72 -0
  10. package/teams/fhr-neowise/skills/code-review/SKILL.md +83 -0
  11. package/teams/fhr-neowise/skills/code-review/review-template.md +90 -0
  12. package/teams/fhr-neowise/skills/mermaid-diagram/SKILL.md +94 -0
  13. package/teams/fhr-neowise/skills/mermaid-diagram/references/BEST_PRACTICES.md +96 -0
  14. package/teams/fhr-neowise/skills/mermaid-diagram/references/architecture.md +434 -0
  15. package/teams/fhr-neowise/skills/mermaid-diagram/references/block.md +753 -0
  16. package/teams/fhr-neowise/skills/mermaid-diagram/references/c4.md +619 -0
  17. package/teams/fhr-neowise/skills/mermaid-diagram/references/classDiagram.md +1186 -0
  18. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-configuration.md +72 -0
  19. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-directives.md +342 -0
  20. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-layouts.md +40 -0
  21. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-math.md +96 -0
  22. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-theming.md +246 -0
  23. package/teams/fhr-neowise/skills/mermaid-diagram/references/config-tidy-tree.md +89 -0
  24. package/teams/fhr-neowise/skills/mermaid-diagram/references/cynefin.md +279 -0
  25. package/teams/fhr-neowise/skills/mermaid-diagram/references/entityRelationshipDiagram.md +670 -0
  26. package/teams/fhr-neowise/skills/mermaid-diagram/references/eventmodeling.md +475 -0
  27. package/teams/fhr-neowise/skills/mermaid-diagram/references/examples.md +301 -0
  28. package/teams/fhr-neowise/skills/mermaid-diagram/references/flowchart.md +2116 -0
  29. package/teams/fhr-neowise/skills/mermaid-diagram/references/gantt.md +725 -0
  30. package/teams/fhr-neowise/skills/mermaid-diagram/references/gitgraph.md +2138 -0
  31. package/teams/fhr-neowise/skills/mermaid-diagram/references/ishikawa.md +66 -0
  32. package/teams/fhr-neowise/skills/mermaid-diagram/references/kanban.md +161 -0
  33. package/teams/fhr-neowise/skills/mermaid-diagram/references/mindmap.md +335 -0
  34. package/teams/fhr-neowise/skills/mermaid-diagram/references/packet.md +153 -0
  35. package/teams/fhr-neowise/skills/mermaid-diagram/references/pie.md +93 -0
  36. package/teams/fhr-neowise/skills/mermaid-diagram/references/quadrantChart.md +267 -0
  37. package/teams/fhr-neowise/skills/mermaid-diagram/references/radar.md +269 -0
  38. package/teams/fhr-neowise/skills/mermaid-diagram/references/railroad.md +337 -0
  39. package/teams/fhr-neowise/skills/mermaid-diagram/references/requirementDiagram.md +495 -0
  40. package/teams/fhr-neowise/skills/mermaid-diagram/references/sankey.md +415 -0
  41. package/teams/fhr-neowise/skills/mermaid-diagram/references/sequenceDiagram.md +1195 -0
  42. package/teams/fhr-neowise/skills/mermaid-diagram/references/stateDiagram.md +670 -0
  43. package/teams/fhr-neowise/skills/mermaid-diagram/references/timeline.md +571 -0
  44. package/teams/fhr-neowise/skills/mermaid-diagram/references/treeView.md +321 -0
  45. package/teams/fhr-neowise/skills/mermaid-diagram/references/treemap.md +353 -0
  46. package/teams/fhr-neowise/skills/mermaid-diagram/references/userJourney.md +42 -0
  47. package/teams/fhr-neowise/skills/mermaid-diagram/references/venn.md +134 -0
  48. package/teams/fhr-neowise/skills/mermaid-diagram/references/wardley.md +732 -0
  49. package/teams/fhr-neowise/skills/mermaid-diagram/references/xyChart.md +312 -0
  50. package/teams/fhr-neowise/skills/mermaid-diagram/references/zenuml.md +474 -0
  51. package/teams/fhr-neowise/skills/mermaid-diagram/scripts/sync_docs.py +138 -0
  52. package/teams/fhr-neowise/skills/pull-request-authoring/COMPLEX.template.md +52 -0
  53. package/teams/fhr-neowise/skills/pull-request-authoring/NON-CODE.template.md +15 -0
  54. package/teams/fhr-neowise/skills/pull-request-authoring/SIMPLE.template.md +20 -0
  55. package/teams/fhr-neowise/skills/pull-request-authoring/SKILL.md +102 -0
  56. package/teams/fhr-neowise/skills/spec-investigation/SKILL.md +139 -0
  57. package/teams/fhr-neowise/skills/spec-investigation/TEMPLATE.spec.md +74 -0
  58. package/teams/fhr-neowise/skills/tdd-workflow/SKILL.md +137 -0
  59. package/teams/fhr-neowise/skills/write-plan/SKILL.md +285 -0
  60. package/teams/fhr-neowise/skills/write-plan/assets/TEMPLATE.checklist.json +79 -0
  61. package/teams/fhr-neowise/skills/write-plan/assets/TEMPLATE.plan.md +158 -0
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: pull-request-authoring
3
+ description: "Apply when opening or updating a GitHub pull request for a branch — classifying the change as complex / simple / non-code, titling it FHR-XXXX: <Ticket Title>, rendering the matching template, drawing Mermaid diagrams for complex changes, and creating or updating the PR via gh."
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Skill: Pull Request Authoring
8
+
9
+ ## When This Applies
10
+
11
+ Apply this skill whenever creating or updating a GitHub pull request for the current branch — whether triggered by `/write-pr` or when the user asks to "open a PR", "write a PR description", or "update the PR".
12
+
13
+ ## Title Format — Non-Negotiable
14
+
15
+ Every PR title is exactly:
16
+
17
+ ```
18
+ FHR-<number>: <Ticket Title>
19
+ ```
20
+
21
+ - `FHR-<number>` comes from the branch name (e.g. `FHR-7162-refine-our-current-harness` → `FHR-7162`).
22
+ - `<Ticket Title>` is the **exact Jira ticket summary** — fetch it, do not paraphrase or invent one.
23
+ - Use the Atlassian MCP tools (`getJiraIssue`) to read the ticket summary for the key.
24
+ - If Jira is unavailable, derive a candidate title from the branch slug, render it, and **ask the user to confirm or correct it** before publishing.
25
+ - The ticket number in the title must match the branch's ticket number.
26
+
27
+ ## Step 1 — Gather the change
28
+
29
+ - Confirm the base branch (`master` unless told otherwise) and the head branch (current).
30
+ - List the changed files and stats vs base:
31
+ - `git diff --stat master...HEAD`
32
+ - `git diff --name-status master...HEAD`
33
+ - Extract the ticket key from the branch name (pattern `[A-Z]+-\d+`).
34
+ - Check whether a PR already exists for the branch: `gh pr list --head <branch> --json number,url,title`.
35
+
36
+ ## Step 2 — Classify the PR type
37
+
38
+ Inspect the changed files and decide the type. **When in doubt, escalate to the more thorough type.**
39
+
40
+ | Type | Signals | Template |
41
+ |------|---------|----------|
42
+ | **Non-code** | Only docs/config (`.md`, `.json`, `.yml`, `.toml`, `.txt`, CI config), no `src/` changes, no test changes | `NON-CODE.template.md` |
43
+ | **Simple code** | Source changed in a single module; localized (a handful of files); no changed control/data flow, no new public types/contracts, no cross-service impact | `SIMPLE.template.md` |
44
+ | **Complex code** | Any one of: multiple modules; new/removed classes or public types; changed control or data flow; new/changed API, GraphQL, or SQL contract; schema/migration change; cross-service interaction | `COMPLEX.template.md` |
45
+
46
+ State the chosen type and the one-line reason, and **confirm with the user** before rendering (the user may override). A type override passed to `/write-pr` (e.g. `type=complex`) skips detection.
47
+
48
+ ## Step 3 — Resolve the title
49
+
50
+ Build `FHR-<number>: <Ticket Title>` per the rules above. Fetch the Jira summary; only fall back to a branch-derived title (with user confirmation) when Jira is unavailable.
51
+
52
+ ## Step 4 — Render the template
53
+
54
+ Read the matching template file from this skill folder and fill every placeholder from the diff. Delete any optional section that genuinely does not apply rather than leaving it empty. Keep the depth proportional to the type — do not pad a simple PR or thin out a complex one.
55
+
56
+ ## Step 5 — Diagrams (complex PRs only)
57
+
58
+ A complex PR **must include at least one Mermaid diagram**. Choose the diagram type(s) that best explain *this* change — never add a diagram that adds no insight:
59
+
60
+ | When the change... | Use |
61
+ |--------------------|-----|
62
+ | alters control or data flow | `flowchart` (show before → after) |
63
+ | adds/changes classes, types, or their relationships | `classDiagram` |
64
+ | changes how services/components interact at runtime | `sequenceDiagram` |
65
+ | changes a state machine | `stateDiagram` |
66
+ | changes a schema or entity model | `erDiagram` |
67
+
68
+ Invoke the **`mermaid-diagram`** skill (in `.claude/skills/mermaid-diagram/`) to produce correct, renderable syntax. Embed each diagram as a ```mermaid fenced block in the body — GitHub renders these natively. Prefer a before/after pair (or annotate what changed) so reviewers see the *delta*, not just the end state.
69
+
70
+ ## Step 6 — Review and approve
71
+
72
+ Present the full rendered title and body to the user. Do **not** create, update, or push anything yet. Support correction cycles: if the user requests changes, re-render and present again. Continue only once the user explicitly approves.
73
+
74
+ ## Step 7 — Save and publish
75
+
76
+ 1. Save the approved body to `PR.md` next to the ticket's spec/plan: locate `.sprints/*/<ticket>/`. If exactly one exists, write `PR.md` there; if none or several exist, ask the user where to save it.
77
+ 2. Ensure the branch is pushed: `git push -u origin <branch>` — pushing requires user confirmation.
78
+ 3. Create or update the PR using the saved file:
79
+ - New PR: `gh pr create --base master --head <branch> --draft --title "FHR-<number>: <Ticket Title>" --body-file <path>/PR.md`
80
+ - Existing PR: `gh pr edit <number> --title "FHR-<number>: <Ticket Title>" --body-file <path>/PR.md`
81
+ 4. Report the PR URL.
82
+
83
+ Creating, updating, and pushing are outward-facing — only do them after the explicit approval in Step 6.
84
+
85
+ ## Templates
86
+
87
+ | File | PR type |
88
+ |------|---------|
89
+ | `COMPLEX.template.md` | Complex code change — full template with Mermaid diagrams |
90
+ | `SIMPLE.template.md` | Simple code change — description + impacted areas |
91
+ | `NON-CODE.template.md` | Non-code change — bullet-point summary |
92
+
93
+ ## Red Flags — STOP and Re-Evaluate
94
+
95
+ | Thought | Reality |
96
+ |---------|---------|
97
+ | "I'll write a clear title that describes the change" | The title is the **exact Jira ticket summary**, format `FHR-<number>: <Ticket Title>`. Fetch it; don't paraphrase. |
98
+ | "This complex change reads fine as prose" | Complex PRs require at least one Mermaid diagram. Use the `mermaid-diagram` skill. |
99
+ | "Diagrams are effort — I'll call it a simple PR" | Classify by the change, not the effort. Multi-module / new types / changed flow = complex. When in doubt, complex. |
100
+ | "A small fix doesn't need impacted areas" | Simple PRs must list the places touched — that is the reviewer's map. |
101
+ | "The description looks good, I'll just open the PR" | Show title + body and get explicit approval first. Creating and pushing are outward-facing. |
102
+ | "I'll write the body inline on the gh command" | Save `PR.md` and use `--body-file` — it avoids shell-escaping and leaves a traceable artifact. |
@@ -0,0 +1,139 @@
1
+ ---
2
+ name: spec-investigation
3
+ description: "Apply when researching and writing a SPEC.md: investigating a ticket, exploring the codebase, identifying unknowns, and structuring a complete specification that an AI coding agent can execute without further clarification."
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Skill: Spec Investigation
8
+
9
+ ## When This Applies
10
+
11
+ Use this skill whenever producing a SPEC.md — whether triggered by `/write-spec` or when Claude determines that spec research is needed before planning or implementing a feature.
12
+
13
+ ## Template
14
+
15
+ The spec template is at `TEMPLATE.spec.md` in this skill folder. Read it before writing any spec.
16
+
17
+ ## Investigation Process
18
+
19
+ Work through all steps in order. Do not skip steps.
20
+
21
+ ### Step 0 — Scope decomposition check
22
+
23
+ Before anything else, assess whether the input describes multiple independent subsystems or features that would make better separate specs.
24
+
25
+ Signs that decomposition is needed:
26
+ - The request touches more than two unrelated modules with no shared contract
27
+ - There are multiple distinct user-facing outcomes that could ship independently
28
+ - A junior engineer reading the ticket would have trouble deciding where to start
29
+
30
+ If decomposition is warranted: present the proposed sub-specs, explain the split, and ask the developer to confirm which sub-feature to tackle first. Each sub-feature gets its own full investigation and SPEC.md. Do not proceed until the scope of *this* spec is agreed.
31
+
32
+ If the scope is appropriate for a single spec, proceed directly to Step 1.
33
+
34
+ ### Step 1 — Gather ticket and requirement context
35
+
36
+ If a Jira ticket key is provided (pattern: `[A-Z]+-\d+`, e.g. `FHR-7106`):
37
+ - Use available Atlassian MCP tools to fetch the ticket: title, description, acceptance criteria, comments, linked Confluence pages, sprint metadata.
38
+ - If Atlassian MCP is unavailable, ask the user to paste the ticket description.
39
+ - Extract the sprint name and ticket number for the output path and spec header.
40
+
41
+ If no ticket key is provided, use the feature description as primary input. Ask the user for the sprint name and ticket number before creating any directory.
42
+
43
+ **Ticket clarity check**: After gathering context, assess whether the requirements are concrete and unambiguous. A well-defined ticket has clear acceptance criteria, a bounded scope, and only one reasonable interpretation. A vague ticket has phrases like "improve X", "support Y somehow", or no acceptance criteria at all.
44
+
45
+ If the ticket is vague, enter collaborative dialogue mode before continuing:
46
+ - Ask clarifying questions **one at a time** — never bundle multiple questions in one message
47
+ - Prefer multiple-choice questions when the answer space is bounded
48
+ - Focus on: purpose (why is this needed now?), constraints (what must not break or change?), success criteria (how will the developer know it's done?)
49
+ - Continue until you have enough to write concrete given/when/then requirements
50
+
51
+ If the ticket is already well-defined, proceed without asking unnecessary questions.
52
+
53
+ ### Step 2 — Understand the codebase
54
+
55
+ Search the workspace for everything relevant to the feature:
56
+ - Existing components, services, classes, or functions the feature touches
57
+ - Existing tests that describe current behavior in the affected area
58
+ - Existing data models, schemas, or API contracts in scope
59
+ - Utilities or abstractions that should be reused
60
+
61
+ Use `grep` (via Bash), `find`, and Read to explore. Parallelize independent reads.
62
+
63
+ For each relevant file, record its path and classification: read-only context, needs modification, or will be created.
64
+
65
+ ### Step 3 — Check prior work on GitHub
66
+
67
+ Search for related pull requests and issues using available GitHub MCP tools (`search_pull_requests`, `issue_read`, `pull_request_read`). Look for previous attempts at the same or similar work and open issues adding context or constraints. Record any findings that constrain or inform the spec.
68
+
69
+ ### Step 4 — Identify unknowns
70
+
71
+ List everything still unclear after Steps 1–3:
72
+ - Missing API or data contracts
73
+ - Ambiguous behavior (errors, empty input, concurrent access)
74
+ - Architecture decisions with more than one valid option
75
+ - Security or performance requirements not mentioned in the input
76
+
77
+ ### Step 5 — Propose implementation approaches
78
+
79
+ Based on your findings from Steps 2–4, propose **2–3 distinct implementation approaches**. For each:
80
+ - Describe the approach in 2–3 sentences
81
+ - List trade-offs: complexity, testability, performance, risk, amount of existing code reused
82
+ - State your recommended approach and the reason
83
+
84
+ Ask the developer to pick an approach before continuing. The chosen approach anchors the spec's architecture and technical constraints sections.
85
+
86
+ If there is genuinely only one reasonable approach, describe it briefly and confirm with the developer rather than fabricating alternatives. Do not proceed to Step 6 until the approach is agreed.
87
+
88
+ ### Step 6 — Research online if needed
89
+
90
+ If the chosen approach involves an external library or pattern that needs verification, use WebFetch or WebSearch. Only fetch pages directly relevant to a confirmed unknown — do not research speculatively.
91
+
92
+ ### Step 7 — Ask the developer
93
+
94
+ If open questions remain after Steps 1–6, ask all of them in a single message before writing. Group by category: Behavior, Scope, Architecture, Data. Wait for answers before proceeding.
95
+
96
+ ### Step 8 — Present a findings summary and confirm
97
+
98
+ Before writing the spec, present a concise pre-write summary:
99
+ - **Affected files**: what will be modified and what will be created
100
+ - **Chosen approach**: one sentence recapping the approach from Step 5
101
+ - **Key assumptions**: the most consequential assumptions being written into the spec
102
+ - **Remaining risks**: anything still uncertain that could require revisiting the spec later
103
+
104
+ Ask: "Does this look right before I write the spec?" Wait for the developer's response. If they request changes, revisit the relevant steps before proceeding.
105
+
106
+ ### Step 9 — Write the spec
107
+
108
+ - Create the directory `.sprints/<sprint-name>/<ticket-number>/` if it does not exist.
109
+ - Write the spec to `.sprints/<sprint-name>/<ticket-number>/SPEC.md` using the template structure.
110
+ - Be concrete: exact file paths, method names, field names, types. No vague descriptions.
111
+ - Out of Scope: list at least one item explicitly, even if it is "no changes to other modules".
112
+ - Context: every file path from Steps 2–3, classified as read-only, modify, or create.
113
+ - Functional Requirements: given/when/then format, at least one edge case per requirement.
114
+ - Assumptions & Open Questions: every assumption made in Steps 1–8 must appear here.
115
+ - Acceptance Criteria: every requirement must have at least one corresponding criterion.
116
+
117
+ ### Step 10 — Self-review the spec
118
+
119
+ After writing, look at the spec with fresh eyes. Fix any issues inline — do not present the spec until this review passes.
120
+
121
+ 1. **Placeholder scan**: Any "TBD", "TODO", incomplete sections, or vague requirements? Fix them before presenting.
122
+ 2. **Internal consistency**: Does the chosen architecture from Step 5 match what is written in Technical Constraints and Functional Requirements? If sections contradict each other, resolve it.
123
+ 3. **Scope check**: Is this focused enough for a single implementation plan? If it has grown to cover multiple independent concerns, flag it for decomposition.
124
+ 4. **Ambiguity check**: Can any requirement be interpreted two ways? If so, pick one and state it explicitly.
125
+ 5. **Validation checklist**:
126
+ - [ ] Spec saved at `.sprints/<sprint-name>/<ticket-number>/SPEC.md`
127
+ - [ ] Goal and measurable success criteria are concrete — not placeholder text
128
+ - [ ] Out of Scope is filled in
129
+ - [ ] Context has specific file paths
130
+ - [ ] At least one given/when/then requirement exists
131
+ - [ ] No unresolved open questions
132
+ - [ ] At least one checkable acceptance criterion
133
+ - [ ] Agent and module are identified in the spec header
134
+
135
+ Fix any failing items before presenting.
136
+
137
+ ## Output Summary
138
+
139
+ Present: what the spec covers, the chosen implementation approach and why, codebase findings that influenced it, assumptions the developer should confirm before implementation starts.
@@ -0,0 +1,74 @@
1
+ # Spec: [Feature Title]
2
+
3
+ Date: YYYY-MM-DD
4
+
5
+ > **Agent**: <!-- Which agent should handle this? e.g. Angular Dev, Java Dev, Scala Dev -->
6
+ > **Module**: <!-- Which module(s) are in scope? e.g. insights-dashboard, reporting-api-v2 -->
7
+ > **Ticket**: <!-- Link to the Jira/GitHub issue -->
8
+
9
+ ---
10
+
11
+ ## 1. Objective
12
+
13
+ - **Goal**: One or two sentences describing what this feature achieves and why it is needed.
14
+ - **Success Criteria**: What observable state proves this is complete? Be specific and measurable.
15
+
16
+ ## 2. Out of Scope
17
+
18
+ Explicitly list what this spec does NOT cover. This prevents scope creep and stops the agent from over-engineering.
19
+
20
+ - ...
21
+
22
+ ## 3. Context
23
+
24
+ **Files to read for context** (understand but do not modify):
25
+ - `path/to/relevant/file.ts`: reason why it is relevant
26
+
27
+ **Files to modify**:
28
+ - `path/to/existing/file.ts`: what changes are needed
29
+
30
+ **Files to create**:
31
+ - `path/to/new/file.ts`: purpose
32
+
33
+ ## 4. Functional Requirements
34
+
35
+ Describe each requirement as a concrete behavior: given an input or trigger, what must happen?
36
+
37
+ 1. **[Requirement name]**: Given [input/state], when [action], then [expected outcome].
38
+ 2. **[Requirement name]**: Include edge cases (empty input, error state, boundary values).
39
+ 3. **[Requirement name]**: Include any API or UI contract changes with exact field names and types.
40
+
41
+ ## 5. Technical Constraints
42
+
43
+ - **Architecture**: Which pattern must be followed (e.g., the service handles logic, the component is presentation-only).
44
+ - **Security**: Any authentication, authorization, input validation, or data sensitivity requirements.
45
+ - **Performance**: Any latency, throughput, or bundle-size requirements.
46
+ - **Dependencies**: Any specific library versions or APIs to use or avoid. Flag if a new dependency is needed.
47
+
48
+ ## 6. Assumptions & Open Questions
49
+
50
+ List anything assumed to be true but not yet confirmed, and anything needing a decision before work can start.
51
+
52
+ **Assumptions**:
53
+ - ...
54
+
55
+ **Open Questions**:
56
+ - ...
57
+
58
+ ## 7. Acceptance Criteria
59
+
60
+ Each criterion describes an observable behavior that can be verified. Written as: "Given [context], when [action], then [outcome]."
61
+
62
+ - [ ] Given ..., when ..., then ...
63
+ - [ ] Given ..., when ..., then ...
64
+ - [ ] All existing tests continue to pass with no regressions.
65
+ - [ ] No new dependencies introduced without explicit approval in this spec.
66
+
67
+ ## 8. Definition of Done
68
+
69
+ - [ ] All acceptance criteria above are met.
70
+ - [ ] Unit tests cover every acceptance criterion and every branch.
71
+ - [ ] Tests are green locally.
72
+ - [ ] No lint or type errors.
73
+ - [ ] No TODO, FIXME, or placeholder code.
74
+ - [ ] No secrets, hardcoded URLs, or environment-specific values in source.
@@ -0,0 +1,137 @@
1
+ ---
2
+ name: tdd-workflow
3
+ description: "Apply when implementing any feature or bugfix — before writing any production code. Also use when confirming RED vs GREEN test state, looking up test commands by module, or deciding when to commit."
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Skill: TDD Workflow
8
+
9
+ **REQUIRED BACKGROUND:** You MUST understand `superpowers:test-driven-development` — it defines the fundamental discipline this skill applies to this project.
10
+
11
+ ## When This Applies
12
+
13
+ Apply this skill during any TDD implementation — whether orchestrated by `/tdd-implementation` or when Claude is writing code and tests in any module of this project.
14
+
15
+ ## Double-Loop TDD
16
+
17
+ ```
18
+ Outer Loop (Integration / Acceptance) Inner Loop (Unit)
19
+ ┌─────────────────────────────────┐ ┌──────────────────────┐
20
+ │ 1. Write a failing integration │ │ 1. Write a failing │
21
+ │ test (RED) │ │ unit test (RED) │
22
+ │ │ │ │
23
+ │ 2. Enter inner loop ───────────────────────► │ 2. Write minimal │
24
+ │ │ │ code (GREEN) │
25
+ │ │ │ │
26
+ │ │ ◄──────── │ 3. Refactor (CLEAN) │
27
+ │ │ repeat │ │
28
+ │ 3. Integration test passes │ until └──────────────────────┘
29
+ │ (GREEN) │ green
30
+ │ │
31
+ │ 4. Refactor across units │
32
+ │ (CLEAN) │
33
+ └─────────────────────────────────┘
34
+ ```
35
+
36
+ **Rules:**
37
+ - Never write production code without a failing test.
38
+ - Each RED-GREEN-REFACTOR cycle should take minutes, not hours.
39
+ - Run the relevant test suite after every GREEN step to confirm no regressions.
40
+ - Commit at every GREEN boundary (all tests pass).
41
+
42
+ ## Confirming Red vs Green
43
+
44
+ After a tester agent writes tests: at least one test must **FAIL**. A run with zero failures means the tester did not write a genuinely failing test — re-invoke the tester with the passing output and ask for a more specific failing assertion.
45
+
46
+ After a dev agent implements code: **zero failures**, and the count of passing tests must have increased by at least the number of tests the tester wrote.
47
+
48
+ ## Test Commands by Language
49
+
50
+ ### Java — Unit Tests
51
+
52
+ ```bash
53
+ ./gradlew :<module>:test
54
+ ./gradlew :<module>:test --tests "com.fredhopper.reporting.<ClassName>Test"
55
+ ```
56
+
57
+ ### Java — Integration Tests
58
+
59
+ ```bash
60
+ ./gradlew :<module>:integrationTest
61
+ ./gradlew :<module>:integrationTest --tests "*TestRunner*"
62
+ ```
63
+
64
+ Integration tests live in `src/integration/` and require Docker (Testcontainers).
65
+
66
+ ### Scala — Unit Tests
67
+
68
+ ```bash
69
+ ./gradlew :<module>:test
70
+ ./gradlew :<module>:test --tests "*MySpec*"
71
+ ```
72
+
73
+ ### Scala — Integration Tests
74
+
75
+ ```bash
76
+ ./gradlew :<module>:integrationTest
77
+ ```
78
+
79
+ ### Angular — Spec Tests
80
+
81
+ ```bash
82
+ # insights-dashboard
83
+ cd insights-dashboard && npm test
84
+ cd insights-dashboard && npm test -- --testPathPattern="feature-name.component.spec"
85
+
86
+ # insights-admin-console
87
+ cd insights-admin-console && npm test
88
+ cd insights-admin-console && npm test -- --testPathPattern="feature-name.component.spec"
89
+ ```
90
+
91
+ ### Python — Unit Tests
92
+
93
+ ```bash
94
+ cd statistical-analysis && PYTHONPATH=main pytest test/ -v
95
+ cd statistical-analysis && PYTHONPATH=main pytest test/test_<module>.py -v
96
+ ./gradlew :statistical-analysis:test
97
+ ```
98
+
99
+ ### Python — Integration Tests
100
+
101
+ ```bash
102
+ cd statistical-analysis && pytest test_integration/ -v
103
+ cd statistical-analysis && pytest test_integration/test_integration_<feature>.py -v
104
+ ```
105
+
106
+ ## Commit at GREEN Boundary
107
+
108
+ When all tests pass after a completed step:
109
+
110
+ 1. Stage only the files changed in this step (avoid unrelated changes).
111
+ 2. Run `./gradlew spotlessApply` for any Java or Groovy changes.
112
+ 3. Commit with format: `<TICKET>: <imperative description of what this step does>`
113
+ 4. Ask the user whether to push: only `git push` if explicitly confirmed.
114
+
115
+ If a pre-commit hook fails: fix the underlying issue and create a **new** commit. Never use `--no-verify`.
116
+
117
+ ## Handling Persistent Failures
118
+
119
+ When tests still fail after implementing:
120
+ - Attempt 1: re-invoke the dev agent with the full failure output.
121
+ - Attempt 2: re-invoke the dev agent once more.
122
+ - After 2 failed attempts: stop, report the full failing test output, and wait for the user to provide guidance before continuing.
123
+
124
+ ## Red Flags — STOP and Re-Evaluate
125
+
126
+ These thoughts mean you are rationalizing. Stop and follow the rules:
127
+
128
+ | Thought | Rule |
129
+ |---------|------|
130
+ | "It's too simple to need a test" | Write the test. Simple code breaks too. |
131
+ | "The acceptance test will cover it" | Unit test cost: ~90 seconds. Write it. |
132
+ | "We're under time pressure" | Skipping tests creates the next sprint's time pressure. |
133
+ | "I'll test it after the feature is wired up" | Tests-after verify what code does. Tests-first define what it should do. |
134
+ | "The test would just mirror the implementation" | That IS a valid unit test. Write it. |
135
+ | "I already manually tested it" | Manual tests don't run in CI. Write the automated test. |
136
+
137
+ **All of these mean: write the failing test first. No exceptions.**