Agent skill

Model Guided Code Repair

by ArabelaTso in ArabelaTso/Skills-4-SE

Automatically repair code violations of temporal properties using model-checking counterexamples as guidance.

Apache-2.0Auto-check passed

Install Model Guided Code Repair

skills CLI
$ npx skills add ArabelaTso/Skills-4-SE --skill model-guided-code-repair -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ArabelaTso/Skills-4-SE model-guided-code-repair --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/model-guided-code-repair .claude/skills/model-guided-code-repair && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
model-guided-code-repair
GitHub stars
253
Token cost
~1.7k tokens
SKILL.md length
716 words
Files
2 (incl. references)
Skills in repo
150
Repo updated
First seen
Licence
Apache-2.0

At a glance

Automatically repair code violations of temporal properties using model-checking counterexamples as guidance.

  • Works in 7 steps: Analyze Input → Understand the Counterexample → Identify Root Cause → …
  • Working with formal verification results
  • SKILL.md covers Overview, Repair Workflow, Output Format and Common Scenarios, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Model Guided Code Repair is an agent skill from ArabelaTso/Skills-4-SE. Automatically repair code violations of temporal properties using model-checking counterexamples as guidance. Use when working with formal verification results, temporal logic property violations (LTL, CTL), model checking counterexamples, or when asked to repair property violations, fix counterexamples, repair temporal properties, fix model checking violations, or repair code based on counterexamples. Applicable to concurrent systems, state machines, synchronization issues, safety/liveness properties, and…

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/temporal_logic_patterns.md`).

The repository describes itself as: A curated list of 180+ useful Claude Skills for Software Engineering and resources for customizing AI for SE workflows. The licence is Apache-2.0.

When your agent uses it

  • Working with formal verification results
  • Temporal logic property violations (LTL
  • Model checking counterexamples
  • Asked to repair property violations

Example prompts

  • “/model-guided-code-repair”

Workflow steps

7 steps, taken from the step headings in SKILL.md.

  1. Analyze Input
  2. Understand the Counterexample
  3. Identify Root Cause
  4. Propose Repair Strategy
  5. Generate Repaired Code
  6. Validate the Repair
  7. Document the Repair

What it can do on your machine

Read from SKILL.md and the folder at commit 4f38503. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Model Guided Code Repair loads about 1.7k tokens when it runs, and up to ~3.1k if it reads all its reference files. Until then it costs about 142 tokens; SKILL.md has 716 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~142
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ArabelaTso/Skills-4-SE at commit 4f38503, republished under its Apache-2.0 licence (© ArabelaTso). 716 words, ~1,689 tokens.

Download SKILL.mdSave it as .claude/skills/model-guided-code-repair/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
model-guided-code-repair
description
Automatically repair code violations of temporal properties using model-checking counterexamples as guidance. Use when working with formal verification results, temporal logic property violations (LTL, CTL), model checking counterexamples, or when asked to repair property violations, fix counterexamples, repair temporal properties, fix model checking violations, or repair code based on counterexamples. Applicable to concurrent systems, state machines, synchronization issues, safety/liveness properties, and resource management violations.

Model-Guided Code Repair

Overview

This skill enables automatic repair of code that violates temporal properties by analyzing model-checking counterexamples. It reasons about the root cause of violations at the model level, proposes minimal and semantically justified code modifications, and validates repairs through re-verification or test generation.

Repair Workflow

Follow this sequential process when repairing temporal property violations:

1. Analyze Input

Gather and understand three required inputs:

  • Program source code: The code containing the violation
  • Violated temporal property: The formal specification (LTL, CTL, or natural language description)
  • Counterexample trace: The execution path demonstrating the violation

Read all inputs carefully. If the temporal property is in natural language, formalize it first.

2. Understand the Counterexample

Trace through the counterexample step-by-step:

  • Identify the sequence of states and transitions
  • Map counterexample states to program locations (line numbers, function calls)
  • Identify variable values at each step
  • Pinpoint the exact moment the property is violated

Output: A clear narrative of the execution path leading to the violation.

3. Identify Root Cause

Analyze why the violation occurs:

  • Missing guards: Are conditions missing that should prevent certain transitions?
  • Incorrect ordering: Are operations executed in the wrong sequence?
  • Race conditions: Are there synchronization issues in concurrent code?
  • Missing state updates: Are variables not being updated correctly?
  • Incorrect logic: Are conditional expressions wrong?

Output: A precise diagnosis of the model-level cause.

4. Propose Repair Strategy

Design a minimal repair that:

  • Directly addresses the root cause
  • Preserves intended program behavior
  • Minimizes code changes
  • Maintains code readability

Common repair strategies:

  • Add guards: Insert conditional checks to prevent invalid transitions
  • Reorder operations: Adjust execution sequence to satisfy temporal ordering
  • Add synchronization: Insert locks, semaphores, or barriers for concurrent code
  • Update state management: Fix variable assignments or state transitions
  • Strengthen preconditions: Add assertions or input validation

Output: A clear repair plan with justification.

5. Generate Repaired Code

Implement the repair:

  • Make minimal, targeted changes to the source code
  • Clearly mark what was changed (comments or annotations)
  • Ensure the repair is syntactically correct
  • Preserve existing code style and conventions

Output: Modified source code with changes clearly indicated.

6. Validate the Repair

Verify that the repair resolves the violation:

Option A: Re-run Model Checker

  • Execute the model checker on the repaired code
  • Verify the temporal property now holds
  • Check that no new violations were introduced

Option B: Generate and Run Tests

  • Create test cases based on the counterexample
  • Generate additional tests for edge cases
  • Execute tests and verify they pass
  • Ensure existing tests still pass (regression testing)

Output: Validation results showing the property is satisfied.

Show full SKILL.md (297 more words)Show less
7. Document the Repair

Provide a comprehensive explanation:

  • Root cause: What caused the violation
  • Repair strategy: Why this approach was chosen
  • Minimality justification: Why this is the smallest necessary change
  • Behavior preservation: How intended functionality is maintained
  • Validation results: Evidence that the repair works

Output Format

Structure the final output as follows:

## Repaired Code

[Modified source code with changes clearly marked]

## Changes Made

- [Line X]: [Description of change]
- [Line Y]: [Description of change]

## Root Cause Analysis

[Explanation of what caused the violation]

## Repair Strategy

[Why this repair approach was chosen]
[Why it is minimal and semantically justified]

## Behavior Preservation

[How the repair maintains intended program behavior]

## Validation Results

[Model checking results OR test execution results]
[Confirmation that the property now holds]

Common Scenarios

Safety Property Violations

Example: "The system must never enter an error state"

  • Look for missing error checks or exception handling
  • Add guards to prevent invalid state transitions
  • Validate with assertions or model checking
Liveness Property Violations

Example: "Every request must eventually be processed"

  • Look for deadlocks, infinite loops, or missing progress conditions
  • Add fairness constraints or progress guarantees
  • Validate with liveness checking or timeout tests
Synchronization Issues

Example: "Shared resources must be accessed atomically"

  • Look for race conditions or missing locks
  • Add synchronization primitives (mutexes, semaphores)
  • Validate with concurrency testing or model checking
State Machine Violations

Example: "State transitions must follow the specified protocol"

  • Look for missing state checks or incorrect transition logic
  • Add state validation or fix transition conditions
  • Validate with state machine verification

Tips for Effective Repairs

  • Start simple: Try the minimal fix first before complex refactoring
  • Preserve structure: Maintain the original code architecture when possible
  • Consider side effects: Ensure repairs don't break other properties
  • Document assumptions: Note any assumptions made during repair
  • Test thoroughly: Validate beyond just the violated property
  • Iterate if needed: If the first repair doesn't work, analyze why and adjust

Integration with Model Checkers

This skill works with various model checking tools:

  • SPIN: For Promela models and LTL properties
  • NuSMV/nuXmv: For SMV models and CTL/LTL properties
  • CBMC: For C programs with assertions
  • Java PathFinder: For Java programs
  • TLA+: For TLA+ specifications

When counterexamples are provided in tool-specific formats, translate them into a clear execution trace before analysis.

© ArabelaTso, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in skills/model-guided-code-repair of ArabelaTso/Skills-4-SE.

  • SKILL.md
  • references/temporal_logic_patterns.md

Open the folder on GitHubat commit 4f38503

Compare with similar skills

Model Guided Code Repair next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Model Guided Code Repair compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Model Guided Code Repair this skillArabelaTso/Skills-4-SE253—~1.7kAutomated safety check: PassApache-2.0
Check PRpaperclipai/paperclip99k—~3.6kAutomated safety check: PassMIT
CSS At Propertythedaviddias/Front-End-Checklist74k—~602Automated safety check: PassMIT
Write Guidevercel/next.js143k—~1.6kAutomated safety check: PassMIT
Openclaw Repair Sweepopenclaw/openclaw392k—~1.8kAutomated safety check: PassMIT
Design Guidepaperclipai/paperclip99k1 repos~3.1kAutomated safety check: PassMIT

Similar skills

  • Check PR

    paperclipai/paperclip

    Check a GitHub, GitLab, or Perforce PR/MR/CL for review comments, failing checks, and PR-body gaps.

    99k GitHub stars~3.6k tokensUpdated today
    DevelopmentAuto-check passed
  • CSS At Property

    thedaviddias/Front-End-Checklist

    A skill your agent uses when implementing animated gradients, complex CSS transitions that involve custom property values, or building a typed design token system where custom property misuse should…

    74k GitHub stars~602 tokensUpdated yesterday
    Frontend & DesignAuto-check passed
  • Write Guide

    vercel/next.js

    Official

    Generates technical guides that teach real-world use cases through progressive examples.

    143k GitHub stars~1.6k tokensUpdated today
    DevelopmentAuto-check passed
  • Openclaw Repair Sweep

    openclaw/openclaw

    Run scoped OpenClaw issue/PR repair campaigns: coordinate workers, prove root causes, and land or close verified work under the requested authority.

    392k GitHub stars~1.8k tokensUpdated today
    DevelopmentAuto-check passed
  • Design Guide

    paperclipai/paperclip

    Paperclip UI design system guide for building consistent, reusable frontend components.

    99k GitHub starsUsed in 1 repo~3.1k tokens
    Frontend & DesignAuto-check passed
  • Check

    davepoon/buildwithclaude

    Run CIAgent regression checks after changing an AI agent's code, prompts, or knowledge base in a repo that has agentcispec.yaml, and interpret the results.

    3.6k GitHub stars~680 tokensUpdated yesterday
    Knowledge ManagementAuto-check passed

More from ArabelaTso/Skills-4-SE

All 150 skills in this repo
  • Framework Migration Assistant

    ArabelaTso/Skills-4-SE

    Automatically migrate Python web applications between frameworks (Flask → FastAPI, Django → FastAPI).

    253 GitHub stars~1.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Metamorphic Test Generator

    ArabelaTso/Skills-4-SE

    Generate test cases using metamorphic testing by applying transformations based on metamorphic properties.

    253 GitHub stars~798 tokensUpdated 1 mo ago
    Auto-check passed
  • Reproduction Trace Instrumenter

    ArabelaTso/Skills-4-SE

    Instruments programs to capture execution traces specifically for reproducing reported bugs, enabling consistent replay and diagnosis of failures.

    253 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Spring Mvc To Boot Migrator

    ArabelaTso/Skills-4-SE

    Automatically migrate Spring MVC applications to Spring Boot.

    253 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check passed
  • State Snapshot Instrumenter

    ArabelaTso/Skills-4-SE

    Instrument programs (Python, C/C++, Java) to capture snapshots of key program states at runtime, including variables, memory, and call stacks.

    253 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check passed

Questions about Model Guided Code Repair

What does Model Guided Code Repair do?

Automatically repair code violations of temporal properties using model-checking counterexamples as guidance. Model Guided Code Repair is an agent skill from ArabelaTso/Skills-4-SE. Automatically repair code violations of temporal properties using model-checking counterexamples as guidance.

When should I use Model Guided Code Repair?

Model Guided Code Repair fits situations like: working with formal verification results; temporal logic property violations (LTL; model checking counterexamples; asked to repair property violations.

How do I install Model Guided Code Repair in Claude Code?

Run `npx skills add ArabelaTso/Skills-4-SE --skill model-guided-code-repair -a claude-code`. Or copy the skill folder (skills/model-guided-code-repair in ArabelaTso/Skills-4-SE) into .claude/skills/model-guided-code-repair in your project. Claude Code loads it when a task matches its description.

How do I install Model Guided Code Repair in Codex?

Run `npx skills add ArabelaTso/Skills-4-SE --skill model-guided-code-repair -a codex`. Or copy the skill folder (skills/model-guided-code-repair in ArabelaTso/Skills-4-SE) into .agents/skills/model-guided-code-repair in your project. Codex loads it when a task matches its description.

Can I use Model Guided Code Repair in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ArabelaTso/Skills-4-SE --skill model-guided-code-repair -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/model-guided-code-repair, .gemini/skills/model-guided-code-repair, .github/skills/model-guided-code-repair and .opencode/skills/model-guided-code-repair in your project.

What does Model Guided Code Repair need to run?

SKILL.md names no scripts, command-line tools or credentials: Model Guided Code Repair is instructions for the agent only.

Does Model Guided Code Repair access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Model Guided Code Repair safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Model Guided Code Repair use?

Model Guided Code Repair is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Model Guided Code Repair use?

About 1.7k tokens (SKILL.md is roughly 6.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.5k tokens, read only when the agent opens those files.

What are the alternatives to Model Guided Code Repair?

Skills that share tags, products or a category with Model Guided Code Repair: Check PR (paperclipai/paperclip, 99k stars), CSS At Property (thedaviddias/Front-End-Checklist, 74k stars), Write Guide (vercel/next.js, 143k stars) and Openclaw Repair Sweep (openclaw/openclaw, 392k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Model Guided Code Repair?

ArabelaTso (a GitHub user) maintains it in ArabelaTso/Skills-4-SE, which has 253 GitHub stars. The repository holds 150 skills in this directory. The repository was last updated on August 21, 2026.

Source: ArabelaTso/Skills-4-SE on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.