ronce-racine 0.5.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.
- package/AGENTS.md +90 -0
- package/LICENSE +21 -0
- package/README.md +281 -0
- package/agents/code-reviewer.md +33 -0
- package/agents/qa-tester.md +28 -0
- package/dist/hooks/README.md +182 -0
- package/dist/hooks/bash-npm-silent.mjs +81 -0
- package/dist/hooks/session-inject.mjs +53 -0
- package/dist/hooks/session-precompact.mjs +36 -0
- package/dist/hooks/session-writer.mjs +142 -0
- package/dist/hooks/skill-reminder.mjs +89 -0
- package/dist/hooks/truncate-bash-output.mjs +46 -0
- package/dist/hooks/truncate-output.mjs +88 -0
- package/dist/hooks/worktree-env-setup.mjs +123 -0
- package/dist/install.js +962 -0
- package/docs/adopting-a-repo.md +80 -0
- package/docs/architecture.md +76 -0
- package/docs/decisions.md +72 -0
- package/docs/developing.md +143 -0
- package/docs/evaluating-skills.md +41 -0
- package/docs/git-worktrees.md +62 -0
- package/docs/rules/clean-architecture-deps.md +66 -0
- package/docs/rules/commits.md +59 -0
- package/docs/rules/detection-gap-protocol.md +55 -0
- package/docs/rules/error-handling-discipline.md +62 -0
- package/docs/rules/minimal-code.md +58 -0
- package/docs/rules/no-raw-sql-interpolation.md +57 -0
- package/docs/rules/pre-commit-secret-detection.md +54 -0
- package/docs/rules/secure-logging.md +53 -0
- package/docs/rules/sql-migrations-discipline.md +58 -0
- package/docs/rules/subscription-cleanup.md +63 -0
- package/docs/rules/test-discipline.md +66 -0
- package/docs/rules/ui-states-complete.md +52 -0
- package/docs/templates/SKILL.template.md +66 -0
- package/docs/templates/rule.template.md +16 -0
- package/docs/writing-a-rule.md +43 -0
- package/docs/writing-a-skill.md +118 -0
- package/package.json +45 -0
- package/rules/clean-architecture-deps.md +20 -0
- package/rules/commits.md +16 -0
- package/rules/detection-gap-protocol.md +35 -0
- package/rules/error-handling-discipline.md +23 -0
- package/rules/minimal-code.md +32 -0
- package/rules/no-raw-sql-interpolation.md +20 -0
- package/rules/pre-commit-secret-detection.md +14 -0
- package/rules/secure-logging.md +16 -0
- package/rules/sql-migrations-discipline.md +18 -0
- package/rules/subscription-cleanup.md +22 -0
- package/rules/test-discipline.md +20 -0
- package/rules/ui-states-complete.md +23 -0
- package/scripts/subscription-leak-scan.ts +53 -0
- package/skills/adversarial-feature-challenge/README.md +65 -0
- package/skills/adversarial-feature-challenge/SKILL.md +96 -0
- package/skills/adversarial-feature-challenge/assets/fuzz-payloads.txt +60 -0
- package/skills/adversarial-feature-challenge/templates/challenge-report.md +42 -0
- package/skills/api-contract-versioning/README.md +62 -0
- package/skills/api-contract-versioning/SKILL.md +76 -0
- package/skills/api-contract-versioning/templates/consumer-inventory.md +29 -0
- package/skills/audit-architecture/README.md +56 -0
- package/skills/audit-architecture/SKILL.md +97 -0
- package/skills/audit-architecture/reference/ar-architecture.md +275 -0
- package/skills/audit-architecture/reference/di-disponibilite.md +252 -0
- package/skills/audit-architecture/reference/im-incidents.md +217 -0
- package/skills/audit-architecture/reference/pa-pannes.md +362 -0
- package/skills/audit-architecture/reference/re-recuperation.md +300 -0
- package/skills/audit-architecture/reference/sc-scalabilite.md +173 -0
- package/skills/audit-architecture/reference/su-support.md +180 -0
- package/skills/audit-ci-cd/README.md +54 -0
- package/skills/audit-ci-cd/SKILL.md +124 -0
- package/skills/audit-ci-cd/reference/artefacts.md +39 -0
- package/skills/audit-ci-cd/reference/deploiement.md +100 -0
- package/skills/audit-ci-cd/reference/dora.md +94 -0
- package/skills/audit-ci-cd/reference/iac.md +40 -0
- package/skills/audit-ci-cd/reference/pipeline-ci.md +36 -0
- package/skills/audit-ci-cd/reference/supply-chain.md +44 -0
- package/skills/audit-compliance/README.md +69 -0
- package/skills/audit-compliance/SKILL.md +176 -0
- package/skills/audit-compliance/reference/conformite-rgpd.md +295 -0
- package/skills/audit-compliance/reference/finops.md +318 -0
- package/skills/audit-compliance/reference/gouvernance-donnees.md +238 -0
- package/skills/audit-industrialisation/README.md +53 -0
- package/skills/audit-industrialisation/SKILL.md +251 -0
- package/skills/audit-observability/README.md +64 -0
- package/skills/audit-observability/SKILL.md +134 -0
- package/skills/audit-observability/reference/alerting.md +214 -0
- package/skills/audit-observability/reference/logging.md +114 -0
- package/skills/audit-observability/reference/metriques.md +166 -0
- package/skills/audit-observability/reference/traces-dashboards.md +90 -0
- package/skills/audit-performance-frontend/README.md +91 -0
- package/skills/audit-performance-frontend/SKILL.md +194 -0
- package/skills/audit-performance-frontend/reference/assets-cache-network.md +129 -0
- package/skills/audit-performance-frontend/reference/css-rendering-pipeline.md +154 -0
- package/skills/audit-performance-frontend/reference/html-critical-path.md +128 -0
- package/skills/audit-performance-frontend/reference/js-engine-runtime.md +280 -0
- package/skills/audit-performance-frontend/reference/memory-gc.md +126 -0
- package/skills/audit-performance-frontend/reference/profiling-tooling.md +98 -0
- package/skills/audit-quality/README.md +85 -0
- package/skills/audit-quality/SKILL.md +126 -0
- package/skills/audit-quality/reference/qa-devops.md +539 -0
- package/skills/audit-quality/reference/qu-qualite-donnees.md +402 -0
- package/skills/audit-report/README.md +72 -0
- package/skills/audit-report/SKILL.md +241 -0
- package/skills/audit-report/reference/scoring-model.md +45 -0
- package/skills/audit-security/README.md +72 -0
- package/skills/audit-security/SKILL.md +140 -0
- package/skills/audit-security/reference/auth-identite.md +98 -0
- package/skills/audit-security/reference/autorisation.md +66 -0
- package/skills/audit-security/reference/chiffrement-tls.md +97 -0
- package/skills/audit-security/reference/detection-patching.md +67 -0
- package/skills/audit-security/reference/incident-response.md +98 -0
- package/skills/audit-security/reference/reseau-conteneurs.md +72 -0
- package/skills/audit-security/reference/secrets.md +36 -0
- package/skills/audit-testing/README.md +82 -0
- package/skills/audit-testing/SKILL.md +131 -0
- package/skills/audit-testing/reference/golden-dataset.md +65 -0
- package/skills/audit-testing/reference/resilience-chaos.md +93 -0
- package/skills/audit-testing/reference/tests-contractuels.md +65 -0
- package/skills/audit-testing/reference/tests-e2e-flaky.md +67 -0
- package/skills/audit-testing/reference/tests-unit-integ-ci.md +125 -0
- package/skills/bug-ticket-root-cause/README.md +67 -0
- package/skills/bug-ticket-root-cause/SKILL.md +86 -0
- package/skills/bug-ticket-root-cause/templates/bug-ticket.md +43 -0
- package/skills/bug-triage-structured/README.md +63 -0
- package/skills/bug-triage-structured/SKILL.md +104 -0
- package/skills/bug-triage-structured/templates/bug-triage.md +38 -0
- package/skills/ci-pipeline-orchestration/README.md +55 -0
- package/skills/ci-pipeline-orchestration/SKILL.md +110 -0
- package/skills/commit-readiness-review/README.md +66 -0
- package/skills/commit-readiness-review/SKILL.md +82 -0
- package/skills/commit-readiness-review/scripts/precommit-scan.ts +81 -0
- package/skills/comprehensive-test-strategy/README.md +64 -0
- package/skills/comprehensive-test-strategy/SKILL.md +108 -0
- package/skills/comprehensive-test-strategy/reference/testing-advanced.md +85 -0
- package/skills/daily-workflow-optimization/README.md +56 -0
- package/skills/daily-workflow-optimization/SKILL.md +80 -0
- package/skills/database-schema-evolution/README.md +54 -0
- package/skills/database-schema-evolution/SKILL.md +107 -0
- package/skills/ddd-backend-implementation/README.md +63 -0
- package/skills/ddd-backend-implementation/SKILL.md +95 -0
- package/skills/design-system-component-lifecycle/README.md +56 -0
- package/skills/design-system-component-lifecycle/SKILL.md +97 -0
- package/skills/design-system-component-lifecycle/templates/component-contract.md +43 -0
- package/skills/detection-sweep/README.md +58 -0
- package/skills/detection-sweep/SKILL.md +93 -0
- package/skills/detection-sweep/scripts/sweep.ts +80 -0
- package/skills/domain-modeling-design/README.md +57 -0
- package/skills/domain-modeling-design/SKILL.md +83 -0
- package/skills/frontend-fullstack-implementation/README.md +60 -0
- package/skills/frontend-fullstack-implementation/SKILL.md +133 -0
- package/skills/frontend-spec-call-site-audit/README.md +66 -0
- package/skills/frontend-spec-call-site-audit/SKILL.md +82 -0
- package/skills/frontend-spec-call-site-audit/scripts/audit-entry-points.ts +79 -0
- package/skills/frontend-spec-call-site-audit/templates/ticket-frontend.md +32 -0
- package/skills/merge-request-review/README.md +60 -0
- package/skills/merge-request-review/SKILL.md +77 -0
- package/skills/merge-request-review/templates/mr-review-report.md +29 -0
- package/skills/production-incident-diagnostic/README.md +63 -0
- package/skills/production-incident-diagnostic/SKILL.md +103 -0
- package/skills/production-incident-diagnostic/templates/incident-report.md +33 -0
- package/skills/qa-session-intake/README.md +56 -0
- package/skills/qa-session-intake/SKILL.md +78 -0
- package/skills/recording-decisions/README.md +91 -0
- package/skills/recording-decisions/SKILL.md +84 -0
- package/skills/recurring-bug-root-cause/README.md +64 -0
- package/skills/recurring-bug-root-cause/SKILL.md +93 -0
- package/skills/recurring-bug-root-cause/scripts/detect-recurring-fixes.ts +46 -0
- package/skills/recurring-bug-root-cause/templates/postmortem-recidive.md +37 -0
- package/skills/refactoring-shared-component-api/README.md +50 -0
- package/skills/refactoring-shared-component-api/SKILL.md +84 -0
- package/skills/refactoring-shared-component-api/scripts/sweep-call-sites.ts +85 -0
- package/skills/refactoring-shared-component-api/templates/migration-checklist.md +19 -0
- package/skills/validating-features-end-to-end/README.md +50 -0
- package/skills/validating-features-end-to-end/SKILL.md +90 -0
- package/skills/visual-regression-check/README.md +51 -0
- package/skills/visual-regression-check/SKILL.md +89 -0
- package/skills/writing-robust-tests/README.md +53 -0
- package/skills/writing-robust-tests/SKILL.md +88 -0
- package/templates/.adopted.example +8 -0
- package/templates/anti-drift.gitlab-ci.yml +23 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# `visual-regression-check`
|
|
2
|
+
|
|
3
|
+
> Green tests never see a broken grid, a mobile overflow, or an `undefined` on screen. Before committing a UI change, look at the real rendering - on desktop and mobile.
|
|
4
|
+
|
|
5
|
+
| | |
|
|
6
|
+
|---|---|
|
|
7
|
+
| **Type** | Skill (on-demand workflow) |
|
|
8
|
+
| **Category** | `frontend` |
|
|
9
|
+
| **Artifact** | [`SKILL.md`](SKILL.md) |
|
|
10
|
+
| **Tooling** | None dedicated (Playwright MCP + project dev command) |
|
|
11
|
+
|
|
12
|
+
## What it is
|
|
13
|
+
|
|
14
|
+
`visual-regression-check` is a pre-commit detection net for UI changes. It drives the running app, captures each affected surface in a desktop and a mobile viewport across the reachable states, and inspects each capture with an objective checklist. It is not a design review - it hunts for *broken*, not for *ugly*.
|
|
15
|
+
|
|
16
|
+
## Why it exists
|
|
17
|
+
|
|
18
|
+
Typecheck, lint, and unit tests are blind to rendering. They pass while a grid collapses, a mobile column overflows, a component never mounts, or an empty state prints `undefined`. Vision catches these reliably - but only if someone actually looks, and looks at **both** viewports and the **non-nominal states**.
|
|
19
|
+
|
|
20
|
+
Mobile (375px) is blind spot #1: overflow and wrap only appear when narrow. Empty/error/loading states are blind spot #2: that is where `undefined`, `NaN`, and raw i18n keys surface. The skill forces coverage of both so a green build is not mistaken for a correct rendering. It explicitly does **not** replace human visual testing - it assumes no one else will look, and acts as the gate before commit.
|
|
21
|
+
|
|
22
|
+
## When it triggers
|
|
23
|
+
|
|
24
|
+
- a UI change is about to be committed
|
|
25
|
+
- "does it render well?" / "does it display correctly?"
|
|
26
|
+
- suspected visual regression, layout/restyle changed
|
|
27
|
+
- green tests but the rendering never actually seen
|
|
28
|
+
|
|
29
|
+
Use `validating-features-end-to-end` instead if the question is whether the feature *works* (golden path, API, DB), and `commit-readiness-review` if the question is whether it is *committable* (secrets, lint, leftovers).
|
|
30
|
+
|
|
31
|
+
## How it works
|
|
32
|
+
|
|
33
|
+
You drive the running app, navigate to each affected surface (a shared component means at least two consuming surfaces), and capture every surface in both a desktop (1280×720) and a mobile (375×812) viewport across the reachable states - nominal, empty, error, loading. Each capture is inspected with vision against an objective checklist (nothing truncated/overflowing, the change actually renders, no `undefined`/`NaN`/raw i18n key, legible text, consistent layout on both viewports) and compared to the pre-change state and any snapshot harness. Trace the verdict - surfaces, viewports, states, capture paths, anomalies, what was not checked - in the MR description.
|
|
34
|
+
|
|
35
|
+
Full step-by-step protocol → [`SKILL.md`](SKILL.md).
|
|
36
|
+
|
|
37
|
+
## Worked example
|
|
38
|
+
|
|
39
|
+
> On acme-app you restyle the results table into a card grid.
|
|
40
|
+
|
|
41
|
+
1. Diff touches `ResultCard` (shared) → check the search page and the dashboard.
|
|
42
|
+
2. Capture both surfaces at 1280×720 and 375×812, in nominal and empty states.
|
|
43
|
+
3. Mobile capture reveals the card grid overflowing horizontally at 375px - fixed before commit, re-captured.
|
|
44
|
+
4. Empty state (filter with no results) rendered a bare `undefined` where the count should be - fixed.
|
|
45
|
+
5. Verdict traced: 2 surfaces × 2 viewports × 2 states, anomalies fixed, loading state flagged "not reached".
|
|
46
|
+
|
|
47
|
+
## Related artifacts
|
|
48
|
+
|
|
49
|
+
- [`validating-features-end-to-end`](../validating-features-end-to-end/) - for the functional side (does it *work*).
|
|
50
|
+
- [`refactoring-shared-component-api`](../refactoring-shared-component-api/) - when the UI change is a shared-contract change.
|
|
51
|
+
- [`writing-robust-tests`](../writing-robust-tests/) - to lock the rendering behind a test once verified.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: visual-regression-check
|
|
3
|
+
description: Use when a UI change is about to be committed and its real rendering needs checking on desktop and mobile - "does it render well?", "does it display correctly?", "ça rend bien ?", "est-ce que ça s'affiche bien ?", suspected visual regression, layout/restyle changed, green tests but the rendering never seen.
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
metadata:
|
|
6
|
+
last-reviewed: 2026-06-19
|
|
7
|
+
category: frontend
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Visual regression check - see the real rendering before commit
|
|
11
|
+
|
|
12
|
+
> If the current repo has a dedicated visual skill (e.g. acme-app → `visual-self-review`), it wins - it knows the pages, the snapshot harness, and the project commands.
|
|
13
|
+
|
|
14
|
+
## This skill vs. others
|
|
15
|
+
|
|
16
|
+
- **This skill** when: a UI change is ready to commit - you must see the **real rendering** (not just the tests) on desktop AND mobile, and catch anything broken
|
|
17
|
+
- **`validating-features-end-to-end`** instead if: the question is "does the feature *work*" (golden path, API, DB) - functional evidence, not rendering
|
|
18
|
+
- **`commit-readiness-review`** instead if: the question is "is it committable" (secrets, lint, debug leftovers)
|
|
19
|
+
|
|
20
|
+
## Principle
|
|
21
|
+
|
|
22
|
+
- **"Green tests ≠ correct rendering"**: typecheck/lint/unit do not see a broken grid, a mobile overflow, a never-mounted component, an `undefined` on screen. Vision detects them reliably.
|
|
23
|
+
- You are **not** asked for an aesthetic judgment but for detecting what is *broken*: overlapping layout, truncated text, overflow, an empty state showing `undefined`.
|
|
24
|
+
- **This is NOT a substitute for human visual testing**: it is a detection net before commit, not a design validation.
|
|
25
|
+
|
|
26
|
+
## Context to gather (before acting)
|
|
27
|
+
|
|
28
|
+
- **Which surfaces are affected**: from the diff, which pages/screens render the changed components. A shared component = check at least 2 consuming surfaces.
|
|
29
|
+
- **How to run the app** locally (dev command + URL/port) - read `package.json` / `Makefile` / the project config.
|
|
30
|
+
- **States to cover**: nominal + reachable ones - empty (filter with no results), error (500 response), loading if stable.
|
|
31
|
+
- **Viewports**: desktop **1280×720** + mobile **375×812** by default; adapt to the project's real breakpoints.
|
|
32
|
+
|
|
33
|
+
## Protocol
|
|
34
|
+
|
|
35
|
+
1. **Start the app** for real (dev command) and wait until it responds.
|
|
36
|
+
2. **Navigate** to each affected surface (`browser_navigate`).
|
|
37
|
+
3. **Capture each surface in each viewport**: `browser_resize` 1280×720 → `browser_take_screenshot`; then `browser_resize` 375×812 → screenshot. Save under a readable path (`<surface>-<viewport>-<state>.png`).
|
|
38
|
+
4. **Cover the states**: nominal, empty, error, loading (those reachable; flag the ones not reached).
|
|
39
|
+
5. **Inspect each capture** (vision) with the objective checklist below.
|
|
40
|
+
6. **Compare** to the expected rendering / the state before the change (and to the project's snapshot harness if it exists).
|
|
41
|
+
|
|
42
|
+
Inspection checklist:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
- [ ] Nothing truncated, overlapping, overflowing; no horizontal scroll on mobile
|
|
46
|
+
- [ ] The expected change is visible (the component actually renders - orphan-component trap)
|
|
47
|
+
- [ ] Empty/error/loading states rendered, no undefined/NaN/raw i18n key on screen
|
|
48
|
+
- [ ] Text legible against the background (contrast), density consistent with neighboring surfaces
|
|
49
|
+
- [ ] Layout consistent on desktop AND mobile (both viewports re-read)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Templates
|
|
53
|
+
|
|
54
|
+
Verdict to trace (MR description / report):
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
Surfaces checked: <list>
|
|
58
|
+
Viewports: desktop 1280×720 ✅ · mobile 375×812 ✅
|
|
59
|
+
States: nominal ✅ · empty ✅ · error ✅ · loading <✅/not reached>
|
|
60
|
+
Captures: <paths>
|
|
61
|
+
Anomalies: <fixed before commit / none>
|
|
62
|
+
Not checked: <unreachable state/surface - explicit>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Traps & rationalizations
|
|
66
|
+
|
|
67
|
+
| Excuse | Reality |
|
|
68
|
+
|--------|---------|
|
|
69
|
+
| "The tests pass so the rendering is fine" | typecheck/lint/unit see neither a broken grid nor a never-mounted component. |
|
|
70
|
+
| "I looked on desktop, that's enough" | Mobile (375px) is blind spot #1: overflow and wrap only appear when narrow. |
|
|
71
|
+
| "No need for the empty/error state" | That is where `undefined`/`NaN`/raw i18n keys surface. One state = partial evidence. |
|
|
72
|
+
| "A human review will validate it" | This skill does not replace the human, but does not assume they will look: be the detection gate before commit. |
|
|
73
|
+
|
|
74
|
+
## Exit condition
|
|
75
|
+
|
|
76
|
+
- [ ] Desktop **and** mobile captures of each affected surface, read with the checklist
|
|
77
|
+
- [ ] Empty/error states checked or explicitly flagged as not checked
|
|
78
|
+
- [ ] Compared to the project's snapshot harness if it exists (intentional diff re-read, otherwise fixed)
|
|
79
|
+
- [ ] Verdict + capture paths traced - never "it should render"
|
|
80
|
+
|
|
81
|
+
## Tooling
|
|
82
|
+
|
|
83
|
+
- Browser driving via Playwright MCP: `mcp__<server>__browser_navigate`, `mcp__<server>__browser_resize`, `mcp__<server>__browser_take_screenshot` (and `browser_snapshot` for the accessibility tree).
|
|
84
|
+
- Failing that: the project's E2E runner / visual snapshot harness (read its config).
|
|
85
|
+
- No dedicated script here: dev command and viewports are project-specific.
|
|
86
|
+
|
|
87
|
+
## Changelog
|
|
88
|
+
|
|
89
|
+
- 1.0.0 (2026-06-19) - initial generic release extracted from acme-app/visual-self-review (stack coupling removed, viewports parameterizable)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# `writing-robust-tests`
|
|
2
|
+
|
|
3
|
+
> A green test you have never seen red proves nothing. The deliverable isn't "tests written" - it's tests whose failure has been demonstrated.
|
|
4
|
+
|
|
5
|
+
| | |
|
|
6
|
+
|---|---|
|
|
7
|
+
| **Type** | Skill (on-demand workflow) |
|
|
8
|
+
| **Category** | `test` |
|
|
9
|
+
| **Artifact** | [`SKILL.md`](SKILL.md) |
|
|
10
|
+
| **Tooling** | [`testing-advanced`](../comprehensive-test-strategy/reference/testing-advanced.md) reference (shared with `comprehensive-test-strategy`) |
|
|
11
|
+
|
|
12
|
+
## What it is
|
|
13
|
+
|
|
14
|
+
`writing-robust-tests` is a design-plus-evidence method for adding tests to existing code that lacks coverage. It combines ISTQB test-design techniques (applied, not copied) with a hard rule: every test must be seen failing before it is trusted.
|
|
15
|
+
|
|
16
|
+
## Why it exists
|
|
17
|
+
|
|
18
|
+
Two failure modes make test suites worthless:
|
|
19
|
+
|
|
20
|
+
1. **The Liar** - a test that stays green even when the code under test is broken. It asserts nothing meaningful (an over-permissive mock, a CSS-class check, an empty fixture) and gives false confidence.
|
|
21
|
+
2. **The fragile E2E** - locators tied to wording, hard `sleep`s, assertions coupled to implementation timing, or a fully-mocked "E2E" that is really a UI test and can never catch a backend contract break.
|
|
22
|
+
|
|
23
|
+
The skill kills the Liar with a mandatory mutation step (break the code, watch the test go red, restore) and kills fragility with strict E2E rules: `data-testid` for every locator, page objects, zero hard waits, and a deliberate choice of test level.
|
|
24
|
+
|
|
25
|
+
## When it triggers
|
|
26
|
+
|
|
27
|
+
- "write tests for X" / "cover this file" / "add tests"
|
|
28
|
+
- code shipped without sufficient tests
|
|
29
|
+
- flaky or fragile suites to harden
|
|
30
|
+
|
|
31
|
+
Use `superpowers:test-driven-development` instead when the code does not exist yet (test first), and `detection-sweep` for a whole-project audit rather than a targeted file.
|
|
32
|
+
|
|
33
|
+
## How it works
|
|
34
|
+
|
|
35
|
+
The method pairs ISTQB test design with a hard evidence rule. You first adapt to the project (framework, neighboring-test conventions, reference fixtures - never invented data), then design deliberately: level first (unit ~70% / integration-contract ~20% / E2E ~10%), black-box techniques, error guessing, and the FIRST properties. E2E work obeys non-negotiable rules - `data-testid` for every locator, page objects, zero hard waits, no timing coupling - and mocking stays at the boundaries only so a fully-mocked "E2E" is called what it is. Finally, every test must be seen failing: run green, break the code under test until it goes red with a readable message, restore. A test still green with broken code is a Liar and gets rewritten.
|
|
36
|
+
|
|
37
|
+
Full step-by-step protocol → [`SKILL.md`](SKILL.md).
|
|
38
|
+
|
|
39
|
+
## Worked example
|
|
40
|
+
|
|
41
|
+
> On acme-app, a `formatInvoiceTotal` helper ships without tests.
|
|
42
|
+
|
|
43
|
+
1. Read `package.json` → Vitest; copy conventions from a neighboring `*.spec.ts`.
|
|
44
|
+
2. Boundary Value Analysis around the free-shipping threshold 100 → cases at 99 / 100 / 101; error guessing adds null, empty cart, negative quantity.
|
|
45
|
+
3. Run → all green.
|
|
46
|
+
4. Mutation: change `>= 100` to `> 100`; the 100 boundary test goes red with a clear message. Restore → green.
|
|
47
|
+
5. Suite run, output pasted in the summary. No hard waits, no invented data.
|
|
48
|
+
|
|
49
|
+
## Related artifacts
|
|
50
|
+
|
|
51
|
+
- the Superpowers `test-driven-development` skill - when the code does not exist yet.
|
|
52
|
+
- [`refactoring-shared-component-api`](../refactoring-shared-component-api/) - pairs here for wrapper/adapter mount tests.
|
|
53
|
+
- [`validating-features-end-to-end`](../validating-features-end-to-end/) - to turn a validated feature into an E2E spec.
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: writing-robust-tests
|
|
3
|
+
description: Use when writing tests for existing code that lacks coverage - "write tests for X", "cover this file", "add tests", "écris des tests pour X", "couvre ce fichier", "ajoute des tests", code shipped without sufficient tests, flaky or fragile test suites to harden.
|
|
4
|
+
version: 1.0.1
|
|
5
|
+
metadata:
|
|
6
|
+
last-reviewed: 2026-07-20
|
|
7
|
+
category: test
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Writing Robust Tests - ISTQB design + evidence
|
|
11
|
+
|
|
12
|
+
> If the current repo has a dedicated test skill (e.g. acme-app → `write-tests`), it wins - it knows the golden dataset and the project commands.
|
|
13
|
+
|
|
14
|
+
## This skill vs. others
|
|
15
|
+
|
|
16
|
+
- **This skill**: the code exists, the tests are missing or fragile
|
|
17
|
+
- **superpowers:test-driven-development**: the code does not exist yet (test first)
|
|
18
|
+
- **detection-sweep**: a whole-project audit, not a targeted file
|
|
19
|
+
|
|
20
|
+
## Principle
|
|
21
|
+
|
|
22
|
+
**A green test you have never seen red proves nothing.** The output of this skill is not "tests written" but "tests whose failure has been demonstrated".
|
|
23
|
+
|
|
24
|
+
## 1. Adapt to the project (2 min, before writing)
|
|
25
|
+
|
|
26
|
+
- Framework + commands: read `package.json` scripts / `Cargo.toml` / `Makefile` / CI config
|
|
27
|
+
- **Read an existing neighboring test** and copy its conventions (page objects, helpers, fixtures) before inventing
|
|
28
|
+
- Data: locate the project's reference seed/fixtures; never invented magic data
|
|
29
|
+
|
|
30
|
+
## 2. Design (ISTQB, apply don't copy)
|
|
31
|
+
|
|
32
|
+
- **Level first**: unit (~70%) / integration-contract (~20%) / E2E (~10%). Choose deliberately - see the mock trap §4
|
|
33
|
+
- **Black-box**: Equivalence Partitioning · Boundary Value Analysis (threshold 100 → 99/100/101) · Decision Table · State Transition (an entity's lifecycle) · Use Case
|
|
34
|
+
- **Experience-based**: error guessing (null/empty/negative/Unicode/SQLi/XSS), regression checklist
|
|
35
|
+
- **FIRST**: Fast (unit without DB/network) · Isolated · Repeatable (no clock or random) · Self-validating · Timely
|
|
36
|
+
|
|
37
|
+
## 3. Absolute E2E rules (any Playwright/Cypress project)
|
|
38
|
+
|
|
39
|
+
1. **`data-testid` for every locator** - never `text=`, placeholder, CSS class, XPath. If the component has none: **adding the `data-testid`s to the component is part of the task**, not an excuse for a fragile locator
|
|
40
|
+
2. **Page Object**: locators / actions / assertions separated, scoped locators (`parent.getByTestId('child')`)
|
|
41
|
+
3. **ZERO hard waits** (`waitForTimeout`, `sleep`) - wait for a concrete state: visible, URL, network response
|
|
42
|
+
4. **Zero assertion coupled to the implementation's timing** (a toast that disappears after 3 s tested with a 5 s timeout = fragile coupling) - drive or neutralize the clock, or test the state not the duration
|
|
43
|
+
5. AAA, a single act, one concept per test ("and" in the name → split); no conditional `test.skip()`
|
|
44
|
+
|
|
45
|
+
## 4. The total-mock trap
|
|
46
|
+
|
|
47
|
+
Mocking the whole API in an "E2E" test makes it a UI component test: it will never detect a backend contract break. Choose explicitly:
|
|
48
|
+
- **True E2E**: real backend + seeded data - covers the contract
|
|
49
|
+
- **Component test**: mocked API - fast, but declare it as such and complete it with a contract test
|
|
50
|
+
|
|
51
|
+
Mock at the boundaries only (external network, clock), never in the middle of the system under test.
|
|
52
|
+
|
|
53
|
+
## 5. Mandatory evidence: the test can fail
|
|
54
|
+
|
|
55
|
+
For each test (or homogeneous group):
|
|
56
|
+
1. Run → green
|
|
57
|
+
2. **Temporarily break the code under test** (invert the condition, return a wrong value) → the test MUST go red with a readable message
|
|
58
|
+
3. Restore → green
|
|
59
|
+
|
|
60
|
+
A test that stays green with broken code is a Liar - rewrite it.
|
|
61
|
+
|
|
62
|
+
## Traps & rationalizations
|
|
63
|
+
|
|
64
|
+
| Excuse | Reality |
|
|
65
|
+
|--------|---------|
|
|
66
|
+
| "No time to run it, the test code is correct" | Tests never run = tests not written. Run them. |
|
|
67
|
+
| "getByRole/placeholder is more accessible" | And fragile at the slightest wording change. data-testid, full stop. |
|
|
68
|
+
| "The component has no data-testid" | Adding them is part of the task. |
|
|
69
|
+
| "I mock the API, it's more stable" | You just turned your E2E into a UI test. Decide the level deliberately. |
|
|
70
|
+
| "It's a one-line fix, no need to see red" | 30 seconds to mutate the code. Always. |
|
|
71
|
+
|
|
72
|
+
## Exit condition
|
|
73
|
+
|
|
74
|
+
- [ ] Project conventions reused (neighboring test read)
|
|
75
|
+
- [ ] data-testid added to the components touched, page object created/updated
|
|
76
|
+
- [ ] ZERO hard waits, zero fragile locator, zero timing coupling
|
|
77
|
+
- [ ] Each test seen red (mutation) then green
|
|
78
|
+
- [ ] Suite run, output pasted in the summary - never "it should pass"
|
|
79
|
+
|
|
80
|
+
## Tooling
|
|
81
|
+
|
|
82
|
+
- Advanced techniques (automated mutation testing, contract harness, fuzzing, quality gates): see `comprehensive-test-strategy/reference/testing-advanced.md` - shared with the strategy skill.
|
|
83
|
+
|
|
84
|
+
## Changelog
|
|
85
|
+
|
|
86
|
+
- 1.0.1 (2026-07-20) - Tooling now links the shared testing-advanced reference (was announced as planned while it already existed)
|
|
87
|
+
|
|
88
|
+
- 1.0.0 (2026-06-19) - initial versioned release + state-of-the-art enrichment (routing, context, protocol, traps, exit condition)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Generic rules managed by the Ronce Racine canonical source.
|
|
2
|
+
# One per line. Rules NOT listed are left untouched (locally customized versions).
|
|
3
|
+
# Sync: npx tsx /path/to/ronce-racine/install.ts install . --rules-only
|
|
4
|
+
minimal-code.md
|
|
5
|
+
commits.md
|
|
6
|
+
test-discipline.md
|
|
7
|
+
# secure-logging.md # ← uncomment to adopt the generic version
|
|
8
|
+
# detection-gap-protocol.md # ← same
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Anti-drift CI gate for the generic Claude config (rules + skills + hooks + agents).
|
|
2
|
+
# Include it in the .gitlab-ci.yml of the repo that adopts Ronce Racine.
|
|
3
|
+
# Compares the installed artifacts (lockfile .claude/.ronce-racine.json) against
|
|
4
|
+
# the published package the lockfile names.
|
|
5
|
+
#
|
|
6
|
+
# Soft by default: `--strict` makes the job fail, but `allow_failure: true` keeps
|
|
7
|
+
# it non-blocking (yellow warning). For a STRICT blocking gate, remove that line.
|
|
8
|
+
|
|
9
|
+
claude-config:drift:
|
|
10
|
+
stage: test
|
|
11
|
+
image: node:22-alpine
|
|
12
|
+
allow_failure: true # ← soft: warns without blocking. Remove to block.
|
|
13
|
+
script:
|
|
14
|
+
# The lockfile records the version installed, so the check runs against
|
|
15
|
+
# exactly that one: a newer release cannot flag this repo on its own.
|
|
16
|
+
- VERSION=$(node -e "try{process.stdout.write(require('./.claude/.ronce-racine.json').source.version||'latest')}catch(e){process.stdout.write('latest')}")
|
|
17
|
+
- npx -y ronce-racine@"$VERSION" check . --strict
|
|
18
|
+
rules:
|
|
19
|
+
- changes:
|
|
20
|
+
- ".claude/**"
|
|
21
|
+
|
|
22
|
+
# Rules-only variant (based on the .adopted manifest):
|
|
23
|
+
# rules: { changes: [".claude/rules/shared/**"] }
|