ain3sh/.agents/elixir-essentials
Claude Code and agent skill by ain3sh/.agents
- community
Checking that the SKILL.md file is still in the repository.
Principles for working with Elixir code. Invoke before writing any .ex or .exs file.
Install
npx vskill@latest install ain3sh/.agents/elixir-essentialsSKILL.md
The same SKILL.md was published earlier as ain3sh/.agents/elixir-essentials.
Elixir Essentials
RULES — Follow these with no exceptions
- Use pattern matching over if/else for control flow and data extraction
- Add @impl true before every callback function (mount, handle_event, handle_info, etc.)
- Return {:ok, result} | {:error, reason} tuples for fallible operations
- Use `with` for 2+ sequential fallible operations instead of nested case
- Use the pipe operator for 2+ chained transformations
- Never nest if/else statements — use case, cond, or multi-clause functions
- Predicate functions end with `?`, dangerous functions end with
! - Let it crash — don't write defensive code for impossible states
Pattern Matching
Pattern matching is the primary control flow mechanism in Elixir. Prefer it over conditional statements.
Prefer Pattern Matching Over if/else
Bad:
Good:
Use Case for Multiple Patterns
Bad:
Good:
Pipe Operator
Use the pipe operator |> to chain function calls for improved readability.
Basic Piping
Bad:
Good:
Pipe into Function Heads
Bad:
Good:
With Statement
Use with for sequential operations that can fail.
Bad:
Good:
With Statement - Inline Error Handling
Handle specific errors in the else block.
Guards
Use guards for simple type and value checks in function heads.
List Comprehensions
Use for comprehensions for complex transformations and filtering.
Bad (multiple passes):
Good (single pass):
Naming Conventions
- Module names:
PascalCase - Function names:
snake_case - Variables:
snake_case - Atoms:
:snake_case - Predicate functions end with
?:valid?,empty? - Dangerous functions end with
!:save!,update!
Tagged Tuples for Error Handling
The idiomatic way to handle success and failure in Elixir.
Case Statements
Pattern match on results.
Bang Functions
Functions ending with ! raise errors instead of returning tuples.
Try/Rescue
Catch exceptions when needed (use sparingly).
Supervision Trees
Let processes fail and restart (preferred over defensive coding).
GenServer Error Handling
Handle errors in GenServer callbacks.
Validation Errors
Return clear, actionable error messages.
Changeset Errors
Extract and format Ecto changeset errors.
Early Returns
Use pattern matching in function heads for early returns.
Avoid Defensive Programming
Don't check for things that can't happen. Let it crash.
Bad (defensive):
Good (trust your types):
If the user is nil or doesn't have a name, it's a bug that should crash and be fixed.
Documentation
Use @doc for public functions and @moduledoc for modules.
Immutability
All data structures are immutable. Functions return new values rather than modifying in place.
Testing
When writing test files for Elixir modules, invoke elixir-phoenix-guide:testing-essentials before writing any _test.exs file.
Anonymous Functions
Use the capture operator & for concise anonymous functions.
Verbose:
Concise:
Named function capture:
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/elixir-essentials/SKILL.md
Popularity
- Repository stars
- 14
- Repository forks
- 1
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. 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/ain3sh/.agents/elixir-essentials)