constraint-driven-developmentcommit ba3d99eSKILL.md · 代码规范
约束驱动开发
把项目质量标准写成 CONSTRAINTS.md 契约,并在 diff 中发现被悄悄降低的标准。
访谈需要用户在场,CI 或无人值守运行时只应用基础规则;gitleaks 必须加 --redact。
npx skills add addyosmani/agent-skills --skill constraint-driven-development已选中命令,请手动复制。
- 权限
- read-repo
- write-files
- shell
- network
- 兼容工具
- Claude Code, Codex, Cursor, Copilot, Gemini CLI
- GitHub
- 112.3k
- 来源
- 社区 · Addy Osmani
- 状态
- 扫描通过
- 许可证
- MIT
- 分类
- 代码规范
核心规则
不得为了让改动通过而削弱 CONSTRAINTS.md 中的标准。
执行阶段
阶段 01先探测再提问
先读取项目已有的测试、lint 和 CI 配置,能读到的就不问。
阶段 02四个带默认值的问题
逐一询问要约束的维度、失败时阻断还是警告、目标数值等,每题都给出默认值。
阶段 03写入并安装工具
写入 CONSTRAINTS.md,在 AGENTS.md 和 CLAUDE.md 中加一行提示,并为每个维度接入相应的检查工具。
阶段 04守住标准本身
在 diff 中检查阈值被调低、测试被跳过或删除、新增 @ts-ignore/eslint-disable 和未完成的桩代码。
权限说明(据 SKILL.md 整理)
| 能力 | 是否需要 | 说明 |
|---|---|---|
| 文件写入 | 需要 | 写入 CONSTRAINTS.md、检查脚本和工具配置,并在 AGENTS.md、CLAUDE.md 中各加一行。 |
| 命令执行 | 部分需要 | 安装并运行所选维度的检查工具(如 gitleaks、osv-scanner、Semgrep、Lighthouse、axe),昂贵的检查限定在 diff 范围。 |
| 网络外发 | 部分需要 | 用于安装检查工具和读取漏洞数据库等外部数据源。 |
SKILL.md 头部信息(YAML)
---
name: constraint-driven-development
description: 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.
---相关技能
规则扫描无法覆盖所有风险,安装前请阅读此技能的 SKILL.md,确认权限后再使用。