singularityhacker/estack/estack-otp
Claude Code and agent skill by singularityhacker/estack
- community
Checking that the SKILL.md file is still in the repository.
Choose and operate Elixir processes, supervision, tasks, and ETS. Use when adding GenServers, concurrent work, process state, fault isolation, or diagnosing mailboxes and timeouts.
Install
npx vskill@latest install singularityhacker/estack/estack-otpSKILL.md
OTP patterns
Inspect the supervision tree and installed Elixir/OTP versions. Start with the runtime requirement, not a preference for process-shaped code.
Choose the mechanism
| Requirement | Starting point | |
|---|---|---|
| Pure transformation | Plain function/module | |
| Bounded concurrent work | Task or Task.Supervisor with explicit result/error handling | |
| Shared state with serialized operations | GenServer; Agent for very simple state | |
| Explicit state/event transitions | Consider :gen_statem when complexity warrants it | |
| Many reads of shared in-memory data | ETS with an explicit owner and lifecycle | |
| Per-entity processes | DynamicSupervisor and Registry | |
| Work surviving process/node loss | Durable queue or persisted workflow |
Stateless work can still need concurrency. Supervision and state are separate decisions. Do not choose spawn_link solely because a decision tree has no better branch.
Bound concurrency and failure
Use linked tasks when their failure should fail the caller. Use supervised unlinked tasks when failures must be handled separately. async_nolink alone does not make Task.await safe: await exits on task failure or timeout.
This illustrative function handles an isolated task's result, failure, and timeout in an ordinary caller:
Killing work does not reverse effects already performed. Use a durable idempotent job for important writes.
In GenServers/LiveViews, avoid blocking the mailbox waiting for long work. Handle task result and :DOWN messages, clear references, and clean up monitors; use LiveView async APIs where appropriate. Bound async-stream concurrency and handle exits/timeouts. Choose linked versus unlinked stream behavior intentionally.
Supervision
Use :one_for_one for independent children, :rest_for_one for ordered dependencies, and :one_for_all only when the children must restart together. Set restart intensity based on recovery behavior. A supervisor restarts a process according to its child spec; it does not persist state, retry every Task automatically, or guarantee business completion.
Keep init fast. handle_continue defers work beyond init but still blocks that process's mailbox while it runs.
State and access
A GenServer serializes callbacks. Measure mailbox growth and latency before assuming it scales. Use call when a reply is required, but recognize that timeouts are not admission control and do not cancel server work automatically. Bound work intake explicitly when needed.
For ETS, document the owner, access mode, restart behavior, and table availability. A protected table lets callers read directly and routes writes through its owner; reads during owner restart may need handling. Use :persistent_term only for rarely changed data; updates have system-wide costs.
Name dynamic processes with Registry/via tuples instead of runtime-generated atoms. Use PartitionSupervisor only after measuring a supervisor bottleneck.
Polling and distribution
Consolidate polling when multiple views need the same external data. Add timeout, backoff, jitter, and bounded work. A named GenServer is a singleton per node, not per cluster. Use an explicit cluster coordination strategy or a durable scheduler if duplicate polling would be harmful.
Keep external I/O out of a busy shared server's callback when it would delay unrelated messages. Broadcast only the data authorized subscribers should receive.
Diagnose before tuning
Inspect queue length, process memory, reductions, and scheduler utilization over time. There is no universal mailbox length that proves a bottleneck. Use :sys.get_state and tracing selectively; state/traces may contain sensitive data. Turn tracing off when finished.
Carry needed locale, request metadata, and identifiers into new processes explicitly. Avoid copying large closures/sockets; reference-counted binaries have different copying behavior from ordinary terms.
References
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 repositoryCheckingskills/estack-otp/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/singularityhacker/estack/estack-otp)