counterexample-to-test-generator

Convert model checker counterexample traces into executable Go or Python test cases.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill bridges the gap between finding a bug in a formal model and verifying that same bug exists in the actual code, ensuring your software behaves as intended.

Core Features & Use Cases

  • Trace to Test Conversion: Transforms a model checker's counterexample trace into an executable test case.
  • Bug Reproducibility: Guarantees that a bug identified in a model can be reliably reproduced in the source code.
  • Regression Guarding: Once the bug is fixed, the generated test acts as a safeguard against its reintroduction.
  • Use Case: After TLC (or a similar tool) reports a violation of a safety property, use this Skill to automatically generate a test that fails when that specific violation occurs in your Go or Python code.

Quick Start

Use the counterexample-to-test-generator skill to convert the TLC trace into a reproducible Go test case.

Frequently Asked Questions about counterexample-to-test-generator

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

FAQPage Schema
How do I convert a model checker counterexample trace into an executable test case?

To convert a counterexample trace into an executable test case, this Skill maps model actions to code operations and asserts invariants, transforming the trace into a reproducible test in the source language.

How can I reproduce a bug found in a formal model within my actual codebase?

Reproducing a formal model bug in your codebase requires mapping the counterexample trace to source language operations. This Skill generates deterministic test cases that fail when the specific violation occurs in your code.

Does this counterexample to test conversion work with Go and Python code?

Yes, counterexample to test conversion works with Go and Python code. It generates executable test cases, such as Go tests, from TLC traces to verify that safety property violations identified in the formal model exist in the source code.

Can I use generated test cases for regression testing after fixing a model checker violation?

Yes, you can use generated test cases for regression testing. Once the model checker violation is fixed in the source code, the generated test acts as a safeguard to prevent the bug from being reintroduced.

What is the best way to bridge the gap between formal verification and source code testing?

The best way to bridge formal verification and source code testing is by automatically generating executable tests from counterexample traces. This ensures bugs identified in formal models are deterministically reproduced and verified in the actual codebase.

Why should I generate tests from TLC traces instead of writing them manually?

Generating tests from TLC traces ensures deterministic bug reproduction by directly mapping model actions to code operations. This avoids manual translation errors and provides immediate regression protection for safety property violations.