constraint-driven-development
Establishes a project's quality bar as a written contract and stops agents quietly lowering it. Interviews the user on which dimensions matter, supplies sane default thresholds when they have no number in mind, records everything in CONSTRAINTS.md, and watches the diff for a weakened bar — new @ts-ignore or eslint-disable suppressions, skipped or deleted tests, assertions stripped out, unimplemented stubs, thresholds edited down. Use when no quality bar is written down, when the user says "set up constraints" or "define our standards", when the user wants dimensions they care about — accessibility, web performance, coverage — set up as enforced constraints, when an agent keeps silencing checks or skipping tests to get to green, when you need a coverage or performance threshold and don't know what number to pick, or when an agent writes more code than anyone will read.
1实现原理 · 为什么它能做到
将项目的质量门槛固化为持久化的 CONSTRAINTS.md 契约文件,防止 Agent 跨会话丢失质量标准
This skill produces something different: a written record of **this project's** bar, with numbers, that outlives the conversation and can be checked mechanically.
遵循问询前先自动嗅探技术栈的原则(Detect before you ask),减少无效冗长交互
Never ask what you can read. Before the first question, gather: | What | Where to look | |------|---------------| | Language and stack | `package.json`, `pyproject.toml`, `go.mod`, `Cargo.toml` | | Test runner | dev dependencies, `test` script, existing test files | | Existing linters | `eslint.config.*`, `biome.json`, `.ruff.toml` |
采用仅限 4 个问题且自带开箱即用默认值的访谈机制,解决用户对指标无概念的困境
Follow the one-question-at-a-time discipline from `interview-me`, with one change: every question here has a default, so "I don't know" is a complete answer that still produces a working config.
确立不可妥协的底线底护(Floor),死守静音注释、空桩代码与跳过测试等走捷径行为
## Floor (always enforced, no setup required) - No new suppression comments: `@ts-ignore`, `eslint-disable`, `# noqa`, `# type: ignore` - No unimplemented stubs: `throw new Error("Not implemented")`, empty `catch {}` - No skipped or deleted tests without a reason in the commit message - No secrets in source - This file does not get weakened to make a change pass
为每个维度绑定具体执行命令与执行阶段,拒绝无验证命令的空洞口号
Every row names the command that produces the verdict. A dimension with a number and no command in this column is an aspiration, not a constraint.
提供配套的质量门禁脚本 quality-gate.mjs,严格拦截 Semgrep/Axe 的高危与严重漏洞
if (tool === 'semgrep') { if (!Array.isArray(report?.results) || !Array.isArray(report.errors) || report.errors.length || !Array.isArray(report.paths?.scanned) || !report.paths.scanned.length) { throw new Error('Incomplete scan'); } levels = report.results.map(finding => finding?.extra?.severity); allowed = ['INFO', 'WARNING', 'ERROR', 'LOW', 'MEDIUM', 'HIGH', 'CRITICAL']; blocking = ['ERROR', 'HIGH', 'CRITICAL'];
提供差异级底线防护守卫脚本 floor-guard,基于 git diff 监控是否偷偷削弱质量标准
// floor-guard.mjs — diff-scoped enforcement of the CONSTRAINTS.md floor. // Usage: node floor-guard.mjs [--base <ref>] (default base: origin/main) import { execFileSync } from 'node:child_process';
2核心能力
4管控建议与判定依据
5第二遍独立确认
- [ok] quality-gate.mjs 本地脚本执行安全核验 — 阅读 46 行 quality-gate.mjs 脚本,仅包含本地 JSON 报告解析与 exit code 返回逻辑,无外部网络请求
- [ok] floor-guard.md 参考脚本行为核验 — 脚本通过 execFileSync 执行本地 git diff,分析差异文本中的压制关键字,属于纯本地只读分析
- [ok] CONSTRAINTS.md 契约格式核实 — SKILL.md 第 125-166 行完整展示了标准契约模板,含 Floor、Enforced with numbers、Measured 及 Exceptions
- [ok] 4 步访谈法机制核实 — SKILL.md 第 85-120 行明确限定为 4 个带有开箱即用默认猜测的问题,控制访谈复杂度
- [ok] 档位判定 blue 确认 — Skill 自身目录携带 scripts/quality-gate.mjs 可执行脚本并建议配置到本地工程执行,准确落入 blue 档位
6结论
Preview this skill in an interactive chat playground. Generic LLM evaluation trial.
💬 Open Chat Trial (Preview)