Agent skill

otp-patterns

Stars 0
Forks 1

Install this agent skill to your Project

npx add-skill https://github.com/layeddie/ai-rules/tree/main/tools/claude/skills/otp-patterns

SKILL.md

Skill: otp-patterns

INVOKE BEFORE implementing or reviewing OTP components (Application, Supervisor, GenServer, Registry, DynamicSupervisor).

Use when

  • Adding or modifying supervised processes.
  • Designing registries/dynamic supervisors.
  • Debugging GenServer callbacks or timeouts.

Checklist

  • Separate client/API vs server callbacks.
  • Add @impl true to callbacks; pattern match on messages.
  • Avoid blocking in callbacks; offload to Tasks or async streams.
  • Supervision: choose the lightest strategy (one_for_one default).
  • Register via Registry or {via, Registry, ...} instead of global names.
  • Instrument with telemetry events for critical paths.

Quick snippets

  • Start child: Supervisor.start_child/2 for static; DynamicSupervisor.start_child/2 for dynamic.
  • Timeout hygiene: handle_call should avoid long work; use async reply when necessary.

References

  • ai-rules: patterns/otp/ if present; follow BEAMAI defaults.

Didn't find tool you were looking for?

Be as detailed as possible for better results