AugmentClaude

Root Cause Remediation

Investigate bugs and failures to fix the underlying cause rather than apply surface patches.

Installation

  1. Make sure Claude is on your device and in your terminal.

    Skills load from ~/.claude/skills/ when Claude Code starts up — so you need it on your machine first. If you don't have it yet, install it once with the command below, then run claude in any terminal to verify.

    One-time setup
    npm i -g @anthropic-ai/claude-code

    Already have it? Skip ahead.

  2. Paste into Claude Code or into your terminal.

    This copies the whole skill folder into ~/.claude/skills/root-cause-remediation-aqm857886159/ — the SKILL.md plus any scripts, reference docs, or templates the skill ships with. Works for every skill.

    What this command does
    1. Makes a new, empty temporary folder.
    2. Downloads the skill's folder, .agents/skills/root-cause-remediation, from github.com/aqm857886159/Nomi (branch main), the GitHub repository it's listed from. You get the version that is there now, not a copy we keep.
    3. Copies that folder to ~/.claude/skills/root-cause-remediation-aqm857886159/.
    4. Deletes the temporary folder.

    Installing runs none of the skill's files; it only downloads and copies them. When you later use the skill, Claude follows its SKILL.md and may run scripts that come with it. Read them first.

    How we check skills, and what we don't · Report this skill

    Faster alternative (instruction-only skills)

    Skips the clone and grabs only the SKILL.md file. Don't use this if the skill ships Python scripts, reference markdowns, or asset templates — they won't be downloaded and the skill will fail when it tries to load them.

    Quick install (SKILL.md only)
    Sign up to copy
  3. Restart Claude Code.

    Quit and reopen Claude Code (or any other agent that loads from ~/.claude/skills/). New skills are picked up on startup.

  4. Just ask Claude.

    Skills auto-activate when your request matches the skill's description — no slash command needed. Trigger phrases live in the skill's own frontmatter; you can read them in the “What this skill does” section above.

Prefer to read the source first? Open on GitHub.

When Claude uses it

Mandatory for every Nomi corrective change: user-reported bugs, regressions, CI-only failures, flaky tests, performance or security defects, review/audit findings, and compatibility failures in any production path. Classify one_off versus recurring before implementation. Recurring and high-risk repairs require a schema-v3 contract, shared enforcement boundary, structural prevention, dependency lifecycle decision, and changed regression evidence.

What this skill does

Root Cause Remediation

Mission

Act as an investigator and system owner, not a patch author. Restore the missing invariant at the earliest shared boundary so the reported failure and every equivalent entry fail safely or succeed consistently. A green example is not success if another vendor, version, caller, platform, or stored value can reproduce the same class.

This skill is the detailed operating source for P2/R21. CLAUDE.md and generated AGENTS.md only carry the trigger; scripts/root-cause-contracts.mjs is the merge-time enforcement authority.

Success Bar

A remediation is complete only when evidence connects all of these:

  • the exact user-visible symptom and deterministic reproduction;
  • the direct mechanism that failed;
  • the class-wide missing invariant;
  • every equivalent entry point found by repository search;
  • one or more shared boundaries that enforce the invariant without exceptions;
  • changed tests for both the reported case and the class boundary;
  • removal or explicit non-applicability of obsolete paths;
  • an explicit dependency upgrade/retention decision with exit criteria when a third-party runtime is involved;
  • verification on the platform or build boundary that originally exposed the defect.

Required Workflow

  1. Reproduce the symptom with the smallest deterministic fixture. Preserve the failing output before editing production code.
  2. Trace the complete path from user input through parsing, state/persistence, shared services, and the final request/write/decode boundary.
  3. Separate symptom, direct_cause, and class_root. The class root is the missing invariant that explains why equivalent inputs or callers can fail, not the line that happened to throw.
  4. Classify recurrence before implementation: one_off requires repository-wide evidence that no other user, input, entry, machine, or future run can reach the mechanism and no reusable invariant can prevent it; observed once is not evidence. Otherwise classify recurring. 4a. Before first proposing a solution, and again when changing it, check this object’s past decisions and deletion records (docs/design/, git log --grep, and known facts supplied by the coordinator); verify the original wording and whether it still applies. State the user outcome to preserve, then compare fixing in the current direction, taking a different approach (changing modes or adopting an existing solution), and deleting it. Choose from the facts; write unknown where evidence is missing. For a small matter with an already clear fix, one sentence is enough.
  5. Count the doors before choosing where to fix. Run node scripts/door-map.mjs <mutator symbol or file> to enumerate every write and read entry point of the state whose invariant broke, and paste the output into the contract's doors. A door map you typed by hand is the same thing as the sentence "I checked"; the script is the check. The tool counts direct call sites only, so follow one more hop when a door is reached through a wrapper. If the fix changes what a shared read face returns (filtering, hiding, reshaping), enumerate every reader of it — including tests/ux walkthroughs and scripts that call it through window.nomiDesktop — and check each reader's expectation before shipping; 改了读面返回什么,就把它的全部读者(含走查)逐个核一遍 (2026-10-22: hiding blank drafts in the project list broke golden path and real-user-journeys, which find a just-created project through listAsync).
  6. Search the repository by data shape, contract, producer, and consumer. Record at least two independently checked same-class entry points; do not search only for the reported provider, version, model, or fixture name. 这一步是修缺陷用的;任务是删掉某个东西时,范围按归属定(它属于谁的目录、声明、夹具、测试),全仓搜索只用来最后核对剩下什么,不用来决定删什么。
  7. Identify the earliest shared boundary that can own the invariant. If callers do not converge, first consolidate ownership or define multiple explicit shared boundaries.
  8. For third-party behavior, inspect current official documentation, source, installed versions, and platform/package drift. Choose upgrade-now, retain-with-exit, or not-applicable; retention requires a target and testable exit criteria.
  9. Read references/contract-v3.template.json, then create or update a schema-v3 docs/fixes/*.root-cause.json before a recurring or high-risk production fix. Preserve the template's exact field names, object shapes, and enums; every changed high-risk production file must be covered by scope_paths.
  10. Add the failing reported-case test and at least one class-level test. Run only this red slice before implementation. 门岗反例夹具只截取本次相关片段;不要把整份旧规则 / 旧文件复制进夹具。先证明夹具会红,按字节还原后再证明回绿。
  11. For recurring repairs, enforce the invariant at the shared boundary and list changed structural code in prevention.artifacts. Delete obsolete behavior in the same change; tests, documentation, and fallback paths are not structural prevention.
  12. Run the changed class tests and pnpm run check:root-cause-contracts. After the logical batch is stable, run the risk-selected repository validation once.

Decision Rules

  • Prefer schema/type/parser/normalization/persistence boundaries over caller-side conditionals.
  • A platform or dependency version may explain the symptom, but it is not automatically the class root. Bind the application-level contract explicitly, then decide whether the dependency also needs an upgrade.
  • Upgrade now when a supported target-aware package can replace the old runtime without weakening packaging, security, or cross-architecture guarantees.
  • Retain with exit only when an application invariant safely spans current versions and the upgrade has concrete prerequisites, owner paths, and verification criteria.
  • If migration cannot distinguish legacy user-authored behavior from generated behavior, fail visibly or require explicit regeneration; do not guess and silently rewrite.
  • If the same class truly has one technical caller, enumerate different input populations or downstream consumers. A one-example scan does not establish generality.

Forbidden Patch Shapes

  • A vendor/model/version/platform branch when a shared role, type, schema, byte, lifecycle, or persistence boundary can own the rule.
  • Swallowing an error, broadening a regex, increasing a timeout/retry count, or weakening validation without proving the underlying invariant.
  • Changing only the failing fixture or mocking away the production boundary.
  • Adding a new path while leaving the old path callable as a fallback.
  • Calling a dependency old but neither upgrading it nor recording a target-aware exit plan.
  • Listing vague entry points, nonexistent paths, unchanged tests, or prose that cannot be tied back to code.

Contract v3 Review

Before implementation, confirm the contract contains:

  • generality_proof explaining why the solution spans the class;
  • shared_boundaries with real path, symbol, and responsibility;
  • doors: every write and read entry point of the affected state, generated by scripts/door-map.mjs, each {kind, path, symbol} — the door's identity is file + symbol, never a line number (line numbers drift on unrelated edits and produced a whole family of no-op "keep the line numbers current" commits);
  • door_reduction: {before, after} where after equals doors.length; when two or more doors survive unchanged, why_not must say why each entry has to exist;
  • same_class_entry_points with path, entry, disposition, and evidence;
  • recurrence with one_off/recurring, reason, and concrete repository scan evidence;
  • recurring prevention with a supported mechanism, shared enforcement path, invariant, fail behavior, no exception policy, strategy, and changed structural artifacts;
  • class_regression_tests that are also changed regression_tests;
  • legacy_paths as removed or justified not-applicable;
  • dependency_lifecycle as not-applicable, upgrade-now, or retain-with-exit.

The exact machine contract is references/contract-v3.template.json. In particular, use same_class_entry_points[].entry_point, disposition enforced or not-affected, the exact recurrence and prevention keys, and an object-shaped legacy_paths; do not paraphrase schema keys in a contract outline. prevention.kind is one of centralized-boundary, schema-validation, type-system, runtime-assertion, static-gate, migration, or dependency-upgrade. Each external source is {kind: official-doc|source-code, url, checked_at: YYYY-MM-DD, purpose}; otherwise use a truthful internal_only_reason. Run the checker immediately after drafting so field-shape errors are resolved before production work.

Schema v1 and v2 contracts are immutable history. Any modification must migrate that contract to v3; new legacy contracts fail CI.

Final Review

Do not call the issue solved until every answer has code or test evidence:

  1. Can the same class still enter through another caller, provider, version, platform, or old stored value? Answer from the door map, not from memory.
  2. Does every equivalent entry converge on a declared enforcement boundary?
  3. Does the boundary fail closed without a compatibility exception or fallback?
  4. Did the reported case fail before the fix and pass after it? For a user-reported problem this means replaying the user's own flow under the same real conditions (what counts as real depends on the problem, for example a real model for generation, real old-version data for an upgrade): complete, with every difference from the user's run named, the same symptom seen before the fix and the same steps passing after it. Derive what to cover from the user's flow and the door map, not from a fixed list (docs/engineering-rules.md R13). Record it in the PR's ## 真实场景复现; a fake-provider walk alone does not count, and missing resources are written as 未验证:原因.
  5. Does a separate class-level test prove the invariant rather than the example?
  6. Are dependency and migration decisions explicit, bounded, and testable?

Unknowns belong in residual_risks; they are not permission to claim completion.

Reference

  • references/contract-v3.template.json - exact schema-v3 authoring template; always read it before drafting a contract.

Related skills