Repository navigation
feat(skills): add constraint-driven-development - #472
Conversation
Every skill here describes what good looks like as prose the agent reads and may or may not follow. None of them record what *this* project's bar is, with numbers, in a form that outlives the session. This one does that job and nothing else. It detects the stack before asking anything, runs at most four questions with a usable default on each so "I don't know" still produces a working config, and writes CONSTRAINTS.md. Two ideas carry most of the weight. Placement by cost, so types and lint sit in the edit loop while anything slow moves to review, because a check that stalls the agent gets switched off and a switched-off gate is worse than none. And ratchets, so a team at 62% coverage records 62% and holds it rather than inventing 85% and learning to ignore a red build. It also watches the bar itself. Agents do not craft loopholes, they take the cheapest road to green: lower a threshold, add .skip, reach for @ts-ignore, leave a stub that throws. All of that is visible in a diff.
Picking 'accessibility' returned a threshold and no mechanism, so the agent had to invent the setup and two agents would invent two different ones. That is the non-determinism the skill exists to remove. Adds a table mapping every dimension to the de facto tool, its install command, its run command, and what to gate on, across JS and Python. De facto matters here: these rule formats are what the ecosystem targets, so a team's existing config keeps working. Five failure modes called out. gitleaks needs --redact or the matched secret lands in the agent transcript. axe and Lighthouse need a running URL, and a project without one should drop the dimension rather than fake a check. Stryker and Semgrep scope to the diff or nobody runs them twice. Coverage reads the lcov the suite already wrote. CONSTRAINTS.md now carries the command next to each rule, so a dimension with a number and no command reads as the aspiration it is.
|
Updated the description to cover The first pass had a real gap: picking So the agent had to invent the mechanism, and two agents would invent two different ones. That is the non-determinism the skill exists to remove. Step 4 now maps every dimension to a de facto tool with install and run commands, Known limitation, written into the description: the tooling table is JS-heavy outside types, lint and coverage. |
|
cc @federicobartoli @nucliweb when time allows for any blocking feedback. I'm also very open to leaving this open a little longer for community input - either way! |
federicobartoli
left a comment
There was a problem hiding this comment.
I'll just say it upfront: this is one of the most interesting skills I've tried. Not because of the interview, but because of what it does after. I field-tested it end to end at 127bd99 on a real project, an MCP server I generated with orval from the Petstore spec (TypeScript + vitest, no CI, no linter), Claude Code on opus-5 at xhigh effort, ~35 minutes. Full transcript kept, happy to share.
What I found in the repo afterwards
CONSTRAINTS.md: floor, every number with the command that checks it and the reason next to it, ratchets seeded with today's measured values (an honest 13.6%, "must not fall"), exceptions with owner and expiry, and a little register of dimensions deliberately not adopted so nobody re-litigates them per PR. I liked that last one more than I expected to.scripts/check-floor.mjs: diff-scoped floor guard (new suppressions, skipped tests, stubs, thresholds edited down), exit 0/1/2vitest.config.ts: coverage scoped to hand-written and patched files. vitest's default only counts imported files and was telling me 98% over 68 statements while blind to 2,300 generated lines. The run noticed that on its own, before I did.check:fast/check:task/check:fullin package.json, measured at 0.9s / 1.6s / ~10s+network.constraintsignorefor controlled exemptions,CLAUDE.mdandAGENTS.mdpointing agents at the contract
I also checked it against the skill's own Verification list: 9/9, no Red Flag triggered. gitleaks ran with --redact everywhere it shows up. Perf and a11y were dropped with the skill's own reasoning (stdio server, no URL) and written down as declined rather than quietly skipped. And the 127bd99 fix holds in practice: every dimension I picked came with its tool installed and the exact command in the Checked-by column.
Two moments that genuinely surprised me. It proved its own gates fire before writing them down: planted a fake AWS key to watch gitleaks catch it, raised a threshold to watch it go red, and doing that it found and fixed two real bugs in its own floor guard (untracked files invisible to git diff, modified tests double-counted). And when a cheat.sh I'd staged for a demo (the four classic tricks: skip a test, ts-ignore, stub, lower a threshold) appeared mid-session, it stopped, said it hadn't created that file, inspected it, and exempted it through a tracked .constraintsignore instead of loosening a rule. I had set a trap for the guard and it handled the trap itself.
Three non-blocking questions, more curiosity than complaint
- The one place I still see the gap 127bd99 closed for dimensions is the floor itself. Dimensions now map to a de facto tool; the floor has none, so the agent wrote its own ~180-line check-floor during the run and debugged it live. Your own argument applies: two agents would invent two different ones, and a Python or Go repo would get a third. Would a reference check-floor shipped in the skill's
references/close that? - The security dimension lands gitleaks and osv-scanner machine-global via brew. Declared and consented, no surprise, but a CI-only option might help people who like their laptops clean.
- Setup was ~35 minutes and 40+ commands. Part of that is my xhigh setting, but a floor-only fast path for a first run might lower the entry cost.
Tiny nit: the exact commands now live twice (CONSTRAINTS.md table and package.json scripts). A note on which copy is canonical might help.
Approving. It does what it says, the run proved it, and I learned a couple of things about my own repo along the way.
Federico's review on #472 noted the floor is the one thing with no de facto tool, so agents reinvent a check-floor each run. Add references/floor-guard.md (the Step 6 checks as a diff-scoped reference implementation, exit 0/1/2, with patterns adaptable per ecosystem) and point Step 6 and the escalation path at it. Also mark CONSTRAINTS.md as the canonical source of commands over the package.json wrappers, and document a floor-only first run plus a CI-only option for machine-wide security tools.
|
This is the best review I've gotten on any of these, thank you for running it end to end and setting a trap for the guard. The two surprises you hit, it proving its own gates fire before writing them down, and handling the cheat.sh you staged by exempting it through a tracked You were right about the first question, and it was the real gap. The floor was the one thing with no de facto tool, so the agent wrote its own ~180 lines live, which is precisely the non-determinism the skill argues against. Pushed a fix (4be4bb7):
I kept the reference deliberately regex-shallow and said so in the file: it catches the cheap-road-to-green moves agents actually make, not a determined human, which is the right trade for something that runs on every diff. I'd love your read on whether it matches what you ended up writing during the run. Verified: validate-skills and the reference-links check pass, the reference implementation parses, skill is at 311 lines. It's on a branch that predates a few things on main (the ref-links validator, the 0.6.7 manifest bump), so it wants a rebase before it lands, but the content is ready. Thanks again, genuinely. |
What this adds
A new Define-phase skill,
constraint-driven-development, plus a/constraintscommand across all three command directories.It interviews you for a quality bar, installs the tooling behind whichever dimensions you pick, writes
CONSTRAINTS.md, places each check by cost, and watches the diff for the bar being lowered.Why this isn't covered by an existing skill
Every skill in the pack describes what good looks like as prose the agent reads and may or may not follow. None of them record what this project's bar is, with numbers, in a form that survives the end of the session.
code-review-and-qualitysays how to review. It doesn't decide what the review enforces.ci-cd-and-automationsays how to build the pipeline. It doesn't decide what the pipeline's thresholds are.test-driven-developmentgives you a cycle. It has nothing on coverage of changed lines, dependency risk, or bundle growth.security-and-hardeningandperformance-optimizationgive you the content of two dimensions; neither elicits which dimensions this team cares about or what number to pick.I checked the 46 open PRs. The closest are #415 (error budget release gate), which gates a deploy on SLO burn rather than defining a code quality bar, and #447 (context budget), which is about LLM context. Neither overlaps.
Grep confirms no existing skill mentions ratchets, diff coverage, or mutation scoring.
Quality is more than tests, and picking a dimension installs something
The interview covers coverage, security, performance, accessibility and architecture. Choosing one gets you a working check, not just a threshold in a table. Step 4 maps each dimension to the de facto tool with its install command, run command, and what to gate on:
pipx install semgrepsemgrep scan --config p/default --config p/owasp-top-tenbrew install gitleaksgitleaks detect --redact --no-bannerbrew install osv-scannerosv-scanner scan source -r .npm i -D @axe-core/cliaxe $URL --tags wcag2a,wcag2aa,wcag21aanpm i -D lighthouselighthouse $URL --output=jsonnpm i -D size-limitsize-limit --jsonnpm i -D dependency-cruiserdepcruise --validate srcnpm i -D @stryker-mutator/corestryker run --mutate <changed files>Types, lint and coverage rows cover both JS and Python. De facto choice is deliberate: these rule formats are what the rest of the ecosystem targets, so a team's existing config keeps working instead of being re-expressed.
Five failure modes are called out because each one is easy to get wrong:
--redacton gitleaks is not optional, or the matched secret lands in the agent's transcript and from there into a log or a commit message.opengrepis the drop-in.CONSTRAINTS.mdcarries a Checked by column holding the exact command, so a dimension with a number and no command reads as the aspiration it is. The commands also land incheck:fast/check:task/check:fullscripts so they're reproducible without an agent.The two ideas doing most of the work
Placement by cost. Types, lint and secrets in the edit loop. Related tests and changed-line coverage at task end. Everything heavy at review or CI. A check that stalls the agent gets switched off, and a switched-off gate is worse than no gate because the bar still looks like it exists.
Ratchets. Set 80% coverage on a codebase at 62% and you get a red build forever, then a team that learns to ignore red builds. Recording today's number and refusing to fall below it needs no agreement and can be adopted on any codebase in any state.
Guarding the bar
Agents don't craft clever loopholes. They hit a red check and take the cheapest road to green: lower a threshold, add
.skip, delete the assertion in the way, reach for@ts-ignore, leave a stub that throws. The skill lists those five moves as things to look for in the diff at review time, with special attention to four suppressions that switch off a check you're relying on (istanbul ignore,Stryker disable,nosemgrep,gitleaks:allow).The intake
At most four questions, each with a usable default so "I don't know" still produces a working config. It detects stack, test runner, linters, coverage and CI before asking anything, and states what each pick costs. A twelve-question intake produces a config nobody understands.
Sane defaults are tabulated with a stated reason for each number, so a threshold doesn't get deleted by the first person who hits it.
Validation
Two eval failures during development were fixed by changing the skill, not the eval:
ci-cd-and-automation. The description was competing on pipeline language, so I cut it back and moved the negative prompt to unambiguous deploy territory.A third eval now covers the tooling requirement directly: asking for accessibility as a constraint must produce axe with commands and a URL question, placed at the preview stage, not a bare threshold.
Known limitation
The tooling table is JS-heavy. Python gets mypy, ruff and pytest-cov, but the accessibility, performance and architecture rows are Node-only, and Go, Rust and Ruby have nothing. Real polyglot coverage is a follow-up, and probably belongs in
references/rather than as more rows in the skill.Also updated
using-agent-skillsrouter gains one node