Skill1.3k estrellas del repoactualizado today
h-diagnose
h-diagnose implements a structured diagnostic workflow for root-cause analysis using parallel hypothesis testing to avoid anchoring bias. It guides users through stabilizing observations, framing diagnosis problems in the HAFT system, querying code context when needed, and generating multiple competing hypotheses with ranked verdicts. Use this skill when investigating intermittent failures, obscure bugs, or system anomalies where systematic elimination of alternatives is necessary rather than intuitive guessing.
Instalar en Claude Code
Copiargit clone --depth 1 https://github.com/m0n0x41d/haft /tmp/h-diagnose && cp -r /tmp/h-diagnose/internal/cli/skill/h-diagnose ~/.claude/skills/h-diagnoseDespués abre una sesión nueva de Claude Code; el skill carga automáticamente.
Definición
SKILL.md
# h-diagnose — Diagnosis with parallel hypothesis testing
You are running the FPF diagnosis workflow: B.4.1 stabilize → B.5.2 abductive four-step → ranked verdict with rivals visible. Parallel subagents test distinct hypotheses in isolated contexts to prevent anchoring bias.
## Step 1 — Stabilize the signal (B.4.1)
Read the symptom carefully. Do not jump to causes. Compress to one sentence:
- What was observed (not assumed)
- What pattern the failures share
- What stays out of scope for now
Bad: "the cache is broken"
Good: "cache invalidation tests in schema-migration suite fail intermittently since 2026-05-22"
If the signal contains umbrella terms ("slow", "broken", "weird") run inline precision restoration per FPF A.6.P/Q/A before proceeding.
## Step 2 — Frame as diagnosis problem
Call:
```
mcp__haft__haft_problem(
action="frame",
problem_type="diagnosis",
title="<short diagnosis title>",
signal="<stabilized observation>",
acceptance="<what would constitute root-cause identified + verified>",
constraints=["<read-only investigation only — no fixes>"]
)
```
Capture the returned `prob-...` ID for downstream subagent calls.
## Step 2.5 — Ground the failing symbol in the graph (when the signal names code)
If the signal names a concrete failing symbol or file, run this ONCE in THIS
orchestrator. The Step 4 hypothesis subagents are read-only investigators and
**cannot call `haft_query`** — only you can pull the graph and pass it down, so do
it here:
```
mcp__haft__haft_query(action="code_context", file="<file>", symbol="<failing symbol>")
```
Extract a compact **graph-context block** from the result:
- the **invariants that must hold here** (each `_(from dec-…)_`) — a *violated*
invariant is a concrete, named root-cause hypothesis, not a guess;
- the **trust-decay tags** on the governing decisions (`[refresh-due]`,
`· N/M predictions unverified`). A STALE governing decision is itself a prime
suspect: if the decision governing this code was never verified, its assumptions
may no longer hold. Agents systematically MISS this hypothesis class because they
reason about the code, not about the decay of the reasoning ABOUT the code.
If the signal does NOT name code (environmental, data, flaky infra), SKIP this step
— the graph adds nothing there; do not force it. Keep the block; you inject it into
every Step 4 subagent.
## Step 3 — Generate ≥3 hypotheses (B.5.2 abductive)
Produce 3-5 candidate root causes. They MUST differ in kind, not degree (FPF EXP-08). If you have three cache hypotheses, force at least one that ISN'T cache-related (data flow, race condition, environmental, etc.).
When Step 2.5 surfaced governed code, make at least one hypothesis structural: a
**violated invariant** or a **stale governing decision** whose assumptions may no
longer hold. This is the hypothesis class abduction-on-code-alone misses.
For each hypothesis state:
- One sentence claim
- Why plausible (one sentence)
- A discriminating probe — what evidence would falsify or confirm
## Step 4 — Test in PARALLEL (one Agent call per hypothesis)
For N hypotheses spawn N Agent subagents IN THE SAME MESSAGE (this is the structural parallelism that prevents anchoring). Each subagent runs in isolated context.
For each hypothesis, spawn:
```
Agent(
description="Test diagnosis hypothesis #<n>",
prompt="
You are testing ONE hypothesis for the diagnosis of:
<stabilized signal>
Your hypothesis: <hypothesis claim>
Why-plausible: <one-line>
Discriminating probe: <one-line probe>
Graph context (the orchestrator pulled this from haft's fused graph — you
CANNOT query it yourself, so use what is given):
<the Step 2.5 graph-context block: invariants that must hold here + governing
decisions with their trust-decay; or "none — this code is ungoverned">
Allowed tools: Read, Grep, Glob, Bash (test runners only — no edits).
NOT allowed: Write, Edit, NotebookEdit. You are READ-ONLY.
Return EXACTLY this structure:
evidence_for:
- <observation supporting hypothesis>
evidence_against:
- <observation contradicting hypothesis>
inconclusive:
- <observation that neither supports nor refutes>
verdict: supported | refuted | inconclusive
confidence: low | medium | high
notes: <one-paragraph summary>
"
)
```
All N Agent calls go in the SAME assistant message — Claude Code executes them in parallel. Wait for all results before Step 5.
## Step 5 — Rank by evidence weight (keep rivals visible per CC-B.5.2-2)
After collecting subagent results, rank hypotheses by:
1. Verdict (supported > inconclusive > refuted)
2. Confidence (high > medium > low)
3. Evidence_for count minus evidence_against count
Identify the **prime hypothesis** (top-ranked) but DO NOT discard the others. Per FPF CC-B.5.2-2 rivals stay visible in the artifact graph for replay and fallback.
## Step 6 — Record as SolutionPortfolio variants
Call:
```
mcp__haft__haft_solution(
action="explore",
problem_ref="<prob-... from Step 2>",
variants=[
{
"title": "<hypothesis 1 short name>",
"description": "<claim + evidence summary>",
"weakest_link": "<what would invalidate this even though current evidence supports>",
"novelty_marker": "<what makes this hypothesis distinct from the others>",
"stepping_stone": false
},
// ... one entry per hypothesis, with the prime one marked as such in description
]
)
```
The kernel returns a SolutionPortfolio ID. Each hypothesis becomes a variant with its evidence trail attached. The operator can verify, supersede, or commission action on any of them.
## Step 7 — Present to operator
Surface to operator:
- Prime hypothesis with evidence summary
- Rivals visible (per CC-B.5.2-2) with their evidence
- Specific next-action recommendation:
- If prime is `supported high-confidence` → recommend `/h-decide` to commit to the fix path
- If prime is `supported medium` → recommend more ta