Agent skill

Counterexample To Test Generator

by ArabelaTso in ArabelaTso/Skills-4-SE

Automatically generates executable test cases from model checking counterexample traces.

Apache-2.0Auto-check passedTesting & QA

Install Counterexample To Test Generator

skills CLI
$ npx skills add ArabelaTso/Skills-4-SE --skill counterexample-to-test-generator -a claude-code

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

GitHub CLI
$ gh skill install ArabelaTso/Skills-4-SE counterexample-to-test-generator --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/counterexample-to-test-generator .claude/skills/counterexample-to-test-generator && 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
counterexample-to-test-generator
GitHub stars
253
Token cost
~1.6k tokens
SKILL.md length
524 words
Files
8 (incl. references, assets)
Skills in repo
170
Repo updated
First seen
Licence
Apache-2.0

At a glance

Automatically generates executable test cases from model checking counterexample traces.

  • Works in 5 steps: Analyze Inputs → Map Abstract States to Concrete Values → Generate Test Structure → …
  • Working with model checker outputs (SPIN
  • SKILL.md covers Overview, Workflow, Example Workflow and Best Practices, plus 2 more sections
  • Runs C#, Java and Python scripts from its folder

What it does

Counterexample To Test Generator is an agent skill from ArabelaTso/Skills-4-SE. Automatically generates executable test cases from model checking counterexample traces. Translates abstract counterexample states and transitions into concrete test inputs, execution steps, and assertions that reproduce property violations. Use when working with model checker outputs (SPIN, CBMC, NuSMV, TLA+, Java PathFinder, etc.) and needing to create regression tests, validate bug fixes, or reproduce verification failures in executable test suites.

Its SKILL.md is about 1.6k tokens, which your agent loads only when the skill is triggered. The skill folder holds 10 other files, including reference files and assets (for example `assets/test_templates/README.md`, `assets/test_templates/python_pytest_template.py` and `references/model_checker_formats.md`).

It sits in Testing & QA, covering Test generation and Debugging. It works with Java. 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 model checker outputs (SPIN
  • Java PathFinder
  • Etc.) and needing to create regression tests
  • Validate bug fixes

Example prompts

  • “/counterexample-to-test-generator”

Requirements

  • Python 3

Workflow steps

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

  1. Analyze Inputs
  2. Map Abstract States to Concrete Values
  3. Generate Test Structure
  4. Implement Test Logic
  5. Generate Output

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

    Ships script files (C#, Java and Python), which the agent can run.

    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

Counterexample To Test Generator loads about 1.6k tokens when it runs, and up to ~3.2k if it reads all its reference files. Until then it costs about 122 tokens; SKILL.md has 524 words of instructions outside code blocks.

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

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). 524 words, ~1,573 tokens.

Download SKILL.mdSave it as .claude/skills/counterexample-to-test-generator/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
name
counterexample-to-test-generator
description
Automatically generates executable test cases from model checking counterexample traces. Translates abstract counterexample states and transitions into concrete test inputs, execution steps, and assertions that reproduce property violations. Use when working with model checker outputs (SPIN, CBMC, NuSMV, TLA+, Java PathFinder, etc.) and needing to create regression tests, validate bug fixes, or reproduce verification failures in executable test suites.

Counterexample To Test Generator

Overview

This skill transforms counterexample traces from model checkers into executable test cases that reliably reproduce property violations. It bridges formal verification and testing by mapping abstract states to concrete values and generating runnable tests with clear traceability from counterexample steps to test logic.

Workflow

Step 1: Analyze Inputs

Gather and understand the counterexample trace and program:

  1. Identify the model checker format: Determine which tool produced the counterexample (SPIN, CBMC, NuSMV, TLA+, JPF, etc.). See references/model_checker_formats.md for format details.

  2. Extract key information:

    • Initial state values
    • Sequence of transitions/steps
    • Variable values at each step
    • Property violation point
    • Error condition or assertion failure
  3. Understand the program structure:

    • Entry points and function signatures
    • Input parameters and their types
    • State variables involved in the trace
    • Control flow relevant to the counterexample
Step 2: Map Abstract States to Concrete Values

Translate the counterexample's abstract representation into concrete test inputs:

  1. Determine concrete values for abstract state variables:

    • Map symbolic values to concrete instances
    • Resolve non-deterministic choices to specific values
    • Handle ranges and constraints from the model
  2. Identify input sequences:

    • Extract the sequence of function calls or operations
    • Determine parameter values for each call
    • Identify timing or ordering constraints
  3. Handle environment assumptions:

    • External inputs or system calls
    • Concurrency or scheduling decisions
    • Resource states (files, network, memory)
Step 3: Generate Test Structure

Create the test case framework in the target language:

  1. Choose test framework based on the program language:

    • C/C++: Google Test, CUnit, Check
    • Java: JUnit, TestNG
    • Python: pytest, unittest
    • C#: NUnit, xUnit
  2. Structure the test:

    • Setup phase: Initialize state to match counterexample start
    • Execution phase: Replay the counterexample sequence
    • Assertion phase: Verify the property violation occurs
  3. Add traceability comments: Map each test step to counterexample steps for debugging and maintenance.

Step 4: Implement Test Logic

Write the executable test code:

  1. Setup code:

    // Initialize variables to counterexample initial state
    // Set up test fixtures or mocks
    // Configure environment (if needed)
  2. Execution sequence:

    // Step 1 (CE line X): [description]
    // Execute operation with concrete values
    
    // Step 2 (CE line Y): [description]
    // Execute next operation
  3. Assertions:

    // Verify property violation (CE line Z)
    // Assert expected failure condition
    // Check final state matches counterexample
Show full SKILL.md (210 more words)Show less
Step 5: Generate Output

Produce the complete test case with documentation:

  1. Test file: Complete, compilable/runnable test code
  2. Mapping document: Table linking counterexample steps to test lines
  3. Execution instructions: How to compile and run the test
  4. Expected behavior: What the test should demonstrate (failure reproduction)

Example Workflow

Input: SPIN counterexample showing a deadlock in a concurrent system

Output:

c
// test_deadlock.c - Reproduces deadlock from SPIN counterexample trail
#include <pthread.h>
#include <assert.h>

// Counterexample mapping:
// CE Step 1-2: Thread 1 acquires lock A
// CE Step 3-4: Thread 2 acquires lock B
// CE Step 5: Thread 1 waits for lock B (blocks)
// CE Step 6: Thread 2 waits for lock A (deadlock)

void* thread1_func(void* arg) {
    pthread_mutex_lock(&lock_a);  // CE Step 1
    sleep(1);                      // CE Step 2 (timing)
    pthread_mutex_lock(&lock_b);  // CE Step 5 (blocks)
    // ... rest of test
}

void test_deadlock_scenario() {
    // Setup: Initialize locks (CE initial state)
    pthread_mutex_init(&lock_a, NULL);
    pthread_mutex_init(&lock_b, NULL);

    // Execute: Create threads in counterexample order
    pthread_create(&t1, NULL, thread1_func, NULL);
    pthread_create(&t2, NULL, thread2_func, NULL);

    // This test will hang, demonstrating the deadlock
    pthread_join(t1, NULL);  // Will timeout
}

Best Practices

  1. Minimize test complexity: Generate the simplest test that reproduces the violation
  2. Preserve causality: Maintain the exact sequence from the counterexample
  3. Make violations obvious: Use clear assertions and error messages
  4. Add context: Include comments explaining the property being violated
  5. Handle non-determinism: Document any assumptions made when concretizing values
  6. Test the test: Verify the generated test actually fails as expected

Common Challenges

Challenge: Counterexample uses symbolic values without concrete bounds Solution: Use representative values from the domain, document the choice

Challenge: Trace involves complex timing or scheduling Solution: Use synchronization primitives or explicit delays to enforce ordering

Challenge: Program state is partially specified in counterexample Solution: Initialize unspecified variables to default/neutral values

Challenge: Counterexample is very long Solution: Identify the minimal prefix that still triggers the violation

References

© 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 7 other files (references, assets) in skills/counterexample-to-test-generator of ArabelaTso/Skills-4-SE.

  • SKILL.md
  • assets/test_templates/README.md
  • assets/test_templates/c_gtest_template.c
  • assets/test_templates/cpp_gtest_template.cpp
  • assets/test_templates/csharp_nunit_template.cs
  • assets/test_templates/java_junit_template.java
  • assets/test_templates/python_pytest_template.py
  • references/model_checker_formats.md

Open the folder on GitHubat commit 4f38503

Compare with similar skills

Counterexample To Test Generator 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.

Counterexample To Test Generator compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Counterexample To Test Generator this skillArabelaTso/Skills-4-SE253—~1.6kAutomated safety check: PassApache-2.0
Test Writeraxelixlabs/axelix148—~2.2kAutomated safety check: PassLGPL-3.0
Code SolvingHoangTheQuyen/think-better122—~3.7kAutomated safety check: PassMIT
Debug Surefireeclipse-rdf4j/rdf4j420—~2.4kAutomated safety check: PassBSD-3-Clause
QABuilderIO/agent-native7.1k—~3kAutomated safety check: NotesNone
Test BlindspotsNeeeophytee/finding-unknowns-skills343—~676Automated safety check: PassMIT

Similar skills

  • Test Writer

    axelixlabs/axelix

    Writes new tests for Axelix source code (Java, Kotlin, TypeScript, JavaScript) that follow the project's testing standards — public-API contract coverage, test isolation, given/when/then structure…

    148 GitHub stars~2.2k tokensUpdated yesterday
    MobileAuto-check passed
  • Code Solving

    HoangTheQuyen/think-better

    Structured coding workflow for non-trivial code work: debug, build features, refactor, optimize, migrate and review code through 7 steps with evidence-based quality gates.

    122 GitHub stars~3.7k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Debug Surefire

    eclipse-rdf4j/rdf4j

    Debug Maven Surefire unit tests by running them in JDWP "wait for debugger" mode (-Dmaven.surefire.debug) and attaching to the forked test JVM using jdb (preferred for CLI/agent debugging)…

    420 GitHub stars~2.4k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • QA

    BuilderIO/agent-native

    Autonomous multi-app QA sweep that drives template apps with Playwright MCP.

    7.1k GitHub stars~3k tokensUpdated yesterday
    Testing & QAAuto-check: notes
  • Test Blindspots

    Neeeophytee/finding-unknowns-skills

    Find consequential behavior that a passing test suite does not establish, using focused exploratory checks.

    343 GitHub stars~676 tokensUpdated 12 days ago
    Testing & QAAuto-check passed
  • Generating Test Reports

    foryourhealth111-pixel/Vibe-Skills

    Generate structured test reports with pass/fail rollups, coverage summaries, and test artifacts.

    3.6k GitHub stars~352 tokensUpdated 1 mo ago
    Testing & QAAuto-check passed

More from ArabelaTso/Skills-4-SE

All 170 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

Works with

Questions about Counterexample To Test Generator

What does Counterexample To Test Generator do?

Automatically generates executable test cases from model checking counterexample traces. Counterexample To Test Generator is an agent skill from ArabelaTso/Skills-4-SE. Automatically generates executable test cases from model checking counterexample traces.

When should I use Counterexample To Test Generator?

Counterexample To Test Generator fits situations like: working with model checker outputs (SPIN; java PathFinder; etc.) and needing to create regression tests; validate bug fixes.

How do I install Counterexample To Test Generator in Claude Code?

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

How do I install Counterexample To Test Generator in Codex?

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

Can I use Counterexample To Test Generator 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 counterexample-to-test-generator -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/counterexample-to-test-generator, .gemini/skills/counterexample-to-test-generator, .github/skills/counterexample-to-test-generator and .opencode/skills/counterexample-to-test-generator in your project.

What does Counterexample To Test Generator need to run?

Going by SKILL.md and its folder, Counterexample To Test Generator needs C#, Java and Python for the scripts in its folder. Our summary lists: Python 3.

Does Counterexample To Test Generator 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 Counterexample To Test Generator 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 Counterexample To Test Generator use?

Counterexample To Test Generator 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 Counterexample To Test Generator use?

About 1.6k tokens (SKILL.md is roughly 6.3k 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.6k tokens, read only when the agent opens those files.

What are the alternatives to Counterexample To Test Generator?

Skills that share tags, products or a category with Counterexample To Test Generator: Test Writer (axelixlabs/axelix, 148 stars), Code Solving (HoangTheQuyen/think-better, 122 stars), Debug Surefire (eclipse-rdf4j/rdf4j, 420 stars) and QA (BuilderIO/agent-native, 7.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Counterexample To Test Generator?

ArabelaTso (a GitHub user) maintains it in ArabelaTso/Skills-4-SE, which has 253 GitHub stars. The repository holds 170 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.