jml-completeness-check
Skill1 starsChanged 7 months agoMITView on GitHub
Verify that the JML specifications are complete and up to date with respect to the implementation. Direction: Code -> JML. Use this skill after implementation is stable or after refactoring. Also trigger when the user says "are the specs complete", "missing contracts", or "JML coverage".
In this repository12 other files it gives its agents.
- api-consistency-checkSkill
- architecture-drift-checkSkill
- design-reviewSkill
- jml-conformance-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 JML specifications are complete and up to date with respect to the code.
- Distinctive: line 23
After step 8 (white-box tests) — the implementation is stable
- Distinctive: line 24
After refactoring a class that has JML annotations
- Distinctive: line 25
After adding a public method to a class with existing JML contracts
- Distinctive: line 26
When retrofitting JML annotations on an existing class
≈ “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 Completeness Check
Purpose
Verify that the JML specifications are complete and up to date with respect to the code. This is the Code -> JML direction: given the implementation, are all behaviours formally specified?
When to run
- After step 8 (white-box tests) — the implementation is stable
- After refactoring a class that has JML annotations
- After adding a public method to a class with existing JML contracts
- When retrofitting JML annotations on an existing class
Inputs
Before starting, read:
- The class source file (implementation + JML annotations)
- The corresponding interface (if any)
- The relevant section of
INVARIANTS.md - The class documentation (the informal contract)
Checklist
1. Invariant completeness
- Size consistency — is there an invariant on
size() >= 0? - Null handling — is there an invariant expressing whether null elements/keys/values are allowed or forbidden?
- Ordering — if the structure maintains order, is the sort invariant expressed?
- Uniqueness — if duplicates are forbidden, is it expressed?
- Structural integrity — are internal structural invariants expressed (e.g. bijectivity, chain consistency, tree balance)?
- Configuration — are non-null constraints on configurable fields expressed (strategies, comparators)?
- Implicit invariants — are there invariants that hold in the
code but are not formalized? Look for:
- Assertions or defensive checks that guard conditions never documented in JML
- Comments like "this is always true at this point"
- Fields that are never null but lack a
!= nullinvariant
2. Constructor completeness
For each public constructor:
- Pre-conditions present — parameters with constraints have
@requires - Post-conditions present — state after construction is
specified (e.g.
size() == 0, configuration values set) - Copy constructors —
size()and element equality specified
3. Method completeness
For each public method:
- Has JML annotations — every public method that is not a
trivial getter should have at least one
@requiresor@ensures - Pre-conditions complete — all parameter constraints documented
in the API have a corresponding
@requires - Post-conditions complete — all behavioural guarantees
documented in the API have a corresponding
@ensures - Return value specified — methods with non-void return have
@ensures \result ... - Size effects specified — mutation methods specify the size
change (
size() == \old(size()) + 1, etc.) - Absence effects specified — removal methods specify that the element is no longer present
- Overriding methods — specs start with
//@ also
4. Purity annotations
- Query methods annotated — methods with no side effects are
annotated
/*@ pure @*/or/*@ strictly_pure @*/ - Inherited purity — if the parent declares a method as pure, the override is also annotated
5. Cross-check with INVARIANTS.md
- Every invariant in
INVARIANTS.mdhas a corresponding@invariantannotation in the code - Every
@invariantin the code is documented inINVARIANTS.md - No discrepancy in formulation between the two
6. Synchronized variants
- The synchronized variant has the same invariants as the unsynchronized variant
- No contract is missing from the synchronized variant that is present in the unsynchronized one
Output format
Report findings grouped by category:
- Missing invariants — invariants that should exist but don't
- Missing method contracts — public methods without JML annotations
- Incomplete contracts — methods with partial specs (e.g. has
@ensuresbut missing@requires, or specifies return value but not size change) - Stale contracts — JML annotations that no longer match the code (e.g. method signature changed, behaviour modified)
- INVARIANTS.md drift — discrepancies between the code annotations and the documentation
For each finding, specify what is missing and suggest the annotation to add.
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.

