Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Statecraft Skill

    1

    Build recoverable UI states that handle network failures, race conditions, and partial successes without losing user data.

    Free

    1 useSecurity scanned
    statecraft-skill

    statecraft-skill

    Example session with this skill installed

    Audit the checkout component in /src/components/Checkout.tsx for state gaps. Focus on how we handle network timeouts during the 'Process Payment' step.

    • Read your context and instructions
    • Compiled the statecraft-
    • Generated the UI component

    I have audited the Checkout.tsx component. The current implementation relies on a single isLoading boolean and a generic error string, which creates several recovery dead ends.

    State Read: checkout depends on payment gateway and inventory; uncertain charges are the primary risk; preserve cart items and user details; recovery must verify transaction status before allowing retry.

    State Audit: Checkout Surface

    StateStatusRisk/Gap
    PendingImplementedUses a full-page overlay that blocks navigation.
    ErrorPartialShows a toast but clears the form state on mount.
    UncertainMissingIf the request times out, the UI treats it as a failure, risking duplicate charges on retry.
    SuccessImplementedRedirects to /success.
    DegradedMissingNo handling for when inventory check fails but payment is ready.

    Next steps

    1. Implement an Uncertain state that polls a /status endpoint instead of showing a raw error.
    2. Update the usePayment hook to preserve form values in local state during the transition.
    3. Add a TransactionId to the request payload to ensure idempotency on the server.

    I can begin implementing the Uncertain state logic if you'd like to proceed.

    Checkout.tsx

    TSX · React component

    Generated

    Example file from a real run - the skill writes it into your workspace.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Most modern web interfaces break the moment they leave the happy path. This skill eliminates "loading spin of death" loops, silent failures, and lost user input by implementing a rigorous state-recovery model for every asynchronous interaction. It moves beyond simple booleans to handle complex scenarios like partial success, race conditions between pagination and filters, and uncertain network outcomes for destructive actions.

    What it does

    • Map reachable states by identifying idle, pending, ready, empty, degraded, blocked, conflict, and uncertain conditions.
    • Implement recovery contracts that define exactly what happened, what data remains safe, and how the user can retry without duplicating work.
    • Enforce race condition logic to ensure late-arriving network responses do not overwrite newer user intent or dirty local edits.
    • Manage collection continuity by merging paged or retried data using stable identities rather than simple array appends.
    • Audit UI resilience by inspecting existing code for state gaps, missing error boundaries, or inaccessible recovery actions.

    How it works

    1. State Read: The agent analyzes the surface dependencies and identifies the costliest failure risks to protect user progress.
    2. Reachability Mapping: It builds a transition map covering triggers, feedback, preservation rules, and next actions.
    3. Implementation: It writes the component logic, ensuring loading states match final structures and errors remain actionable.
    4. Verification: The agent uses existing project test harnesses or mocks to prove every state is reproducible and reachable via the UI.

    Frameworks & tools

    This skill is framework-agnostic but designed for user-facing web interfaces. It works with React, Vue, Svelte, or vanilla TypeScript/JavaScript and integrates with existing testing tools like Jest, Vitest, Playwright, or Storybook for state verification.

    Why this beats prompting it yourself

    Standard prompts often forget edge cases like "uncertain" states where a payment might have succeeded despite a network timeout. This skill uses a structured reachability map to ensure zero dead ends, preserving user input during failures that would normally wipe a form.

    Use cases

    • Building a multi-step checkout where duplicate submissions must be prevented during timeouts.
    • Implementing a search-as-you-type interface that correctly handles out-of-order API responses.
    • Auditing a legacy dashboard to identify where users are getting stuck in unrecoverable error states.
    • Handling partial file upload successes by allowing users to retry only the failed items in a batch.

    Known limitations

    This skill focuses on user-facing state and recovery behavior, not backend infrastructure reliability. It does not provide visual design systems and should be paired with a design skill for

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Frontend & Web Apps.

    Focuses on frontend state logic and recovery paths. Does not fix backend infrastructure or provide original visual design systems. Requires existing project test harnesses for full verification.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    1 use

    Times used to date

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 25 days ago

    • Free with an Agensi account

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Listed25 days ago

    What's inside

    Frequently Asked Questions

    This skill moves beyond simple "loading" and "error" flags to handle complex scenarios like race conditions, partial API successes, and network timeouts that often cause users to lose their input data.

    Yes, it is framework-agnostic and works seamlessly with React, Vue, Svelte, or vanilla TypeScript by integrating into your existing state management patterns.

    No, this skill is designed for any AI agent capable of reading and writing code, such as GitHub Copilot, Cursor, or custom-built development agents.

    The skill identifies "stale" requests and implements logic to ensure that late-arriving responses from older actions don't accidentally overwrite your most recent user updates.

    You receive the complete logic patterns for state recovery, a suite of reachability mapping templates, and the integration prompts necessary for your agent to audit and repair UI components.

    While it excels at building new components, it is also highly effective at auditing legacy codebases to find and fix "dead end" states where users currently get stuck.

    New in Frontend & Web Apps

    Free