Works with the AI tools you already use

    CClaude CodeCCursorCCodex CLIGGitHub CopilotGGemini CLI+17 more

    Repair Atomic File Replace Bugs

    1

    Repair atomic file replacement bugs that expose partial content, cross filesystems, lose metadata, or overstate durability.

    Secure checkout via Stripe

    0 installsSecurity scanned

    See it in action

    You say

    Our Python service rewrites config.json by opening the live file with "w" and json.dump(). Concurrent readers sometimes see empty or partial JSON, and a crash can leave the service unable to start. Repair the repository using a disposable directory and injected write/flush/replace failures. Preserve the existing file mode and current durability requirement, do not touch real configuration files, and do not claim universal power-loss safety.

    Your agent does

    Unsafe publication path found. The writer truncates the live configuration before serialization completes, so concurrent readers can observe empty or partial JSON. The repair writes a same-directory staged file, validates and closes it, applies the repository sync contract, replaces through a platform adapter, preserves required mode metadata, and tests every failure boundary without claiming universal power-loss durability.

    What you get

    Prevent readers from parsing partial or empty configuration files.Standardize file replacement logic across Windows and POSIX systems.Automate cleanup of stale temporary files after application crashes.Add deterministic fault injection to test file-system failure modes.

    About this skill

    The problem

    File writers often truncate live targets before new content is ready, leading to corrupted manifests, empty configs, or partial caches during crashes. Developers frequently struggle with cross-platform rename semantics and stale temporary files that leak after process failures.

    What it does

    • Identifies unsafe truncation and cross-filesystem staging that breaks atomic visibility.
    • Implements same-directory staging to ensure rename operations are atomic.
    • Standardizes platform-specific replacement behavior between POSIX and Windows.
    • Adds explicit flush, sync, and parent-directory synchronization points for durability.
    • Automates stale temporary file cleanup and adds deterministic fault-injection tests.

    Frameworks & tools

    Works with any language using standard filesystem APIs (Node.js fs, Python os/pathlib, Rust std::fs, Go os). Uses Read, Edit, and Bash tools.

    Why this beats prompting it yourself

    Generic LLMs often suggest simple rename calls without accounting for cross-device links, Windows file locking, or metadata preservation. This skill enforces a strict publication contract that separates staged content from published paths, preventing data corruption patterns that manual code reviews miss.

    Use cases

    • Preventing partial writes in JSON configuration or state files.
    • Managing atomic updates for high-frequency cache and artifact generation.
    • Fixing platform-inconsistent file replacement bugs in CLI tools.
    • Implementing robust crash recovery for local file-based databases or manifests.

    How to install

    Drop the file into your AI Agent. Works with Claude, Cursor, ChatGPT, and 20+ more.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    30-day refund

    Not a fit? Get your money back

    Trust & safety

    Security scanned

    Verified clean today

    Listedtoday

    Frequently Asked Questions