Spec To Code Compliance logo

Spec To Code Compliance

OrganizationPopular
trailofbits
spec-to-code-compliance

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.

Overview

Publishertrailofbits
Repositoryskills
Skill namespec-to-code-compliance
Stars
7.1K
Forks
611
Bundled files
6
LicenseCC-BY-SA-4.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 6 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by trailofbits on GitHub. Read the source before you install it.

Installation

Install the Spec To Code Compliance AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/trailofbits/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/plugins/spec-to-code-compliance/skills/spec-to-code-compliance .claude/skills/spec-to-code-compliance
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Spec To Code Compliance in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Spec To Code Compliance on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Spec To Code Compliance is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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 checks first.
  • undecidable, and any documentProblem, are findings about the documentation. A requirement too vague to check is one the client cannot hold anyone to.
  • stronger-than-spec is an undocumented constraint. It works today, and nothing tells the next person changing that code that anything depended on it.

The report also carries the reverse direction — behavior the code has that no document mentions — which the per-requirement pass cannot find by construction, since it is driven by the documents.

Read notChecked, unverified, and unreadableDocuments before treating the report as complete. Requirements below the fan-out cut were never checked, and a divergence whose refutation agents both failed is unverified rather than confirmed.

Judgment the workflow does not make for you

Severity is consequence, not distance from the text: DIVERGENCE_RUBRIC.md. A rounding step that bleeds a pool outranks a MUST satisfied by different means than the document describes, and documentation drift with no behavioral consequence is a docs ticket.

The verdict is not the finding. absent on a mandatory requirement is a finding; absent on a sentence describing a roadmap item is not. Deciding which is which is what this skill is for, and the workflow hands you the evidence to decide it with.

The target does not have to be a contract

The question is the same everywhere — what does this requirement demand, where would it be enforced, is it enforced on every path — but what counts as a specification and where enforcement hides both change. DOMAIN_NOTES.md maps that across contracts, C and C++, services, and decompiled firmware, and covers the case where the specification is an RFC or a standard rather than a project document. Read it when the target is not a contract, and when scoping a check against a large standard.

Reference

  • ANALYSIS_FORMAT.md — the on-disk format for a per-requirement analysis. Read when extending this plugin or judging whether a record is trustworthy.
  • WORKED_EXAMPLE.md — three requirements chased to a verdict, one per verdict that is easy to get wrong: arithmetic that satisfies a requirement it does not resemble, an absence whose searches are the finding, and enforcement present on every path but the one nobody tested.
  • DOMAIN_NOTES.md — per-domain mapping of specifications and enforcement.
  • DIVERGENCE_RUBRIC.md — severity, and the two directions of a gap.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Spec To Code Compliance AI skill do?

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.

Why use Spec To Code Compliance on TypingMind?

Because you install it once and use it with any model. Spec To Code Compliance is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Spec To Code Compliance in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/trailofbits/skills/tree/main/plugins/spec-to-code-compliance/skills/spec-to-code-compliance. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Spec To Code Compliance?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Spec To Code Compliance?

As many as you like. As long as a model supports skills, you can use Spec To Code Compliance with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Spec To Code Compliance AI skill free?

Yes. It is published on GitHub by trailofbits under the CC-BY-SA-4.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇