openjml-more

Write JML specifications and verify Java programs with OpenJML.

15|2|Updated Mar 3, 2026
One-click install
npx skills add https://github.com/adzerk/spec-driven-workshop --skill openjml-more
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: openjml-more
Source: https://github.com/adzerk/spec-driven-workshop/tree/main/skills/openjml-more
Command: npx skills add https://github.com/adzerk/spec-driven-workshop --skill openjml-more

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Write precise JML specifications for Java programs and verify them using OpenJML.

Core Features & Use Cases

  • Provides guidance on writing preconditions, postconditions, invariants, and loop specifications for Java methods.
  • Explains performing Extended Static Checking (ESC) and Runtime Assertion Checking (RAC) with OpenJML, interpreting results, and debugging failures.
  • Covers modeling with model/ghost fields, visibility rules, and modular verification practices to keep specs aligned with implementation.

Quick Start

Write a simple JML contract for a Java method and verify it with OpenJML ESC.

Frequently Asked Questions about openjml-more

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write JML specifications for Java methods?

JML specifications define preconditions, postconditions, and invariants for Java methods. You write them using JML syntax directly in your Java code to specify expected behavior and verify program correctness.

What is the difference between OpenJML ESC and RAC verification?

OpenJML ESC performs Extended Static Checking at compile time to prove specifications, while RAC inserts Runtime Assertion Checks that monitor assertions dynamically during execution. ESC finds errors statically; RAC catches them at runtime.

How do I debug OpenJML ESC verification failures?

Debug OpenJML ESC failures by analyzing the generated counterexamples and refining your JML specifications. Check preconditions, postconditions, and loop contracts to ensure they accurately model the implementation's behavior.

When should I use model fields versus ghost fields in JML?

Use JML model fields to abstractly represent concrete implementation state for specification purposes, and ghost fields for specification-only variables that do not correspond to program state. Both help keep specs aligned with implementation.

How do I write loop contracts for Java verification in JML?

Write JML loop contracts by specifying loop invariants, variants, and decreases clauses. These contracts allow OpenJML to verify loops modularly without unrolling them, ensuring termination and state preservation across iterations.

What are the JML visibility rules for modular verification?

JML visibility rules ensure specifications only refer to elements visible to the client. Following these rules during modular verification prevents information leakage and maintains soundness when checking individual program modules in isolation.