@xynogen/pix-skills 0.7.8 → 0.7.12
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/package.json +5 -5
- package/skills/tdd.md +47 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xynogen/pix-skills",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.12",
|
|
4
4
|
"description": "Pi extension — agent skill loader (skill tool + skills bundle)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"@earendil-works/pi-tui": "*"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@xynogen/pix-data": "^0.4.
|
|
50
|
-
"@xynogen/pix-gate": "^0.2.
|
|
51
|
-
"@xynogen/pix-pretty": "^1.
|
|
52
|
-
"@xynogen/pix-runtime": "^0.
|
|
49
|
+
"@xynogen/pix-data": "^0.4.3",
|
|
50
|
+
"@xynogen/pix-gate": "^0.2.6",
|
|
51
|
+
"@xynogen/pix-pretty": "^1.11.2",
|
|
52
|
+
"@xynogen/pix-runtime": "^0.5.3"
|
|
53
53
|
}
|
|
54
54
|
}
|
package/skills/tdd.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd
|
|
3
|
+
description: Pragmatic test-driven development for any language or framework. Use when building features or fixing bugs test-first without dogma — red-green loop, seams, vertical slices, with sanctioned exceptions.
|
|
4
|
+
---
|
|
5
|
+
# Pragmatic TDD
|
|
6
|
+
|
|
7
|
+
Test-first by default, not test-first as religion. The loop is the tool; keeping momentum matters more than ritual purity.
|
|
8
|
+
|
|
9
|
+
## The Loop
|
|
10
|
+
|
|
11
|
+
1. **RED** — write one small failing test for the next behavior. Run it. It must fail because the behavior is missing (a typo or setup error doesn't count as red).
|
|
12
|
+
2. **GREEN** — write the simplest code that passes. No speculative features, no drive-by refactors.
|
|
13
|
+
3. **REFACTOR** — once green, clean names and duplication. Tests stay green. No new behavior.
|
|
14
|
+
4. Repeat, one vertical slice at a time: one test → one implementation → next test. Never write all tests up front.
|
|
15
|
+
|
|
16
|
+
## Where tests go: seams
|
|
17
|
+
|
|
18
|
+
Test at public boundaries — the interface a caller actually uses — never internals. A good test reads like a spec ("rejects empty email") and survives refactors because it doesn't know how the code works, only what it does.
|
|
19
|
+
|
|
20
|
+
- Don't test private helpers directly; test them through the public seam.
|
|
21
|
+
- Prefer real code over mocks. Mock only unowned boundaries (network, clock, filesystem when slow).
|
|
22
|
+
- Expected values come from an independent source (spec, worked example, known literal) — never recomputed the same way the code computes them.
|
|
23
|
+
|
|
24
|
+
## Sanctioned exceptions — no guilt, but say so
|
|
25
|
+
|
|
26
|
+
Test-after or no-test is fine for:
|
|
27
|
+
|
|
28
|
+
- **Spikes/exploration** — explore freely, then either throw it away and redo test-first, or backfill tests before merging. Backfilled tests must be broken on purpose once (mutate the code, watch them fail) to prove they bite.
|
|
29
|
+
- **Trivial glue** — one-line delegations, config, generated code, pure declarations.
|
|
30
|
+
- **UI layout/styling** — assert behavior if any, not pixels.
|
|
31
|
+
- **Hard-to-harness legacy code** — add a characterization test at the nearest seam you *can* reach, then proceed.
|
|
32
|
+
|
|
33
|
+
When you skip test-first, state it in one line ("skipping TDD: config-only change"). Silent skipping is the failure mode, not the skipping itself.
|
|
34
|
+
|
|
35
|
+
## Non-negotiables (the relaxed variant still keeps these)
|
|
36
|
+
|
|
37
|
+
- **Bug fixes always get a failing test first.** Reproducing the bug in a test is the fix's proof and the regression guard.
|
|
38
|
+
- **A test you never saw fail proves nothing.** Watch red at least once — fresh or via deliberate mutation.
|
|
39
|
+
- **Green means all green.** Other tests breaking is your problem now, not later.
|
|
40
|
+
- **Never weaken an assertion to get to green.** Fix the code or renegotiate the requirement, out loud.
|
|
41
|
+
|
|
42
|
+
## Smells to stop on
|
|
43
|
+
|
|
44
|
+
- Test needs heavy mocking → the design is too coupled; simplify the interface before writing more tests.
|
|
45
|
+
- Test setup is huge → extract helpers, or the seam is wrong.
|
|
46
|
+
- Test breaks when you refactor without behavior change → it's coupled to implementation; rewrite it against the seam.
|
|
47
|
+
- Assertion is `expect(f(a,b)).toBe(a+b)` style → tautological; use a literal.
|