Logo: Safe Smokes

Safe Smokes

Communautéit
randommonicle
safe-smokes

Never run destructive operations against shared or live data in tests, smokes, or seeds. Flip-and-restore with try/finally instead of delete; seed in beforeAll and tear down in afterAll; restore shared state exactly as found. Triggers when writing or editing any test, smoke, or seed script that connects to a shared or live database, Supabase or otherwise. Does not trigger on tests that run only against mocks, fixtures, or an in-memory database.

Iwwersiicht

Editeurrandommonicle
Repositoryclaude-skills
Skill-Nummsafe-smokes
Stären
27
Forks
3
Matgeliwwert Dateien
Nëmmen Instruktiounen
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    randommonicle huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Safe Smokes an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/randommonicle/claude-skills/tree/main/safe-smokes
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/randommonicle/claude-skills.git /tmp/claude-skills
mkdir -p .claude/skills
cp -r /tmp/claude-skills/safe-smokes .claude/skills/safe-smokes
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Safe Smokes an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Safe Smokes automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Safe Smokes net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Safe smokes against shared data

A smoke must leave shared state exactly as it found it. On 2026-05-18, before this discipline was written, a smoke deleted ASH's real provider row. The rules below exist so that never recurs.

When this applies

Any test, smoke, or seed that connects to a shared or live database. In PropOS this is the Supabase smoke-db project running against real firm data. The risk is highest for the regulated c1-* smokes and anything touching firm, provider, ledger, demand, or transaction rows.

Confirm the target before you run

More than one project exists per environment, and the active credentials or the Dashboard can point at the wrong one. Before running any smoke that can write, confirm which project the run targets and that it is the one you intend, against the project ref recorded in the repo's own instructions rather than one memorised here. The 2026-05-18 incident combined a destructive delete with an unconfirmed target: flip-and-restore removes the first risk, and confirming the target removes the second.

Core rules

  1. Never .delete() shared real-firm state. Capture the current value, mutate it, assert, then restore. The test owns only the rows it created.
  2. Flip-and-restore in try/finally. The restore runs in finally so it happens even when the assertion throws. A restore that only runs on the happy path is not a restore.
  3. Seed in beforeAll, tear down in afterAll. Set-up creates the test's own rows; tear-down removes exactly those and nothing else.
  4. NULL foreign keys before deleting parents. For example, NULL invoices.transaction_id before deleting transactions, and widen the capture to the direct FK (payment_authorisations.transaction_id) so nothing is orphaned or blocked.
  5. Union-of-anchors tear-down. Delete by the union of every anchor a test could have created, not just the happy-path id. A test that branches creates different rows on different paths.
  6. Idempotent and self-cleaning. Do not assume a clean database. Clean up after yourself; never truncate or reset shared tables to force a known state.

Why flip-and-restore, not transaction rollback

App-level smokes open their own client connections. A BEGIN ... ROLLBACK in the test process does not wrap the connection the application code uses, so it does not isolate the writes. Rollback isolation only works when the test and the code under test share the same database connection and transaction, as with in-database pgTAP tests. For live Supabase smokes, flip-and-restore is the correct pattern, not a workaround.

If an assertion can be expressed as SQL-level RLS checks, prefer pgTAP with BEGIN ... ROLLBACK: it leaves zero residue by construction. Use flip-and-restore for everything that must run through the app's client.

Concurrent runs

Flip-and-restore is not safe under parallel runs that touch the same shared row: two runs can interleave so one restores the other's value, not the original. Serialise smokes that mutate shared rows, or give each run its own row keyed to the run, so no two runs flip the same state at once.

Service-role smokes

The regulated c1-* smokes need SUPABASE_SERVICE_ROLE_KEY in app/.env.local. Absent the key, they SKIP rather than fail. State the skip explicitly in the run summary. Never let a skip read as a pass: a skipped regulated smoke is unverified, not green.

Windows

Use localhost, not 127.0.0.1. Do not background a curl-poll loop to wait for the dev server; grep the server's own ready signal in its log instead.

What this skill does not do

It does not replace catalog verification, which proves the schema, and it does not choose the test framework. It governs how any test touches shared data, so a passing suite never costs real firm state.

Why

Shared-database tests run against data other people rely on. One .delete() on the wrong row is a regulatory and trust incident, and it has happened once. Flip-and-restore makes the destructive path impossible to take by accident: the test never holds a delete on state it did not create.

Additions from cross-repo lessons (ratified 2026-07-23)

  • Teardown must prove itself. A .delete() under RLS returns success with zero rows — on any no-DELETE-policy table an authenticated teardown is a silent leak (the same bug sat in 12 files; one instance leaked 1,148 rows). Assert teardown row counts; use service-role teardown for no-DELETE tables, and never "fix" the no-op by adding a DELETE policy to an audit table. When one instance is found, grep the whole tree for the verb-on-table.
  • Prove zero residue with a prefix-scoped post-run count, not with the absence of errors.
  • Scope assertions on shared data. Never assert a global or firm-wide exact count on a shared database: floor globals, exact-match only rows the test owns. A read-only money smoke needs a stability gate on the rows it reads.
  • Isolation conversions are not mechanical. Moving a smoke to throwaway-fixture isolation requires checking HOW each written table is made append-only (an RLS deny is teardown-able by service role; a trigger is not), which gates a fresh fixture trips that the shared fixture had already satisfied, FK-ordered teardown, and self-cleaning on partial seed failure.
  • A fixture shortcut is a finding. When a test exploits a gap to build its fixtures, that gap is an attacker's path, not a convenience — report it.

Note on hub routing: prove-it-can-fail routes here for any shared-data test. The route adds a path in; it does not narrow this skill's own trigger.

Additions from the misses-log sweep (2026-10-22)

  • A test never waits on a person. Patch every modal or prompt in the test harness to fail with its title, so an unexpected dialog is a failure, not a hang. (RimModManager L-005.)
  • A live check stays off the user's desktop. A check that opens windows, takes focus or starts apps on the user's own machine needs their go-ahead and a quiet moment; otherwise hand them the exact steps. (RimModManager L-010.)

Additions from the misses-log sweep (2026-11-01)

  • A service-role anchor query carries a firm predicate. A query run with the service role bypasses RLS, so an anchor or teardown written without a tight WHERE reaches every tenant's rows rather than the test's. Name the fixture's own key in the predicate and never rely on the policy that is not applying. (PropOS 2026-07-24.)
  • A suite whose tests share accumulated state declares serial mode. Parallel workers get their own beforeAll, and a worker restart re-runs it, so shared accumulated state is rebuilt underneath a test that was counting on it. Declare the file serial, or give each test its own fixture. (PropOS 2026-08-11.)

Heefeg gestallte Froen

Wat mécht de KI-Skill Safe Smokes?

Never run destructive operations against shared or live data in tests, smokes, or seeds. Flip-and-restore with try/finally instead of delete; seed in beforeAll and tear down in afterAll; restore shared state exactly as found. Triggers when writing or editing any test, smoke, or seed script that connects to a shared or live database, Supabase or otherwise. Does not trigger on tests that run only against mocks, fixtures, or an in-memory database.

Firwat Safe Smokes op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Safe Smokes besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Safe Smokes an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/randommonicle/claude-skills/tree/main/safe-smokes an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Safe Smokes benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Safe Smokes benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Safe Smokes domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Safe Smokes gratis?

Jo. randommonicle huet de Skill ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇