constraint-driven-development: the supplied floor guard passes on untracked suppressions, deleted test files and loosened maximum budgets
skills/constraint-driven-development/references/floor-guard.md (main at bcab6a1) supplies a guard and tells agents to adapt it rather than write their own. Its comments promise to include untracked files, catch deleted test files and weakened thresholds, and stay quiet when constraints tighten. I ran the fenced implementation unchanged, with Node, against fourteen small fixtures, each a fresh temporary git repository with one source file, one test file and a CONSTRAINTS.md (a floor bullet, a coverage minimum, a bundle maximum). Seven behave as promised, seven do not:
| Change | Expected exit | Actual exit |
|---|---|---|
| Unchanged repository | 0 | 0 |
| Suppression added in tracked file | 1 | 1 |
| Suppression in new untracked file | 1 | 0 |
| Skipped test in new untracked file | 1 | 0 |
| Same suppression in staged new file | 1 | 1 |
| Existing test file deleted, unstaged | 1 | 0 |
| Existing test file deleted, staged | 1 | 0 |
| Assertion removed from surviving test file | 1 | 1 |
| Minimum coverage lowered 80% to 60% | 1 | 1 |
| Minimum coverage raised 80% to 90% | 0 | 0 |
| Maximum bundle size raised 200 KB to 300 KB | 1 | 0 |
| Maximum bundle size reduced 200 KB to 150 KB | 0 | 1 |
| Floor rule deleted | 1 | 0 |
| Tracked exception row added | 1 | 1 |
Four causes, all in the plumbing the reference says to keep unchanged when adapting the language patterns:
- Untracked files are discarded.
git diff --no-index /dev/null <file>exits 1 whenever there are differences, which is the normal case. The sharedgit()wrapper treats every nonzero exit as failure and returns null, so the caller substitutes an empty diff. Every added-line rule is blind to new files, whatever the patterns say. - Deleted files lose their identity. The parser takes the filename only from the
+++line. For a deletion that line is+++ /dev/null, and the slice yieldsev/null, which never matches a test filename. There is no explicit deletion rule either, and staging does not change it. - Numeric direction is hardcoded. A decreasing number is treated as weaker. That is right for a minimum (coverage) and inverted for a maximum (size, latency, error budget): raising a maximum passes, tightening one fails.
- Removed floor bullets are never checked. A comment promises it; the loop only reports a numeric decrease paired with an added constraints line.
To see whether this reaches generated projects, I ran the skill's constraints setup three times in fresh Claude Code sessions (2.1.278, claude-opus-5) on a small Node project and probed each generated guard in a fresh git repository. All three blocked a deleted regression test and a new untracked suppression: when adapting, the model repaired the plumbing without being asked. One public verbatim copy of the reference (domengabrovsek/claude, skills/constraints/scripts/floor-guard.mjs) keeps the original logic and misses both. So the defect lives in the shipped reference and in copies of it, not necessarily in every adapted guard.
The repository's own deterministic gate passes at this commit (140 checks, 88/88 routing prompts), which is expected: it checks the Markdown, not what the program does when run. I searched issues and PRs for floor-guard, untracked and threshold and read the comments on #472, which introduced the reference; #584, #585 and #588 are about references being unavailable or their links, not this. If it was reported somewhere I did not look, apologies.
Save the reference file beside the script as floor-guard.source.md, then python3 reproduce.py. It extracts the fenced block, builds each fixture, runs the guard with --base HEAD, records every subprocess call to results.json, and prints the table above.
import pathlib,re,subprocess,tempfile,json
HERE=pathlib.Path(__file__).resolve().parent
text=(HERE/'floor-guard.source.md').read_text()
code=re.search(r'```js\n(.*?)\n```',text,re.S).group(1)+'\n'
(HERE/'floor-guard.extracted.mjs').write_text(code)
cases=[
('unchanged',0,lambda p:None),
('tracked-suppression',1,lambda p:(p/'app.js').write_text('// @ts-ignore\nmodule.exports=1;\n')),
('untracked-suppression',1,lambda p:(p/'new.js').write_text('// @ts-ignore\nmodule.exports=1;\n')),
('untracked-skipped-test',1,lambda p:(p/'new.test.js').write_text("test.skip('regression',()=>{});\n")),
('staged-new-suppression',1,lambda p:(p/'new.js').write_text('// @ts-ignore\nmodule.exports=1;\n')),
('deleted-test-file',1,lambda p:(p/'app.test.js').unlink()),
('staged-deleted-test-file',1,lambda p:(p/'app.test.js').unlink()),
('removed-assertion',1,lambda p:(p/'app.test.js').write_text("const assert=require('assert');\n")),
('coverage-relaxed',1,lambda p:(p/'CONSTRAINTS.md').write_text((p/'CONSTRAINTS.md').read_text().replace('| Coverage | >= 80% |','| Coverage | >= 60% |'))),
('coverage-tightened',0,lambda p:(p/'CONSTRAINTS.md').write_text((p/'CONSTRAINTS.md').read_text().replace('| Coverage | >= 80% |','| Coverage | >= 90% |'))),
('bundle-limit-relaxed',1,lambda p:(p/'CONSTRAINTS.md').write_text((p/'CONSTRAINTS.md').read_text().replace('| Bundle | <= 200 KB |','| Bundle | <= 300 KB |'))),
('bundle-limit-tightened',0,lambda p:(p/'CONSTRAINTS.md').write_text((p/'CONSTRAINTS.md').read_text().replace('| Bundle | <= 200 KB |','| Bundle | <= 150 KB |'))),
('floor-rule-deleted',1,lambda p:(p/'CONSTRAINTS.md').write_text((p/'CONSTRAINTS.md').read_text().replace('- No skipped tests.\n',''))),
('tracked-new-exception',1,lambda p:(p/'CONSTRAINTS.md').write_text((p/'CONSTRAINTS.md').read_text()+'| W1 | temporary waiver | owner | 2026-10-01 |\n')),
]
results=[]
for name,expected,mutate in cases:
with tempfile.TemporaryDirectory(prefix='floor-') as temp:
p=pathlib.Path(temp);commands=[]
def run(argv):
r=subprocess.run(argv,cwd=p,text=True,capture_output=True)
commands.append(dict(argv=argv,exit=r.returncode,stdout=r.stdout,stderr=r.stderr))
return r
for argv in [['git','init','-q'],['git','config','user.name','Local Test'],['git','config','user.email','[email protected]']]:assert run(argv).returncode==0
(p/'app.js').write_text('module.exports=1;\n')
(p/'app.test.js').write_text("const assert=require('assert');\nassert.equal(require('./app'),1);\n")
(p/'CONSTRAINTS.md').write_text('# Constraints\n\n## Floor\n- No skipped tests.\n\n| Dimension | Rule |\n|---|---|\n| Coverage | >= 80% |\n| Bundle | <= 200 KB |\n\n## Exceptions\n')
assert run(['git','add','.']).returncode==0;assert run(['git','commit','-qm','baseline']).returncode==0
mutate(p)
if name.startswith('staged-'):assert run(['git','add','-A']).returncode==0
actual=run(['node',str(HERE/'floor-guard.extracted.mjs'),'--base','HEAD'])
results.append(dict(name=name,expected_exit=expected,actual_exit=actual.returncode,matches=actual.returncode==expected,commands=commands))
(HERE/'results.json').write_text(json.dumps(results,indent=2))
for r in results:print(f"{r['name']}: expected {r['expected_exit']}, actual {r['actual_exit']}, {'MATCH' if r['matches'] else 'MISMATCH'}")
print('Summary:',sum(r['matches'] for r in results),'match;',sum(not r['matches'] for r in results),'mismatch')The fix is contained: keep stdout when --no-index exits 1, take old and new file identities from both diff headers and treat +++ /dev/null as a deletion, model whether a threshold is a minimum or a maximum, check removed floor bullets as the comment says, and exit 2 when the guard cannot reach a verdict rather than 0. A PR with that fix and these fourteen cases as its test file follows this issue. If you would rather reduce the reference to a description than ship executable guidance, say so and I will close it.
Source: addyosmani/agent-skills