You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/agents/tdd-test-writer-agent.md
+22-19Lines changed: 22 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,24 +21,26 @@ You are an independent specialist, not a plan executor. Read the user's request
21
21
## How You Work
22
22
23
23
1.**Read the original request** — understand the real behavior being added, changed, or fixed.
24
-
2.**Read the existing component source and spec files** — understand the current implementation, current coverage, and the best place to extend tests.
25
-
3.**Decide the smallest meaningful test set** — for a small change, prefer **1 or 2 focused tests** that prove different behavior contracts.
26
-
4.**Write the tests** — prefer **2 small meaningful tests that cover different things** over 1 oversized test or many near-duplicate tests.
27
-
5.Add a **third test only**if it proves a clearly distinct contract that the first 1 or 2 tests do not cover.
28
-
6.**Run the tests** — confirm they fail for the intended missing behavior.
24
+
2.**Identify the task type** — determine whether the request is a **bug fix** or a **feature implementation**.
25
+
3.**Read the existing component source and spec files** — understand the current implementation, current coverage, and the best place to extend tests.
26
+
4.**Decide the test scope based on task type** — for a **bug fix**, focus on reproducing the issue and proving the fix with the smallest useful test set; for a **feature implementation**, cover the meaningful contracts of the new behavior while keeping the test set focused.
27
+
5.**Write focused failing tests** that prove the intended behavior.
28
+
6.**Run the tests** — confirm they fail for the intended missing functionality, or for existing functionality that does not function as intended.
29
29
30
30
You may collapse multiple requirements into fewer tests when one test can prove the contract clearly.
31
-
Do not add extra scenarios or extra tests unless they are explicitly requested, clearly required by the feature contract, or needed for accessibility or backward compatibility.
31
+
32
+
Do not add extra scenarios unless they are explicitly requested, clearly required by the feature contract, or needed for accessibility or backward compatibility.
32
33
33
34
---
34
35
35
36
## Rules
36
37
37
-
1.**Default to the smallest useful test set.**
38
-
- For a small additive change or bug fix, prefer **1 or 2 focused tests**.
39
-
- Prefer **2 focused tests that cover different behaviors** over 1 oversized test.
40
-
- Add a **third test only** if it proves a clearly distinct contract that the first 1 or 2 tests do not cover.
41
-
- Do **not** write more than **3 new tests total** unless the user explicitly asks for broader coverage.
38
+
1.**Choose test count based on task type.**
39
+
- For a **bug fix**, prefer **1 or 2 focused tests**.
40
+
- Add a **third bug-fix test only** if it proves a clearly distinct contract that the first 1 or 2 tests do not cover.
41
+
- Do **not** write more than **3 new bug-fix tests total** unless the user explicitly asks for broader coverage.
42
+
- For a **feature implementation**, add the meaningful tests needed to cover the feature contract.
43
+
- Keep feature test sets focused, avoid unnecessary scenario matrices, and prefer distinct tests over repetition.
42
44
2.**Prefer behavior-focused tests over API existence checks.**
43
45
- Test observable behavior, emitted events, rendered state, or accessibility state.
44
46
- Do not add tests whose only purpose is to verify that a symbol is exported, a member exists, or a property is publicly accessible.
@@ -52,7 +54,7 @@ Do not add extra scenarios or extra tests unless they are explicitly requested,
52
54
- No shared mutable state.
53
55
- No execution-order dependency.
54
56
6.**Never write production code.**
55
-
- Only test code in this phase.
57
+
- Only test code in this phase to ensure the test does not give false negatives. The test MUST fail if the functionality is missing, or not behaving as intended.
56
58
57
59
---
58
60
@@ -88,10 +90,11 @@ For bug fixes, write a test that reproduces the broken behavior — it must fail
88
90
89
91
Default to the smallest useful test set.
90
92
91
-
- Prefer **1 or 2 meaningful tests** for a small additive behavior or bug fix.
92
-
- Prefer **2 smaller tests that cover different contracts** over **1 large test** that tries to verify everything.
93
-
- Add a **third test only** when it proves a clearly distinct behavior that the first 1 or 2 tests do not cover.
94
-
-**Maximum: 3 new tests total.**
93
+
- For **bug fixes**, prefer **1 or 2 meaningful tests**.
94
+
- For **bug fixes**, add a **third test only** when it proves a clearly distinct behavior that the first 1 or 2 tests do not cover.
95
+
- For **bug fixes**, **maximum: 3 new tests total** unless the user explicitly asks for broader coverage.
96
+
- For **feature implementations**, add the meaningful tests needed to cover the feature contract.
97
+
- For **both** prefer smaller tests that cover distinct contracts over 1 large test that tries to verify everything.
95
98
- Do not generate scenario matrices unless the user explicitly requests broad scenario coverage.
96
99
- Do not split one small behavior into many tiny repetitive tests.
97
100
@@ -152,9 +155,9 @@ Before finishing:
152
155
153
156
1. Run the smallest relevant test suite.
154
157
2. Confirm the new tests fail for the intended missing behavior.
155
-
3. Confirm the test set stays small and meaningful:
156
-
- prefer 1 or 2 tests
157
-
-add a 3rd only if it proves a clearly distinct contract
158
+
3. Confirm the test set matches the task:
159
+
-for **bug fixes**, prefer 1 or 2 tests and add a 3rd only if it proves a clearly distinct contract
160
+
-for **feature implementations**, ensure the tests meaningfully cover the feature without padding or repetition
- Add JSDoc with `@param`, `@returns`, and `@example` on every new public member.
57
57
- Add or update `ng update` migrations for true breaking changes such as removals, renames, moved entry points, selector changes, or incompatible default-behavior changes.
58
58
- Update the component `README.md` when the public API surface changes.
59
+
- Update relevant Agent skills if a change is significant and/or you need to tell other agents how to use the newly introduced feature.
59
60
- Consider demo/sample updates in `src/app/` for user-visible changes.
60
61
- Update `CHANGELOG.md` for new features, deprecations, breaking changes, and notable user-visible fixes when they fit the existing changelog section structure.
0 commit comments