@xynogen/pix-skills 0.7.8 → 0.7.13

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-skills",
3
- "version": "0.7.8",
3
+ "version": "0.7.13",
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.0",
50
- "@xynogen/pix-gate": "^0.2.0",
51
- "@xynogen/pix-pretty": "^1.10.0",
52
- "@xynogen/pix-runtime": "^0.4.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
  }
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: harden
3
+ description: Retrofit static analysis onto an existing project in any language — lint, format, type/compile check, tests, dependency hygiene, audit, CI gate. Use only on explicit request — "harden this project", "add static analysis", "set up quality gates".
4
+ disable-model-invocation: true
5
+ ---
6
+ # Project Hardening Directive
7
+
8
+ ## Goal
9
+
10
+ An existing project gains a fail-fast static-analysis gate: one command locally, same command in CI, red blocks merge. Do not scaffold new projects — that is `bootstrap`'s job.
11
+
12
+ ## Phase 1: Audit (read-only)
13
+
14
+ Inventory before touching anything:
15
+
16
+ - **Ecosystem** — detect language(s), build system, package/dependency manager, existing configs (linter, formatter, compiler/type-checker settings, CI files, hooks). Mixed-language repos: audit each language separately.
17
+ - **Existing tools win** — a project with a working linter keeps it; never swap tools for taste. Only fill gaps.
18
+ - **Verify, don't recall** — before proposing any tool, confirm it exists and its flags via `--help` or official docs. Ecosystems move; memory rots.
19
+ - **Gaps checklist** (rank by value/effort, report before applying):
20
+ 1. Formatter + linter present and enforced (not just installed)?
21
+ 2. Warnings fail CI, or are they decorative?
22
+ 3. Strictest static check the language offers covers ALL source including tests — type-check for typed languages, compiler warnings-as-errors, or a type-annotation checker for dynamic ones (mypy/pyright, sorbet, phpstan)?
23
+ 4. Test runner wired with at least one real test? Coverage threshold?
24
+ 5. Dependency vulnerability audit at high severity (`npm audit`, `cargo audit`, `pip-audit`, `govulncheck`, `mvn dependency-check`, `bundler-audit` — whatever the ecosystem ships)?
25
+ 6. Dependency versions locked (lockfile, pinned requirements, go.sum, Cargo.lock) + CI installs exactly those versions (frozen/locked/ci mode)?
26
+ 7. CI exists, runs the same commands as local, pinned toolchain version (never `latest`)?
27
+ 8. Dead-code / unused-dep detection — only for multi-package repos; use the ecosystem's tool if one exists, skip otherwise.
28
+
29
+ ## Phase 2: Propose
30
+
31
+ Present the gap list with one-line fixes and effort estimates. Get approval before installing anything. Skip items the user rejects — no silent extras.
32
+
33
+ ## Phase 3: Apply
34
+
35
+ - **One tool per job.** Prefer the ecosystem's converged default (examples: Biome or ESLint+Prettier; ruff+mypy; gofmt+vet+staticcheck; clippy+rustfmt; ktlint+detekt; php-cs-fixer+phpstan). Unsure what the current default is → check docs, don't guess.
36
+ - **Single gate command** — one entry point chaining format-check → lint → static/type check → tests, fail-fast. Use whatever the project already uses to run tasks: package-manager script, Makefile, justfile, rakefile, cargo alias, gradle task. CI calls this exact entry point, never a diverging copy.
37
+ - **Warnings are errors in CI.** A rule worth having is worth failing on.
38
+ - **Coverage: ratchet, don't aspire.** Set threshold to the current actual percentage; raise it later. Never set an aspirational number that fails on day one.
39
+ - **Pin versions** — tool versions locked by the dependency manager (or a pinned tool-version file: `.tool-versions`, `rust-toolchain.toml`, `.python-version`), toolchain version pinned in CI config.
40
+ - Config over code: use the tool's recommended preset + minimal overrides. No 300-line rule files.
41
+
42
+ ## Phase 4: Verify + Report
43
+
44
+ - Run the full gate once — must pass green on the untouched codebase (fix or downgrade rules until it does; a gate that starts red gets deleted by the next dev).
45
+ - Break one thing on purpose (introduce a lint error), confirm the gate catches it, revert.
46
+
47
+ ```text
48
+ ## Hardened: [project name]
49
+
50
+ **Gate:** `[command]` → PASS
51
+ **Added:** [tool: purpose, one line each]
52
+ **Skipped:** [item: reason]
53
+ **CI:** [file, trigger, runtime pin]
54
+ **Ratchets:** coverage at N% — raise when it grows
55
+ ```
56
+
57
+ Mixed-language repo: repeat the gate per language, one top-level command runs all.
58
+
59
+ ## Red Flags — STOP
60
+
61
+ - Replacing a working tool the project already uses.
62
+ - Installing anything before Phase 2 approval.
63
+ - A gate that is red on the first run after setup.
64
+ - CI commands that differ from the local gate script.
65
+ - Aspirational coverage thresholds.
66
+ - Adding hooks (husky etc.) when a gate script + CI already covers it — hooks are opt-in, ask first.
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.