Spec compliance

From bronlabs/bron-crypto · View interactive version

Spec compliance is an AI agent skill from the GitHub repository bronlabs/bron-crypto. Determine whether a package faithfully implements its cited reference — academic paper, normative spec (RFC / wiki / design doc), or upstream reference implementation code. Use when the user asks to check paper/spec/reference-implementation compliance, reduction alignment, byte-exact parity with an

How to use this skill

Skill file

You are checking whether a package implements its cited reference(s) correctly. References can be academic papers, normative specs (RFC / wiki / design doc), or upstream reference implementations. Be skeptical, cite file:line plus the right anchor in each reference (paper §/figure for papers, MUST/SHALL clauses for specs, file/function for code), and don't fix — report. The point is alignment with the cited description, not stylistic review.

Steps

  1. Identify the target. A package directory under pkg/. Ask if unclear. If the user names a file, treat the file's package as the target.
  1. Reference discovery. Packages often cite more than one reference — e.g. one paper for the main protocol, one for a sub-protocol, one for the notation, one for a transformation (Fiat–Shamir, derandomisation), or a non-academic spec / reference implementation for an encoding or wire format. Treat each citation as an independent reference and resolve all of them.
  1. In-repo spec discovery. This is additional to the directive-pointed references collected in step 2 — it captures normative content that lives inside the repo without a <!-- ... --> pointer.
  1. Compliance walk. Walk the package code with the resolved reference(s) open. When more than one reference is in play, keep track of which one each code region is supposed to follow (use the role mapping from step 2 plus any in-code citations like // Fig. 4 of KOS15 or // matches DecodeBase58). Findings must attribute the discrepancy to a specific reference — [deviation vs. KOS15 §4.2] or [deviation vs. bitcoin/base58.cpp:DecodeBase58] is more useful than [deviation vs. paper].

The checklist below is reference-kind-aware. Apply each row only when the corresponding reference kind is in scope; skip rows that don't apply to the package under review.

For paper references — focus on the formal model:

For spec references — focus on normative wire / behavioural claims:

For code references — focus on byte-exact behaviour parity:

  1. Categorise findings. For each item, decide:
  1. Output as GitHub-flavoured markdown. Use headers, bold severity tags, and code spans for paths so the terminal renders cleanly. Don't wrap the whole report in a fenced code block. Template:

```

## Spec compliance — <pkg>

References:

In-repo spec: <README §, RFC number, SPEC.md, or "none">

Acknowledged drift (from README): <one-liner each, scoped to the reference it applies to, or "none">

### Reference ↔ Reference consistency

_(Drop bullets that don't apply. If only one reference and no separate in-repo spec, write "single reference; no cross-check needed".)_

### Findings

_(If none: "No findings.")_

### Summary

Counts: N deviation, N missing, N addition, N question.

Per-reference coverage: KOS15 (paper): N findings; RFC9180 (spec): N; bitcoin/base58.cpp (code): N.

Highest-risk: path:line (vs. <short-name> §X) — <property at stake: soundness / ZK / interop / round-trip>.

```

Severity tags must be one of [deviation vs. <ref>], [missing vs. <ref>], [addition vs. <ref|all references>], [question vs. <ref>] and always bolded. The <ref> is the reference short-name (optionally suffixed with a section / function / line — e.g. KOS15 §4.2, RFC9180 §4.1 (MUST), bitcoin/base58.cpp:DecodeBase58), or spec for the in-repo spec, or all references when the addition contradicts every cited source. Order findings as: deviations first, then missing, then additions, then questions; within each bucket order by reference short-name (alphabetical), then file path, then line.

Don'ts

Caveats

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.