jordanchoo/acfs-agent-skills/async-state-machine-hardening
Claude Code and agent skill by jordanchoo/acfs-agent-skills
- community
Checking that the SKILL.md file is still in the repository.
Harden async workflows with queues, webhooks, cron jobs, pollers, retries, and multi-stage state transitions. Use when designing or reviewing status machines, dedupe behavior, idempotency, retry semantics, partial-failure handling, or race-prone background processing.
Install
npx vskill@latest install jordanchoo/acfs-agent-skills/async-state-machine-hardeningSKILL.md
The same SKILL.md was published earlier as jordanchoo/acfs-agent-skills/async-state-machine-hardening.
Async State Machine Hardening
Use this skill when a system does work later, elsewhere, or more than once.
Typical triggers:
- Queue or task processors
- Webhook receivers
- Pollers and reconcilers
- Cron-triggered workflows
- Multi-stage jobs with persisted status
- Bugs involving retries, duplicate delivery, stuck states, or race conditions
Core Principle
Treat every async boundary as hostile:
- Messages can arrive twice.
- Workers can crash after side effects but before state writes.
- State can change between read and write.
- Retries can replay stale intent.
- Partial success is normal, not exceptional.
Load References Only When Needed
- Read references/failure-patterns.md when you need deeper review guidance for TOCTOU, dedupe, retry, partial-failure, logging, or counter drift bugs.
- Read references/test-matrix.md when you need a more detailed failure-path test plan.
Hardening Workflow
1. Map the state machine first
Write down:
- States
- Allowed transitions
- Terminal states
- Re-entry rules
- Ownership of each transition
If you cannot state which component owns a transition, the design is already weak.
Use a compact format like:
Then add invariants:
2. Check the critical failure surfaces
Always review:
- TOCTOU and stale reads
- idempotency and dedupe
- retry semantics
- partial failure and orphaned work
- observability, redaction, and derived-state drift
Do not guess here. If the implementation is nontrivial, open the deeper reference.
Design Rules
- One component should own each transition.
- Terminal means terminal. Do not reuse terminal or cancelling work as active work.
- Duplicate delivery must have explicit semantics.
- Side effects and status changes must be ordered intentionally.
- Reconciliation is part of the design, not a cleanup script of shame.
- Error taxonomy must drive behavior. "failed" is usually too vague.
Code Review Checklist
Ask these in order:
- Can this handler run twice without corrupting state?
- Can it crash after the side effect but before the state write?
- Can another worker mutate the same record between read and write?
- Does retry preserve correctness, not just eventual completion?
- Are duplicate tasks or duplicate webhooks classified correctly?
- Can counters, summaries, or progress totals drift from source records?
- Are cancellation states and retry states distinct?
- Is sensitive data kept out of logs and error payloads?
Common Smells
- single
statusfield with no attempt metadata - broad
catchthat overwrites the original error contract - reads outside transactions followed by guarded writes
- "not found" and "not yours" returning distinguishable messages when that leaks existence
- state transitions inferred from logs instead of persisted facts
- counters updated optimistically with no recompute path
Deliverables This Skill Should Push Toward
- a transition map
- explicit invariants
- an error taxonomy
- idempotency and dedupe rules
- targeted failure-path tests
- a reconciliation plan for derived state
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingasync-state-machine-hardening/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/jordanchoo/acfs-agent-skills/async-state-machine-hardening)