model-guided-code-repair

Localize faults in software models from counterexample traces and propose code fixes.

1|2|Updated Mar 10, 2026
One-click install
npx skills add https://github.com/santosomar/general-secure-coding-agent-skills --skill model-guided-code-repair-santosomar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model-guided-code-repair
Source: https://github.com/santosomar/general-secure-coding-agent-skills/tree/main/skills/verification/model-guided-code-repair
Command: npx skills add https://github.com/santosomar/general-secure-coding-agent-skills --skill model-guided-code-repair-santosomar

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill transforms a model checker's counterexample trace into actionable code changes, directly addressing the root cause of a violation rather than just understanding it.

Core Features & Use Cases

  • Trace Analysis: Identifies the specific step in a model checker's trace that led to a property violation.
  • Fault Localization: Pinpoints the "culprit" action or state transition responsible for the violation.
  • Automated Fix Proposal: Suggests strengthening guards or adding missing actions to prevent the violation.
  • Code Propagation: Maps model-level fixes back to the corresponding source code regions.
  • Use Case: After a TLA+ model checker finds a violation, use this Skill to automatically determine which part of your concurrent system's code needs modification to prevent that specific failure scenario.

Quick Start

Use the model-guided-code-repair skill to analyze the provided counterexample trace and suggest a code fix.

Frequently Asked Questions about model-guided-code-repair

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

FAQPage Schema
How do I fix source code using a model checker counterexample trace?

To fix code using a counterexample trace, you analyze the trace to localize the fault, propose strengthening guards or adding actions, and map those model-level fixes back to the corresponding source code regions.

What is fault localization in software model checking?

Fault localization in software model checking identifies the specific state transition or culprit action in a model that caused a property violation, allowing you to target the root cause directly.

How do I propagate TLA+ model fixes back to my concurrent system source code?

Propagating TLA+ model fixes to source code requires mapping between model actions and code regions; once a missing action or guard is proposed, the fix is applied directly to the mapped source code.

Can I use model-guided-code-repair with NuSMV or Spin model checkers?

Yes, model-guided-code-repair works with counterexample traces from model checkers like NuSMV, Spin, and TLC to identify critical violation steps and suggest code modifications.

Do I need a mapping between model actions and code regions to automate code repair?

Yes, you need a mapping between model actions and code regions; this mapping is required for effectively propagating the suggested guard strengthenings and missing actions back to the source code.

What is the best way to turn model violations into code fixes?

The best way to turn model violations into code fixes is to automate trace analysis to pinpoint the culprit action, propose strengthening guards, and propagate those changes back to the source code.