agentleFS
TrarothTraroth/claude-dev-framework/skills/jml-completeness-check/SKILL.md

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".

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
  1. Distinctive:

    Verify that the JML specifications are complete and up to date with respect to the code.

    line 15
  2. Distinctive:

    After step 8 (white-box tests) — the implementation is stable

    line 23
  3. Distinctive:

    After refactoring a class that has JML annotations

    line 24
  4. Distinctive:

    After adding a public method to a class with existing JML contracts

    line 25
  5. Distinctive:

    When retrofitting JML annotations on an existing class

    line 26

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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:

  1. The class source file (implementation + JML annotations)
  2. The corresponding interface (if any)
  3. The relevant section of INVARIANTS.md
  4. 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 != null invariant

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 @requires or @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.md has a corresponding @invariant annotation in the code
  • Every @invariant in the code is documented in INVARIANTS.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:

  1. Missing invariants — invariants that should exist but don't
  2. Missing method contracts — public methods without JML annotations
  3. Incomplete contracts — methods with partial specs (e.g. has @ensures but missing @requires, or specifies return value but not size change)
  4. Stale contracts — JML annotations that no longer match the code (e.g. method signature changed, behaviour modified)
  5. INVARIANTS.md drift — discrepancies between the code annotations and the documentation

For each finding, specify what is missing and suggest the annotation to add.

Download now (ZIP)

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.