Joser
Claude Code Plugin for Elixir: Custom Skills and Hooks for Better Code
Quality
I’ve been experimenting with Claude Code for Elixir development and built a
custom plugin to improve code quality. To test whether it actually makes a
difference, I built the same Phoenix LiveView application twice once with
minimal configuration and once with the full plugin.
The Experiment
I created an image gallery application with Phoenix LiveView featuring:
- Image uploads with progress tracking
- Folder organization
- Tab-based navigation
- Responsive TailwindCSS UI
- Local file storage with PostgreSQL metadata
Build 1 (Baseline): Minimal configuration, just project guidelines and
specs
Build 2 (Plugin): Custom skills, hooks, agent docs, and comprehensive
project documentation
What’s in the Plugin?
4 Custom Skills:
- Elixir patterns (pattern matching, pipe operators, with statements)
- Phoenix LiveView (lifecycle, uploads, streams)
- Ecto database (schemas, changesets, queries)
- Error handling (tagged tuples, error patterns)
5 Validation Hooks:
- Warn on nested if/else (prefer pattern matching)
- Block hardcoded config values (require
Application.get_env/2) - Warn on
Enum.map |> Enum.filterchains - Block missing
@impl trueon callbacks - Warn on string concatenation in loops
Agent Documentation:
- Project structure and context boundaries
- LiveView implementation checklists
- Ecto conventions and best practices
- Testing guides
The Results
| Metric | Build 1 (Baseline) | Build 2 (Plugin) |
|---|---|---|
| Lines of Code | ~550 | ~2,000+ (with tests) |
| Automated Tests | 0 | 46 tests |
| Test Coverage | Manual only | 28/28 context tests passing |
| Credo Score | Not run | Excellent (7 minor issues) |
| Convention Adherence | Good | Excellent |
Where the Plugin Excelled
1. Comprehensive Testing
Build 2 included 46 automated tests covering all context operations, edge
cases, and error handling from the start.
2. Better Code Quality
Consistent pattern matching, proper pipe operator usage, tagged tuples for
error handling, and @impl true on all callbacks.
3. Idiomatic Elixir
The plugin encouraged idiomatic patterns throughout:
# Pattern matching over if/else
def process({:ok, result}), do: transform(result)
def process({:error, reason}), do: handle_error(reason)
# with statements for multi-step operations
def create_image_with_folder(attrs, folder_id) do
with {:ok, folder} <- get_folder(folder_id),
{:ok, image} <- create_image(attrs) do
{:ok, %{image: image, folder: folder}}
end
end
Important Limitation
Both builds required manual testing to catch functional issues. The plugin
helps write better code with proper patterns and conventions, but it cannot
replace human validation of feature functionality.
The Verdict
The plugin produces higher-quality, more maintainable code with better test
coverage. If you're building Elixir applications professionally, the
investment is worth it.
Try It Yourself
The plugin configuration is available on GitHub:
https://github.com/j-morgan6/elixir-claude-optimization
The package includes:
- Skills for Elixir patterns, LiveView, Ecto, and error handling
- Hooks that enforce conventions and warn about anti-patterns
- Agent documentation for project structure and testing
- Sample CLAUDE.md for project setup
This is a one time investment that's reusable across all your Elixir projects.
I'd love to hear your thoughts or experiences with AI-assisted Elixir
development!
Trending in AI / LLMs
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #iex
- #elixirconf-us
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 5- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Joser
GitHub - j-morgan6/elixir-phoenix-guide · GitHub Link to the repo!
Joser
Released v1.1.0 of my Elixir Claude optimization plugin
The problem: Claude Code had the right skills but wasn’t invoking them consistently. Skills existed but sat unused.
What changed:
• New skill-discovery system for systematic skill selection
• Replaced passive “Use when” with mandatory “INVOKE BEFORE” directives
• File pattern detection for automatic skill recommendations
• 50%+ increase in skill utilization
The impact:
Claude Code now consistently identifies applicable skills BEFORE writing code. The plugin finally does what it should: ensure Elixir/Phoenix best practices are followed from the start, not fixed after the fact.
More updates coming soon. If you’re using Claude Code for Elixir/Phoenix work, this one’s worth checking out.
GitHub: https://lnkd.in/eU-Ghh6x
kjwvanijk
Looks very interesting, I have been using Claude code for a bit and ran into the same issues. Yesterday I tried out gtp-5.3 codex and it performed a lot better in writing clean idiomatic elixir.
What I wonder though, how does this plugin interact with usage_rules if at all?
Joser
v1.3.0 adds one thing: a testing-essentials skill.
The plugin now has 5 skills. The new one activates before any _test.exs file and enforces 8 testing rules covering DataCase/ConnCase setup, fixture patterns, LiveView and
context test skeletons, and a light TDD workflow.
All 4 existing skills now route to testing-essentials when you’re working on test files. The testing-guide.md agent doc was refactored into a deep reference so there’s no
duplication between it and the skill.
Plugin at a glance:
Install / update:
/plugin marketplace add j-morgan6/elixir-phoenix-guide
/plugin
Already installed? Open /plugin and update from the menu.
GitHub: GitHub - j-morgan6/elixir-phoenix-guide · GitHub
Joser
v2.3.0 adds five new skills and six security hooks.
The plugin now covers 19 skills across security, deployment, channels, telemetry, and JSON APIs alongside the existing LiveView, Ecto, and OTP coverage. The new security hooks run as you write code, blocking SQL injection, atom exhaustion, and open redirects, and warning on raw/1 usage, sensitive data in logs, and timing-unsafe comparisons.
New skills:
New security hooks:
Plugin at a glance:
GitHub: GitHub - j-morgan6/elixir-phoenix-guide · GitHub