Skip to content

Commit b4970aa

Browse files
committed
chore(release): v1.1.0 - modular validation, new workflow skills, docs refresh
- Refactor validate into dedicated modules under src/pb_spec/validation: build, plan, parser, result, scanner, rumdl - Add config, exceptions, git_utils, output modules - Add pb-* workflow skills: brainstorming, dispatching-parallel-agents, finishing, improve, receiving-code-review, requesting-code-review, subagent-driven-development, systematic-debugging, test-driven-development, verification-before-completion, writing-skills - Add using-pb-spec skill - Update skills/pb-plan and design template - Refresh docs/contract.md, docs/design.md, README.md - Bump pyproject version and dev dependencies, refresh uv.lock
1 parent 4386466 commit b4970aa

37 files changed

Lines changed: 4334 additions & 1270 deletions

File tree

README.md

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

1515
Compared to letting AI "just write code", pb-spec provides a hardened execution harness (guardrails). It requires context-first design, contract-based architecture, and dual-loop verification through logging and health checks.
1616

17+
### Design Standards
18+
19+
`design.md` artifacts conform to four industry-standard specification formats:
20+
21+
| Standard | Purpose | pb-spec Application |
22+
|---|---|---|
23+
| **EARS Notation** | Eliminate ambiguous requirements with 5 sentence patterns (Ubiquitous, State-driven, Event-driven, Unwanted, Exception) | Every requirement in `design.md` uses EARS syntax with `[REQ-XX]` IDs |
24+
| **C4 Model + Mermaid** | Architecture topology in parseable text (Context, Container, Component diagrams) | Architecture sections use `` ```mermaid `` blocks with C4 hierarchy |
25+
| **DBML / Prisma Schema** | Structured data models with strict types, relationships, and indexes | Data model sections use DBML or Prisma Schema DSL — natural language forbidden |
26+
| **MADR (ADR Records)** | Architecture decision records with Context/Decision/Consequences | Every AD has `[Context]`, `[Decision]`, `[Consequences]` subsections |
27+
| **API-First Type Signatures** | Contracts defined before implementation (OpenAPI, Protocol, Trait) | Interface sections use type signatures — narrative descriptions forbidden |
28+
1729
### Best-Practice Alignment
1830

1931
| Source | Core Idea | How pb-spec Applies It |
@@ -29,6 +41,8 @@ Compared to letting AI "just write code", pb-spec provides a hardened execution
2941
| [Harness Design for Long-Running Application Development](https://www.anthropic.com/engineering/harness-design-long-running-apps) | Generator/Evaluator separation; adversarial evaluation with MCP-driven live verification | `pb-build` dual-persona: Generator builds, independent Evaluator audits with fresh context; adaptive evaluation by task complexity |
3042
| [Stop Using /init for AGENTS.md](https://addyosmani.com/blog/agents-md/) | Keep AGENTS.md focused and maintainable | `/pb-init` updates a managed snapshot block in `AGENTS.md` while preserving all user-authored constraints outside that block |
3143
| [Ensuring Correctness Through the Type System](https://lindbakk.com/blog/ensuring-correctness-through-the-type-system) | Use the type system to encode invariants and catch errors early | Encode contracts as type-level assertions in `design.md` and add type checks to verification; `pb-plan` adds type guidance and `pb-build` runs the type checker when applicable |
44+
| [shadcn/improve](https://github.com/shadcn/improve) | Audit codebase, write self-contained plans for cheaper executors | `/pb-improve` surveys codebase, produces prioritized findings and handoff plans |
45+
| [Superpowers](https://github.com/obra/superpowers) | Composable skills, evidence-based claims, systematic debugging, skill auto-triggering | `using-pb-spec` bootstrap; `pb-verification-before-completion`; `pb-systematic-debugging`; supporting skills ecosystem |
3246

3347
## Installation
3448

@@ -44,6 +58,7 @@ npx skills add longcipher/pb-spec
4458
npx skills add longcipher/pb-spec --skill pb-init
4559
npx skills add longcipher/pb-spec --skill pb-plan
4660
npx skills add longcipher/pb-spec --skill pb-build
61+
npx skills add longcipher/pb-spec --skill improve
4762
```
4863

4964
*(After installation, skills will be placed in `.agents/skills/` or the compatible local directory for your environment, and automatically indexed by your AI.)*
@@ -56,15 +71,35 @@ Invoke these skills directly in your IDE / Agent terminal:
5671
2. **/pb-plan "requirement description"**: For example `/pb-plan Add WebSocket auth`, AI will generate `design.md`, `tasks.md`, and `.feature` test specs with Architecture Decisions.
5772
3. **/pb-build "feature-name"**: Automatically reads `tasks.md`, starts the outer BDD and inner TDD dual-loop with Subagents, closing and verifying each task one by one.
5873
4. **/pb-refine "feature-name"**: *(Optional)* When encountering design blocks (Build Blocked) or architectural flaws, iteratively modify specs based on feedback.
74+
5. **/pb-improve**: Audit the codebase and generate prioritized implementation plans for other agents to execute.
5975

6076
## Skills Overview
6177

78+
### Workflow Skills
79+
6280
| Skill | Trigger | Output | Description |
6381
|---|---|---|---|
6482
| `pb-init` | `/pb-init` | `AGENTS.md` | Audit repo and safely update/append a managed snapshot block without rewriting user-authored constraints |
6583
| `pb-plan` | `/pb-plan <requirement>` | `specs/<spec-dir>/design.md` + `tasks.md` + `features/*.feature` | Design proposal + Gherkin scenarios + ordered task breakdown |
6684
| `pb-refine` | `/pb-refine <feature>` | Revised spec files | Apply feedback or Design Change Requests |
6785
| `pb-build` | `/pb-build <feature-name>` | Code + tests | BDD+TDD via Generator (builds) + Evaluator (adversarial review) dual-persona workflow |
86+
| `pb-improve` | `/pb-improve` | `plans/*.md` | Codebase audit → prioritized findings → self-contained handoff plans |
87+
88+
### Supporting Skills
89+
90+
| Skill | Trigger | Description |
91+
|---|---|---|
92+
| `using-pb-spec` | Session start | Bootstrap: establishes skill invocation discipline |
93+
| `pb-brainstorming` | Before creative work | Explores intent, requirements, and design before implementation |
94+
| `pb-test-driven-development` | Before writing code | Red → Green → Refactor cycle, non-negotiable TDD |
95+
| `pb-systematic-debugging` | Any bug or failure | Find root cause before attempting fixes |
96+
| `pb-verification-before-completion` | Before claiming done | Evidence before assertions, always |
97+
| `pb-requesting-code-review` | Before merge | Dispatch independent reviewer subagent |
98+
| `pb-receiving-code-review` | Processing feedback | Technical evaluation, not performative agreement |
99+
| `pb-dispatching-parallel-agents` | Multiple independent tasks | One agent per problem domain, concurrent execution |
100+
| `pb-subagent-driven-development` | Executing plans | Fresh context per task, two-stage review |
101+
| `pb-finishing-a-development-branch` | Work complete | Verify tests → Present options → Execute choice |
102+
| `pb-writing-skills` | Creating/editing skills | Skills are code, not prose — test them |
68103

69104
## Supported AI Tools
70105

@@ -79,12 +114,24 @@ This skill library uses the standard `SKILL.md` specification. Fully compatible
79114

80115
## Workflow
81116

82-
Four agent skills that chain together:
117+
Five agent skills that chain together:
83118

84119
```text
85120
/pb-init → /pb-plan → [/pb-refine] → /pb-build
121+
122+
/pb-improve → plans/ → any executor
86123
```
87124

125+
Supporting skills activate automatically during the workflow:
126+
127+
- `pb-brainstorming` — before `/pb-plan` when requirements are unclear
128+
- `pb-test-driven-development` — during `/pb-build` for every task
129+
- `pb-systematic-debugging` — when tasks fail repeatedly
130+
- `pb-verification-before-completion` — before marking any task DONE
131+
- `pb-requesting-code-review` / `pb-receiving-code-review` — review cycles
132+
- `pb-dispatching-parallel-agents` — parallel audit in `/pb-improve`
133+
- `pb-finishing-a-development-branch` — finalization after `/pb-build`
134+
88135
### 1. `/pb-init` — AGENTS.md Snapshot & Safe Merge
89136

90137
Audits your project and writes a `pb-init` snapshot into `AGENTS.md` using managed markers:
@@ -113,7 +160,11 @@ specs/<YYYY-MM-DD-NO-feature-name>/
113160

114161
Key capabilities:
115162

116-
- **Architecture Decisions**: Explicit `Architecture Decisions` section with SRP, DIP, and pattern evaluation
163+
- **EARS Requirements**: All acceptance criteria use 5 sentence patterns for machine-checkable verification
164+
- **C4 + Mermaid Architecture**: Architecture diagrams in parseable Mermaid syntax
165+
- **MADR Decisions**: Architecture decisions with Context/Decision/Consequences
166+
- **DBML Data Models**: Structured data models in DSL (natural language forbidden)
167+
- **API-First Contracts**: Type signatures before implementation (OpenAPI, Protocol, Trait)
117168
- **Risk-based testing**: Property tests by default for broad input domains; fuzzing and benchmarks conditional
118169
- **Template identity alignment**: Renames generic scaffold names to project-matching identifiers
119170
- **Source requirement normalization**: Converts arbitrary-format input into a structured requirement ledger
@@ -146,9 +197,35 @@ Key principles:
146197
- **Architecture decisions are binding**: Executes the approved design; does not invent a different architecture
147198
- **Escalation over thrashing**: 3 consecutive failures → suspend task + DCR packet to `/pb-refine`
148199

200+
### 5. `/pb-improve` — Codebase Audit & Plan Generation
201+
202+
Audits any codebase and writes self-contained implementation plans for other agents to execute. The skill never modifies source code — only produces plans under `plans/`.
203+
204+
```text
205+
/pb-improve full audit → prioritized findings → plans
206+
/pb-improve quick cheap pass: hotspots, top findings only
207+
/pb-improve deep exhaustive: every package, every category
208+
/pb-improve security focused audit (also: perf, tests, bugs, ...)
209+
/pb-improve branch audit only what the current branch changes
210+
/pb-improve next feature suggestions — where to take the project
211+
/pb-improve plan <description> skip the audit, spec one thing
212+
/pb-improve review-plan <file> critique and tighten an existing plan
213+
/pb-improve execute <plan> dispatch a cheaper executor, review its work
214+
/pb-improve reconcile refresh the backlog: verify, unblock, retire
215+
/pb-improve ... --issues also publish plans as GitHub issues
216+
```
217+
218+
How it works:
219+
220+
1. **Recon** — Maps the repo: stack, conventions, build/test/lint commands (verification gates).
221+
2. **Audit** — Fans out parallel subagents across 9 categories: correctness, security, performance, test coverage, tech debt, dependencies, DX, docs, direction.
222+
3. **Vet** — Re-reads every cited location to drop false positives and correct mis-attributions.
223+
4. **Prioritize** — Findings ordered by leverage (impact ÷ effort, weighted by confidence).
224+
5. **Plan** — One file per selected finding in `plans/` with self-contained context, verification gates, and STOP conditions.
225+
149226
## Design Philosophy: Agent Harness
150227

151-
pb-spec's design is inspired by Anthropic's research on [Effective Harnesses for Long-Running Agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents). Core idea: place AI agents inside a strict, observable, recoverable execution environment.
228+
pb-spec's design is inspired by Anthropic's research on [Effective Harnesses for Long-Running Agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents) and the [Superpowers](https://github.com/obra/superpowers) methodology. Core idea: place AI agents inside a strict, observable, recoverable execution environment.
152229

153230
| Principle | How pb-spec Implements It |
154231
|---|---|
@@ -161,6 +238,9 @@ pb-spec's design is inspired by Anthropic's research on [Effective Harnesses for
161238
| **Observability as Context** | Task verification includes runtime signals (logs/health) |
162239
| **Escalation Loop** | 3 consecutive failures → DCR handoff to `pb-refine` |
163240
| **Generator/Evaluator Isolation** | Generator builds; Evaluator judges with fresh context |
241+
| **Evidence Before Claims** | `pb-verification-before-completion`: no success claims without fresh verification |
242+
| **Systematic Debugging** | `pb-systematic-debugging`: root cause before fixes, scientific method |
243+
| **Skill Auto-Triggering** | `using-pb-spec` bootstrap ensures skills activate at the right moments |
164244

165245
## License
166246

docs/contract.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,14 @@ Note: Complexity levels (lightweight, medium, high) are orthogonal to mode. Both
105105
The following sections are required for a build-eligible full-mode `design.md`:
106106

107107
1. `Executive Summary`
108-
2. `Requirements & Goals`
109-
3. `Architecture Overview`
110-
4. `Detailed Design`
111-
5. `Verification & Testing Strategy`
112-
6. `Implementation Plan`
108+
2. `Requirements & Goals` — must use **EARS (Easy Approach to Requirements Syntax)** notation with 5 sentence patterns (Ubiquitous, State-driven, Event-driven, Unwanted, Exception)
109+
3. `Architecture Overview` — must use **C4 Model** rendered in **Mermaid.js** syntax (Context, Container, Component diagrams)
110+
4. `Architecture Decisions` — must use **MADR (Markdown Any Decision Records)** format with `[Context]`, `[Decision]`, `[Consequences]`
111+
5. `Data Models` — must use **DBML** or **Prisma Schema** DSL (natural language table descriptions forbidden)
112+
6. `Interface Contracts` — must use **API-First** type signatures (OpenAPI YAML for external APIs, language-native type syntax for internal modules)
113+
7. `Detailed Design`
114+
8. `Verification & Testing Strategy`
115+
9. `Implementation Plan`
113116

114117
### 6.3 Conditional Sections for Full Mode
115118

@@ -131,7 +134,7 @@ A lightweight `design.md` must still include:
131134

132135
1. `Summary`
133136
2. `Approach`
134-
3. `Architecture Decisions`
137+
3. `Architecture Decisions` — must use **MADR** format even in lightweight mode
135138
4. `BDD/TDD Strategy`
136139
5. `Code Simplification Constraints`
137140
6. `BDD Scenario Inventory`
@@ -140,6 +143,8 @@ A lightweight `design.md` must still include:
140143

141144
Lightweight mode may omit the full-mode `Detailed Design` and `Implementation Plan` sections as standalone top-level sections if the same information is captured compactly in the required lightweight sections.
142145

146+
Lightweight mode may also omit C4 diagrams, DBML/Prisma schemas, and full API contracts when the change is too small to warrant them — but Architecture Decisions must still use MADR format.
147+
143148
### 6.5 Lightweight-to-Full Mapping
144149

145150
For validation purposes, lightweight mode satisfies the full contract through the following mapping:
@@ -166,6 +171,14 @@ For validation purposes:
166171
- a section may satisfy a conditional requirement by explicitly stating why it is `N/A`
167172
- repo-specific standards must be grounded in actual repo docs or code, not generic boilerplate
168173

174+
**Format-specific validation rules:**
175+
176+
- **EARS Requirements:** Each requirement must use one of the 5 EARS patterns (Ubiquitous, State-driven, Event-driven, Unwanted, Exception). Requirements written as vague goals ("the system should be fast") are invalid.
177+
- **C4/Mermaid Architecture:** Architecture sections must contain at least one ````mermaid` code block. Natural language architecture descriptions alone do not satisfy the Architecture Overview requirement.
178+
- **MADR Decisions:** Each Architecture Decision must have `Context`, `Decision`, and `Consequences` subsections. Decisions without consequences are incomplete.
179+
- **DBML/Prisma Data Models:** Data model sections must use DBML or Prisma Schema syntax inside a fenced code block. Natural language table descriptions ("users table has an id and name") are invalid.
180+
- **API-First Contracts:** Interface sections must use type signatures (OpenAPI YAML, TypeScript interfaces, Python Protocols, Rust traits). Narrative API descriptions without type definitions are invalid.
181+
169182
## 7. `tasks.md` Contract
170183

171184
### 7.1 Task File Structure

0 commit comments

Comments
 (0)