counterfactual-engineering

counterfactual-engineering is a skill for Codex from edwardyap90/counterfactual-engineering-skill. It costs 56 tokens per session (1,286 once invoked), scanned A, original, MIT.

A method for comparing multiple plausible ways to make a software change by testing each one in an isolated copy of the project.

In plain words
What is it for?
Use it for risky bug fixes, migrations, performance work, authentication or security changes, redesigns, and architecture decisions.
Why use it?
It replaces choosing an approach by guesswork with evidence from comparable verification, which is useful when regressions or trade-offs are likely.

Skill for Codex

Written for Codex: agents/openai.yaml present. Also seen: mentions AGENTS.md; mentions Codex.

Good fit Use it for risky bug fixes, migrations, performance work, authentication or security changes, redesigns, and architecture decisions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/edwardyap90/counterfactual-engineering-skill/counterfactual-engineering
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add edwardyap90/counterfactual-engineering-skill --skill counterfactual-engineering
Clone the repo
git clone --depth 1 https://github.com/edwardyap90/counterfactual-engineering-skill

Made for: Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for counterfactual-engineering

README.md
[![agentmods](https://agentmods.dev/badge/skills/edwardyap90/counterfactual-engineering-skill/counterfactual-engineering/github.svg)](https://agentmods.dev/skills/edwardyap90/counterfactual-engineering-skill/counterfactual-engineering)
Your own site
<a href="https://agentmods.dev/skills/edwardyap90/counterfactual-engineering-skill/counterfactual-engineering"><img src="https://agentmods.dev/badge/skills/edwardyap90/counterfactual-engineering-skill/counterfactual-engineering/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for counterfactual-engineering

Your own site · 80×15
<a href="https://agentmods.dev/skills/edwardyap90/counterfactual-engineering-skill/counterfactual-engineering"><img src="https://agentmods.dev/badge/skills/edwardyap90/counterfactual-engineering-skill/counterfactual-engineering.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,286 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00056 $0.01286
Opus 5 $0.00028 $0.00643
Sonnet 5 $0.00011 $0.00257
Haiku 4.5 $0.00006 $0.00129

Measured 11d ago against content hash 2daf2591c70f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

counterfactual-engineering scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

The scan reads SKILL.md. This mod also ships 4 executable files (scripts/cleanup_experiments.sh, scripts/compare_candidates.py, scripts/create_experiments.sh, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

counterfactual-engineering/SKILL.md · 103 lines

How it starts

The opening of the file, as written. The whole thing — 103 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Counterfactual Engineering

Purpose

Use this skill to turn "pick a solution and hope" into "test competing solutions and choose with evidence." It is most useful for risky bug fixes, architecture changes, migrations, performance work, auth/security changes, frontend redesigns, and any task where two or more credible approaches exist.

Do not use the full workflow for tiny deterministic edits where there is only one reasonable change. In that case, keep the normal direct implementation path.

Workflow

  1. Read the project first. Inspect AGENTS.md, README, key config, test scripts, current git status, and the files that own the behavior. If the worktree has unrelated user changes, preserve them and avoid broad staging.
  2. State the candidates before editing. Propose 2-3 candidate strategies with short labels such as minimal-fix, root-cause-fix, and compatibility-layer. Include the validation commands that every candidate must run.
  3. Create isolated experiment spaces. Prefer scripts/create_experiments.sh in a clean git repository. If the repo is dirty or not a git repo, create manual copies or patches and clearly state the limitation.
  4. Implement one strategy per candidate. Keep each candidate focused on its declared hypothesis. Do not mix fixes across candidates until comparison is complete.
  5. Run comparable verification. Use the same test, typecheck, lint, build, screenshot, benchmark, or domain-specific checks for every candidate. Use scripts/run_verification.sh when shell-command evidence is enough.
  6. Compare with evidence. Use scripts/compare_candidates.py or a manual report. Treat passing correctness checks as mandatory before weighing diff size or style.
  7. Apply only the winner. Bring the winning candidate back into the real worktree with an explicit patch, cherry-pick, or targeted manual edit. Do not silently merge experimental branches.
  8. Clean up or record artifacts. Remove temporary worktrees with scripts/cleanup_experiments.sh unless the user wants evidence kept. Summarize the winning rationale, rejected candidates, checks run, and remaining risk.

Read the full file on GitHub · 103 lines

Files

What ships with it

7 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 103 lines · 56 tokens per session scan A 2daf2591c70f

Subscribe to this mod's changes

counterfactual-engineering is a skill published in the GitHub repository edwardyap90/counterfactual-engineering-skill (21 stars, last pushed 3mo ago), licensed MIT. It adds 56 tokens to every session and 1,286 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

prove-checks

Prove a passing check was capable of failing before recording it as evidence. Use when a test, CI job, build-and-diff, smoke test or rehearsal comes back green and that green is about to be treated as proof - especially when the check depends on a setup mutation (a sed/awk rewrite, an env var, a secret, a fixture…

sergeyklay/.agents · 221 tokens

evidence-first-debugging

Use when debugging a crash, lỗi, failing game, tool, build, service, script, or reproducible local code failure requires repro or reproduction, giả thuyết or ranked hypotheses, instrumentation, root-cause isolation, a minimal fix, regression proof, and a regression test.

hoatv2211/GameStudio-CodexKIT · 63 tokens

systematic-debugging

4-phase root cause debugging: understand bugs before fixing.

NousResearch/hermes-agent · 16 tokens

langsmith-observability

LLM observability platform for tracing, evaluation, and monitoring. Use when debugging LLM applications, evaluating model outputs against datasets, monitoring production systems, or building systematic testing pipelines for AI applications.

davila7/claude-code-templates · 45 tokens

experimental-code-coverage-local-debugger

Runs code coverage locally via Universal Test Runner (UTR) or helper scripts, mimicking LUCI trybots. Activate when CQ tryjobs fail or underreport coverage, to test local GN/recipe repairs before uploading, or to debug hermetic crashes.

chromium/chromium · 59 tokens

adversarial-reviewer

Adversarial code review that assumes bugs exist and hunts for them. Use when asked to review code, find bugs, audit for correctness, stress-test a PR, or when someone says "tear this apart" or "what's wrong with this". Give no benefit of the doubt — every line is guilty until proven innocent.

emdash-cms/emdash · 71 tokens