Skip to content
Back to skills

Record Hypothesis Before Fix

ASecurity

Required before any production-code edit during the red phase. Forces externalization of "why I think this fix will work" with cited test_error_id and stack_frame_id evidence.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 7, 2026
testing

Security analysis

A100/100

Scanned November 7, 2026

npx -y skills add spencerbeggs/vitest-agent --skill record-hypothesis-before-fix --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Record Hypothesis Before Fix?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Record Hypothesis Before Fix
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/spencerbeggs-record-hypothesis-before-fix/badge)](https://www.skillsdirectory.com/skills/spencerbeggs-record-hypothesis-before-fix)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: record-hypothesis-before-fix
description: Required before any production-code edit during the red phase. Forces externalization of "why I think this fix will work" with cited test_error_id and stack_frame_id evidence.
---

# Record a hypothesis before a fix

Before editing production code in response to a failing test, call:

```text
hypothesis (action: record)({
  content: "<your hypothesis>",
  tddTaskId: <the id returned by tdd_task (action: start)>,
  citedTestErrorId: <test_errors.id from test_errors>,
  citedStackFrameId: <stack_frames.id from the same error>
})
```

## Rules

1. Pass `tddTaskId` (the id returned by `tdd_task (action: start)`) — it binds the hypothesis deterministically to your task's session. Do **not** pass a `sessionId`: the field is a dev/test fallback the server ignores when host context is available, and passing the tddTaskId value under the `sessionId` key misattributes the hypothesis to an unrelated session. Without a `tddTaskId` the server still resolves the binding session from the recovered host context, so omitting both ids is acceptable; a wrong `sessionId` is not.
2. Both `citedTestErrorId` and `citedStackFrameId` are required. A hypothesis without specific evidence is a vibe.
3. The hypothesis should describe a causal claim. "The validation function returns null because the type guard runs before the input is normalized" is a hypothesis. "Fix the validation" is not.
4. After the fix, validate the hypothesis: `hypothesis (action: validate)({ id, outcome: "confirmed" | "refuted" | "abandoned" })`.

## Why externalize?

The act of writing the hypothesis forces you to commit to a specific causal claim before you change code. If you can't write the hypothesis, you don't know enough to fix the bug yet — and your fix is statistically more likely to be a guess.

## Reusable outside TDD

Flaky-triage and fix-failing-test workflows use this. The compliance hooks (Stop, SessionEnd) prompt for hypotheses if recent file_edits aren't cited.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.