@tplog/hasapi 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.
- package/LICENSE +21 -0
- package/README.md +54 -0
- package/bin/hasapi.mjs +292 -0
- package/hasapi-skills/README.md +56 -0
- package/hasapi-skills/_shared/common.md +240 -0
- package/hasapi-skills/_shared/custom-risks-guide.md +48 -0
- package/hasapi-skills/_shared/decay-risks.md +294 -0
- package/hasapi-skills/_shared/remedy-guide.md +37 -0
- package/hasapi-skills/_shared/source-coverage.md +248 -0
- package/hasapi-skills/_shared/test-decay-risks.md +246 -0
- package/hasapi-skills/hasapi-audit/SKILL.md +42 -0
- package/hasapi-skills/hasapi-audit/architecture-guide.md +195 -0
- package/hasapi-skills/hasapi-audit/onboarding-guide.md +89 -0
- package/hasapi-skills/hasapi-debt/SKILL.md +35 -0
- package/hasapi-skills/hasapi-debt/debt-guide.md +125 -0
- package/hasapi-skills/hasapi-diagnosing-bugs/SKILL.md +134 -0
- package/hasapi-skills/hasapi-diagnosing-bugs/scripts/hitl-loop.template.sh +41 -0
- package/hasapi-skills/hasapi-grilling/SKILL.md +10 -0
- package/hasapi-skills/hasapi-handoff/SKILL.md +16 -0
- package/hasapi-skills/hasapi-health/SKILL.md +37 -0
- package/hasapi-skills/hasapi-health/health-guide.md +89 -0
- package/hasapi-skills/hasapi-implement/SKILL.md +15 -0
- package/hasapi-skills/hasapi-resolving-merge-conflicts/SKILL.md +14 -0
- package/hasapi-skills/hasapi-review/SKILL.md +37 -0
- package/hasapi-skills/hasapi-review/pr-review-guide.md +163 -0
- package/hasapi-skills/hasapi-setup/SKILL.md +121 -0
- package/hasapi-skills/hasapi-setup/domain.md +51 -0
- package/hasapi-skills/hasapi-setup/issue-tracker-github.md +22 -0
- package/hasapi-skills/hasapi-setup/issue-tracker-gitlab.md +23 -0
- package/hasapi-skills/hasapi-setup/issue-tracker-local.md +19 -0
- package/hasapi-skills/hasapi-setup/triage-labels.md +15 -0
- package/hasapi-skills/hasapi-sweep/SKILL.md +38 -0
- package/hasapi-skills/hasapi-sweep/sweep-guide.md +264 -0
- package/hasapi-skills/hasapi-tdd/SKILL.md +108 -0
- package/hasapi-skills/hasapi-tdd/mocking.md +59 -0
- package/hasapi-skills/hasapi-tdd/refactoring.md +10 -0
- package/hasapi-skills/hasapi-tdd/tests.md +61 -0
- package/hasapi-skills/hasapi-test/SKILL.md +36 -0
- package/hasapi-skills/hasapi-test/test-guide.md +147 -0
- package/hasapi-skills/hasapi-to-issues/SKILL.md +84 -0
- package/hasapi-skills/hasapi-to-prd/SKILL.md +75 -0
- package/package.json +39 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Tech Debt Assessment Guide — Mode 3
|
|
2
|
+
|
|
3
|
+
**Purpose:** Identify, classify, and prioritize technical debt across the entire codebase.
|
|
4
|
+
Every finding must follow the Iron Law: Symptom → Source → Consequence → Remedy.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Evidence Gathering
|
|
9
|
+
|
|
10
|
+
If you have insufficient evidence to assess the codebase, ask the user ONE question —
|
|
11
|
+
choose the single question most relevant to what you already know:
|
|
12
|
+
|
|
13
|
+
1. "Which part of the codebase takes the longest to modify for a typical feature?"
|
|
14
|
+
2. "Which module do developers avoid touching, and why?"
|
|
15
|
+
3. "Which parts of the system have the fewest tests and the most bugs?"
|
|
16
|
+
4. "Is there a module that only one person fully understands?"
|
|
17
|
+
|
|
18
|
+
After one answer, proceed. Do not ask more than one question.
|
|
19
|
+
If the user declines or says they don't know, proceed with available evidence and note
|
|
20
|
+
which areas could not be assessed.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Analysis Process
|
|
25
|
+
|
|
26
|
+
Work through these four steps in order.
|
|
27
|
+
|
|
28
|
+
### Step 1: Full Decay Risk Scan
|
|
29
|
+
|
|
30
|
+
Scan for all six decay risks across the entire codebase. List every finding before scoring
|
|
31
|
+
any of them. This prevents anchoring on early findings and missing systemic patterns.
|
|
32
|
+
|
|
33
|
+
For each risk, look for:
|
|
34
|
+
|
|
35
|
+
**Cognitive Overload:** Are there widespread naming problems, deeply nested logic, or
|
|
36
|
+
excessively long functions spread across many modules?
|
|
37
|
+
|
|
38
|
+
**Change Propagation:** Which modules cause the most ripple effects when changed?
|
|
39
|
+
Are there modules that everyone must modify when adding a new feature?
|
|
40
|
+
|
|
41
|
+
**Knowledge Duplication:** How many times is the same concept implemented independently?
|
|
42
|
+
Is the domain vocabulary consistent across the codebase?
|
|
43
|
+
|
|
44
|
+
**Accidental Complexity:** Are there architectural layers or abstractions that add no value?
|
|
45
|
+
Is the infrastructure overhead proportional to the problem being solved?
|
|
46
|
+
|
|
47
|
+
**Dependency Disorder:** Are there dependency cycles? Does domain logic depend on infrastructure?
|
|
48
|
+
Are there modules with no clear layering position?
|
|
49
|
+
|
|
50
|
+
**Domain Model Distortion:** Is business logic in the right layer?
|
|
51
|
+
Do code names match business names? Are domain objects anemic?
|
|
52
|
+
|
|
53
|
+
### Step 2: Score Each Finding with Pain × Spread
|
|
54
|
+
|
|
55
|
+
After listing all findings, score each one:
|
|
56
|
+
|
|
57
|
+
**Pain score (1–3):** How much does this slow down development today?
|
|
58
|
+
- 3: Developers actively avoid touching this area; it causes bugs on most changes
|
|
59
|
+
*(e.g., "nobody wants to touch the billing module because it always breaks something")*
|
|
60
|
+
- 2: This area is noticeably slower to work in than the rest of the codebase
|
|
61
|
+
*(e.g., "adding a field takes 2–3x longer here than elsewhere")*
|
|
62
|
+
- 1: This is a quality issue but not currently causing active pain
|
|
63
|
+
*(e.g., "inconsistent naming, but we always know what we mean")*
|
|
64
|
+
|
|
65
|
+
**Spread score (1–3):** How many files, modules, or developers does this affect?
|
|
66
|
+
- 3: Affects 5+ modules or all developers on the team
|
|
67
|
+
*(e.g., "every new feature touches the God class in core/")*
|
|
68
|
+
- 2: Affects 2–4 modules or a subset of the team
|
|
69
|
+
*(e.g., "the auth and notification modules are tightly coupled")*
|
|
70
|
+
- 1: Isolated to one module or one developer's area
|
|
71
|
+
*(e.g., "legacy parser that only one person maintains")*
|
|
72
|
+
|
|
73
|
+
**Priority = Pain × Spread** (max 9)
|
|
74
|
+
|
|
75
|
+
| Priority | Classification | Action |
|
|
76
|
+
|----------|---------------|--------|
|
|
77
|
+
| 7–9 | Critical debt | Address in next sprint |
|
|
78
|
+
| 4–6 | Scheduled debt | Plan within quarter |
|
|
79
|
+
| 1–3 | Monitored debt | Log and watch |
|
|
80
|
+
|
|
81
|
+
### Step 3: Classify Debt Intent
|
|
82
|
+
|
|
83
|
+
After scoring, classify each finding as intentional or accidental:
|
|
84
|
+
|
|
85
|
+
**Intentional debt** — a conscious shortcut taken to meet a deadline, with the expectation
|
|
86
|
+
of paying it back. The team knows about it. It may be legitimate (a strategic prototype,
|
|
87
|
+
a known temporary workaround during a migration).
|
|
88
|
+
|
|
89
|
+
**Accidental debt** — degradation that accumulated without a deliberate decision: the team
|
|
90
|
+
did not choose it and may not even know it exists. This is the kind Ward Cunningham's
|
|
91
|
+
original definition warned against — not a tactical trade-off, but structural erosion.
|
|
92
|
+
|
|
93
|
+
Mark each finding with `[intentional]` or `[accidental]` in the Debt Summary Table.
|
|
94
|
+
Intentional debt with no visible payback plan — no linked ticket, no code comment, no
|
|
95
|
+
documented decision — should be treated as accidental for prioritization purposes.
|
|
96
|
+
Focus remediation energy on accidental debt first; intentional debt at least has an owner.
|
|
97
|
+
|
|
98
|
+
### Step 4: Group by Decay Risk
|
|
99
|
+
|
|
100
|
+
Report findings grouped by risk type, not by file or module.
|
|
101
|
+
Grouping by risk reveals systemic patterns:
|
|
102
|
+
- "Change Propagation is systemic" → architectural intervention needed
|
|
103
|
+
- "Cognitive Overload is isolated" → localized refactoring sufficient
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Output
|
|
108
|
+
|
|
109
|
+
Use the standard Report Template from `../_shared/common.md`. Mode: Tech Debt Assessment.
|
|
110
|
+
|
|
111
|
+
After Findings, append a Debt Summary Table:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
## Debt Summary
|
|
115
|
+
| Risk | Findings | Avg Priority | Classification | Intent |
|
|
116
|
+
|------|----------|-------------|----------------|--------|
|
|
117
|
+
| Cognitive Overload | N | X.X | Monitored/Scheduled/Critical | intentional/accidental |
|
|
118
|
+
| Change Propagation | N | X.X | ... | ... |
|
|
119
|
+
| Knowledge Duplication | N | X.X | ... | ... |
|
|
120
|
+
| Accidental Complexity | N | X.X | ... | ... |
|
|
121
|
+
| Dependency Disorder | N | X.X | ... | ... |
|
|
122
|
+
| Domain Model Distortion | N | X.X | ... | ... |
|
|
123
|
+
|
|
124
|
+
**Recommended focus:** [risks with highest average priority]
|
|
125
|
+
```
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hasapi-diagnosing-bugs
|
|
3
|
+
description: Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Diagnosing Bugs
|
|
7
|
+
|
|
8
|
+
A discipline for hard bugs. Skip phases only when explicitly justified.
|
|
9
|
+
|
|
10
|
+
When exploring the codebase, read `CONTEXT.md` (if it exists) to get a clear mental model of the relevant modules, and check ADRs in the area you're touching.
|
|
11
|
+
|
|
12
|
+
## Phase 1 — Build a feedback loop
|
|
13
|
+
|
|
14
|
+
**This is the skill.** Everything else is mechanical. If you have a **tight** pass/fail signal for the bug — one that goes red on _this_ bug — you will find the cause; bisection, hypothesis-testing, and instrumentation all just consume it. If you don't have one, no amount of staring at code will save you.
|
|
15
|
+
|
|
16
|
+
Spend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**
|
|
17
|
+
|
|
18
|
+
### Ways to construct one — try them in roughly this order
|
|
19
|
+
|
|
20
|
+
1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e.
|
|
21
|
+
2. **Curl / HTTP script** against a running dev server.
|
|
22
|
+
3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.
|
|
23
|
+
4. **Headless browser script** (Playwright / Puppeteer) — drives the UI, asserts on DOM/console/network.
|
|
24
|
+
5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.
|
|
25
|
+
6. **Throwaway harness.** Spin up a minimal subset of the system (one service, mocked deps) that exercises the bug code path with a single function call.
|
|
26
|
+
7. **Property / fuzz loop.** If the bug is "sometimes wrong output", run 1000 random inputs and look for the failure mode.
|
|
27
|
+
8. **Bisection harness.** If the bug appeared between two known states (commit, dataset, version), automate "boot at state X, check, repeat" so you can `git bisect run` it.
|
|
28
|
+
9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.
|
|
29
|
+
10. **HITL bash script.** Last resort. If a human must click, drive _them_ with `scripts/hitl-loop.template.sh` so the loop is still structured. Captured output feeds back to you.
|
|
30
|
+
|
|
31
|
+
Build the right feedback loop, and the bug is 90% fixed.
|
|
32
|
+
|
|
33
|
+
### Tighten the loop
|
|
34
|
+
|
|
35
|
+
Treat the loop as a product. Once you have _a_ loop, **tighten** it:
|
|
36
|
+
|
|
37
|
+
- Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)
|
|
38
|
+
- Can I make the signal sharper? (Assert on the specific symptom, not "didn't crash".)
|
|
39
|
+
- Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)
|
|
40
|
+
|
|
41
|
+
A 30-second flaky loop is barely better than no loop; a 2-second deterministic one is tight — a debugging superpower.
|
|
42
|
+
|
|
43
|
+
### Non-deterministic bugs
|
|
44
|
+
|
|
45
|
+
The goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100×, parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not — keep raising the rate until it's debuggable.
|
|
46
|
+
|
|
47
|
+
### When you genuinely cannot build a loop
|
|
48
|
+
|
|
49
|
+
Stop and say so explicitly. List what you tried. Ask the user for: (a) access to whatever environment reproduces it, (b) a captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or (c) permission to add temporary production instrumentation. Do **not** proceed to hypothesise without a loop.
|
|
50
|
+
|
|
51
|
+
### Completion criterion — a tight loop that goes red
|
|
52
|
+
|
|
53
|
+
Phase 1 is done when the loop is **tight** and **red-capable**: you can name **one command** — a script path, a test invocation, a curl — that you have **already run at least once** (paste the invocation and its output), and that is:
|
|
54
|
+
|
|
55
|
+
- [ ] **Red-capable** — it drives the actual bug code path and asserts the **user's exact symptom**, so it can go red on this bug and green once fixed. Not "runs without erroring" — it must be able to _catch this specific bug_.
|
|
56
|
+
- [ ] **Deterministic** — same verdict every run (flaky bugs: a pinned, high reproduction rate, per above).
|
|
57
|
+
- [ ] **Fast** — seconds, not minutes.
|
|
58
|
+
- [ ] **Agent-runnable** — you can run it unattended; a human in the loop only via `scripts/hitl-loop.template.sh`.
|
|
59
|
+
|
|
60
|
+
If you catch yourself reading code to build a theory before this command exists, **stop — jumping straight to a hypothesis is the exact failure this skill prevents.** No red-capable command, no Phase 2.
|
|
61
|
+
|
|
62
|
+
## Phase 2 — Reproduce + minimise
|
|
63
|
+
|
|
64
|
+
Run the loop. Watch it go red — the bug appears.
|
|
65
|
+
|
|
66
|
+
Confirm:
|
|
67
|
+
|
|
68
|
+
- [ ] The loop produces the failure mode the **user** described — not a different failure that happens to be nearby. Wrong bug = wrong fix.
|
|
69
|
+
- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).
|
|
70
|
+
- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.
|
|
71
|
+
|
|
72
|
+
### Minimise
|
|
73
|
+
|
|
74
|
+
Once it's red, shrink the repro to the **smallest scenario that still goes red**. Cut inputs, callers, config, data, and steps **one at a time**, re-running the loop after each cut — keep only what's load-bearing for the failure.
|
|
75
|
+
|
|
76
|
+
Why bother: a minimal repro shrinks the hypothesis space in Phase 3 (fewer moving parts left to suspect) and becomes the clean regression test in Phase 5.
|
|
77
|
+
|
|
78
|
+
Done when **every remaining element is load-bearing** — removing any one of them makes the loop go green.
|
|
79
|
+
|
|
80
|
+
Do not proceed until you have reproduced **and** minimised.
|
|
81
|
+
|
|
82
|
+
## Phase 3 — Hypothesise
|
|
83
|
+
|
|
84
|
+
Generate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.
|
|
85
|
+
|
|
86
|
+
Each hypothesis must be **falsifiable**: state the prediction it makes.
|
|
87
|
+
|
|
88
|
+
> Format: "If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse."
|
|
89
|
+
|
|
90
|
+
If you cannot state the prediction, the hypothesis is a vibe — discard or sharpen it.
|
|
91
|
+
|
|
92
|
+
**Show the ranked list to the user before testing.** They often have domain knowledge that re-ranks instantly ("we just deployed a change to #3"), or know hypotheses they've already ruled out. Cheap checkpoint, big time saver. Don't block on it — proceed with your ranking if the user is AFK.
|
|
93
|
+
|
|
94
|
+
## Phase 4 — Instrument
|
|
95
|
+
|
|
96
|
+
Each probe must map to a specific prediction from Phase 3. **Change one variable at a time.**
|
|
97
|
+
|
|
98
|
+
Tool preference:
|
|
99
|
+
|
|
100
|
+
1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.
|
|
101
|
+
2. **Targeted logs** at the boundaries that distinguish hypotheses.
|
|
102
|
+
3. Never "log everything and grep".
|
|
103
|
+
|
|
104
|
+
**Tag every debug log** with a unique prefix, e.g. `[DEBUG-a4f2]`. Cleanup at the end becomes a single grep. Untagged logs survive; tagged logs die.
|
|
105
|
+
|
|
106
|
+
**Perf branch.** For performance regressions, logs are usually wrong. Instead: establish a baseline measurement (timing harness, `performance.now()`, profiler, query plan), then bisect. Measure first, fix second.
|
|
107
|
+
|
|
108
|
+
## Phase 5 — Fix + regression test
|
|
109
|
+
|
|
110
|
+
Write the regression test **before the fix** — but only if there is a **correct seam** for it.
|
|
111
|
+
|
|
112
|
+
A correct seam is one where the test exercises the **real bug pattern** as it occurs at the call site. If the only available seam is too shallow (single-caller test when the bug needs multiple callers, unit test that can't replicate the chain that triggered the bug), a regression test there gives false confidence.
|
|
113
|
+
|
|
114
|
+
**If no correct seam exists, that itself is the finding.** Note it. The codebase architecture is preventing the bug from being locked down. Flag this for the next phase.
|
|
115
|
+
|
|
116
|
+
If a correct seam exists:
|
|
117
|
+
|
|
118
|
+
1. Turn the minimised repro into a failing test at that seam.
|
|
119
|
+
2. Watch it fail.
|
|
120
|
+
3. Apply the fix.
|
|
121
|
+
4. Watch it pass.
|
|
122
|
+
5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.
|
|
123
|
+
|
|
124
|
+
## Phase 6 — Cleanup + post-mortem
|
|
125
|
+
|
|
126
|
+
Required before declaring done:
|
|
127
|
+
|
|
128
|
+
- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)
|
|
129
|
+
- [ ] Regression test passes (or absence of seam is documented)
|
|
130
|
+
- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)
|
|
131
|
+
- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)
|
|
132
|
+
- [ ] The hypothesis that turned out correct is stated in the commit / PR message — so the next debugger learns
|
|
133
|
+
|
|
134
|
+
**Then ask: what would have prevented this bug?** If the answer involves architectural change (no good test seam, tangled callers, hidden coupling) hand off to the `/improve-codebase-architecture` skill with the specifics. Make the recommendation **after** the fix is in, not before — you have more information now than when you started.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Human-in-the-loop reproduction loop.
|
|
3
|
+
# Copy this file, edit the steps below, and run it.
|
|
4
|
+
# The agent runs the script; the user follows prompts in their terminal.
|
|
5
|
+
#
|
|
6
|
+
# Usage:
|
|
7
|
+
# bash hitl-loop.template.sh
|
|
8
|
+
#
|
|
9
|
+
# Two helpers:
|
|
10
|
+
# step "<instruction>" → show instruction, wait for Enter
|
|
11
|
+
# capture VAR "<question>" → show question, read response into VAR
|
|
12
|
+
#
|
|
13
|
+
# At the end, captured values are printed as KEY=VALUE for the agent to parse.
|
|
14
|
+
|
|
15
|
+
set -euo pipefail
|
|
16
|
+
|
|
17
|
+
step() {
|
|
18
|
+
printf '\n>>> %s\n' "$1"
|
|
19
|
+
read -r -p " [Enter when done] " _
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
capture() {
|
|
23
|
+
local var="$1" question="$2" answer
|
|
24
|
+
printf '\n>>> %s\n' "$question"
|
|
25
|
+
read -r -p " > " answer
|
|
26
|
+
printf -v "$var" '%s' "$answer"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# --- edit below ---------------------------------------------------------
|
|
30
|
+
|
|
31
|
+
step "Open the app at http://localhost:3000 and sign in."
|
|
32
|
+
|
|
33
|
+
capture ERRORED "Click the 'Export' button. Did it throw an error? (y/n)"
|
|
34
|
+
|
|
35
|
+
capture ERROR_MSG "Paste the error message (or 'none'):"
|
|
36
|
+
|
|
37
|
+
# --- edit above ---------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
printf '\n--- Captured ---\n'
|
|
40
|
+
printf 'ERRORED=%s\n' "$ERRORED"
|
|
41
|
+
printf 'ERROR_MSG=%s\n' "$ERROR_MSG"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hasapi-grilling
|
|
3
|
+
description: Interview the user relentlessly about a plan or design. Use when the user wants to stress-test a plan before building, or uses any 'grill' trigger phrases.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Interview me relentlessly about every aspect of this plan until we reach a shared understanding. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one. For each question, provide your recommended answer.
|
|
7
|
+
|
|
8
|
+
Ask the questions one at a time, waiting for feedback on each question before continuing. Asking multiple questions at once is bewildering.
|
|
9
|
+
|
|
10
|
+
If a question can be answered by exploring the codebase, explore the codebase instead.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hasapi-handoff
|
|
3
|
+
description: Compact the current conversation into a handoff document for another agent to pick up.
|
|
4
|
+
argument-hint: "What will the next session be used for?"
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
Write a handoff document summarising the current conversation so a fresh agent can continue the work. Save to the temporary directory of the user's OS - not the current workspace.
|
|
9
|
+
|
|
10
|
+
Include a "suggested skills" section in the document, which suggests skills that the agent should invoke.
|
|
11
|
+
|
|
12
|
+
Do not duplicate content already captured in other artifacts (PRDs, plans, ADRs, issues, commits, diffs). Reference them by path or URL instead.
|
|
13
|
+
|
|
14
|
+
Redact any sensitive information, such as API keys, passwords, or personally identifiable information.
|
|
15
|
+
|
|
16
|
+
If the user passed arguments, treat them as a description of what the next session will focus on and tailor the doc accordingly.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hasapi-health
|
|
3
|
+
description: >
|
|
4
|
+
Combined codebase health dashboard that scores a project across all four quality
|
|
5
|
+
dimensions — PR quality, architecture, tech debt, and test quality — in a single
|
|
6
|
+
pass, drawing on twelve classic engineering books.
|
|
7
|
+
Triggers when: user wants an overall quality assessment, asks "how healthy is this
|
|
8
|
+
codebase?", "run all the checks", "give me a big-picture quality report", "I need a
|
|
9
|
+
health score before the release", "what's the overall state of our code?", or wants
|
|
10
|
+
to onboard a new team with a quality overview.
|
|
11
|
+
Do NOT trigger for: server health checks, HTTP health endpoints, Kubernetes
|
|
12
|
+
liveness/readiness probes, database health, or application uptime. Also do not
|
|
13
|
+
trigger when the user specifically requests only one dimension — use the
|
|
14
|
+
corresponding focused skill instead (brooks-review / brooks-audit /
|
|
15
|
+
brooks-debt / brooks-test).
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Brooks-Lint — Health Dashboard
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
1. Read `../_shared/common.md` for the Iron Law, Project Config, Report Template, and Health Score rules
|
|
23
|
+
2. Read `../_shared/source-coverage.md` for book-level coverage, exceptions, and tradeoffs
|
|
24
|
+
3. Read `../_shared/decay-risks.md` for production risk symptom definitions
|
|
25
|
+
4. Read `../_shared/test-decay-risks.md` for test risk symptom definitions
|
|
26
|
+
5. Read `health-guide.md` in this directory for the dashboard orchestration process
|
|
27
|
+
|
|
28
|
+
## Process
|
|
29
|
+
|
|
30
|
+
**If the user has not specified a project or directory:** apply Auto Scope Detection
|
|
31
|
+
from `../_shared/common.md` to determine the review scope before proceeding.
|
|
32
|
+
|
|
33
|
+
1. Run abbreviated scans across all four dimensions (Step 1 of the guide)
|
|
34
|
+
2. Compute per-dimension and composite Health Scores with weighting (Step 2 of the guide)
|
|
35
|
+
3. Output the Health Dashboard using the dashboard report template (Step 3 of the guide)
|
|
36
|
+
|
|
37
|
+
**Mode line in report:** `Health Dashboard`
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Health Dashboard Guide — Mode 5
|
|
2
|
+
|
|
3
|
+
**Purpose:** Produce a cross-dimensional health dashboard for the codebase.
|
|
4
|
+
Every finding must follow the Iron Law: Symptom → Source → Consequence → Remedy.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Analysis Process
|
|
9
|
+
|
|
10
|
+
### Step 1: Run Lightweight Scan Across Four Dimensions
|
|
11
|
+
|
|
12
|
+
For each dimension, run an abbreviated scan using the decay-risks definitions
|
|
13
|
+
from `_shared/`. Do NOT read the individual mode guide files — use the abbreviated
|
|
14
|
+
checklists below. Cap each dimension at 3 findings; for Debt: cap at 2 per risk code and 3 across all risk codes.
|
|
15
|
+
|
|
16
|
+
**PR dimension (if changes exist):**
|
|
17
|
+
- Apply Auto Scope Detection (common.md)
|
|
18
|
+
- Scan for R2 (Change Propagation) and R1 (Cognitive Overload) in the diff
|
|
19
|
+
|
|
20
|
+
**Architecture dimension:**
|
|
21
|
+
- Gather codebase context: read top-level structure, entry points, import statements
|
|
22
|
+
- Draw a Mermaid dependency graph (follow standard graph rules from common.md)
|
|
23
|
+
- Scan for R5 (Dependency Disorder): circular deps, upward flows, fan-out > 5
|
|
24
|
+
- INCLUDE the Mermaid graph in output
|
|
25
|
+
|
|
26
|
+
**Debt dimension:**
|
|
27
|
+
- Scan for all six decay risks (R1-R6) across the codebase
|
|
28
|
+
- Skip Pain × Spread scoring (use severity tier only)
|
|
29
|
+
|
|
30
|
+
**Test dimension:**
|
|
31
|
+
- Build the Test Suite Map (unit/integration/E2E counts)
|
|
32
|
+
- Scan for T1 (Test Obscurity) and T2 (Test Brittleness) in test files
|
|
33
|
+
|
|
34
|
+
### Step 2: Compute Dashboard Scores
|
|
35
|
+
|
|
36
|
+
Each dimension gets its own Health Score (base 100, same deduction rules from common.md).
|
|
37
|
+
Composite score = weighted average of dimension scores:
|
|
38
|
+
|
|
39
|
+
| Dimension | Weight | Rationale |
|
|
40
|
+
|-----------|--------|-----------|
|
|
41
|
+
| PR (code quality) | 0.25 | Only applies if changes exist; skip if no diff |
|
|
42
|
+
| Architecture | 0.30 | Structural issues have highest blast radius |
|
|
43
|
+
| Debt | 0.25 | Systemic but slower-moving |
|
|
44
|
+
| Test | 0.20 | Supporting signal |
|
|
45
|
+
|
|
46
|
+
If PR dimension is skipped (no changes), redistribute its 0.25 weight proportionally
|
|
47
|
+
across the remaining three dimensions by dividing each remaining weight by
|
|
48
|
+
(1 − 0.25) = 0.75. Compute redistribution dynamically — do not hardcode the values.
|
|
49
|
+
|
|
50
|
+
**Redistributed weights (PR skipped):**
|
|
51
|
+
|
|
52
|
+
| Dimension | Base Weight | Redistributed Weight |
|
|
53
|
+
|-----------|------------|---------------------|
|
|
54
|
+
| Architecture | 0.30 | 0.30 / 0.75 = 0.40 |
|
|
55
|
+
| Debt | 0.25 | 0.25 / 0.75 = 0.33 |
|
|
56
|
+
| Test | 0.20 | 0.20 / 0.75 = 0.27 |
|
|
57
|
+
|
|
58
|
+
### Step 3: Output Dashboard
|
|
59
|
+
|
|
60
|
+
Use the dashboard report template below instead of the standard common.md template.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Dashboard Report Template
|
|
65
|
+
|
|
66
|
+
````markdown
|
|
67
|
+
# Brooks-Lint Health Dashboard
|
|
68
|
+
|
|
69
|
+
**Mode:** Health Dashboard
|
|
70
|
+
**Scope:** [project name or directory]
|
|
71
|
+
**Composite Score:** XX/100
|
|
72
|
+
|
|
73
|
+
| Dimension | Score | Top Finding |
|
|
74
|
+
|-----------|-------|------------|
|
|
75
|
+
| Code Quality | XX/100 | [one-line summary or "Clean"] |
|
|
76
|
+
| Architecture | XX/100 | [one-line summary or "Clean"] |
|
|
77
|
+
| Tech Debt | XX/100 | [one-line summary or "Clean"] |
|
|
78
|
+
| Test Quality | XX/100 | [one-line summary or "Clean"] |
|
|
79
|
+
|
|
80
|
+
## Module Dependency Graph
|
|
81
|
+
[Mermaid graph from architecture scan]
|
|
82
|
+
|
|
83
|
+
## Top Findings (max 5 across all dimensions)
|
|
84
|
+
[Standard Iron Law format, sorted by severity]
|
|
85
|
+
|
|
86
|
+
## Recommendation
|
|
87
|
+
[One paragraph: what to fix first, which dimension needs the most attention,
|
|
88
|
+
suggest running the full individual skill for the worst dimension]
|
|
89
|
+
````
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hasapi-implement
|
|
3
|
+
description: "Implement a piece of work based on a PRD or set of issues."
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Implement the work described by the user in the PRD or issues.
|
|
8
|
+
|
|
9
|
+
Use /skill:hasapi-tdd where possible, at pre-agreed seams.
|
|
10
|
+
|
|
11
|
+
Run typechecking regularly, single test files regularly, and the full test suite once at the end.
|
|
12
|
+
|
|
13
|
+
Once done, use /skill:hasapi-review to review the work.
|
|
14
|
+
|
|
15
|
+
Commit your work to the current branch.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hasapi-resolving-merge-conflicts
|
|
3
|
+
description: "Use when you need to resolve an in-progress git merge/rebase conflict."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
1. **See the current state** of the merge/rebase. Check git history, and the conflicting files.
|
|
7
|
+
|
|
8
|
+
2. **Find the primary sources** for each conflict. Understand deeply why each change was made, and what the original intent was. Read the commit messages, check the PRs, check original issues/tickets.
|
|
9
|
+
|
|
10
|
+
3. **Resolve each hunk.** Preserve both intents where possible. Where incompatible, pick the one matching the merge's stated goal and note the trade-off. Do **not** invent new behaviour. Always resolve; never `--abort`.
|
|
11
|
+
|
|
12
|
+
4. Discover the project's **automated checks** and run them — typically typecheck, then tests, then format. Fix anything the merge broke.
|
|
13
|
+
|
|
14
|
+
5. **Finish the merge/rebase.** Stage everything and commit. If rebasing, continue the rebase process until all commits are rebased.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hasapi-review
|
|
3
|
+
description: >
|
|
4
|
+
PR code review that surfaces decay risks, design smells, and maintainability
|
|
5
|
+
issues with concrete Symptom → Source → Consequence → Remedy findings, drawing
|
|
6
|
+
on twelve classic engineering books.
|
|
7
|
+
Triggers when: user asks to review code, check a PR, shares a diff or pastes
|
|
8
|
+
code asking "does this look right?" / "any issues here?" / "ready to merge?",
|
|
9
|
+
or asks for feedback on a function, class, or file.
|
|
10
|
+
Also triggers when user mentions: code smells / refactoring / clean architecture /
|
|
11
|
+
DDD / domain-driven design / SOLID principles / Hyrum's Law / deep modules /
|
|
12
|
+
tactical programming / conceptual integrity / Brooks's Law / Mythical Man-Month /
|
|
13
|
+
second system effect.
|
|
14
|
+
Do NOT trigger for: questions about how to write code from scratch, language syntax
|
|
15
|
+
questions, or framework/tool questions where no existing code is shared.
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Brooks-Lint — PR Review
|
|
19
|
+
|
|
20
|
+
## Setup
|
|
21
|
+
|
|
22
|
+
1. Read `../_shared/common.md` for the Iron Law, Project Config, Report Template, and Health Score rules
|
|
23
|
+
2. Read `../_shared/source-coverage.md` for book-level coverage, exceptions, and tradeoffs
|
|
24
|
+
3. Read `../_shared/decay-risks.md` for symptom definitions and source attributions
|
|
25
|
+
4. Read `pr-review-guide.md` in this directory for the analysis process
|
|
26
|
+
|
|
27
|
+
## Process
|
|
28
|
+
|
|
29
|
+
**If the user has not specified files or pasted code:** apply Auto Scope Detection
|
|
30
|
+
from `../_shared/common.md` to determine the review scope before proceeding.
|
|
31
|
+
|
|
32
|
+
1. Understand the review scope, then scan for each decay risk in the order specified (Steps 1–6 of the guide)
|
|
33
|
+
2. Run the Quick Test Check (Step 7 of the guide) — skip for docs-only or non-production changes
|
|
34
|
+
3. Apply the Iron Law to every finding
|
|
35
|
+
4. Output using the Report Template from common.md
|
|
36
|
+
|
|
37
|
+
**Mode line in report:** `PR Review`
|