Chuyển đến nội dung
Skillpedia
Kiểm thử8.0k · #12706

spec-to-code-compliance

Skill này làm gì

Skill này kiểm tra code có thật sự làm đúng như đặc tả hoặc whitepaper của nó không. Dành cho kiểm toán viên và kỹ sư cần chứng minh một triển khai khớp với tài liệu đã công bố hoặc của khách hàng.

Khi nào nên dùng

  • ✓Khi khách hàng hoặc kiểm toán viên muốn có bằng chứng rằng code khớp với đặc tả bằng văn bản.
  • ✓Khi bạn có tài liệu giao thức và một triển khai và muốn tìm chỗ chúng mâu thuẫn.
  • ✓Khi bạn cần danh sách hành vi không được tài liệu trong code mà ghi chú thiết kế không đề cập.

Liên kết skill

https://github.com/trailofbits/skills/blob/main/plugins/spec-to-code-compliance/skills/spec-to-code-compliance/SKILL.md

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/trailofbits/skills/blob/main/plugins/spec-to-code-compliance/skills/spec-to-code-compliance/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi muốn so sánh đặc tả giao thức này với code của tôi và tìm các yêu cầu mà code không tuân theo.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent đọc tài liệu và code song song, liệt kê từng yêu cầu, rồi kiểm tra code đáp ứng, vi phạm hay im lặng. Mỗi khoảng trống được đánh dấu là lỗi code hoặc lỗi tài liệu.

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.

Spec-to-Code Compliance

Two artifacts disagree, and the job is to find where. The documentation says what the system does; the code decides what it actually does. Every gap between them is either a bug or a documentation fix, and which one it is is the finding.

When to Use

You have both documentation describing intended behavior and the code that should implement it. A whitepaper against a protocol, a design note against a service, a README's stated guarantees against the functions behind them.

Most useful when the document is authoritative — something a client wrote, published, or is audited against — because then a divergence is a defect rather than stale prose.

When NOT to Use

Not for code with no documentation of intended behavior. There is nothing to check against, and a requirement inferred from the code is checked against itself. Build the system model first with audit-context-building.

Not for finding bugs in general. This finds one class: where the code and the document disagree. A bug both artifacts are silent about is out of scope, and a bug the document endorses is a finding against the document.

Not for writing or improving documentation, though it produces the list of what needs fixing.

Do not check requirements in this context

Run /spec-to-code-compliance:spec-compliance <path>. The slash command takes a path; to name the specification directly or widen the fan-out, ask for the run with those values — "run spec-compliance on ./contracts against SPEC.md, checking 20 requirements" — and they reach the script as {path, spec, limit}. Typing the object literally after the slash command does not work; it arrives as a string and becomes the path.

It finds the documents, splits them into individually checkable requirements, gives each requirement its own agent to hunt the code with, has independent agents try to refute every divergence before it is reported, and writes spec-compliance/REPORT.md plus one file per requirement under spec-compliance/requirements/. Only compact records come back here.

For a single requirement, dispatch the spec-to-code-compliance:spec-compliance-checker agent at it.

This is not a preference about where output lands. The check does not fit in one context window if it is done honestly: judging one requirement means reading the enforcement, its callees, and its callers, and doing that for thirty requirements means holding thirty call chains at once. Attempted inline, the first few get a real check and the rest get a plausible one — and the transcript looks the same either way, because a verdict resting on a promising function name reads exactly like one resting on having read the function. Per requirement, in its own context, is what makes that difference visible.

Two properties come from the script rather than from instructions, and cannot be had here:

  • A refutation the finding's author did not perform. Claude favors findings it produced when asked to check them. The workflow sends each divergence to agents that did not produce it — one reading the code again, one re-reading the document — and drops what either knocks down.
  • Records that cannot be prose. A subagent bound to a return schema has to name the lines it read and the searches it ran. An absent verdict arrives with the patterns tried and their results attached, which is the only thing separating a real absence from a search that stopped early.

Measured on the routes-not-inline eval: with this plugin installed the work is dispatched every run, without it never — Δ +1.00. Deleting this section while leaving the workflow in place changes nothing, because the workflow is a real command that gets found and dispatched on its own. Read that as the mechanism carrying the behavior rather than this text: the section is here so a human knows what runs and why, not because the routing depends on it.

What comes back, and how to read it

Every requirement gets one of six verdicts: implemented, partial, contradicted, stronger-than-spec, absent, or undecidable. The interesting ones are the middle four.

  • partial is usually the most serious thing in the report. The requirement holds on the paths anyone would test and fails on one nobody did, which is how it survived long enough to be found.
  • absent rests entirely on its searched record. Read it. Enforcement often lives somewhere the search did not go — a modifier, a base class, a caller that chec
Câu hỏi thường gặp

Nó có cần tài liệu không?

Có. Skill dành cho code có mô tả bằng văn bản về hành vi dự kiến. Code không có tài liệu thì không có gì để đối chiếu.

Nó có tìm được mọi lỗi không?

Không. Nó chỉ tìm các trường hợp code và tài liệu không khớp nhau.

Tôi bắt đầu thế nào?

Chỉ cho skill file đặc tả bạn muốn đối chiếu với code.

Chi tiết

Mô tả gốc của tác giả

Check code against the documentation that specifies it - which requirements hold, which the code contradicts, which are absent, and what the code does that no document mentions. Use when comparing an implementation against a whitepaper, protocol spec, or design document.

repo: trailofbits/skills

Độ phổ biến

Sao GitHub
8.0k
Vị trí xếp hạng
#12706
Giấy phép
CC-BY-SA-4.0
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự