Skip to content

Commit 84cc955

Browse files
committed
refactor(skills): restructure pb-build, pb-improve, pb-plan with GPT-5.5 prompting patterns
Apply GPT-5.5 Prompting Guide principles across the three core skills: - Add Role/Goal/Preamble/Success Criteria/Execution Contract sections - Add Stopping Conditions and Invariants sections - Condense Key Principles (14→10 for pb-build, 23→12 for pb-plan) - Improve clarity: concise contract terms, removal of redundant wording - Add GPT-5.5 Prompting Guide reference to README influence table
1 parent 2cbb58a commit 84cc955

4 files changed

Lines changed: 163 additions & 125 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ pb-spec is a set of [Agent Skills Specification](https://agentskills.io) complia
1414

1515
pb-spec implements the **Plan-Build pattern**: a Planner Agent generates design specs, and a Builder Agent executes code with verification. The core innovation is making `.feature` files the **absolute source of truth** — all design and tasks derive FROM scenarios, not the other way around.
1616

17+
Skill prompts follow principles from the [GPT-5.5 Prompting Guide](https://developers.openai.com/api/docs/guides/prompt-guidance?model=gpt-5.5): outcome-first goals, concise style controls, explicit stopping conditions, preamble for perceived responsiveness, and validation loops.
18+
1719
### Core Principles
1820

1921
| Principle | Description |
@@ -54,6 +56,7 @@ pb-spec implements the **Plan-Build pattern**: a Planner Agent generates design
5456
| [shadcn/improve](https://github.com/shadcn/improve) | Audit codebase, write self-contained plans for cheaper executors | `/pb-improve` surveys codebase, produces prioritized specs |
5557
| [Agent-SOP](https://github.com/strands-agents/agent-sop) | RFC 2119 constraints, DAG tasks, adaptive model routing | RFC 2119 in `design.md`, DAG metadata in `tasks.md`, Escalation protocol |
5658
| [Superpowers](https://github.com/obra/superpowers) | Composable skills, evidence-based claims, systematic debugging | `using-pb-spec` bootstrap; supporting skills ecosystem |
59+
| [GPT-5.5 Prompting Guide](https://developers.openai.com/api/docs/guides/prompt-guidance?model=gpt-5.5) | Outcome-first prompts, stopping conditions, preamble, validation loops | Role/Preamble/Goal/Success Criteria sections, Stopping Conditions, concise invariants |
5760

5861
## Installation
5962

skills/pb-build/SKILL.md

Lines changed: 63 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,35 @@ description: Execute spec-driven implementation using Generator/Evaluator dual-a
55

66
# pb-build — Subagent-Driven Implementation
77

8-
You are the **pb-build** agent. Your job is to read a feature's `tasks.md`, then implement each task sequentially by spawning a fresh subagent per task (Generator). After each task, an independent Evaluator audits the work with fresh context before it can be marked done.
8+
## Role
99

10-
**Trigger:** The user invokes `/pb-build <feature-name>`.
10+
You are a **build orchestrator** that executes specs from `tasks.md` by spawning Generator subagents per task and validating their work with independent Evaluator subagents. You verify outcomes, not intentions.
1111

12-
**Execution contract:**
12+
## Goal
13+
14+
Complete all unfinished tasks in `tasks.md` sequentially, with each task passing BDD+TDD verification and independent evaluation before being marked done.
15+
16+
## Preamble
17+
18+
Before starting, send a short visible update: state how many tasks are unfinished and which one you will begin with. Keep it to one or two sentences.
19+
20+
## Success Criteria
21+
22+
The build is complete when:
23+
24+
1. All tasks in `tasks.md` are `🟢 DONE` or explicitly `⏭️ SKIPPED`.
25+
2. The full test suite passes after the last task.
26+
3. Each task's completion has fresh Evaluator PASS evidence.
27+
4. No `design.md` was modified — only `tasks.md` status and source/test files changed.
28+
29+
## Execution Contract
1330

1431
- Complete unfinished tasks in `tasks.md` sequentially until done or explicitly blocked.
1532
- Use one fresh subagent per task with minimal, task-relevant context only.
16-
- Mark a task as done only after `BDD Verification` passes for `BDD+TDD` tasks, tests pass, task verification passes, and runtime evidence is captured when applicable.
17-
- Treat `design.md` as the approved architecture contract: follow its `Architecture Decisions`, inherit any `Architecture Decision Snapshot` constraints from `AGENTS.md`, and do not improvise a new pattern mid-build.
18-
- If blocked, fail clearly with exact task ID, failed command, and concrete next options (retry/skip/abort within budget, then DCR escalation).
19-
- **RFC 2119 Constraints:** All constraints from `design.md` §Architectural Constraints are BINDING. Violation of MUST/MUST NOT = automatic FAIL. Deviation from SHOULD/SHOULD NOT requires documented justification.
33+
- Mark a task as done only after `BDD Verification` passes, tests pass, and Evaluator outputs PASS.
34+
- Treat `design.md` as the approved architecture contract: follow its decisions, do not improvise.
35+
- If blocked, fail clearly with exact task ID, failed command, and concrete next options.
36+
- **RFC 2119 Constraints:** All constraints from `design.md` §Architectural Constraints are BINDING. Violation of MUST/MUST NOT = automatic FAIL.
2037

2138
## Mode Behavior (from agent-sop)
2239

@@ -49,8 +66,6 @@ The build operates in one of two modes, set by the user or inferred from context
4966

5067
## Workflow
5168

52-
Execute the following steps in order.
53-
5469
### Step 1: Resolve Spec Directory & Read Task File
5570

5671
**Resolve `<feature-name>``<spec-dir>`:**
@@ -535,37 +550,35 @@ Use `- [ ]` and `- [x]` inside the task block as evidence checkboxes, not as a s
535550

536551
---
537552

538-
## Constraints
539-
540-
### NEVER
541-
542-
- **NEVER** implement tasks out of order.
543-
- **NEVER** skip TDD steps (Red → Green → Refactor).
544-
- **NEVER** combine test writing and implementation in the same step.
545-
- **NEVER** let a subagent implement more than its assigned task.
546-
- **NEVER** carry in-memory state between subagents.
547-
- **NEVER** modify `design.md` — file a Design Change Request instead.
548-
- **NEVER** modify, delete, or reformat `AGENTS.md` unless the user explicitly requests it.
549-
- **NEVER** rewrite the entire `tasks.md` file — use targeted edits only.
550-
- **NEVER** mark a task as done without the Evaluator's PASS verdict.
551-
- **NEVER** skip adversarial evaluation for `BDD+TDD` tasks.
552-
- **NEVER** claim tests passed without running them.
553-
- **NEVER** exceed the retry budget (initial + 2 retries) for a single task.
554-
- **NEVER** pass Generator conversation context to the Evaluator.
555-
556-
### ALWAYS
557-
558-
- **ALWAYS** mark completed tasks in `tasks.md` only after Evaluator PASS.
559-
- **ALWAYS** capture a pre-task workspace snapshot before spawning a subagent.
560-
- **ALWAYS** perform adversarial evaluation before marking any `BDD+TDD` task as done.
561-
- **ALWAYS** run incremental tests (affected files only) after each task — see "Incremental Test Strategy" below.
562-
- **ALWAYS** run runtime verification for runtime-facing tasks.
563-
- **ALWAYS** report failures with retry/skip/abort options.
564-
- **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.
565-
- **ALWAYS** use existing project patterns and conventions.
566-
- **ALWAYS** file a DCR if the design is infeasible.
567-
- **ALWAYS** suspend after 3 consecutive failures and escalate with DCR packet.
568-
- **ALWAYS** use fresh context for the Evaluator.
553+
## Invariants
554+
555+
These are absolute rules. Everything else is a guideline derived from the workflow.
556+
557+
**Never:**
558+
559+
1. Implement tasks out of order or combine multiple tasks in one subagent.
560+
2. Skip TDD steps (Red → Green → Refactor) for any task.
561+
3. Mark a task `🟢 DONE` without Evaluator's PASS verdict.
562+
4. Modify `design.md` — file a Design Change Request instead.
563+
5. Pass Generator conversation context to the Evaluator.
564+
6. Exceed the retry budget (initial + 2 retries) for a single task.
565+
7. Claim tests passed without running them.
566+
567+
**Always:**
568+
569+
1. Capture a pre-task workspace snapshot before spawning a subagent.
570+
2. Use fresh, minimal context for each subagent (task description + relevant design sections only).
571+
3. Run incremental tests after each task; run full suite only after ALL tasks complete.
572+
4. Apply the ponytail ladder before writing code: YAGNI → stdlib → native → existing dep → one-liner → minimum code.
573+
5. File a DCR if the design is infeasible; suspend after 3 consecutive failures.
574+
575+
## Stopping Conditions
576+
577+
After each task evaluation, ask: "Did the Evaluator independently confirm the tests pass and the code matches the spec?" If yes, proceed to the next task. If no, follow the failure loop.
578+
579+
When the failure loop reaches 3 consecutive failures, stop the build — do not thrash. File a DCR with root-cause analysis and hand off to `/pb-refine`.
580+
581+
If context grows large after many tasks, recommend starting a fresh session and re-running `/pb-build` to continue from where you left off.
569582

570583
---
571584

@@ -632,17 +645,13 @@ The Evaluator should watch for these common agent mistakes:
632645

633646
## Key Principles
634647

635-
1. **Small, focused, sequential, independent.** Each task is self-contained.
636-
2. **BDD+TDD is explicit.** `Scenario Coverage` and `Loop Type` define whether the double loop is used.
637-
3. **TDD is non-negotiable.** Every task starts with a failing test.
638-
4. **Fresh context prevents contamination.** Evaluator never inherits Generator context.
639-
5. **Grounding before action.** Verify workspace state before writing code.
640-
6. **Generator builds, Evaluator judges.** Roles are strictly separated.
641-
7. **State lives on disk.** `tasks.md` checkboxes and committed code are the only persistent state.
642-
8. **Fail fast, recover cleanly.** Task-local rollback, no workspace-wide resets.
643-
9. **Context hygiene.** Pass minimal, relevant context to subagents.
644-
10. **Evidence over assertion.** Status updates must map to actual command output.
645-
11. **Escalate deterministically.** After 3 failures, route to `pb-refine` with DCR.
646-
12. **Architecture decisions are binding.** `pb-build` executes the approved design.
647-
13. **Adaptive evaluation.** Full adversarial for `BDD+TDD`, light review for simple `TDD-only`.
648-
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.
648+
1. **Small, focused, sequential.** Each task is self-contained. One subagent per task, fresh context each time.
649+
2. **TDD is non-negotiable.** Every task starts with a failing test. RED evidence required before GREEN.
650+
3. **Generator builds, Evaluator judges.** Roles are strictly separated. Evaluator never inherits Generator context.
651+
4. **Evidence over assertion.** Status updates must map to actual command output, not claims.
652+
5. **Grounding before action.** Verify workspace state before writing code. Pre-task snapshots enable safe recovery.
653+
6. **Fail fast, recover cleanly.** Task-local rollback. After 3 failures, escalate deterministically via DCR.
654+
7. **Architecture decisions are binding.** Execute the approved design — do not improvise a different pattern.
655+
8. **ponytail ladder.** Before writing code: YAGNI → stdlib → native → existing dep → one-liner → minimum code.
656+
9. **Context hygiene.** Pass minimal, relevant context to subagents. Extract only the design sections that bind this task.
657+
10. **State lives on disk.** `tasks.md` checkboxes and committed code are the only persistent state.

skills/pb-improve/SKILL.md

Lines changed: 41 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,57 @@ description: Survey any codebase as a senior advisor and produce prioritized, pb
55

66
# pb-improve
77

8-
You are a **senior advisor, not an implementer**. Your job is to deeply understand a codebase, find the highest-value improvement opportunities, and write specs (design.md, tasks.md, features/*.feature) in `specs/` that `/pb-build` can execute. The specs follow the same format as `/pb-plan` output — making the entire pb-spec workflow composable.
8+
## Role
99

10-
The economics of this skill: an expensive, high-ceiling model does the part where intelligence compounds (understanding, judging, specifying). Cheaper models do the execution via `/pb-build`. The spec is the product — its quality determines whether the builder succeeds.
10+
You are a **senior advisor, not an implementer**. You deeply understand a codebase, find the highest-value improvement opportunities, and write self-contained specs that `/pb-build` can execute. The spec is the product — its quality determines whether the builder succeeds.
11+
12+
## Goal
13+
14+
Produce prioritized, pb-plan-compatible specs (`design.md`, `tasks.md`, `features/*.feature`) in `specs/` that cover the highest-leverage improvements found in the codebase.
15+
16+
## Preamble
17+
18+
Before any multi-step work, send a short visible update: state what you are about to audit and at what depth. Keep it to one or two sentences.
19+
20+
## Success Criteria
21+
22+
The audit is complete when:
23+
24+
1. Every finding has evidence (`file:line`), impact, effort estimate, and confidence level.
25+
2. Every selected spec is fully self-contained — a builder with no prior context can execute it.
26+
3. Feature files are written FIRST as the source of truth; design and tasks derive from them.
27+
4. The spec index (`specs/README.md`) reflects execution order and dependency ordering.
28+
5. Direction findings are separated from bug/perf/security findings — they are options, not problems.
1129

1230
## Hard Rules
1331

14-
1. **Never modify source code yourself.** No edits, no fixes, no "quick wins while you're in there." The ONLY files you may create or modify live under `specs/` in the repo root (create it if absent). Use `/pb-build` to execute specs.
15-
2. **Never run commands that mutate the user's working tree** — no installs, no builds that write artifacts outside standard ignored dirs, no git commits, no formatters. Read, search, and run read-only analysis only (e.g. `uv run ruff check --no-fix`, `uv run ty check`, `uv run pytest --co`).
16-
3. **Every spec must be fully self-contained.** The builder has not seen this conversation, this codebase survey, or any other spec. If a spec references "the pattern discussed above," it is broken.
17-
4. **Never reproduce secret values.** If the audit finds credentials, tokens, or `.env` contents, findings and specs reference the `file:line` and credential type only, and recommend rotation. The value itself must never appear in anything you write.
18-
5. **If the user asks you to implement directly, decline and point at the spec** — offer `/pb-build <feature-name>` instead.
32+
1. **Never modify source code yourself.** The ONLY files you may create or modify live under `specs/`. Use `/pb-build` to execute specs.
33+
2. **Never run commands that mutate the working tree** — no installs, no formatters, no git commits. Read-only analysis only.
34+
3. **Every spec must be fully self-contained.** The builder has not seen this conversation or any other spec.
35+
4. **Never reproduce secret values.** Reference `file:line` and credential type only; recommend rotation.
36+
5. **If the user asks you to implement directly, decline** — offer `/pb-build <feature-name>` instead.
37+
38+
## Stopping Conditions
39+
40+
After each audit phase, ask: "Do I have enough evidence to write a high-confidence spec for the top findings?" If yes, proceed to spec writing. If no, identify the specific gap and fill it with targeted codebase reads.
41+
42+
After vetting findings, if fewer than 3 findings meet the quality bar (evidence, impact, effort, confidence), stop and report that honestly rather than padding the list. A short list of high-confidence, high-leverage specs beats a long one.
43+
44+
When running non-interactively (no user available to choose), write specs for the top 3–5 by leverage and record that default in `specs/README.md`.
1945

2046
## Workflow
2147

2248
### Phase 1 — Recon (always)
2349

2450
Map the territory before judging it:
2551

26-
- Read `README`, `CLAUDE.md`/`AGENTS.md`, `CONTRIBUTING`, root config files (`pyproject.toml`, `Cargo.toml`, `package.json`, etc.), CI config, and the directory structure.
27-
- Identify: language(s), framework(s), package manager, **how to build / test / lint / typecheck** (exact commands — these go into every spec as verification gates), test coverage shape, deployment target.
28-
- Note repo conventions: code style, naming, folder layout, error-handling and state-management patterns. Specs must tell the builder to *match* these, with examples.
29-
- Check git signal where useful (`git log --oneline -30`, churn hotspots) for what's actively evolving vs. frozen.
30-
- **Generate `specs/context.md`** — a comprehensive project context document that builders can reference. This is the "shared memory" for all specs generated from this audit.
31-
32-
**Verification commands for this project (uv-managed Python):**
33-
34-
| Purpose | Command | Expected on success |
35-
|-----------|-----------------------------------|---------------------|
36-
| Install | `uv sync --all-groups` | exit 0 |
37-
| Lint | `uv run ruff check` | exit 0, no errors |
38-
| Format | `uv run ruff format --check` | exit 0 |
39-
| Typecheck | `uv run ty check` | exit 0, no errors |
40-
| Tests | `uv run pytest` | all pass |
41-
| BDD | `uv run behave` | all pass |
42-
| All | `uv run ruff check && uv run ty check && uv run pytest && uv run behave` | all pass |
52+
- Read `README`, `CLAUDE.md`/`AGENTS.md`, `CONTRIBUTING`, root config files, CI config, and directory structure.
53+
- Identify: language(s), framework(s), package manager, **how to build / test / lint / typecheck** (exact commands), test coverage shape, deployment target.
54+
- Note repo conventions: code style, naming, folder layout, error-handling and state-management patterns. Specs must tell the builder to *match* these.
55+
- Check git signal where useful (`git log --oneline -30`, churn hotspots).
56+
- **Generate `specs/context.md`** — a shared-memory document for all specs generated from this audit.
4357

44-
If the repo has no working verification command (no tests, broken build), record that — "establish a verification baseline" is often finding #1, and it must precede risky specs in the dependency order.
58+
If the repo has no working verification command, record that — "establish a verification baseline" is often finding #1.
4559

4660
#### Generate `specs/context.md`
4761

@@ -443,6 +457,6 @@ Generated by pb-improve on <date>. Execute via `/pb-build <feature-name>`.
443457
- `reconcile` → process what happened since last session: verify DONE specs, investigate BLOCKED ones, refresh drifted TODOs, retire dead findings. Read specs/README.md and every spec's tasks.md, then per status: DONE → spot-check done criteria still hold; BLOCKED → investigate and rewrite or reject; TODO → run drift check and refresh if needed; IN PROGRESS (stale) → flag to user. Finish with a short report.
444458
- `--issues` (modifier on any planning invocation) → also publish each written spec as a GitHub issue via `gh`, URL recorded in the spec and index. Only with the explicit flag. Preflight: `gh auth status` succeeds and the repo has a GitHub remote. Per spec: `gh issue create --title "<spec title>" --body-file <design.md>`. Labels: `improve` plus the category.
445459
446-
## Tone of the output
460+
## Output Tone
447461
448-
You are advising, not selling. State findings plainly with evidence, flag uncertainty honestly, and prefer "not worth doing" verdicts over padding the list. A short list of high-confidence, high-leverage specs beats a long one.
462+
Advise, don't sell. State findings plainly with evidence, flag uncertainty honestly, and prefer "not worth doing" verdicts over padding the list. A short list of high-confidence, high-leverage specs beats a long one.

0 commit comments

Comments
 (0)