pi-dev 0.1.1
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 +28 -0
- package/README.md +117 -0
- package/dist/cli.js +73 -0
- package/dist/install.js +101 -0
- package/dist/manifest.js +28 -0
- package/dist/paths.js +14 -0
- package/package.json +48 -0
- package/presets/preferences.md +74 -0
- package/skills/diagnose/SKILL.md +117 -0
- package/skills/diagnose/scripts/hitl-loop.template.sh +41 -0
- package/skills/do/SKILL.md +180 -0
- package/skills/grill-with-docs/ADR-FORMAT.md +47 -0
- package/skills/grill-with-docs/CONTEXT-FORMAT.md +77 -0
- package/skills/grill-with-docs/SKILL.md +88 -0
- package/skills/improve-codebase-architecture/DEEPENING.md +37 -0
- package/skills/improve-codebase-architecture/INTERFACE-DESIGN.md +44 -0
- package/skills/improve-codebase-architecture/LANGUAGE.md +53 -0
- package/skills/improve-codebase-architecture/SKILL.md +71 -0
- package/skills/migrate/SKILL.md +231 -0
- package/skills/recon-with-vision/SKILL.md +106 -0
- package/skills/setup/SKILL.md +121 -0
- package/skills/setup/domain.md +51 -0
- package/skills/setup/issue-tracker-github.md +22 -0
- package/skills/setup/issue-tracker-gitlab.md +23 -0
- package/skills/setup/issue-tracker-local.md +19 -0
- package/skills/setup/triage-labels.md +15 -0
- package/skills/taste/SKILL.md +148 -0
- package/skills/tdd/SKILL.md +109 -0
- package/skills/tdd/deep-modules.md +33 -0
- package/skills/tdd/interface-design.md +31 -0
- package/skills/tdd/mocking.md +59 -0
- package/skills/tdd/refactoring.md +10 -0
- package/skills/tdd/tests.md +61 -0
- package/skills/to-issues/SKILL.md +81 -0
- package/skills/to-prd/SKILL.md +74 -0
- package/skills/triage/AGENT-BRIEF.md +168 -0
- package/skills/triage/OUT-OF-SCOPE.md +101 -0
- package/skills/triage/SKILL.md +111 -0
- package/skills/where/SKILL.md +108 -0
- package/skills/zoom-out/SKILL.md +7 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: taste
|
|
3
|
+
description: View, update, or onboard engineering taste (lifecycle, philosophy, testing, architecture, automation, communication) across global → project → package layers. Use when the user says "내 취향 좀 보자", "취향 업데이트", "preferences 보여줘", "taste 갱신", or when /do reports preferences are missing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /taste — Project Preferences
|
|
7
|
+
|
|
8
|
+
Three-layer preferences:
|
|
9
|
+
|
|
10
|
+
1. **Global** — `~/.pi/agent/preferences.md` (user-level defaults across all projects).
|
|
11
|
+
2. **Project** — `docs/agents/preferences.md` at the repo root (overrides global).
|
|
12
|
+
3. **Package** — `packages/<pkg>/preferences.md` (overrides project for that package only).
|
|
13
|
+
|
|
14
|
+
Skills merge **global → project → package**, last write wins per key. Other skills must call this merge at the start of every run.
|
|
15
|
+
|
|
16
|
+
## Modes
|
|
17
|
+
|
|
18
|
+
- **onboarding** — first time in a project. Project file does not exist. Run a short interview (only project-specific questions; do NOT re-ask global defaults).
|
|
19
|
+
- **init** — same as onboarding but explicitly invoked, even if file exists, with user permission to overwrite.
|
|
20
|
+
- **update** — file exists; user wants to change specific section(s).
|
|
21
|
+
- **review** — print the merged result + per-layer breakdown; stop.
|
|
22
|
+
|
|
23
|
+
Pick mode based on (a) file existence, (b) user phrasing.
|
|
24
|
+
|
|
25
|
+
## Onboarding mode (most important)
|
|
26
|
+
|
|
27
|
+
Triggered by `/do` on first session in a project (no `docs/agents/preferences.md`). Goal: minimal friction, only ask what global cannot answer.
|
|
28
|
+
|
|
29
|
+
### Onboarding flow
|
|
30
|
+
|
|
31
|
+
1. **Read global** at `~/.pi/agent/preferences.md`. If missing, fall back to built-in defaults (see below) and warn once.
|
|
32
|
+
2. **Auto-detect project signals** — quick scan to pre-fill answers:
|
|
33
|
+
- `package.json` workspaces / `pnpm-workspace.yaml` / `turbo.json` → monorepo?
|
|
34
|
+
- test config (`vitest.config*`, `jest.config*`, `playwright.config*`) → testing stack
|
|
35
|
+
- scripts named `*live-test*`, `*smoke*`, `e2e*`, `prod:*` → live-test infra strength
|
|
36
|
+
- `AGENTS.md` / `CLAUDE.md` → existing rules to honour
|
|
37
|
+
- presence of `docs/agents/{issue-tracker,triage-labels,domain}.md` → already setup-matt-pocock'd
|
|
38
|
+
- git remote → fork? primary repo?
|
|
39
|
+
- `CHANGELOG.md` / version → maturity proxy
|
|
40
|
+
- presence of `.github/workflows/*` → CI strength
|
|
41
|
+
3. **Compute project profile** from signals:
|
|
42
|
+
- `stage` proxy: changelog age + version + commit cadence
|
|
43
|
+
- `live-test-infra`: `strong` | `medium` | `weak` based on script/config presence
|
|
44
|
+
- `mocking-default`: detect mock-heavy patterns vs faux/real-deps
|
|
45
|
+
- `module-shape`: monorepo vs single-package
|
|
46
|
+
4. **Present a 1-screen summary** of detected signals + the 4–6 questions where project context likely diverges from global. Do not ask anything global already answers consistently.
|
|
47
|
+
|
|
48
|
+
### The minimal onboarding questions (max 6)
|
|
49
|
+
|
|
50
|
+
Only ask questions where (a) the project signal contradicts global, OR (b) the question is inherently project-specific:
|
|
51
|
+
|
|
52
|
+
1. **Project name + 1-line purpose** (always ask — used in free notes)
|
|
53
|
+
2. **Lifecycle stage override?** (only if signals suggest different from global; offer detected default)
|
|
54
|
+
3. **Mocking stance override?** (only if mock-heavy patterns detected and global says `fakes`)
|
|
55
|
+
4. **Local-live entrypoint?** — how does the agent boot the app/subsystem locally? Pick one or describe: `pnpm dev:prod` / `npm run dev` / custom script / "we don't have one yet — agent will build a harness". This drives `local-live-policy=mandatory`.
|
|
56
|
+
5. **Ops-live policy override?** (only if `ops-live-infra=weak` or `=strong` strongly contradicts global)
|
|
57
|
+
6. **Auto-commit/auto-pr override?** (only if repo has fork structure, strong CI, or production-critical paths)
|
|
58
|
+
7. **Regression test locations** — single path, or per-package map. Defaults to `<package>/test/regressions/<slug>.test.ts`.
|
|
59
|
+
8. **Project taboos / blocking rules** (free text — extract from `AGENTS.md` BLOCKING/CRITICAL/NEVER sections, ask user to confirm/append)
|
|
60
|
+
|
|
61
|
+
Each question:
|
|
62
|
+
|
|
63
|
+
- One sentence explainer
|
|
64
|
+
- Detected default + global default
|
|
65
|
+
- Choices
|
|
66
|
+
- "skip" or "global default" as bulk-accept
|
|
67
|
+
|
|
68
|
+
After answers, show the resulting `docs/agents/preferences.md` file (only the keys that **differ from global**) and ask for final OK before writing.
|
|
69
|
+
|
|
70
|
+
### Built-in fallback defaults (when global missing)
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
stage=growth, change-budget=module
|
|
74
|
+
simplicity-bias=simple-first, completeness-bias=feature-complete, over-engineering-tolerance=0, durability-target=long-lived
|
|
75
|
+
test-priority-order=local-live>integration>unit, wait-budget-seconds=30, wait-budget-exceeded-action=redesign-test
|
|
76
|
+
test-design-bar=design-first, coverage-scope=critical-paths, mocking-stance=fakes
|
|
77
|
+
local-live-policy=mandatory, ops-live-policy=risk-gated
|
|
78
|
+
module-depth-preference=deep, dedup-trigger=never-preemptive, adr-threshold=hard-to-reverse-only
|
|
79
|
+
auto-create-issues=preview-then-yes, auto-apply-labels=yes, auto-commit-per-slice=staged-only, auto-pr=branch-push-only, interrupt-on-ambiguity=confidence<0.5
|
|
80
|
+
verbosity=minimal, explanation-style=decisions-only, language=ko
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Init / Update / Review modes
|
|
84
|
+
|
|
85
|
+
- **init**: same as onboarding but assume file may exist; confirm overwrite.
|
|
86
|
+
- **update**: read existing project file. Ask which section(s). Walk only those. Show diff. Write.
|
|
87
|
+
- **review**: print merged result + per-layer breakdown table. Do not modify.
|
|
88
|
+
|
|
89
|
+
## Output template
|
|
90
|
+
|
|
91
|
+
Project file format — **only include keys that differ from global**. This keeps files small and the override intent obvious.
|
|
92
|
+
|
|
93
|
+
```markdown
|
|
94
|
+
# <Project> Engineering Preferences
|
|
95
|
+
|
|
96
|
+
> Project-level overrides on `~/.pi/agent/preferences.md`. Keys not listed here inherit from global. Edit this file directly to update.
|
|
97
|
+
|
|
98
|
+
last-updated: YYYY-MM-DD
|
|
99
|
+
project: <name>
|
|
100
|
+
purpose: <one-liner>
|
|
101
|
+
|
|
102
|
+
## Overrides
|
|
103
|
+
|
|
104
|
+
- <section>.<key>: <value> # <one-line rationale>
|
|
105
|
+
|
|
106
|
+
## Project taboos
|
|
107
|
+
|
|
108
|
+
- <BLOCKING/NEVER rules from AGENTS.md, confirmed with user>
|
|
109
|
+
|
|
110
|
+
## Free notes
|
|
111
|
+
|
|
112
|
+
<free-form>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
If there are no overrides (global fits perfectly), still write the file with `purpose`, `taboos`, and free notes — its existence signals "onboarding ran".
|
|
116
|
+
|
|
117
|
+
**Migration marker**: every project file MUST end with the line
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
<!-- migrated: <ISO-date> by `/migrate` -->
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
`/do` checks this marker as the strict gate. If absent, it refuses to start and invokes `/migrate` first. Onboarding without prior migration is not allowed.
|
|
124
|
+
|
|
125
|
+
## AGENTS.md hookup
|
|
126
|
+
|
|
127
|
+
After writing the project file, ensure `AGENTS.md` (or `CLAUDE.md`) has:
|
|
128
|
+
|
|
129
|
+
```markdown
|
|
130
|
+
### Preferences
|
|
131
|
+
|
|
132
|
+
Per-project engineering preferences in `docs/agents/preferences.md` (overrides on `~/.pi/agent/preferences.md`). The `/do` meta skill reads merged preferences before every run.
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
If the section already exists, leave it alone.
|
|
136
|
+
|
|
137
|
+
## Merge function (canonical, for other skills)
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
merged = global
|
|
141
|
+
for each (key, value) in project:
|
|
142
|
+
merged[key] = value
|
|
143
|
+
for each (key, value) in package (if applicable):
|
|
144
|
+
merged[key] = value
|
|
145
|
+
return merged
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Other skills should call this merge at run start, never cache across runs.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd
|
|
3
|
+
description: Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test-Driven Development
|
|
7
|
+
|
|
8
|
+
## Philosophy
|
|
9
|
+
|
|
10
|
+
**Core principle**: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.
|
|
11
|
+
|
|
12
|
+
**Good tests** are integration-style: they exercise real code paths through public APIs. They describe _what_ the system does, not _how_ it does it. A good test reads like a specification - "user can checkout with valid cart" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.
|
|
13
|
+
|
|
14
|
+
**Bad tests** are coupled to implementation. They mock internal collaborators, test private methods, or verify through external means (like querying a database directly instead of using the interface). The warning sign: your test breaks when you refactor, but behavior hasn't changed. If you rename an internal function and tests fail, those tests were testing implementation, not behavior.
|
|
15
|
+
|
|
16
|
+
See [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.
|
|
17
|
+
|
|
18
|
+
## Anti-Pattern: Horizontal Slices
|
|
19
|
+
|
|
20
|
+
**DO NOT write all tests first, then all implementation.** This is "horizontal slicing" - treating RED as "write all tests" and GREEN as "write all code."
|
|
21
|
+
|
|
22
|
+
This produces **crap tests**:
|
|
23
|
+
|
|
24
|
+
- Tests written in bulk test _imagined_ behavior, not _actual_ behavior
|
|
25
|
+
- You end up testing the _shape_ of things (data structures, function signatures) rather than user-facing behavior
|
|
26
|
+
- Tests become insensitive to real changes - they pass when behavior breaks, fail when behavior is fine
|
|
27
|
+
- You outrun your headlights, committing to test structure before understanding the implementation
|
|
28
|
+
|
|
29
|
+
**Correct approach**: Vertical slices via tracer bullets. One test → one implementation → repeat. Each test responds to what you learned from the previous cycle. Because you just wrote the code, you know exactly what behavior matters and how to verify it.
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
WRONG (horizontal):
|
|
33
|
+
RED: test1, test2, test3, test4, test5
|
|
34
|
+
GREEN: impl1, impl2, impl3, impl4, impl5
|
|
35
|
+
|
|
36
|
+
RIGHT (vertical):
|
|
37
|
+
RED→GREEN: test1→impl1
|
|
38
|
+
RED→GREEN: test2→impl2
|
|
39
|
+
RED→GREEN: test3→impl3
|
|
40
|
+
...
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Workflow
|
|
44
|
+
|
|
45
|
+
### 1. Planning
|
|
46
|
+
|
|
47
|
+
When exploring the codebase, read `docs/agents/domain.md` first if it exists, use the project's domain glossary so that test names and interface vocabulary match the project's language, and respect ADRs in the area you're touching.
|
|
48
|
+
|
|
49
|
+
Before writing any code:
|
|
50
|
+
|
|
51
|
+
- [ ] Confirm with user what interface changes are needed
|
|
52
|
+
- [ ] Confirm with user which behaviors to test (prioritize)
|
|
53
|
+
- [ ] Identify opportunities for [deep modules](deep-modules.md) (small interface, deep implementation)
|
|
54
|
+
- [ ] Design interfaces for [testability](interface-design.md)
|
|
55
|
+
- [ ] List the behaviors to test (not implementation steps)
|
|
56
|
+
- [ ] Get user approval on the plan
|
|
57
|
+
|
|
58
|
+
Ask: "What should the public interface look like? Which behaviors are most important to test?"
|
|
59
|
+
|
|
60
|
+
**You can't test everything.** Confirm with the user exactly which behaviors matter most. Focus testing effort on critical paths and complex logic, not every possible edge case.
|
|
61
|
+
|
|
62
|
+
### 2. Tracer Bullet
|
|
63
|
+
|
|
64
|
+
Write ONE test that confirms ONE thing about the system:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
RED: Write test for first behavior → test fails
|
|
68
|
+
GREEN: Write minimal code to pass → test passes
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
This is your tracer bullet - proves the path works end-to-end.
|
|
72
|
+
|
|
73
|
+
### 3. Incremental Loop
|
|
74
|
+
|
|
75
|
+
For each remaining behavior:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
RED: Write next test → fails
|
|
79
|
+
GREEN: Minimal code to pass → passes
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Rules:
|
|
83
|
+
|
|
84
|
+
- One test at a time
|
|
85
|
+
- Only enough code to pass current test
|
|
86
|
+
- Don't anticipate future tests
|
|
87
|
+
- Keep tests focused on observable behavior
|
|
88
|
+
|
|
89
|
+
### 4. Refactor
|
|
90
|
+
|
|
91
|
+
After all tests pass, look for [refactor candidates](refactoring.md):
|
|
92
|
+
|
|
93
|
+
- [ ] Extract duplication
|
|
94
|
+
- [ ] Deepen modules (move complexity behind simple interfaces)
|
|
95
|
+
- [ ] Apply SOLID principles where natural
|
|
96
|
+
- [ ] Consider what new code reveals about existing code
|
|
97
|
+
- [ ] Run tests after each refactor step
|
|
98
|
+
|
|
99
|
+
**Never refactor while RED.** Get to GREEN first.
|
|
100
|
+
|
|
101
|
+
## Checklist Per Cycle
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
[ ] Test describes behavior, not implementation
|
|
105
|
+
[ ] Test uses public interface only
|
|
106
|
+
[ ] Test would survive internal refactor
|
|
107
|
+
[ ] Code is minimal for this test
|
|
108
|
+
[ ] No speculative features added
|
|
109
|
+
```
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Deep Modules
|
|
2
|
+
|
|
3
|
+
From "A Philosophy of Software Design":
|
|
4
|
+
|
|
5
|
+
**Deep module** = small interface + lots of implementation
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
┌─────────────────────┐
|
|
9
|
+
│ Small Interface │ ← Few methods, simple params
|
|
10
|
+
├─────────────────────┤
|
|
11
|
+
│ │
|
|
12
|
+
│ │
|
|
13
|
+
│ Deep Implementation│ ← Complex logic hidden
|
|
14
|
+
│ │
|
|
15
|
+
│ │
|
|
16
|
+
└─────────────────────┘
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Shallow module** = large interface + little implementation (avoid)
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
┌─────────────────────────────────┐
|
|
23
|
+
│ Large Interface │ ← Many methods, complex params
|
|
24
|
+
├─────────────────────────────────┤
|
|
25
|
+
│ Thin Implementation │ ← Just passes through
|
|
26
|
+
└─────────────────────────────────┘
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
When designing interfaces, ask:
|
|
30
|
+
|
|
31
|
+
- Can I reduce the number of methods?
|
|
32
|
+
- Can I simplify the parameters?
|
|
33
|
+
- Can I hide more complexity inside?
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Interface Design for Testability
|
|
2
|
+
|
|
3
|
+
Good interfaces make testing natural:
|
|
4
|
+
|
|
5
|
+
1. **Accept dependencies, don't create them**
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
// Testable
|
|
9
|
+
function processOrder(order, paymentGateway) {}
|
|
10
|
+
|
|
11
|
+
// Hard to test
|
|
12
|
+
function processOrder(order) {
|
|
13
|
+
const gateway = new StripeGateway();
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
2. **Return results, don't produce side effects**
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
// Testable
|
|
21
|
+
function calculateDiscount(cart): Discount {}
|
|
22
|
+
|
|
23
|
+
// Hard to test
|
|
24
|
+
function applyDiscount(cart): void {
|
|
25
|
+
cart.total -= discount;
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
3. **Small surface area**
|
|
30
|
+
- Fewer methods = fewer tests needed
|
|
31
|
+
- Fewer params = simpler test setup
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# When to Mock
|
|
2
|
+
|
|
3
|
+
Mock at **system boundaries** only:
|
|
4
|
+
|
|
5
|
+
- External APIs (payment, email, etc.)
|
|
6
|
+
- Databases (sometimes - prefer test DB)
|
|
7
|
+
- Time/randomness
|
|
8
|
+
- File system (sometimes)
|
|
9
|
+
|
|
10
|
+
Don't mock:
|
|
11
|
+
|
|
12
|
+
- Your own classes/modules
|
|
13
|
+
- Internal collaborators
|
|
14
|
+
- Anything you control
|
|
15
|
+
|
|
16
|
+
## Designing for Mockability
|
|
17
|
+
|
|
18
|
+
At system boundaries, design interfaces that are easy to mock:
|
|
19
|
+
|
|
20
|
+
**1. Use dependency injection**
|
|
21
|
+
|
|
22
|
+
Pass external dependencies in rather than creating them internally:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// Easy to mock
|
|
26
|
+
function processPayment(order, paymentClient) {
|
|
27
|
+
return paymentClient.charge(order.total);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Hard to mock
|
|
31
|
+
function processPayment(order) {
|
|
32
|
+
const client = new StripeClient(process.env.STRIPE_KEY);
|
|
33
|
+
return client.charge(order.total);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**2. Prefer SDK-style interfaces over generic fetchers**
|
|
38
|
+
|
|
39
|
+
Create specific functions for each external operation instead of one generic function with conditional logic:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
// GOOD: Each function is independently mockable
|
|
43
|
+
const api = {
|
|
44
|
+
getUser: (id) => fetch(`/users/${id}`),
|
|
45
|
+
getOrders: (userId) => fetch(`/users/${userId}/orders`),
|
|
46
|
+
createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// BAD: Mocking requires conditional logic inside the mock
|
|
50
|
+
const api = {
|
|
51
|
+
fetch: (endpoint, options) => fetch(endpoint, options),
|
|
52
|
+
};
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The SDK approach means:
|
|
56
|
+
- Each mock returns one specific shape
|
|
57
|
+
- No conditional logic in test setup
|
|
58
|
+
- Easier to see which endpoints a test exercises
|
|
59
|
+
- Type safety per endpoint
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Refactor Candidates
|
|
2
|
+
|
|
3
|
+
After TDD cycle, look for:
|
|
4
|
+
|
|
5
|
+
- **Duplication** → Extract function/class
|
|
6
|
+
- **Long methods** → Break into private helpers (keep tests on public interface)
|
|
7
|
+
- **Shallow modules** → Combine or deepen
|
|
8
|
+
- **Feature envy** → Move logic to where data lives
|
|
9
|
+
- **Primitive obsession** → Introduce value objects
|
|
10
|
+
- **Existing code** the new code reveals as problematic
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Good and Bad Tests
|
|
2
|
+
|
|
3
|
+
## Good Tests
|
|
4
|
+
|
|
5
|
+
**Integration-style**: Test through real interfaces, not mocks of internal parts.
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
// GOOD: Tests observable behavior
|
|
9
|
+
test("user can checkout with valid cart", async () => {
|
|
10
|
+
const cart = createCart();
|
|
11
|
+
cart.add(product);
|
|
12
|
+
const result = await checkout(cart, paymentMethod);
|
|
13
|
+
expect(result.status).toBe("confirmed");
|
|
14
|
+
});
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Characteristics:
|
|
18
|
+
|
|
19
|
+
- Tests behavior users/callers care about
|
|
20
|
+
- Uses public API only
|
|
21
|
+
- Survives internal refactors
|
|
22
|
+
- Describes WHAT, not HOW
|
|
23
|
+
- One logical assertion per test
|
|
24
|
+
|
|
25
|
+
## Bad Tests
|
|
26
|
+
|
|
27
|
+
**Implementation-detail tests**: Coupled to internal structure.
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
// BAD: Tests implementation details
|
|
31
|
+
test("checkout calls paymentService.process", async () => {
|
|
32
|
+
const mockPayment = jest.mock(paymentService);
|
|
33
|
+
await checkout(cart, payment);
|
|
34
|
+
expect(mockPayment.process).toHaveBeenCalledWith(cart.total);
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Red flags:
|
|
39
|
+
|
|
40
|
+
- Mocking internal collaborators
|
|
41
|
+
- Testing private methods
|
|
42
|
+
- Asserting on call counts/order
|
|
43
|
+
- Test breaks when refactoring without behavior change
|
|
44
|
+
- Test name describes HOW not WHAT
|
|
45
|
+
- Verifying through external means instead of interface
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
// BAD: Bypasses interface to verify
|
|
49
|
+
test("createUser saves to database", async () => {
|
|
50
|
+
await createUser({ name: "Alice" });
|
|
51
|
+
const row = await db.query("SELECT * FROM users WHERE name = ?", ["Alice"]);
|
|
52
|
+
expect(row).toBeDefined();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// GOOD: Verifies through interface
|
|
56
|
+
test("createUser makes user retrievable", async () => {
|
|
57
|
+
const user = await createUser({ name: "Alice" });
|
|
58
|
+
const retrieved = await getUser(user.id);
|
|
59
|
+
expect(retrieved.name).toBe("Alice");
|
|
60
|
+
});
|
|
61
|
+
```
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: to-issues
|
|
3
|
+
description: Break a plan, spec, or PRD into independently-grabbable issues on the project issue tracker using tracer-bullet vertical slices. Use when user wants to convert a plan into issues, create implementation tickets, or break down work into issues.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# To Issues
|
|
7
|
+
|
|
8
|
+
Break a plan into independently-grabbable issues using vertical slices (tracer bullets).
|
|
9
|
+
|
|
10
|
+
The issue tracker and triage label vocabulary should have been provided to you — run `/`/setup`` if not. Before fetching or publishing, read `docs/agents/issue-tracker.md`, `docs/agents/triage-labels.md`, and `docs/agents/domain.md` if they exist.
|
|
11
|
+
|
|
12
|
+
## Process
|
|
13
|
+
|
|
14
|
+
### 1. Gather context
|
|
15
|
+
|
|
16
|
+
Work from whatever is already in the conversation context. If the user passes an issue reference (issue number, URL, or path) as an argument, fetch it from the issue tracker and read its full body and comments.
|
|
17
|
+
|
|
18
|
+
### 2. Explore the codebase (optional)
|
|
19
|
+
|
|
20
|
+
If you have not already explored the codebase, do so to understand the current state of the code. Issue titles and descriptions should use the project's domain glossary vocabulary, and respect ADRs in the area you're touching.
|
|
21
|
+
|
|
22
|
+
### 3. Draft vertical slices
|
|
23
|
+
|
|
24
|
+
Break the plan into **tracer bullet** issues. Each issue is a thin vertical slice that cuts through ALL integration layers end-to-end, NOT a horizontal slice of one layer.
|
|
25
|
+
|
|
26
|
+
Slices may be 'HITL' or 'AFK'. HITL slices require human interaction, such as an architectural decision or a design review. AFK slices can be implemented and merged without human interaction. Prefer AFK over HITL where possible.
|
|
27
|
+
|
|
28
|
+
<vertical-slice-rules>
|
|
29
|
+
- Each slice delivers a narrow but COMPLETE path through every layer (schema, API, UI, tests)
|
|
30
|
+
- A completed slice is demoable or verifiable on its own
|
|
31
|
+
- Prefer many thin slices over few thick ones
|
|
32
|
+
</vertical-slice-rules>
|
|
33
|
+
|
|
34
|
+
### 4. Quiz the user
|
|
35
|
+
|
|
36
|
+
Present the proposed breakdown as a numbered list. For each slice, show:
|
|
37
|
+
|
|
38
|
+
- **Title**: short descriptive name
|
|
39
|
+
- **Type**: HITL / AFK
|
|
40
|
+
- **Blocked by**: which other slices (if any) must complete first
|
|
41
|
+
- **User stories covered**: which user stories this addresses (if the source material has them)
|
|
42
|
+
|
|
43
|
+
Ask the user:
|
|
44
|
+
|
|
45
|
+
- Does the granularity feel right? (too coarse / too fine)
|
|
46
|
+
- Are the dependency relationships correct?
|
|
47
|
+
- Should any slices be merged or split further?
|
|
48
|
+
- Are the correct slices marked as HITL and AFK?
|
|
49
|
+
|
|
50
|
+
Iterate until the user approves the breakdown.
|
|
51
|
+
|
|
52
|
+
### 5. Publish the issues to the issue tracker
|
|
53
|
+
|
|
54
|
+
For each approved slice, publish a new issue to the issue tracker. Use the issue body template below. Apply the `needs-triage` triage label so each issue enters the normal triage flow.
|
|
55
|
+
|
|
56
|
+
Publish issues in dependency order (blockers first) so you can reference real issue identifiers in the "Blocked by" field.
|
|
57
|
+
|
|
58
|
+
<issue-template>
|
|
59
|
+
## Parent
|
|
60
|
+
|
|
61
|
+
A reference to the parent issue on the issue tracker (if the source was an existing issue, otherwise omit this section).
|
|
62
|
+
|
|
63
|
+
## What to build
|
|
64
|
+
|
|
65
|
+
A concise description of this vertical slice. Describe the end-to-end behavior, not layer-by-layer implementation.
|
|
66
|
+
|
|
67
|
+
## Acceptance criteria
|
|
68
|
+
|
|
69
|
+
- [ ] Criterion 1
|
|
70
|
+
- [ ] Criterion 2
|
|
71
|
+
- [ ] Criterion 3
|
|
72
|
+
|
|
73
|
+
## Blocked by
|
|
74
|
+
|
|
75
|
+
- A reference to the blocking ticket (if any)
|
|
76
|
+
|
|
77
|
+
Or "None - can start immediately" if no blockers.
|
|
78
|
+
|
|
79
|
+
</issue-template>
|
|
80
|
+
|
|
81
|
+
Do NOT close or modify any parent issue.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: to-prd
|
|
3
|
+
description: Turn the current conversation context into a PRD and publish it to the project issue tracker. Use when user wants to create a PRD from the current context.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
This skill takes the current conversation context and codebase understanding and produces a PRD. Do NOT interview the user — just synthesize what you already know.
|
|
7
|
+
|
|
8
|
+
The issue tracker and triage label vocabulary should have been provided to you — run `/`/setup`` if not. Before publishing, read `docs/agents/issue-tracker.md`, `docs/agents/triage-labels.md`, and `docs/agents/domain.md` if they exist.
|
|
9
|
+
|
|
10
|
+
## Process
|
|
11
|
+
|
|
12
|
+
1. Explore the repo to understand the current state of the codebase, if you haven't already. Use the project's domain glossary vocabulary throughout the PRD, and respect any ADRs in the area you're touching.
|
|
13
|
+
|
|
14
|
+
2. Sketch out the major modules you will need to build or modify to complete the implementation. Actively look for opportunities to extract deep modules that can be tested in isolation.
|
|
15
|
+
|
|
16
|
+
A deep module (as opposed to a shallow module) is one which encapsulates a lot of functionality in a simple, testable interface which rarely changes.
|
|
17
|
+
|
|
18
|
+
Check with the user that these modules match their expectations. Check with the user which modules they want tests written for.
|
|
19
|
+
|
|
20
|
+
3. Write the PRD using the template below, then publish it to the project issue tracker. Apply the `needs-triage` triage label so it enters the normal triage flow.
|
|
21
|
+
|
|
22
|
+
<prd-template>
|
|
23
|
+
|
|
24
|
+
## Problem Statement
|
|
25
|
+
|
|
26
|
+
The problem that the user is facing, from the user's perspective.
|
|
27
|
+
|
|
28
|
+
## Solution
|
|
29
|
+
|
|
30
|
+
The solution to the problem, from the user's perspective.
|
|
31
|
+
|
|
32
|
+
## User Stories
|
|
33
|
+
|
|
34
|
+
A LONG, numbered list of user stories. Each user story should be in the format of:
|
|
35
|
+
|
|
36
|
+
1. As an <actor>, I want a <feature>, so that <benefit>
|
|
37
|
+
|
|
38
|
+
<user-story-example>
|
|
39
|
+
1. As a mobile bank customer, I want to see balance on my accounts, so that I can make better informed decisions about my spending
|
|
40
|
+
</user-story-example>
|
|
41
|
+
|
|
42
|
+
This list of user stories should be extremely extensive and cover all aspects of the feature.
|
|
43
|
+
|
|
44
|
+
## Implementation Decisions
|
|
45
|
+
|
|
46
|
+
A list of implementation decisions that were made. This can include:
|
|
47
|
+
|
|
48
|
+
- The modules that will be built/modified
|
|
49
|
+
- The interfaces of those modules that will be modified
|
|
50
|
+
- Technical clarifications from the developer
|
|
51
|
+
- Architectural decisions
|
|
52
|
+
- Schema changes
|
|
53
|
+
- API contracts
|
|
54
|
+
- Specific interactions
|
|
55
|
+
|
|
56
|
+
Do NOT include specific file paths or code snippets. They may end up being outdated very quickly.
|
|
57
|
+
|
|
58
|
+
## Testing Decisions
|
|
59
|
+
|
|
60
|
+
A list of testing decisions that were made. Include:
|
|
61
|
+
|
|
62
|
+
- A description of what makes a good test (only test external behavior, not implementation details)
|
|
63
|
+
- Which modules will be tested
|
|
64
|
+
- Prior art for the tests (i.e. similar types of tests in the codebase)
|
|
65
|
+
|
|
66
|
+
## Out of Scope
|
|
67
|
+
|
|
68
|
+
A description of the things that are out of scope for this PRD.
|
|
69
|
+
|
|
70
|
+
## Further Notes
|
|
71
|
+
|
|
72
|
+
Any further notes about the feature.
|
|
73
|
+
|
|
74
|
+
</prd-template>
|