constraint-driven-development
Skill này làm gì
Công cụ này tạo một “hợp đồng” chất lượng cho dự án lập trình của bạn. Nó định nghĩa các quy tắc rõ ràng về điều gì được chấp nhận, như độ phủ kiểm thử hoặc không có lỗi, và đảm bảo các quy tắc này được tự động tuân thủ, tránh việc chất lượng code bị hạ thấp mà không ai hay biết.
Khi nào nên dùng
- ✓Khi bạn bắt đầu một dự án mới hoặc một tính năng quan trọng.
- ✓Khi bạn muốn đảm bảo AI giữ đúng tiêu chuẩn chất lượng đã định.
- ✓Khi lượng code AI tạo ra quá lớn để rà soát thủ công.
Liên kết skill
https://github.com/addyosmani/agent-skills/blob/main/skills/constraint-driven-development/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Thiết lập tiêu chuẩn chất lượng cho dự án này, bao gồm độ phủ kiểm thử và quy tắc bảo mật.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Công cụ trước tiên kiểm tra những gì đã có trong dự án (như công cụ kiểm thử và lint). Sau đó, nó hỏi vài câu đơn giản để xác định các quy tắc chất lượng, như kiểm tra nào quan trọng và việc vi phạm nên chặn công việc hay chỉ cảnh báo. Cuối cùng, nó lưu các quy tắc này trong file CONSTRAINTS.md và theo dõi code để đảm bảo không vi phạm.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Constraint-Driven Development
Overview
Other skills in this pack describe what good looks like. code-review-and-quality gives you five axes. test-driven-development gives you a cycle. security-and-hardening gives you a threat list. All of that lives in prose the agent reads and may or may not follow, and none of it survives the end of the session.
This skill produces something different: a written record of this project's bar, with numbers, that outlives the conversation and can be checked mechanically.
The reason matters. When you wrote the code, reading it told you whether it was any good. An agent writes more in an afternoon than you will read that week, so the judgement moves out of your head and into checks that run around the loop. Those checks need to exist, they need numbers you actually chose, and they need to fire close enough to the work that the agent fixes its own output.
Spec-driven development says what to build. Test-driven development proves it works. Constraint-driven development defines what "good enough to ship" means, before anyone argues about it in a pull request.
When to Use
Apply this skill when:
- Starting a project or a significant feature and no quality bar is written down
- The user asks to "set up constraints", "add quality gates", "define our standards", or "stop the agent shipping junk"
- An agent is producing volume nobody is reading line by line
- CI has checks but nobody can say which ones block a merge and which ones are decoration
- Coverage, performance, or accessibility numbers get argued about per-PR instead of decided once
- You're about to run
/build autoor any autonomous loop, and the only thing standing between it and main is a test suite the agent also wrote
When NOT to use:
- The project already has a
CONSTRAINTS.mdand the user isn't changing it — read it and follow it instead - One-off scripts, spikes, throwaway prototypes
- The user wants a code review right now (
code-review-and-quality) or a CI pipeline built (ci-cd-and-automation) - Pre-product-market-fit code with a two-week expected lifetime — the floor below is still worth it, the rest isn't
Loading Constraints
The interview needs a live user. Don't run it in non-interactive contexts (CI, /loop, autonomous runs). If constraints are missing and you're in one of those, apply the Floor below, note that you did, and flag the rest for a human.
The Process
Step 1: 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 |
| Coverage today | coverage/ output, or run the suite once |
| CI | .github/workflows/, .gitlab-ci.yml |
| Agent harness | .claude/, .codex/, AGENTS.md |
Report what you found in two lines, then ask only what's left.
Step 2: Four questions, each with a default
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.
Q1: Beyond the floor, which of these do you want enforced?
(a) Test coverage on new code
(b) Security scanning
(c) Performance budgets
(d) Accessibility
(e) Architecture boundaries
GUESS: (a) and (b) — you have a test runner already and you're handling user input.
DEFAULT if unsure: (a) and (b).
Say what each pick costs: (c) and (d) need a running URL, (e) needs a rules file written.
Q2: When a check fails while the agent is mid-task, should it block or warn?
GUESS: Block. You're running agents unattended and a warning nobody reads is a warning.
DEFAULT if unsure: Block on the floor, warn on everything else for the first two weeks.
Q3: Do you have target numbers in mind, or should I measure where you are today and hold that line?
GUESS: Measure. Most teams don't have a number, and an invented one gets ignored.
DEFAULT if unsure: Measure and hold. See "Ratchets" below.
Q4: What's the slowest check you'll tolerate before the agent hands work back?
GUESS: About 90 seconds. Longer and you'll stop running it.
DEFAULT if unsure: 90 seconds at task end, unlimited in CI.
…
Câu hỏi thường gặp
“Floor” (sàn) là gì?
“Floor” là các quy tắc chất lượng tối thiểu luôn được áp dụng, ngay cả khi bạn không định nghĩa quy tắc khác. Ví dụ là không cho phép chú thích bỏ qua lỗi hoặc để code chưa hoàn thiện.
Vì sao dùng số thay vì quy tắc chung chung?
Các con số (như “80% độ phủ kiểm thử”) làm quy tắc khách quan và dễ kiểm tra tự động. Điều này tránh tranh cãi và đảm bảo mọi người biết chính xác điều gì được mong đợi.
Điều gì xảy ra nếu một quy tắc bị vi phạm?
Tùy cách cấu hình, công cụ có thể cảnh báo về vi phạm hoặc chặn công việc cho đến khi vấn đề được sửa. Điều này đảm bảo chất lượng đã định được duy trì.
Chi tiết
Mô tả gốc của tác giả
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, unimplement
repo: addyosmani/agent-skills
Độ phổ biến
- Sao GitHub
- 107k
- Vị trí xếp hạng
- #766
- Giấy phép
- MIT
- Cập nhật
- 13/10/2026
Bình luận
- …
Thêm skill từ kho mã này
api-and-interface-design
107kGiúp tạo các API và giao diện được định nghĩa rõ ràng. Hữu ích khi thiết kế cách các phần của phần mềm giao tiếp với nhau.
browser-testing-with-devtools
107kGiúp agent kiểm thử code trực tiếp trên trình duyệt thật. Hữu ích để kiểm tra cách hoạt động trong môi trường thực tế, tìm lỗi và vấn đề hiệu suất.
ci-cd-and-automation
107kDạy agent AI của bạn tự động hóa các việc lặp lại, đưa dự án đi triển khai và quản lý hạ tầng.
code-review-and-quality
107kThực hiện rà soát code chi tiết trên nhiều khía cạnh. Hữu ích trước khi gộp thay đổi mới để đảm bảo chất lượng và ngăn vấn đề sau này.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.