jml-conformance-check
Skill1 starsChanged 7 months agoMITView on GitHub
Verify that the implementation conforms to its JML specifications (invariants, requires, ensures). Direction: JML -> Code. Use this skill after implementation or after modifying a class that has JML annotations. Also trigger when the user says "check conformance", "verify contracts", or "does the code match the specs".
In this repository12 other files it gives its agents.
- api-consistency-checkSkill
- architecture-drift-checkSkill
- design-reviewSkill
- jml-completeness-checkSkill
- jml-designSkill
- jml-test-generationSkill
- new-classSkill
- refactor-classSkill
- static-analysisSkill
- test-coverage-reviewSkill
- update-backlogSkill
- update-readmeSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Verify that the code conforms to the JML specifications.
- Distinctive: line 27
After step 7 (implementation) when JML specs were written at step 2
- Distinctive: line 28
After modifying a method that has JML contracts
- Distinctive: line 29
After fixing a bug — to verify the fix didn't break a contract
- Distinctive: line 30
When OpenJML is unavailable or reports an internal error
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
JML Conformance Check
Purpose
Verify that the code conforms to the JML specifications. This is the JML -> Code direction: given the contracts, does the implementation respect them?
This skill complements OpenJML's --esc verification. OpenJML performs
formal static verification but may not be available or may crash on some
inputs. This skill performs a structured manual review.
When to run
- After step 7 (implementation) when JML specs were written at step 2
- After modifying a method that has JML contracts
- After fixing a bug — to verify the fix didn't break a contract
- When OpenJML is unavailable or reports an internal error
Inputs
Before starting, read:
- The class source file (implementation + JML annotations)
- The corresponding interface (if any) — check for inherited contracts
- The relevant section of
INVARIANTS.md
Checklist
1. Class invariants
For each @invariant annotation in the class:
- Established by constructors — every constructor leaves the object in a state that satisfies all invariants
- Preserved by mutation methods — every method that modifies state restores all invariants before returning
- Temporarily broken invariants — if an invariant is broken mid-method, verify it is restored before any return path (including exceptional exits)
- Not bypassed by internal helpers — private methods called by public methods must not leave invariants broken if the caller does not restore them
2. Pre-conditions (@requires)
For each @requires clause:
- Validated or assumed — the method either checks the pre-condition and throws an appropriate exception, or documents that the caller is responsible
- Consistent with documentation — the
@requiresclause matches the@throwsdocumentation - Not silently ignored — the method does not proceed normally when the pre-condition is violated
3. Post-conditions (@ensures)
For each @ensures clause:
- Satisfied on all return paths — including early returns and edge cases (empty collection, single element, null parameter where allowed)
- Satisfied for boundary values — size 0, size 1, maximum capacity, first/last element
- Return value correct — if the contract specifies
\result, verify the actual return value matches - Size changes correct — if the contract specifies
size() == \old(size()) + 1, verify thatsizeis incremented exactly once, on all paths - Side effects match — if the contract says an element is now present, verify that it is actually inserted
4. Purity annotations
- Methods annotated
/*@ pure @*/have no side effects (no field writes, no calls to non-pure methods) - Methods annotated
/*@ strictly_pure @*/additionally perform no allocation and call onlystrictly_puremethods - Overriding methods inherit the purity constraint of the parent
5. also keyword
- Every JML spec on a method that overrides a parent method starts
with
//@ also
6. Cross-check with INVARIANTS.md
- Every invariant listed in
INVARIANTS.mdhas a corresponding@invariantannotation in the code - No invariant in the code contradicts
INVARIANTS.md
Output format
Report findings grouped by severity:
- Violations — the code does not satisfy a JML contract
- Risks — the code probably satisfies the contract but the reasoning is fragile (e.g. depends on insertion order, hash distribution, or undocumented behaviour)
- OK — contracts verified, no issues found
For each violation, specify:
- The JML annotation (quote it)
- The method or constructor where it fails
- The execution path or input that triggers the violation
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

