/write-error-divergence
L1 trigger - audits file/database write paths for metadata commits, cache updates, and success returns that diverge when writes fail.
$ npx -y skills add PlamenTSV/plamen --skill write-error-divergence --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/write-error-divergence
Context preview
The summary Claude sees to decide when to auto-load this skill.
L1 trigger - audits file/database write paths for metadata commits, cache updates, and success returns that diverge when writes fail.
SKILL.md
write-error-divergence.SKILL.mdname: "write-error-divergence"
description: "L1 trigger - audits file/database write paths for metadata commits, cache updates, and success returns that diverge when writes fail."
Injectable Skill: Write Error Divergence
> **L1 trigger**: `STORAGE` or `DATABASE_TX` flag OR file/DB write APIs detected (`write_all`, `fs::write`, `rename`, `flush`, `commit`, `put`, `insert`, `batch`, `transaction`) > **Inject Into**: `depth-state-trace`, `depth-edge-case` > **Language**: Go and Rust > **Finding prefix**: `[WED-N]`
Purpose
Node clients often pair durable writes with in-memory metadata, indexes, caches, or database transactions. If metadata advances before the durable write succeeds, restart or reorg behavior can diverge from the actual persisted state.
1. Write Unit Enumeration
For each storage path, enumerate the logical write unit:
| Write Unit | Data Write | Metadata/Index Update | Error Check | Rollback/Cleanup | Verdict | |------------|------------|-----------------------|-------------|------------------|---------|
Include:
- block/header/transaction persistence;
- cache metadata, expiry timestamps, indices, checkpoints, migration markers;
- database transactions and batches;
- file writes that use temp files, rename, flush, fsync, or parent-directory fsync.
2. Required Checks
For each write unit:
- **Metadata-before-data**: metadata, cache state, or checkpoint markers must not advance before the durable write succeeds.
- **Success-after-side-effect**: `Ok(())`, HTTP success, or actor success messages must be returned only after the write and required flush/commit complete.
- **Commit-before-check**: database transactions must not commit when the closure or inner operation returned an error.
- **Partial write**: short writes, interrupted writes, rename failures, flush/fsync failures, and parent-directory fsync failures must be handled consistently.
- **Rollback/cleanup**: failed writes must either roll back metadata or leave an explicit repair/retry marker.
- **Restart trace**: trace what a node observes after restart if the write fails at each boundary.
Tag evidence as `[WED-METADATA-BEFORE-DATA:{file}:{line}]`, `[WED-COMMIT-BEFORE-CHECK:{file}:{line}]`, `[WED-SUCCESS-BEFORE-WRITE:{file}:{line}]`, or `[WED-RESTART-DIVERGE:{file}:{line}]`.
3. Non-Finding Rules
Do not report internal best-practice issues unless a failed write can produce stale reads, corrupted state, replay, permanent data loss, fork-choice divergence, or a liveness failure after restart.
4. Output
Use normal finding format. If no finding exists, still emit the write-unit table with file:line evidence for each safe rollback or commit path.
Read more
name: "write-error-divergence" description: "L1 trigger - audits file/database write paths for metadata commits, cache updates, and success returns that diverge when writes fail."
Injectable Skill: Write Error Divergence
> **L1 trigger**: `STORAGE` or `DATABASE_TX` flag OR file/DB write APIs detected (`write_all`, `fs::write`, `rename`, `flush`, `commit`, `put`, `insert`, `batch`, `transaction`) > **Inject Into**: `depth-state-trace`, `depth-edge-case` > **Language**: Go and Rust > **Finding prefix**: `[WED-N]`
Purpose
Node clients often pair durable writes with in-memory metadata, indexes, caches, or database transactions. If metadata advances before the durable write succeeds, restart or reorg behavior can diverge from the actual persisted state.
1. Write Unit Enumeration
For each storage path, enumerate the logical write unit:
| Write Unit | Data Write | Metadata/Index Update | Error Check | Rollback/Cleanup | Verdict | |------------|------------|-----------------------|-------------|------------------|---------|
Include:
- block/header/transaction persistence;
- cache metadata, expiry timestamps, indices, checkpoints, migration markers;
- database transactions and batches;
- file writes that use temp files, rename, flush, fsync, or parent-directory fsync.
2. Required Checks
For each write unit:
- **Metadata-before-data**: metadata, cache state, or checkpoint markers must not advance before the durable write succeeds.
- **Success-after-side-effect**: `Ok(())`, HTTP success, or actor success messages must be returned only after the write and required flush/commit complete.
- **Commit-before-check**: database transactions must not commit when the closure or inner operation returned an error.
- **Partial write**: short writes, interrupted writes, rename failures, flush/fsync failures, and parent-directory fsync failures must be handled consistently.
- **Rollback/cleanup**: failed writes must either roll back metadata or leave an explicit repair/retry marker.
- **Restart trace**: trace what a node observes after restart if the write fails at each boundary.
Tag evidence as `[WED-METADATA-BEFORE-DATA:{file}:{line}]`, `[WED-COMMIT-BEFORE-CHECK:{file}:{line}]`, `[WED-SUCCESS-BEFORE-WRITE:{file}:{line}]`, or `[WED-RESTART-DIVERGE:{file}:{line}]`.
3. Non-Finding Rules
Do not report internal best-practice issues unless a failed write can produce stale reads, corrupted state, replay, permanent data loss, fork-choice divergence, or a liveness failure after restart.
4. Output
Use normal finding format. If no finding exists, still emit the write-unit table with file:line evidence for each safe rollback or commit path.
Autonomous Web3 security auditor for Claude Code and OpenAI Codex CLI. Orchestrates 18-100 AI agents across 40+ phases to produce audit reports with verified PoC exploits — for smart contracts and L1 node-client infrastructure.
Repo: PlamenTSV/plamen
Other skills on plamen.
- /ability-analysis
Trigger Pattern Always (Aptos Move) - foundational security check - Inject Into Breadth agents, depth agents
Open skill - /bit-shift-safety
Trigger Pattern Always (Aptos Move) - Move VM aborts on shift = bit width - Inject Into Breadth agents, depth-edge-case
Open skill - /centralization-risk
Trigger Protocol has privileged roles (admin, operator, governance, resource account owner) - Covers Single points of failure, privilege escalation, external governance dependen...
Open skill - /cross-chain-timing
Trigger Pattern wormhole|layerzero|ccip|bridge|cross_chain|vaa|guardian|emitter|relay|remote_chain|payload|nonce.sequence - Inject Into Breadth agents, depth-external
Open skill - /dependency-audit
Trigger EXTERNAL_LIB flag detected (protocol uses third-party Move dependencies) - Used by Breadth agents, depth-external
Open skill - /economic-design-audit
Trigger Pattern MONETARY_PARAMETER flag (required) - Inject Into Breadth agents (merged via M4 hierarchy)
Open skill

