openjml

Write and verify JML specifications for 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
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: openjml
Source: https://github.com/adzerk/spec-driven-workshop/tree/main/skills/openjml
Command: npx skills add https://github.com/adzerk/spec-driven-workshop --skill openjml

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writes and verifies JML specifications for Java programs using OpenJML, enabling formal contracts for methods and ensuring verifiable proofs.

Core Features & Use Cases

  • Write preconditions, postconditions, invariants, and loop specifications for Java methods.
  • Run OpenJML ESC and RAC verification to diagnose and fix specification failures.
  • Review and refine JML syntax, and debug verification results with templates and examples.

Quick Start

Create a simple Java class with JML annotations and run openjml --esc to verify.

Frequently Asked Questions about openjml

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 for Java methods are written using standard clauses to define preconditions, postconditions, invariants, and loop specifications. This provides formal contracts for methods, ensuring verifiable proofs of program correctness.

What is the difference between ESC and RAC verification in OpenJML?

ESC (Extended Static Checking) and RAC (Runtime Assertion Checking) are OpenJML verification modes. ESC statically proves specifications at compile time, while RAC checks JML assertions dynamically during program execution to diagnose specification failures.

How do I debug OpenJML verification failures?

Debugging OpenJML verification failures involves reviewing JML syntax, refining preconditions and postconditions, and analyzing ESC or RAC results. Templates and examples help identify specification mismatches and correct proof failures for Java programs.

Can I use OpenJML to verify loop specifications in Java?

Yes, OpenJML verifies loop specifications in Java programs. You can write JML annotations for loop invariants and use the --esc command to formally verify that loops satisfy their specified behavioral contracts.

Do I need OpenJML installed to write JML specifications?

Writing JML specifications requires understanding standard JML clauses for preconditions and invariants. To verify these specifications, you need the OpenJML tool to run ESC or RAC workflows and generate verifiable proofs for your Java code.

What is the best way to add formal contracts to Java programs?

Adding formal contracts to Java programs is best done using JML annotations. By writing preconditions, postconditions, and invariants, you establish formal method specifications that can be automatically verified using OpenJML's static or runtime checking.