counterfactual

Compare current and minimal algorithms to identify the smallest fix.

16|3|Updated May 5, 2026
One-click install
npx skills add https://github.com/Kevin-Liu-01/Agent-Machines --skill counterfactual
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: counterfactual
Source: https://github.com/Kevin-Liu-01/Agent-Machines/tree/main/knowledge/skills/counterfactual
Command: npx skills add https://github.com/Kevin-Liu-01/Agent-Machines --skill counterfactual

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Identify and articulate the gap between the current implementation and the minimal correct algorithm, enabling targeted debugging and minimal, verifiable fixes.

Core Features & Use Cases

  • Structured invariant declaration and explicit side-by-side descriptions of the minimal algorithm and the current algorithm.
  • A repeatable process to locate the first divergence, measure its impact, and propose the smallest intervention.
  • Useful in debugging complex regressions, code reviews, and design discussions where expected behavior differs from actual behavior.

Quick Start

Run a counterfactual analysis by comparing the current algorithm to the minimal algorithm and identifying the smallest fix.

Frequently Asked Questions about counterfactual

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

FAQPage Schema
How do I find the smallest code fix for a regression by comparing expected and actual behavior?

Perform a counterfactual analysis by declaring invariants and comparing the minimal correct algorithm side-by-side with the current implementation. This structured comparison locates the first divergence to propose the smallest possible fix.

What is the best way to structure a debugging analysis for complex software regressions?

Structure the debugging analysis using defined sections: Goal, Minimal algorithm, Current algorithm, Gap, Smallest fix, and Falsifier. This explicit layout quantifies deviations and ensures targeted, verifiable corrections for complex regressions.

How does comparing a minimal algorithm to a current implementation help with code review?

Comparing the minimal algorithm to the current implementation during code review identifies unnecessary complexity and quantifies deviations from expected behavior. It highlights exact gaps where the current code diverges from the minimal correct logic.

Can I use invariant declarations to debug expected versus actual behavior differences?

Yes, you can use structured invariant declarations to explicitly define and debug expected versus actual behavior differences. This side-by-side comparison measures the impact of deviations across software components to find the smallest intervention.

What do I need to define before analyzing deviations between current and minimal algorithms?

You need to define the goal, the minimal correct algorithm, and the current algorithm before analyzing deviations. Explicit considerations for ownership, wake mechanisms, and testability are also required to ensure the gap analysis is verifiable.