Skip to content

Commit f9b6f00

Browse files
committed
feat(skills): integrate ponytail simplification ladder into pb-plan, pb-build, pb-improve
Embed the ponytail 6-rung decision ladder (YAGNI → stdlib → native → existing dep → one-liner → minimum code) at every decision point across the pb-spec workflow. Inspired by the ponytail project which achieves 54% code reduction with 100% safety through a concrete decision framework instead of vague "simplify" instructions. ## pb-plan (skills/pb-plan/SKILL.md) - Replace generic "code-simplification lens" with ponytail ladder in execution contract - Add ponytail evaluation criterion to Architecture Decision Snapshot step - Replace Code Simplification Constraints with ponytail ladder + ponytail: comment convention + never-simplify-away carve-out - Add "ponytail-first" as Key Principle #1 ## pb-build (skills/pb-build/SKILL.md + references/) - Expand ALWAYS follow YAGNI to full ponytail ladder reference - Add ponytail ladder as Key Principle #14 - implementer_prompt: Add ponytail ladder as mandatory pre-code check before GREEN phase - implementer_prompt: Add Simplicity Check (2k) after Scope Check - evaluator_prompt: Expand over-engineering red flag with ponytail-specific criteria (unnecessary abstractions, custom vs stdlib, boilerplate) - evaluator_prompt: Add Check D — Simplicity Audit using ponytail ladder ## pb-improve (skills/pb-improve/SKILL.md + references/) - Replace Code Simplification Constraints with ponytail ladder - Add instruction: every generated design.md/tasks.md must carry the ladder - audit-playbook: Add Over-engineering category under Tech Debt & Architecture with 6 finding patterns and "deletion value" impact metric - plan-template: Replace generic simplification constraints with ponytail ladder ## Templates (references/) - design_template.md: Replace §3.6 Code Simplification Constraints with ponytail ladder section - tasks_template.md: Replace Simplification Rule and all 6 Simplification Focus placeholders with ponytail ladder reference ## Spec - specs/2026-06-22-01-integrate-ponytail: design.md, tasks.md, features/integrate-ponytail.feature ## Verification - 67 tests pass, ruff check clean, rumdl check clean - ponytail keyword appears 25+ times across skill ecosystem - All 8 grep verification checks pass
1 parent fecb4ba commit f9b6f00

12 files changed

Lines changed: 546 additions & 42 deletions

File tree

skills/pb-build/SKILL.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ Use `- [ ]` and `- [x]` inside the task block as evidence checkboxes, not as a s
543543
- **ALWAYS** run the full test suite after each task.
544544
- **ALWAYS** run runtime verification for runtime-facing tasks.
545545
- **ALWAYS** report failures with retry/skip/abort options.
546-
- **ALWAYS** follow YAGNI — implement only what the task requires.
546+
- **ALWAYS** apply the ponytail ladder — (1) Does this need to exist? (2) Stdlib? (3) Native? (4) Existing dep? (5) One line? (6) Minimum code. Never simplify away: validation, error handling, security.
547547
- **ALWAYS** use existing project patterns and conventions.
548548
- **ALWAYS** file a DCR if the design is infeasible.
549549
- **ALWAYS** suspend after 3 consecutive failures and escalate with DCR packet.
@@ -566,3 +566,4 @@ Use `- [ ]` and `- [x]` inside the task block as evidence checkboxes, not as a s
566566
11. **Escalate deterministically.** After 3 failures, route to `pb-refine` with DCR.
567567
12. **Architecture decisions are binding.** `pb-build` executes the approved design.
568568
13. **Adaptive evaluation.** Full adversarial for `BDD+TDD`, light review for simple `TDD-only`.
569+
14. **ponytail ladder.** Before writing code, climb the 6-rung ladder: YAGNI → stdlib → native → existing dep → one-liner → minimum code. The Evaluator checks for over-engineering using the same ladder.

skills/pb-build/references/evaluator_prompt.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@ Analyze the git diff against the task contract.
7272
- Secrets, API keys, or credentials in the code
7373
- Debug artifacts (`console.log`, `print()`, `debugger`, TODO comments from other tasks)
7474
- Import of libraries not in the project's dependency manifest
75-
- Over-engineering (abstractions beyond what the task requires)
75+
- Over-engineering (ponytail ladder check):
76+
- Unnecessary abstractions: interfaces with one implementation, factories for one product, configs for values that never change
77+
- Custom code where stdlib/native suffices
78+
- Boilerplate "for later" that doesn't serve the current task
79+
- Missing `ponytail:` comment on deliberate simplifications
80+
- Code that could be 1 line but isn't
7681
- Missing error handling for external calls
7782

7883
4. **Dependency integrity:**
@@ -137,6 +142,18 @@ Test the implementation beyond what the scenario explicitly requires.
137142

138143
**Output:** List every edge case tested and its result.
139144

145+
### Check D — Simplicity Audit (Ponytail)
146+
147+
Apply the ponytail ladder to the diff:
148+
149+
1. **YAGNI:** Does everything in the diff serve the task? No speculative features, no "while I'm here" additions.
150+
2. **Stdlib:** Could any custom code be replaced by stdlib/native? (e.g., `dataclass` over pydantic for simple DTOs, `pathlib` over os.path, stdlib `http.server` for simple endpoints)
151+
3. **One-liner:** Are there multi-line implementations that could be one line?
152+
4. **Abstractions:** Are there interfaces with one implementation? Factories for one product? Config files for values that never change?
153+
5. **Boilerplate:** Is there scaffolding "for later"? Later can scaffold for itself.
154+
155+
**Output:** Flag any over-engineering found. Each issue should reference the specific ponytail ladder rung violated.
156+
140157
---
141158

142159
## Verdict

skills/pb-build/references/implementer_prompt.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,17 @@ Follow the outside-in cycle strictly. `BDD+TDD` tasks must first prove the busin
9999

100100
#### 2d. GREEN — Write Minimum Implementation
101101

102+
**Ponytail ladder (mandatory before writing code):**
103+
Before writing any implementation, climb the ladder:
104+
105+
1. Does this need to exist at all? (YAGNI)
106+
2. Stdlib does it? Use it.
107+
3. Native platform feature? Use it.
108+
4. Already-installed dependency? Use it.
109+
5. One line? One line.
110+
6. Only then: minimum code that works.
111+
Mark deliberate simplifications with `ponytail:` comments naming the ceiling and upgrade path.
112+
102113
- Write the **minimum code** needed to make the failing test pass.
103114
- Do not add features, optimizations, or abstractions not required by this task.
104115
- **Constraint:** Do not edit files you did not read in Step 1. If you need to modify a new file, read it first.
@@ -157,6 +168,14 @@ Output this analysis enclosed in `<error_analysis>` tags before rewriting code.
157168
- Confirm implementation matches the task contract and does not include extra scope.
158169
- If extra scope slipped in, remove it before submitting.
159170

171+
#### 2k. Simplicity Check (Ponytail)
172+
173+
- Did you apply the ponytail ladder before writing code?
174+
- Is there an unnecessary abstraction (interface with one implementation, factory for one product, config for a value that never changes)?
175+
- Could stdlib/native handle this without custom code?
176+
- If you wrote >10 lines, could it be 1 line?
177+
- Mark any deliberate simplifications with `ponytail:` comments.
178+
160179
#### Design Infeasibility
161180

162181
If during implementation you discover the design is **infeasible** (API doesn't exist, data structure won't work, dependency conflict, etc.):

skills/pb-improve/SKILL.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ Write each spec **for the weakest plausible builder**. That means:
175175
- A test plan (what new tests to write, where, following which existing test as a pattern).
176176
- A maintenance note (what future changes will interact with this, what to watch in review).
177177
- Escape hatches: "if X turns out to be true, STOP and report back instead of improvising."
178+
- **Ponytail ladder in every spec:** Every generated `design.md` must include the ponytail ladder in its Code Simplification Constraints section. Every generated `tasks.md` must reference the ladder in Simplification Focus fields.
178179

179180
#### Step 1: Feature Files (`features/*.feature`) — WRITE FIRST
180181

@@ -283,9 +284,24 @@ Write ONE `design.md` that consolidates all findings. Structure:
283284

284285
## Code Simplification Constraints
285286

287+
**Ponytail Ladder (mandatory at every decision point):**
288+
289+
1. Does this need to exist at all? Speculative need = skip it. (YAGNI)
290+
2. Stdlib does it? Use it.
291+
3. Native platform feature covers it? Use it.
292+
4. Already-installed dependency? Use it.
293+
5. One line? One line.
294+
6. Only then: minimum code that works.
295+
296+
**Mark deferrals:** Use `ponytail:` comments for deliberate simplifications with known ceilings.
297+
298+
**Never simplify away:** input validation, error handling, security, accessibility, anything explicitly requested.
299+
300+
**Additional constraints:**
301+
286302
- **Behavioral Contract:** Preserve existing behavior unless a listed scenario or requirement explicitly changes it.
287303
- **Repo Standards:** Use only the coding standards established by `AGENTS.md`, `CLAUDE.md`, and the existing codebase.
288-
- **Readability Priorities:** Prefer explicit control flow, clear names, reduced nesting.
304+
- **Readability Priorities:** Prefer explicit control flow, clear names, reduced nesting. Avoid dense or clever rewrites.
289305
- **Refactor Scope:** Limit cleanup to touched modules unless the design explicitly justifies broader refactor.
290306

291307
## BDD Scenario Inventory

skills/pb-improve/references/audit-playbook.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,19 @@ The goal is not a percentage — it's *which untested code is dangerous*.
6767
- Inconsistent patterns: three ways of doing data fetching / error handling / styling in the same repo — pick the winner (the one the team converged on most recently) and plan the consolidation.
6868
- Abstraction mismatches: premature abstractions with a single implementation, or missing abstractions where the same change always requires touching N files in lockstep.
6969

70+
### Over-Engineering (Ponytail Ladder)
71+
72+
Apply the ponytail ladder to find unnecessary complexity:
73+
74+
- **Unnecessary abstractions:** interfaces/protocols with exactly one implementation, abstract base classes with one concrete child, factory functions that only produce one product type.
75+
- **Config for constants:** configuration files or environment variables for values that never actually change in the deployed system.
76+
- **Custom vs stdlib:** hand-rolled implementations of what stdlib provides (e.g., custom URL parser when `urllib.parse` exists, custom JSON encoder when `json.dumps` suffices, custom retry when `tenacity` is already installed).
77+
- **Boilerplate "for later":** scaffolding, interfaces, extension points, plugin systems that nothing currently uses.
78+
- **Premature optimization:** caching, batching, lazy loading, connection pooling implemented before profiling shows a need.
79+
- **Ceremony over substance:** more than 3 lines of setup/config/wiring for what could be a one-liner.
80+
81+
**Impact metric:** Count the lines removable if the simpler approach were used. This is the "deletion value" of the finding.
82+
7083
## 6. Dependencies & Migrations
7184

7285
- Major-version lag on core framework/runtime (not every minor bump — the ones with real cost to staying behind: EOL, security-fix cutoffs, ecosystem incompatibility).

skills/pb-improve/references/plan-template.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,25 @@ The facts the builder needs, inlined — never "as discussed" or "see audit":
123123

124124
## Code Simplification Constraints
125125

126+
**Ponytail Ladder (mandatory at every decision point):**
127+
128+
1. Does this need to exist at all? Speculative need = skip it. (YAGNI)
129+
2. Stdlib does it? Use it.
130+
3. Native platform feature covers it? Use it.
131+
4. Already-installed dependency? Use it.
132+
5. One line? One line.
133+
6. Only then: minimum code that works.
134+
135+
**Mark deferrals:** Use `ponytail:` comments for deliberate simplifications with known ceilings and upgrade paths.
136+
137+
**Never simplify away:** input validation at trust boundaries, error handling that prevents data loss, security measures, accessibility basics, anything explicitly requested.
138+
139+
**Additional constraints:**
140+
126141
- **Behavioral Contract:** Preserve existing behavior unless a listed scenario or requirement explicitly changes it.
127-
- **Repo Standards:** Use only the coding standards that are actually established by `AGENTS.md`, `CLAUDE.md`, and the existing codebase for this repo.
128-
- **Readability Priorities:** Prefer explicit control flow, clear names, reduced nesting, and removal of redundant abstractions when that improves maintainability.
129-
- **Refactor Scope:** Limit cleanup to touched modules unless the design explicitly justifies a broader refactor.
130-
- **Clarity Guardrails:** Avoid dense or clever rewrites; where relevant, avoid nested ternary operators in favor of clearer branching.
142+
- **Repo Standards:** Use only the coding standards established by `AGENTS.md`, `CLAUDE.md`, and the existing codebase.
143+
- **Readability Priorities:** Prefer explicit control flow, clear names, reduced nesting. Avoid dense or clever rewrites.
144+
- **Refactor Scope:** Limit cleanup to touched modules unless the design explicitly justifies broader refactor.
131145

132146
## BDD Scenario Inventory
133147

0 commit comments

Comments
 (0)