erlang-otp-behaviors
by @wu-uk
Use when oTP behaviors including gen_server for stateful processes, gen_statem for state machines, supervisors for fault tolerance, gen_event for event handl...
1. Use gen_server for stateful processes to leverage OTP infrastructure and error handling
2. Implement all callback functions even if they return default values for completeness
3. Keep state records simple to reduce complexity and improve maintainability
4. Use handle_cast for fire-and-forget operations without response requirements
5. Implement proper termination in terminate/2 for resource cleanup
6. Set appropriate timeout values to prevent indefinite blocking in calls
7. Use gen_statem for complex state machines with many states and transitions
8. Design supervisor hierarchies that match application component dependencies
9. Use appropriate restart strategies based on child process relationships
10. Test supervisor behavior by intentionally crashing children to verify recovery
clawhub install fix-erlang-ssh-cve-erlang-otp-behaviors