Claude
View SourceHelp make Claude Code write production-ready Elixir, every time.
Claude, not to be confused with the Claude (probably should have picked a better name π ), is an elixir library, batteries-included integration that helps ensure every line of code Claude writes is checked for proper formatting, compiles without warnings, and follows your project's conventionsβautomatically.
π Quickstart
New to Claude? Our quickstart guide walks you through a complete setup with real examples.
Installation
# Install Claude
mix igniter.install claude
# That's it! Now Claude:
# β Checks if files need formatting after editing
# β Detects compilation errors immediately
# β Validates code before commits
The Problem
When Claude Code writes Elixir, you often need to:
- Run
mix formatmanually or prompt Claude to format the file - Discover compilation errors only when you run the code or tests
The Solution
This project hooks directly into Claude Code's workflow:
# When Claude writes this code with formatting and compilation issues:
defmodule MyModule do
def process_user_data(user, _options) do
{:ok, %{id: user.id, name: user.name, email: user.email, created_at: user.created_at, updated_at: user.updated_at, status: user.status, role: user.role}} # Line too long!
end
def calculate_total(items) do # Unused function!
Enum.reduce(items, 0, fn item, acc -> acc + item.price * item.quantity end)
end
end
# Claude immediately sees:
# β οΈ File needs formatting (line too long)
# β Compilation error: unused function `calculate_total/1`Features
π― Smart Hooks
Automatically check formatting, catch compilation errors, validate commits, and more - with smart output handling that prevents context overflow.
- Output Control: Choose between
:nonemode (summary only) or:fullmode for detailed output - Webhook Reporting (Experimental): Send hook events to external endpoints for monitoring and integration
- Automatic Dependency Management: Auto-install missing dependencies during hook execution
β See Hooks Documentation for details and configuration.
π€ Sub-agents
Create specialized AI assistants with built-in best practices from your dependencies.
β See Sub-Agents Documentation for details and examples.
π MCP Server Support
Integrate with Phoenix development tools via Tidewave. MCP servers are configured in .claude.exs and synced to .mcp.json when you run mix claude.install.
β See MCP Servers Guide for details and configuration.
π Best Practices
Usage rules from your dependencies are automatically synced to CLAUDE.md, ensuring Claude follows library-specific best practices.
- Nested Memories: Distribute CLAUDE.md files across different directories for context-specific guidance
- Embedded Documentation: Usage rules are now embedded directly in CLAUDE.md for better visibility
β See Usage Rules Guide for how Claude integrates with usage rules.
π οΈ Bundled Commands
Pre-configured slash commands for common Elixir development tasks, automatically installed in .claude/commands/.
- Library Management:
/claude:install,/claude:uninstall,/claude:config - Dependency Management:
/mix:deps,/mix:deps-add,/mix:deps-upgrade - Nested Memories:
/memory:nested-add,/memory:nested-sync,/memory:check
β Type / in Claude Code to see all available commands.
Installation
Requirements
- Elixir 1.18 or later
- Claude Code CLI (installation guide)
- Mix project
Install via Igniter
mix igniter.install claude
This will:
- Add
claudeto your dependencies - Generate
.claude.exsconfiguration file - Configure hooks in
.claude/settings.json - Generate sub-agents in
.claude/agents/ - Install bundled slash commands in
.claude/commands/ - Sync usage rules to
CLAUDE.md - Create
.mcp.jsonfor MCP servers (if configured)
Configuration File
All Claude settings are managed through .claude.exs:
%{
hooks: %{
stop: [:compile, :format],
post_tool_use: [:compile, :format]
},
mcp_servers: [:tidewave], # For Phoenix projects
subagents: [...] # Specialized AI assistants
}Run mix claude.install after updating to apply changes.
How It Works
This library leverages Claude Code's hook system to intercept file operations:
- Claude edits a file β PostToolUse hook triggered
- Hook runs Mix tasks β
mix format --check-formatted,mix compile --warnings-as-errors - Feedback provided β Claude sees any issues and can fix them
- Process repeats β Until the code is production-ready
This happens automatically, without interrupting Claude's workflow.
Documentation
- Quickstart Guide - Get started quickly with examples
- Hooks Reference - Available hooks and configuration
- Sub-Agents Reference - Creating specialized AI assistants
- MCP Servers Guide - Model Context Protocol integration
- Usage Rules Guide - Best practices integration
- Anthropic's Code Hooks Guide
- Anthropic's Subagents Guide
Contributing
We welcome contributions!
# Run tests
mix test
# Format code
mix format
# Run quality checks
mix compile --warnings-as-errors
Support
- π¬ Discussions
- π Issue Tracker
Roadmap
β Recently Added
Mix Task Generator
mix claude.gen.subagent- Interactive generator for new sub-agents with:- Name validation and formatting
- Tool selection with warnings
- Multi-line prompt support
- Automatic
.claude.exsintegration
Nested Memories
- Directory-specific CLAUDE.md files (e.g.,
lib/my_app_web/CLAUDE.mdfor Phoenix) - Configure via
nested_memoriesin.claude.exs - Distribute context-specific usage rules across your codebase
Bundled Slash Commands
/claude:*commands for library management (install, uninstall, config, status)/elixir:*commands for version management and compatibility checks/memory:*commands for nested memories management/mix:*commands for dependency management- Auto-installed in
.claude/commands/duringmix claude.install
π Coming Soon
More MCP Servers
- Database tools (PostgreSQL, MySQL, Redis)
- Testing and documentation servers
- Auto-configuration based on project dependencies
Dynamic Sub-agents
- Generate sub-agents for each dependency with context automatically
- Common workflow templates (LiveView, GraphQL, Testing)
Want to contribute? Open an issue on GitHub!
License
MIT - see LICENSE for details.
Made with β€οΈ by the Elixir community