This skill should be used when the user asks to "review Elm code", "Elm code quality", "Elm idioms check", "review my Elm", "check code quality", or wants feedback on Elm code patterns, idioms, Msg/Model design, or module organization.
Install
npx skillscat add bromanko/llm-agents/elm-code-review Install via the SkillsCat registry.
SKILL.md
Elm Code Review
Action required: Run /review elm code to start an interactive code quality review. Do not perform the review manually.
Perform a thorough code quality review of Elm code, focusing on idiomatic patterns, The Elm Architecture, and clean module design.
Scope Determination
First, determine what code to review:
- If the user specifies files/directories: Review those paths
- If no scope specified: Review working changes
- Check for
.jjdirectory first, usejj diffif present - Otherwise use
git diffto identify changed.elmfiles - If no changes, ask the user what to review
- Check for
Review Process
- Read the target files using the Read tool
- Analyze against the checklist below
- Output findings in the standard format
Review Checklist
The Elm Architecture (TEA)
Modelrepresents the full application/component state clearlyMsgtype captures all possible user and system eventsMsgvariants are specific (not catch-all likeNoOpoveruse)updatefunction handles allMsgcases meaningfullyviewis a pure function ofModel- No business logic in
view— only presentation CmdandSubused correctly for side effectsinitsets up reasonable default state
Type Design
- Custom types model domain states explicitly (avoid stringly-typed code)
- Opaque types used to hide implementation details in exposed modules
- Type aliases used for records to improve readability
- Impossible states made impossible through type design
- Phantom types or extensible records used where appropriate
- Avoid overly generic types when specific types would be clearer
Pattern Matching
caseexpressions are exhaustive (compiler enforces this, but watch for lazy_ ->catch-alls)- Pattern matching preferred over nested
if/then/else - Destructuring used effectively in function arguments and
letbindings - Complex patterns broken into helper functions for readability
Pipeline & Composition
- Pipeline operator (
|>) used for data transformations - Function composition (
>>) used where it aids clarity - Pipelines read top-to-bottom as a clear sequence of operations
- Avoid excessively long pipelines (break into named intermediate values)
Maybe/Result Handling
- No
Maybe.withDefaultthat silently discards importantNothingcases Resultused for operations that can fail with meaningful errorsMaybe.map/Result.mapchains used instead of nestedcaseexpressionsMaybe.andThen/Result.andThenfor chaining fallible operations- Avoid
Maybewhen a custom type with explicit states would be clearer
Module Organization
- Exposed functions form a clear, minimal API (
exposinglist is intentional) - Related functionality grouped in same module
- Module names reflect their purpose
exposing (..)avoided in imports (prefer explicit imports)- Module boundaries align with domain concepts
- No circular dependencies
Naming Conventions
- Functions use
camelCase - Types use
PascalCase - Module names use
PascalCasewith dot separators - Names are descriptive but not overly verbose
- Boolean functions prefixed appropriately (e.g.,
isValid,hasItems) Msgvariants use verb form (e.g.,ClickedButton,ReceivedResponse)
JSON Decoders/Encoders
- Decoders validate data at the boundary
- Decoder pipelines are clear and readable
- Error messages in decoders are helpful
- Encoders match expected API format
- Optional fields handled explicitly (
Decode.maybevsDecode.field)
Code Clarity
- Functions are focused (single responsibility)
- Complex logic has explanatory comments
- No dead code or unused imports
- Consistent formatting (elm-format applied)
letbindings used to name intermediate values for clarity
Output Format
Present findings as:
## Findings
### [SEVERITY] Issue Title
**File:** `path/to/Module.elm:LINE`
**Category:** quality
**Issue:** Description of what's wrong and why it matters.
**Suggestion:** How to fix, with code example if helpful.
**Effort:** trivial|small|medium|large
---Use severity indicators:
- HIGH: Bugs, incorrect behavior, serious maintainability issues
- MEDIUM: Non-idiomatic code, unclear patterns, missing error handling
- LOW: Style issues, minor improvements, optional enhancements
Summary
After all findings, provide:
- Total count by severity
- Top 2-3 priority items to address
- Overall code quality assessment (1-2 sentences)