@zenspc/pi-pstack 0.1.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.
Files changed (128) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +49 -0
  3. package/agents/comment-sicko.md +34 -0
  4. package/agents/poteto-agent.md +13 -0
  5. package/extensions/pstack/config.ts +228 -0
  6. package/extensions/pstack/index.ts +211 -0
  7. package/package.json +57 -0
  8. package/skills/architect/SKILL.md +82 -0
  9. package/skills/architect/references/design-red-flags.md +33 -0
  10. package/skills/architect/references/rationale-template.md +35 -0
  11. package/skills/architect/references/runner-prompt.md +20 -0
  12. package/skills/arena/SKILL.md +70 -0
  13. package/skills/automate-me/SKILL.md +114 -0
  14. package/skills/blast-radius/SKILL.md +49 -0
  15. package/skills/bro/SKILL.md +6 -0
  16. package/skills/create-verification-skill/SKILL.md +43 -0
  17. package/skills/create-verification-skill/references/feature-map-example/README.md +47 -0
  18. package/skills/create-verification-skill/references/feature-map-example/create-note.md +39 -0
  19. package/skills/create-verification-skill/references/feature-map-example/search.md +45 -0
  20. package/skills/figure-it-out/SKILL.md +54 -0
  21. package/skills/how/SKILL.md +134 -0
  22. package/skills/how/references/critic-prompt.md +59 -0
  23. package/skills/how/references/critique-rubric.md +58 -0
  24. package/skills/how/references/explainer-prompt.md +55 -0
  25. package/skills/how/references/explorer-prompt.md +52 -0
  26. package/skills/interrogate/SKILL.md +109 -0
  27. package/skills/interrogate/references/code-quality-review.md +47 -0
  28. package/skills/interrogate/references/lead-judgment.md +58 -0
  29. package/skills/interrogate/references/reviewer-prompt.md +72 -0
  30. package/skills/interrogate/references/rubric.md +77 -0
  31. package/skills/maintain-verification-skill/SKILL.md +38 -0
  32. package/skills/no-comments/SKILL.md +23 -0
  33. package/skills/poteto-mode/SKILL.md +140 -0
  34. package/skills/poteto-mode/playbooks/authoring-a-skill.md +12 -0
  35. package/skills/poteto-mode/playbooks/autonomous-run.md +13 -0
  36. package/skills/poteto-mode/playbooks/autopilot-full.md +13 -0
  37. package/skills/poteto-mode/playbooks/autopilot-stack.md +31 -0
  38. package/skills/poteto-mode/playbooks/babysit.md +27 -0
  39. package/skills/poteto-mode/playbooks/bug-fix.md +17 -0
  40. package/skills/poteto-mode/playbooks/eval.md +27 -0
  41. package/skills/poteto-mode/playbooks/feature.md +21 -0
  42. package/skills/poteto-mode/playbooks/hillclimb.md +21 -0
  43. package/skills/poteto-mode/playbooks/investigation.md +14 -0
  44. package/skills/poteto-mode/playbooks/multi-phase-plan.md +3 -0
  45. package/skills/poteto-mode/playbooks/opening-a-pr.md +35 -0
  46. package/skills/poteto-mode/playbooks/orchestrate.md +113 -0
  47. package/skills/poteto-mode/playbooks/pause-safely.md +10 -0
  48. package/skills/poteto-mode/playbooks/perf-issue.md +24 -0
  49. package/skills/poteto-mode/playbooks/prototype.md +14 -0
  50. package/skills/poteto-mode/playbooks/refactoring.md +16 -0
  51. package/skills/poteto-mode/playbooks/runtime-forensics.md +11 -0
  52. package/skills/poteto-mode/playbooks/session-pickup.md +13 -0
  53. package/skills/poteto-mode/playbooks/shipping.md +40 -0
  54. package/skills/poteto-mode/playbooks/trace-forensics.md +14 -0
  55. package/skills/poteto-mode/playbooks/visual-parity.md +11 -0
  56. package/skills/poteto-mode/playbooks/worktree-cleanup.md +14 -0
  57. package/skills/poteto-mode/references/bugbot-triage.md +142 -0
  58. package/skills/poteto-mode/references/plan.md +105 -0
  59. package/skills/poteto-mode/scripts/bootstrap.ts +62 -0
  60. package/skills/poteto-mode/scripts/bun.lock +67 -0
  61. package/skills/poteto-mode/scripts/orch/orch.test.ts +634 -0
  62. package/skills/poteto-mode/scripts/orch/orch.ts +578 -0
  63. package/skills/poteto-mode/scripts/orch/store.ts +1607 -0
  64. package/skills/poteto-mode/scripts/package.json +16 -0
  65. package/skills/poteto-mode/scripts/watch-pr/cli.test.ts +224 -0
  66. package/skills/poteto-mode/scripts/watch-pr/cli.ts +223 -0
  67. package/skills/poteto-mode/scripts/watch-pr/fakes.test-helper.ts +118 -0
  68. package/skills/poteto-mode/scripts/watch-pr/github.test.ts +306 -0
  69. package/skills/poteto-mode/scripts/watch-pr/github.ts +699 -0
  70. package/skills/poteto-mode/scripts/watch-pr/policy.test.ts +420 -0
  71. package/skills/poteto-mode/scripts/watch-pr/policy.ts +832 -0
  72. package/skills/poteto-mode/scripts/watch-pr/render.ts +169 -0
  73. package/skills/poteto-mode/scripts/watch-pr/tsconfig.json +13 -0
  74. package/skills/poteto-mode/scripts/watch-pr/types.compile.ts +93 -0
  75. package/skills/poteto-mode/scripts/watch-pr/types.ts +401 -0
  76. package/skills/poteto-mode/scripts/watch-pr/watch-pr +6 -0
  77. package/skills/poteto-mode/scripts/worktree-audit.sh +85 -0
  78. package/skills/principle-boundary-discipline/SKILL.md +33 -0
  79. package/skills/principle-build-the-lever/SKILL.md +22 -0
  80. package/skills/principle-encode-lessons-in-structure/SKILL.md +30 -0
  81. package/skills/principle-exhaust-the-design-space/SKILL.md +20 -0
  82. package/skills/principle-experience-first/SKILL.md +18 -0
  83. package/skills/principle-fix-root-causes/SKILL.md +22 -0
  84. package/skills/principle-foundational-thinking/SKILL.md +20 -0
  85. package/skills/principle-guard-the-context-window/SKILL.md +16 -0
  86. package/skills/principle-laziness-protocol/SKILL.md +17 -0
  87. package/skills/principle-make-operations-idempotent/SKILL.md +23 -0
  88. package/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +21 -0
  89. package/skills/principle-minimize-reader-load/SKILL.md +22 -0
  90. package/skills/principle-model-the-domain/SKILL.md +25 -0
  91. package/skills/principle-never-block-on-the-human/SKILL.md +22 -0
  92. package/skills/principle-outcome-oriented-execution/SKILL.md +21 -0
  93. package/skills/principle-prove-it-works/SKILL.md +32 -0
  94. package/skills/principle-redesign-from-first-principles/SKILL.md +15 -0
  95. package/skills/principle-separate-before-serializing-shared-state/SKILL.md +15 -0
  96. package/skills/principle-sequence-verifiable-units/SKILL.md +21 -0
  97. package/skills/principle-subtract-before-you-add/SKILL.md +21 -0
  98. package/skills/principle-type-system-discipline/SKILL.md +30 -0
  99. package/skills/recall/SKILL.md +40 -0
  100. package/skills/reflect/SKILL.md +77 -0
  101. package/skills/reflect/references/divergent-reviewer.md +43 -0
  102. package/skills/reflect/references/judgment-reviewer.md +42 -0
  103. package/skills/reflect/references/synthesizer.md +56 -0
  104. package/skills/reflect/references/tooling-reviewer.md +57 -0
  105. package/skills/setup-pstack/SKILL.md +28 -0
  106. package/skills/show-me-your-work/SKILL.md +89 -0
  107. package/skills/show-me-your-work/references/decision-log-template.tsv +1 -0
  108. package/skills/show-me-your-work/scripts/log.sh +40 -0
  109. package/skills/swarm/SKILL.md +45 -0
  110. package/skills/tdd/SKILL.md +43 -0
  111. package/skills/teach/SKILL.md +20 -0
  112. package/skills/technical-writing/SKILL.md +129 -0
  113. package/skills/typescript-best-practices/SKILL.md +28 -0
  114. package/skills/typescript-best-practices/references/patterns.md +292 -0
  115. package/skills/unslop/SKILL.md +80 -0
  116. package/skills/why/SKILL.md +229 -0
  117. package/skills/why/references/epistemics.md +144 -0
  118. package/skills/why/references/investigator-prompt.md +103 -0
  119. package/skills/why/references/source-playbook.md +17 -0
  120. package/skills/why/references/sources/code-archaeology.md +88 -0
  121. package/skills/why/references/sources/databricks.md +70 -0
  122. package/skills/why/references/sources/datadog.md +99 -0
  123. package/skills/why/references/sources/incident-postmortem.md +15 -0
  124. package/skills/why/references/sources/linear.md +48 -0
  125. package/skills/why/references/sources/notion.md +55 -0
  126. package/skills/why/references/sources/sentry.md +100 -0
  127. package/skills/why/references/sources/slack.md +54 -0
  128. package/skills/why/references/synthesizer-prompt.md +135 -0
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env bash
2
+ # Read-only worktree prune audit. Classifies every git worktree by size, merge
3
+ # state, uncommitted work, remote/PR state, and the most recent chat that
4
+ # operated in it. Emits a table sorted by size with a suggested bucket. Never
5
+ # deletes anything; deletion stays a human-gated step in the playbook.
6
+ #
7
+ # Usage: worktree-audit.sh [repo-path] (defaults to the current repo)
8
+ set -u
9
+
10
+ repo="${1:-$(git rev-parse --show-toplevel 2>/dev/null)}"
11
+ [ -z "$repo" ] && { echo "not in a git repo; pass a repo path" >&2; exit 1; }
12
+ cd "$repo" || exit 1
13
+
14
+ # Main worktree is the first entry; everything else is a candidate.
15
+ main_wt=$(git worktree list --porcelain | awk '/^worktree /{print $2; exit}')
16
+
17
+ # origin/main drives the merge check. Best-effort; stale is fine for a first pass.
18
+ git fetch origin main --quiet 2>/dev/null || echo "warn: could not fetch origin/main; merged column may be stale" >&2
19
+
20
+ # PR state by branch, fetched once. Empty if gh is unavailable.
21
+ prs=$(mktemp)
22
+ gh pr list --author "@me" --state all --limit 1000 \
23
+ --json number,state,headRefName 2>/dev/null > "$prs" || echo "[]" > "$prs"
24
+
25
+ # Transcripts dir: ~/.pi/agent/sessions (JSONL, one file per session).
26
+ transcripts="$HOME/.pi/agent/sessions"
27
+ now=$(date +%s)
28
+
29
+ printf "SIZE\tAGE\tMERGED\tDIRTY\tREMOTE\tPR\tLAST_CHAT\tBUCKET\tWORKTREE\n"
30
+
31
+ git worktree list --porcelain | awk '/^worktree /{print $2}' | while read -r wt; do
32
+ [ "$wt" = "$main_wt" ] && continue
33
+
34
+ size=$(du -sh "$wt" 2>/dev/null | awk '{print $1}')
35
+ head=$(git -C "$wt" rev-parse HEAD 2>/dev/null)
36
+ head_ts=$(git -C "$wt" log -1 --format='%ct' HEAD 2>/dev/null || echo 0)
37
+ age=$([ "$head_ts" -gt 0 ] 2>/dev/null && echo "$(( (now - head_ts) / 86400 ))d" || echo "?")
38
+
39
+ # Squash-merged branches are not ancestors of main, so PR state is the
40
+ # real signal; merge-base only catches fast-forward/rebase merges.
41
+ git merge-base --is-ancestor "$head" origin/main 2>/dev/null && merged=YES || merged=no
42
+
43
+ # Distinguish real WIP (tracked edits) from disposable untracked scratch.
44
+ porcelain=$(git -C "$wt" status --porcelain 2>/dev/null)
45
+ if [ -z "$porcelain" ]; then dirty=clean
46
+ elif printf '%s\n' "$porcelain" | grep -qv '^??'; then
47
+ dirty="wip:$(printf '%s\n' "$porcelain" | grep -cv '^??')"
48
+ else dirty="scratch:$(printf '%s\n' "$porcelain" | grep -c '^??')"; fi
49
+
50
+ branch=$(git -C "$wt" symbolic-ref --quiet --short HEAD 2>/dev/null || echo "")
51
+ if [ -z "$branch" ]; then remote=detached
52
+ elif git -C "$wt" show-ref --verify --quiet "refs/remotes/origin/$branch"; then
53
+ [ "$(git -C "$wt" rev-parse "origin/$branch" 2>/dev/null)" = "$head" ] \
54
+ && remote=pushed \
55
+ || remote="ahead$(git -C "$wt" rev-list --count "origin/$branch..HEAD" 2>/dev/null)"
56
+ else remote=no-remote; fi
57
+
58
+ pr=$([ -n "$branch" ] && jq -r --arg b "$branch" \
59
+ '.[] | select(.headRefName==$b) | "#\(.number)/\(.state)"' "$prs" 2>/dev/null | head -1)
60
+ [ -z "$pr" ] && pr="-"
61
+
62
+ # Most recent chat whose transcript operated in this worktree. Match path
63
+ # followed by "/" or a quote so glint-482 does not match glint-482-r37.
64
+ last="-"; last_ts=0
65
+ if [ -d "$transcripts" ]; then
66
+ f=$(rg -l -e "${wt}/" -e "${wt}\"" "$transcripts" 2>/dev/null \
67
+ | xargs stat -f '%m %N' 2>/dev/null | sort -rn | head -1)
68
+ if [ -n "$f" ]; then last_ts=$(echo "$f" | awk '{print $1}')
69
+ last=$(date -r "$last_ts" '+%Y-%m-%d' 2>/dev/null); fi
70
+ fi
71
+ recent=$([ "$last_ts" -gt 0 ] 2>/dev/null && [ $(( (now - last_ts) / 86400 )) -le 4 ] && echo yes || echo no)
72
+
73
+ case "$dirty" in wip:*) bucket=hold-wip ;; *)
74
+ case "$pr" in *OPEN*) bucket=hold-open-pr ;; *)
75
+ if [ "$recent" = yes ]; then bucket=verify-recent-chat
76
+ elif [ "$merged" = YES ] || [ "$pr" != "-" ]; then bucket=safe
77
+ else bucket=review; fi ;;
78
+ esac ;;
79
+ esac
80
+
81
+ printf "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" \
82
+ "$size" "$age" "$merged" "$dirty" "$remote" "$pr" "$last" "$bucket" "$wt"
83
+ done | sort -t$'\t' -k1,1 -rh
84
+
85
+ rm -f "$prs"
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: principle-boundary-discipline
3
+ description: "Apply when wiring validation, error handling, or framework adapters. Concentrate guards at system boundaries (CLI, config, network, external APIs); trust internal types and keep business logic in pure functions."
4
+ ---
5
+
6
+ # Boundary Discipline
7
+
8
+ Place validation, type narrowing, and error handling at system boundaries. Trust internal code unconditionally. Business logic lives in pure functions; the shell is thin and mechanical.
9
+
10
+ **Why:** Scattered validation is noisy, redundant, and gives a false sense of safety. Validate data once at the boundary. Keep logic out of framework wiring so it can be tested without the framework.
11
+
12
+ **The pattern:**
13
+ - **At boundaries** (CLI args, config files, external APIs, network protocols): validate, return errors, handle defensively.
14
+ - **Inside the system:** typed data, error propagation, no re-validation. Trust the types.
15
+ - **Across the boundary.** Expose domain concepts, not the boundary's private representation. Keep general-purpose mechanism inside and special-purpose policy at the edge.
16
+
17
+ **Applications:**
18
+
19
+ Validation and error handling:
20
+ - Validate config at parse time (the boundary), not inside business logic
21
+ - Parse raw data into domain types at the boundary
22
+ - Do not re-export transport, storage, framework, or wire types through the public surface
23
+ - No redundant nil checks deep in call chains if the boundary already validated
24
+
25
+ Code organization:
26
+ - Business logic in pure functions with no framework dependencies
27
+ - Parse functions: pure transforms from raw bytes to typed state
28
+ - Prompt construction: structured state in, string out
29
+ - Scoring and assessment: pure transforms from state to results
30
+
31
+ **The tests:**
32
+ - "Is this data crossing a system boundary right now?" If not, validation is redundant.
33
+ - "Can this be a pure function that the shell just calls?" If yes, extract it.
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: principle-build-the-lever
3
+ description: "Apply to any non-trivial work, not just bulk work: edits, migrations, analyses, checks. Build the tool that does it or proves it (codemod, script, generator, or a skill your subagents follow) instead of working by hand. The tool is the artifact a reviewer can rerun."
4
+ ---
5
+ # Build the Lever
6
+
7
+ When the work isn't trivial, build the tool that does it instead of doing it by hand.
8
+
9
+ **Why:** Two payoffs. Throughput: a codemod, generator, or script does the work the same way every time and reruns for free. Confidence: the tool is one artifact a reviewer can read and rerun to check the work. Hand-done changes can only be re-verified by redoing them. A deterministic script turns "trust me" into "run this".
10
+
11
+ **Pattern:** Default to building the lever. Skip it only when the task is genuinely trivial, a couple of obvious edits you can see at a glance.
12
+
13
+ - Do the first unit by hand to learn the recipe, then build the tool. Prove it by rerunning it on that unit and diffing against your hand-done version. Make the lever safe to rerun. A reviewer will.
14
+ - Codemod or script for edits, generator for repetitive files, a dump-to-sqlite query for analysis, a rerunnable check for verification.
15
+ - A deterministic lever beats fan-out. If the tool can process every unit in one pass, run it yourself; don't fan out delegates to hand-apply what a script can do.
16
+ - When you fan work out to subagents, write the lever as a skill they all read: the recipe, the verification contract, and the do-not-touch fences in one artifact, so every delegate inherits the same hardened version instead of re-explaining it per prompt and watching each one drift. Keep it outside the delegates' write scope so they can't quietly edit the contract.
17
+ - Applying this principle produces a file. If you cited it and there is no codemod, script, generator, or delegate skill in the diff, you didn't apply it.
18
+ - Commit the lever when the work outlives the session, so the next run reruns it instead of redoing it.
19
+
20
+ **Balance:** The bar is triviality, not repetition. A one-off still earns a lever when the lever is what makes the work checkable. Per the [Laziness Protocol](../principle-laziness-protocol/SKILL.md), build the smallest script that does or proves the job, never a framework.
21
+
22
+ Distinct from [Encode Lessons in Structure](../principle-encode-lessons-in-structure/SKILL.md), which makes a recurring instruction a durable guardrail. This is throughput and reviewability on the work in front of you. For scripting the verification itself, see [Prove It Works](../principle-prove-it-works/SKILL.md).
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: principle-encode-lessons-in-structure
3
+ description: "Apply when you catch yourself writing the same instruction a second time, or notice a recurring correction. Encode the rule as a lint, metadata flag, runtime check, or script instead of more text."
4
+ ---
5
+
6
+ # Encode Lessons in Structure
7
+
8
+ Encode recurring fixes in mechanisms (tools, code, metadata, automation) instead of textual instructions. Every error, human correction, and unexpected outcome is a learning signal. Capture it, route it, and close the loop.
9
+
10
+ **Why:** Textual instructions are easy to miss. They require the reader to notice, remember, and comply. Structural mechanisms (lint rules, metadata flags, runtime checks, automation scripts) enforce the rule without cooperation.
11
+
12
+ **Pattern:**
13
+ When you catch yourself writing the same instruction a second time:
14
+ 1. Ask: can this be a lint rule, a metadata flag, a runtime check, or a script?
15
+ 2. If yes, encode it. Delete the instruction
16
+ 3. If no (genuinely requires judgment), make the instruction more prominent and add an example of the failure mode
17
+
18
+ **Pick the strongest rung.** When more than one mechanism would work, choose the strongest the situation allows (an unrepresentable state that cannot compile, then a lint or banned API that fails CI, then a canonical helper, then a runtime check), because agents copy whatever the surrounding code already does and a weaker guard becomes the next template.
19
+
20
+ **Corollary:** Don't paper over symptoms. If the fix is structural, ONLY use the structural fix. The instruction IS the symptom.
21
+
22
+ **Feedback loop:**
23
+ - **Capture every correction.** When the human intervenes or tests fail, decide if it's a one-off or a pattern.
24
+ - **Route to the right layer.** One-off -> brain note. Recurring fix -> skill or lint rule. Systemic issue -> principle.
25
+ - **Close the loop.** Don't just record. Apply now or create a concrete todo.
26
+
27
+ **Anti-patterns:**
28
+ - Acknowledging without recording ("I'll keep that in mind" does not persist)
29
+ - Recording without routing (a brain note about a lint rule that should exist is wasted unless the lint rule gets implemented)
30
+ - Fixing without generalizing (fixing one instance while leaving the recurring pattern intact)
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: principle-exhaust-the-design-space
3
+ description: "Apply when facing a novel UI interaction or architectural decision with no precedent in the codebase. Build 2-3 competing prototypes and compare side by side before committing."
4
+ ---
5
+
6
+ # Exhaust the Design Space
7
+
8
+ When a novel interaction or architectural decision has no established precedent, explore several concrete alternatives before implementation. Building the wrong thing costs more than exploring three options.
9
+
10
+ **The rule.** When the right answer is not obvious, build 2-3 competing prototypes or sketches. Compare them side by side. Only then commit. Design it twice is this rule by another name. A second flavor of the first shape does not count.
11
+
12
+ **When it applies:**
13
+ - Novel UI interactions (no prior art in the codebase)
14
+ - Architectural choices with multiple viable approaches
15
+ - Product design decisions where user experience depends on feel, not logic
16
+
17
+ **When it doesn't:**
18
+ - Mechanical implementation where the pattern is established
19
+ - Bug fixes or refactors with a clear target state
20
+ - Changes where constraints dictate a single viable approach
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: principle-experience-first
3
+ description: "Apply when product, UX, or feature-scope tradeoffs come up. Choose user delight over implementation convenience; ship fewer polished features over more rough ones."
4
+ ---
5
+
6
+ # Experience First
7
+
8
+ The product is the experience. Every technical decision either helps or hurts it. When implementation convenience conflicts with user delight, choose delight.
9
+
10
+ - Say no to 1,000 things (every feature, control, and option must earn its place)
11
+ - Ship less, ship better (polished experience with three features beats rough one with ten)
12
+ - Prototype before committing (design decisions are cheaper in throwaway HTML than production code)
13
+ - Sweat the details (transitions, alignment, spacing, feedback, error states)
14
+ - Tighten the core loop (every feature should serve the central workflow or get out of the way)
15
+
16
+ The user is whoever consumes the work. For a UI that is the end user. For a library or an internal API it is the colleague who imports it. The engineer who maintains the code next is a user too. Weigh their experience the same way, and explain impact from their seat.
17
+
18
+ Foundations should serve the experience, not the other way around. Foundational thinking governs the *sequence* of work; this principle governs the *target*.
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: principle-fix-root-causes
3
+ description: "Apply when debugging. Trace each symptom to its root cause and fix it there; reproduce first, ask why until you reach it, resist nil-check guards that silence crashes."
4
+ ---
5
+
6
+ # Fix Root Causes
7
+
8
+ When debugging, do not paper over symptoms. Trace every problem to its root cause and fix it there.
9
+
10
+ **Why:** Symptom fixes accumulate. Each workaround makes the system harder to reason about, and the real bug remains. Root-cause fixes are slower upfront but reduce total debugging time.
11
+
12
+ **Pattern:**
13
+ - Reproduce first (if you can't reproduce it, you can't verify your fix)
14
+ - Ask "why" until you hit the root cause
15
+ - Resist the urge to add guards (adding a nil check to silence a crash is a symptom fix)
16
+ - If a workaround needs a paragraph-long comment to justify it, the code is wrong (fix the code, not the comment)
17
+ - Check for the pattern, not just the instance (grep for the same pattern, fix all instances)
18
+ - When stuck, instrument. Don't guess (add logging, read the actual error)
19
+
20
+ **Restart bugs: suspect state before code**
21
+
22
+ Code doesn't change between runs. State does. When something "fails after restart," suspect stale persistent state first: config files, caches, lock files, serialized state. If clearing a state file restores behavior, prioritize state validation as the fix.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: principle-foundational-thinking
3
+ description: "Apply before writing logic: choosing core types and data structures, sequencing scaffold-vs-feature work, asking what concurrent actors share. Get the data structures right so downstream code becomes obvious."
4
+ ---
5
+
6
+ # Foundational Thinking
7
+
8
+ **Structural decisions** protect option value. **Code-level decisions** protect simplicity. Over-engineering is often a premature decision that closes doors. The right foundational data structure keeps doors open.
9
+
10
+ **Data structures first.** Get the data shape right before writing logic. The right shape makes downstream code obvious. Define core types early, trace every access pattern, and choose structures that match the dominant paths. A data-structure change late is a rewrite. Early, it is often a one-line diff.
11
+
12
+ At code level, DRY the structure, not every line. Types and data models should converge. Three similar statements still beat a premature abstraction. Prefer explicit over clever. Test behavior and edge cases, not line counts.
13
+
14
+ **Concurrency corollary.** Before sharing state between actors, ask "what happens if another actor modifies this concurrently?" If not "nothing", isolate.
15
+
16
+ **Scaffold first.** If something helps every later phase, do it first. Ask "does every subsequent phase benefit from this existing?" CI, linting, test infrastructure, and shared types are scaffold. Sequence for option value: setup before features, tests before fixes. Keep commits small and single-purpose.
17
+
18
+ Each increment should land a coherent abstraction or deepen one that exists. Do not spread a new capability across callers as special-case coordination.
19
+
20
+ Subtraction comes before scaffolding: remove dead weight first, then lay foundations.
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: principle-guard-the-context-window
3
+ description: "Apply when context is filling up: large outputs, long files, repeated reads, fan-out planning. Route bulk to subagents; keep summaries in the main thread, not raw payloads."
4
+ ---
5
+
6
+ # Guard the Context Window
7
+
8
+ The context window is finite and non-renewable within a session. Every token that enters should earn its place.
9
+
10
+ **Why:** Context overflow degrades reasoning quality, creates compression artifacts, and halts progress. Unlike compute or time, context spent inside a session cannot be reclaimed.
11
+
12
+ **Pattern:**
13
+ - **Isolate large payloads.** Route verbose outputs, screenshots, and large documents to subagents. The main context gets summaries, not raw data.
14
+ - **Don't read what you won't use.** Read selectively based on relevance. If a file isn't needed for the current task, skip it.
15
+ - **Keep frequently used content inline.** Templates and references used on every invocation belong in the skill file, not in separate files that cost a read each time.
16
+ - **Size phases and cap scope.** Limit files per phase, set turn budgets, account for mechanism costs.
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: principle-laziness-protocol
3
+ description: "Apply when refactoring, evaluating diff size, or tempted to add abstractions, layers, or signal threading. Bias toward deletion and the smallest change that solves the problem."
4
+ ---
5
+
6
+ # Laziness Protocol
7
+
8
+ Writing code is cheap for you, which makes over-engineering easy. Counter it by borrowing a human maintainer's fatigue. Aim for the most result with the least code and complexity.
9
+
10
+ - **Prefer deletion.** When asked to refactor or improve, look for removals before additions.
11
+ - **Maintain a flat call hierarchy.** Avoid deep call chains. A rich interface that hides substantial work is not a deep call chain. If answering a question requires tracing through more than 3 files or layers, flatten it.
12
+ - **Consolidate decisions.** Do not repeat the same choice in several places. Put it behind one source of truth and pass the result as a simple flag.
13
+ - **Minimize the diff.** Make the smallest change that solves the problem. Fewer lines beat "elegant" boilerplate.
14
+ - **Question the threading.** If a task asks you to pass a new signal through types, schemas, pipelines, or similar layers, stop and look for a more direct path.
15
+ - **Sweat the small leaks.** Remove tiny pass-throughs, representation leaks, and duplicated choices before they spread. Small leaks compound into permanent coordination costs.
16
+
17
+ **Prime directive:** If a human developer would find the code exhausting to maintain, it is a bad solution. Be lazy. Stay simple.
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: principle-make-operations-idempotent
3
+ description: "Apply when designing commands, lifecycle steps, or processing loops that run amid crashes, restarts, and retries. Converge to the same end state regardless of partial prior runs."
4
+ ---
5
+
6
+ # Make Operations Idempotent
7
+
8
+ Design operations so they converge to the correct state regardless of how many times they run or where they start from. Every state-mutating operation should answer: "What happens if this runs twice? What happens if the previous run crashed halfway?"
9
+
10
+ **Why:** Commands, lifecycle operations, and processing loops run where crashes, restarts, and retries are normal. If partial state changes the next run's outcome, every restart becomes a debugging session.
11
+
12
+ **The pattern:**
13
+ - Convergent startup: scan for existing state, clean stale artifacts, adopt live sessions
14
+ - Content-based cleanup: compare by content equivalence, not creation order
15
+ - Self-healing locks: use PID-based stale lock detection
16
+ - Idempotent scheduling: failed work respawns cleanly, fresh input regenerated after each cycle
17
+
18
+ **The test:**
19
+ 1. What happens if this runs twice in a row?
20
+ 2. What happens if the previous run crashed at every possible point?
21
+ 3. Does re-execution converge to the same end state?
22
+
23
+ If any answer is "it depends on what state was left behind," the operation needs a reconciliation step.
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: principle-migrate-callers-then-delete-legacy-apis
3
+ description: "Apply when introducing a new internal API while old callers still exist. Migrate callers and delete the old API in the same wave instead of preserving compatibility layers."
4
+ ---
5
+
6
+ # Migrate Callers Then Delete Legacy APIs
7
+
8
+ When we decide a new API is the right design, migrate callers and remove the old API in the same refactor wave instead of preserving compatibility layers.
9
+
10
+ **Rule:**
11
+ - Do not keep legacy API paths alive only because internal callers still exist
12
+ - Inventory callers, migrate them, and delete the old API immediately
13
+ - Treat temporary adapters as exceptional and time-boxed, not default architecture
14
+ - Update tests to assert the new contract, and delete tests that only protect pre-refactor implementation details
15
+
16
+ **When this applies:**
17
+ - No external users depend on backward compatibility
18
+ - The project can absorb coordinated breaking changes
19
+ - The new API is part of a simplification or refactor initiative
20
+
21
+ Keeping both old and new APIs creates dual-path complexity, slows cleanup, and makes the codebase feel append-only.
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: principle-minimize-reader-load
3
+ description: "Apply when reviewing or shaping code that's hard to trace. Count layers between question and answer, and hidden state in the reader's head; collapse one-caller wrappers and shrink mutable scope."
4
+ ---
5
+
6
+ # Minimize Reader Load
7
+
8
+ Maintainability is the work a reader must do to understand code. Track two axes:
9
+ 1. **Layers to trace.** How many indirections sit between the question and the answer.
10
+ 2. **State to hold.** How much hidden or mutable context the reader must keep in their head.
11
+
12
+ **Why:** Code is read far more than it is written. LOC, cyclomatic complexity, and "clean architecture" are proxies. Reader load is the thing that matters. The two axes are independent. A flat file with 50 globals can be as hard to reason about as a 6-layer adapter stack. Guard both. This is the human analog of [Guard the Context Window](../principle-guard-the-context-window/SKILL.md): working memory is finite for readers too.
13
+
14
+ **The pattern:**
15
+ - **Collapse layers** that do not earn their keep: wrappers with one caller, adapters with no second implementation, indirection introduced for a future that never came. Inline them.
16
+ - **Make adjacent layers change the abstraction.** A layer that repeats the same methods and arguments adds reader load without compression. Collapse pass-through layers.
17
+ - **Demand interface compression.** A broad interface that hides little complexity makes readers learn both the surface and the implementation. Prefer boundaries that hide meaningful decisions.
18
+ - **Shrink state scope:** prefer pure functions (returns over mutations), locals over fields, fields over module state, and module state over globals. Derive instead of sync.
19
+ - **Name the invariant at the boundary,** not in every consumer, so the reader learns it once.
20
+ - Before adding a layer or a piece of state, ask: does this reduce reader load somewhere else by at least as much?
21
+
22
+ **The test:** Can a new reader answer "where does X come from?" and "what can change X?" in under 30 seconds? If not, cut layers or cut state.
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: principle-model-the-domain
3
+ description: "Apply when writing stateful logic, or when code branches a lot or repeats a shape assumption across files. Encode the domain in a structure instead of scattered conditionals."
4
+ ---
5
+
6
+ # Model the Domain
7
+
8
+ Encode the real domain in a data structure instead of scattering it across conditionals.
9
+
10
+ **Why:** Scattered booleans, repeated shape assumptions, and branching spread across files are accidental complexity. A structure that matches the domain makes invalid states unrepresentable and deletes branches. Choosing it at write time is cheap; recovering it later reads as a refactor and gets deferred.
11
+
12
+ **Reach for structures like these:**
13
+
14
+ - A state machine instead of scattered booleans, phases, or lifecycle checks.
15
+ - A typed object/model instead of loose parameters or repeated shape assumptions.
16
+ - A map, registry, lookup table, or discriminated union instead of branching spread across files.
17
+ - A reducer or command/event model instead of ad hoc state mutations.
18
+ - A module organized around one body of domain knowledge instead of a sequence such as load, validate, transform, and save. Execution order is not ownership.
19
+ - A small module boundary that gathers repeated behavior, ownership, or invariants.
20
+ - A queue, cache, index, graph/tree, or normalized collection where the data access pattern calls for it.
21
+ - Any other structure that fits. The list above covers the common cases only. When none fits, work out what the code must never allow and how the data gets read, then find the structure that encodes exactly that.
22
+
23
+ Do not force an abstraction. Prefer boring code if the current shape is already clear, local, and unlikely to grow. Be skeptical of an abstraction that adds indirection without removing branches, duplicated rules, invalid states, or lifecycle risk.
24
+
25
+ The tell that you skipped this is a new feature that grows an existing if/else chain by one more branch, or a second boolean that must stay in sync with the first. Temporal decomposition is another tell. Phase-named modules repeat the same domain rules across steps.
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: principle-never-block-on-the-human
3
+ description: "Apply when tempted to ask 'should I do X?' on reversible work. Proceed, present the result, let the human course-correct after the fact; reserve confirmation for irreversible actions."
4
+ ---
5
+
6
+ # Never Block on the Human
7
+
8
+ The human supervises asynchronously. Agents must stay unblocked: make reasonable decisions, proceed, and let the human course-correct after the fact. Code is cheap. Waiting is expensive.
9
+
10
+ **Why:** Every permission pause stalls the pipeline and makes the human the bottleneck. Since code changes are reversible and reviewable, a wrong decision usually costs less than blocking.
11
+
12
+ **Pattern:**
13
+ - **Proceed, then present.** Do the work, show the result. Don't ask "should I do X?" Do X, explain why.
14
+ - **Reserve questions for genuine ambiguity.** Ask only when you truly cannot infer intent from context.
15
+ - **Make the system self-healing.** When you notice a problem, log it and fix it in the next round.
16
+ - **Supervision is async.** The human reviews plans, diffs, and changes on their own schedule. Design workflows for review-after-the-fact.
17
+ - **Code is cheap, attention is scarce.** A wrong implementation costs minutes to fix. A blocked agent costs the human's attention to unblock.
18
+
19
+ **Boundaries:**
20
+ - **Irreversible actions** (force-push, delete production data, send external messages) still require confirmation.
21
+ - **Reversible actions** (write code, edit notes, split tasks) should proceed without blocking.
22
+ - **Product direction** comes from the human; *execution* should not block.
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: principle-outcome-oriented-execution
3
+ description: "Apply during planned rewrites and migrations with explicit phase boundaries. Converge on the target architecture; don't preserve smooth intermediate states with throwaway compatibility code."
4
+ ---
5
+
6
+ # Outcome-Oriented Execution
7
+
8
+ Optimize for the intended, verifiable end state rather than preserving smooth intermediate states.
9
+
10
+ **Why:** Keeping every intermediate step fully stable often creates temporary compatibility code that becomes long-lived debt. Converge on the target architecture and prove correctness at explicit verification boundaries.
11
+
12
+ **Core rule:**
13
+ - Prioritize end-state integrity over transitional stability
14
+ - Intermediate breakage is acceptable when it is planned, scoped, and reversible
15
+ - Always run final verification before declaring done
16
+
17
+ **Guardrails:**
18
+ - Use this for planned rewrites and migrations with explicit phase boundaries
19
+ - Declare where temporary breakage is acceptable
20
+ - Keep high-signal checks for actively touched areas while migrating
21
+ - Require full static and runtime verification at plan completion
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: principle-prove-it-works
3
+ description: "Apply after completing a task, before declaring done. Verify against the real artifact (run the feature, read the actual value, inspect the diff), not a proxy, self-report, or 'it compiles.'"
4
+ ---
5
+
6
+ # Prove It Works
7
+
8
+ Verify every task output by checking the real thing directly. Do not infer from proxies, self-reports, or "it compiles."
9
+
10
+ **Why:** Unverified work has unknown correctness. Indirect verification (file mtimes, output freshness, agent self-reports, cached screenshots) feels cheaper than direct observation. Acting on a wrong inference costs far more than checking the source.
11
+
12
+ **Pattern:** After completing any task, ask: "how do I prove this actually works?"
13
+
14
+ Check the real thing, not a proxy:
15
+ - Check process liveness directly, not indirectly through derived state
16
+ - Read the actual value, not a cached or derived representation
17
+ - When verification fails, suspect the observation method before suspecting the system
18
+
19
+ Code and features:
20
+ 1. Build it (necessary but not sufficient)
21
+ 2. Run it and exercise the actual feature path
22
+ 3. Check the full chain: does data flow from input to output?
23
+ 4. For integrations, test the full communication path end-to-end
24
+
25
+ Delegation: trust artifacts, not self-reports.
26
+ When verifying delegated work, inspect the actual output artifact (git diff, file contents, runtime behavior), not the delegate's summary. Agents report what they intended, not always what happened.
27
+
28
+ ## Script the check when you can
29
+
30
+ The strongest proof is a deterministic script that re-runs the same comparison, not a one-time eyeball. Write the script, run it, and keep its output as an artifact a reviewer can re-run instead of trusting your word. A script comparing the old and new compiled output catches what a glance misses.
31
+
32
+ Keep the artifact visible for the human. Commit it only for large or complex work where the trail has to be auditable later, like a big port or migration (the **show-me-your-work** skill). Most work just needs it visible, not committed.
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: principle-redesign-from-first-principles
3
+ description: "Apply when integrating a new requirement into an existing design. Redesign as if the requirement had been a foundational assumption from day one, instead of bolting it on."
4
+ ---
5
+
6
+ # Redesign From First Principles
7
+
8
+ When integrating a change, don't bolt it onto the existing design. Redesign as if the requirement had been there from the start. The result should look like what we would have built if we'd known on day one.
9
+
10
+ - Read all affected files and understand the current design holistically
11
+ - Ask: "if we were writing this from scratch with this new requirement, what would we build?"
12
+ - Propagate the change through every reference: types, docs, examples, rationale sections
13
+ - Think about the redesign holistically, then deliver it incrementally
14
+
15
+ This is the method for preserving option value when integrating changes into an existing design.
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: principle-separate-before-serializing-shared-state
3
+ description: "Apply when concurrent actors might write to the same file, branch, key, or state object. Eliminate the sharing first; serialize structurally only when one shared writer is a real invariant."
4
+ ---
5
+
6
+ # Separate Before Serializing Shared State
7
+
8
+ When concurrent actors might share mutable state, first ask whether they truly need the same mutable object. If not, eliminate the sharing. When sharing is real, enforce serialization structurally: lockfiles, sequential phases, exclusive ownership. Instructions and conventions are not concurrency control.
9
+
10
+ **Why:** Concurrent writes to shared state create race conditions that are intermittent, hard to reproduce, and expensive to debug. Telling agents or goroutines to "take turns" does not work.
11
+
12
+ **Pattern:**
13
+ 1. **Identify shared mutable state** (files both read and write, branches both push to, APIs both define and consume).
14
+ 2. **Default: eliminate the shared write target.** Ask: do these actors need one canonical object, or are they publishing independent facts? Give each actor its own owned file, key, branch, or state directory, and merge only at the read/reporting boundary. Two workers writing their own `lastX` field into one `state.json` is still shared mutation; `indexer-state.json` + `metrics-state.json` is not.
15
+ 3. **Only when one shared write target is a real invariant, serialize access structurally** (lockfiles, sequential phases, single-writer actor, or atomic compare-and-swap). Treat "we need a lock" as a design smell to check, not as the default answer.
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: principle-sequence-verifiable-units
3
+ description: "Apply to multi-step work (sweeps, migrations, runs of similar edits) and to how you stack commits and PRs. Break work into small units that each end in a verifiable state, check each before the next, and order delivery so the sequence proves itself to a reviewer."
4
+ ---
5
+
6
+ # Sequence work into verifiable units
7
+
8
+ Order work as a sequence of small units, each ending in a state you can check, and don't advance until the current one is green. The same discipline runs at two altitudes, how you execute and how you deliver.
9
+
10
+ **Why:** A break caught at the unit that caused it is cheap to localize. A break caught after a batch is buried, and you have already built further on a broken base. Sequencing those same units into a delivery a reviewer can replay turns "trust me" into "watch it go red, then green."
11
+
12
+ **Execution.** In a sweep, migration, or any run of similar edits, verify each change before starting the next. Never batch the edits and verify once at the end. Each unit is a before/after bracket: known-good state, one change, run the check, then proceed. Rebase onto clean trunk first so every check measures against the real baseline. When a lever does the edits, the per-unit check is nearly free; run it anyway.
13
+
14
+ **Delivery.** Stack commits and PRs in the order that proves the work. The canonical shape is the failing test first, then the fix on top. The first unit shows the bug is real (red), the next shows it resolved (green), so a reviewer sees both the problem and the proof. Other story orders are a subtraction before the reshape, a baseline capture before the treatment, the scaffold before the feature. Each commit lands on its own and the sequence reads as an argument.
15
+
16
+ **Pattern:**
17
+ - Pick the smallest unit that ends in a check: an edit plus its test, or a commit that stands alone.
18
+ - Verify before advancing. Red to green per unit, never deferred to a final batch.
19
+ - Order the units so the sequence builds confidence on its own, for you while executing and for a reviewer reading the stack.
20
+
21
+ The sequencing complement to the **prove-it-works** principle skill, which keeps each check real, and the **build-the-lever** principle skill, which makes the per-unit check cheap.
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: principle-subtract-before-you-add
3
+ description: "Apply when sequencing an addition, refactor, or rewrite. Remove dead weight, redundant validators, and stub references first, then build on the simpler base."
4
+ ---
5
+
6
+ # Subtract Before You Add
7
+
8
+ When evolving a system, remove complexity first, then build. Deletion gives you a simpler base, which makes the next addition smaller and less brittle.
9
+
10
+ **Why:** Adding to a complex system compounds complexity. Removing first cuts the surface area, reveals the essential structure, and usually makes the next design obvious. Default to subtraction.
11
+
12
+ Make simplification a continual investment. Leave the design slightly simpler and more capable behind the same or smaller surface than you found it.
13
+
14
+ **The pattern:**
15
+ - Sequence removal before construction
16
+ - Cut before you polish (get to the minimum before investing in quality)
17
+ - Design for observed usage, not speculative edge cases
18
+ - No speculative validators, parsers, or guards beyond what the spec demands
19
+ - Out-of-spec features drag validators behind them. Persistence, retry-on-startup, and schema migration each need guards to defend their inputs.
20
+ - Simplify prompts (remove redundant instructions, excessive templates)
21
+ - When a reference has no novel content, delete it rather than leaving a stub
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: principle-type-system-discipline
3
+ description: "Apply when designing types, reviewing a function signature, or writing code in any statically-typed language. Make illegal states unrepresentable, brand semantic primitives, parse external data at boundaries, refuse to lie to the compiler, exhaust variants, derive from authoritative schemas."
4
+ ---
5
+
6
+ # Type System Discipline
7
+
8
+ The type checker is a proof assistant. Use it to eliminate impossible states, mismatched primitives, and unhandled variants at compile time. A case the types let you ignore becomes a runtime failure the compiler could have stopped. Prefer defining errors and special cases out of existence over proliferating handlers; unrepresentable states, total functions, and interface redesign (the patterns below) are the tools.
9
+
10
+ Applies to any typed language. Skills like `typescript-best-practices` ground it in specific syntax.
11
+
12
+ **The patterns:**
13
+
14
+ - **Make illegal states unrepresentable.** Model variants as sum types: discriminated unions in TypeScript, enums with payloads in Rust/Swift/Kotlin, sealed classes in Scala, ADTs in Haskell/OCaml. Don't model state as a bag of optional fields where contradictory combinations compile. A subtle anti-pattern worth naming: `{ completed: boolean; completedAt?: Date }` admits `completed: true; completedAt: undefined`, which is meaningless. Derive the boolean from a single source like `completedAt !== null`, or model the variants explicitly as `{ kind: 'open' } | { kind: 'done'; at: Date }`. If a bug forces the question "wait, can this combination actually happen?", the type is too loose.
15
+ - **Types are constructions, not restrictions.** Build the type up from the values you want instead of carving them out of a looser type with checks. The invariant that seems to need a refinement type is usually a construction away. A non-empty list is a head plus a rest, not a list with a length check. A valid time range is a start plus a duration, not two timestamps you must keep ordered. No representation is privileged. A list of pairs is an even-length list if you interpret it that way, so choose the shape that cannot build the illegal value and expose the interface callers need on top.
16
+ - **Brand semantic primitives.** `UserId` and `OrderId` are strings underneath but should not be interchangeable. Newtypes in Rust, opaque types in Swift, value classes in Kotlin, phantom types in Haskell, branded intersections in TypeScript. Validate once at creation, trust the type downstream.
17
+ - **External data is untyped until parsed.** RPC payloads, JSON, IPC messages, CLI args, config files, environment variables, database rows. Have a parse function at every boundary that turns unstructured input into the typed model. See the **boundary-discipline** principle skill for where to put validation.
18
+ - **Don't lie to the type system.** Casts, unsafe coercions, and assertion functions that bypass the compiler are runtime crashes waiting to happen. If the compiler can't prove a fact, prove it (validate, narrow, refine the model) or accept that the cast is a hazard. The cast you bury today is the postmortem you write next week.
19
+ - **Exhaustive matching is the compiler's job.** When you match on a sum type, the compiler must fail compilation if a new variant is added without handling. Use the idiom your language provides: `never`-typed binding in TypeScript, unannotated `match` in Rust, `-Wincomplete-patterns` in Haskell, sealed-class match exhaustiveness in Kotlin.
20
+ - **Derive types from authoritative schemas.** When a protocol buffer, OpenAPI spec, GraphQL schema, database migration, or design-system token file defines a shape, derive from it instead of hand-rolling a parallel type. Manual duplication drifts. See the **encode-lessons-in-structure** principle skill.
21
+ - **Strengthen a type only where partiality appears.** A runtime assertion, null check, or "this should never happen" throw marks the place a type is too weak. Push that check up into the type. Then stop. The type system's job is to track the cases each use site must handle, not to describe the data as precisely as possible. Prefer total functions. `sum` of an empty list is 0, so it takes the plain list. `head` of an empty list has no answer, so it demands the non-empty one. Extra precision costs reuse and ceremony and buys no safety.
22
+
23
+ **The tests:**
24
+
25
+ - "Can I write a comment explaining when this combination of fields is valid?" If yes, the type is too loose. Split it into a sum type.
26
+ - "Do two of my function arguments share a primitive type but mean different things?" Brand them.
27
+ - "Where did this `any`, this `as`, this `assertNotNull` come from?" Trace it to the boundary and validate there instead.
28
+ - "If a new variant is added next month, will the compiler tell the next agent where to add a case?" If no, the match isn't exhaustive.
29
+ - "Is this type duplicating a shape another file owns?" Derive instead.
30
+ - "Am I strengthening this type to keep an operation total, or just to be more precise?" If nothing would otherwise panic, keep the plain type.