elixir-anti-patterns

Detect Elixir anti-patterns and propose idiomatic refactors for codebases.

2|Updated Mar 23, 2026
One-click install
npx skills add https://github.com/dot-prompt/dotprompt --skill elixir-anti-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: elixir-anti-patterns
Source: https://github.com/dot-prompt/dotprompt/tree/main/.agent/skills/elixir-anti-patterns
Command: npx skills add https://github.com/dot-prompt/dotprompt --skill elixir-anti-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Identifies common Elixir anti-patterns and provides actionable refactoring guidance to improve readability, reliability, and maintainability.

Core Features & Use Cases

  • Detects frequent Elixir anti-patterns including long with clauses, complex extractions, dynamic atom creation, non-assertive map access, and overly large structs.
  • Provides idiomatic refactorings with concrete before-and-after examples.
  • Assists in code reviews and design discussions by offering practical rules and patterns for safe improvements.

Quick Start

Refactor the attached Elixir module to remove anti-patterns and improve readability.

Frequently Asked Questions about elixir-anti-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor long with clauses in Elixir to improve code readability?

To refactor long Elixir with clauses, break complex conditional extractions into smaller, focused helper functions or replace nested conditions with idiomatic pattern matching. This approach reduces branching complexity and clarifies the success path logic.

What are common Elixir anti-patterns related to dynamic atom creation?

Dynamic atom creation in Elixir is an anti-pattern because atoms are not garbage collected, risking memory exhaustion. Refactor dynamic atom creation to use existing atoms or safe alternatives like strings to prevent table overflow.

How do I fix non-assertive map access in Elixir code reviews?

Fix non-assertive map access by replacing bracket notation with dot notation where keys are guaranteed. This refactor leverages pattern matching to enforce key presence, surfacing missing data during compilation or tests.

When should I refactor an oversized Elixir struct?

Refactor an oversized Elixir struct when it accumulates unrelated fields, making maintenance difficult. Split the large struct into smaller, cohesive domain-specific structs to improve data modeling and reduce coupling.

Can I integrate Elixir refactoring rules into automated linters?

Yes, the structured rules and actionable guidance for fixing Elixir anti-patterns are suitable for integration into code reviews and linters. You can configure automated workflows to flag complex extractions and dynamic atom creation.