data-heal-playbook

Repairs poisoned database rows with one-time idempotent server-side heal transactions.

Updated Jun 15, 2026
One-click install
npx skills add https://github.com/ravenslight2010/Production-run-calculator --skill data-heal-playbook-ravenslight2010
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: data-heal-playbook
Source: https://github.com/ravenslight2010/Production-run-calculator/tree/main/.agents/skills/data-heal-playbook
Command: npx skills add https://github.com/ravenslight2010/Production-run-calculator --skill data-heal-playbook-ravenslight2010

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When a bug writes wrong values into the production database, fixing the code alone is not enough because the bad data is already persisted. This Skill provides a disciplined playbook for diagnosing the damage, writing a narrowly scoped one-time heal, and verifying it without touching production directly. ## Core Features & Use Cases - Structured heal plan: Requires a written diagnosis, affected-row scope, deterministic repair rule, idempotency strategy, rollback posture, and verification criteria before any code is written. - One-time idempotent heal pattern: Implements heals in artifacts/api-server/src/lib/dataHeals.ts using a single transaction, a claimed marker row in data_heals, and monotonic updatedAtMs bumps so stale clients cannot republish poisoned values. - Manager-value preservation: Excludes or escalates rows that may be legitimate manager corrections, and restricts daily_sync repairs to today and future dates. - Use Case: An import bug wrote a wrong number into many brand profiles. Use this Skill to survey prevalence with grouped counts, dry-run the target set, ship a marker-claimed heal transaction, and verify the repair in dev and after publish. ## Quick Start Ask the AI to use the data-heal-playbook to diagnose and repair the poisoned profile values left behind by the fixed import bug.

Frequently Asked Questions about data-heal-playbook

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

FAQPage Schema
How do I fix bad data already saved in the production database?

Fix the write-path bug first, then ship a one-time heal: diagnose the poisoned rows with grouped-count queries, dry-run the exact target set, and apply a deterministic repair inside a single transaction guarded by a claimed marker row in the data_heals table.

How do I make a database data migration idempotent?

Give the heal a fresh stable marker id and claim it in the data_heals table with onConflictDoNothing before changing rows. If no marker row is inserted, skip execution, so restarts and concurrent instances produce zero additional changes.

Can I edit the production database directly to fix bad rows?

No. This playbook forbids ad-hoc production mutations; heals ship as code in dataHeals.ts and run on server startup. Live verification uses only the approved read-only production procedure after publish.

How do I avoid overwriting legitimate user-entered values during a data repair?

Capture the manager-entered fields or row versions that must survive and require the known bad predicate to match before touching a row. Any row that may be a valid manager correction is excluded or escalated rather than overwritten.

When should I use a data heal versus an import audit?

Use an import audit to verify a new import landed correctly, and use this heal playbook after a write bug is understood and poisoned rows are confirmed. The audit's affected-row scope and preservation evidence feed directly into the heal plan.