Dialyzer static type analysis for Elixir projects

GitHub stars
176

Install

/plugin install dialyzer@elixir

Run it inside Claude Code after adding the marketplace with /plugin marketplace add bradleygolden/claude-marketplace-elixir.

Contents

Discovered from source

Agents 2

Changelog

All notable changes to this plugin will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

[Unreleased]

[1.2.1] - 2025-01-08

Changelog tracking begins with this version. For prior history, see git log.

dialyzer

Dialyzer static type analysis plugin for Claude Code.

Installation

claude
/plugin install dialyzer@elixir

Requirements

  • Elixir installed and available in PATH
  • Mix available
  • Dialyzer installed (included with Erlang/OTP)
  • Dialyxir installed in your project (add {:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false} to mix.exs)
  • Run from an Elixir project directory (with mix.exs)
  • Initial PLT (Persistent Lookup Table) built with mix dialyzer --plt

Features

Automatic Hooks

PreToolUse - Before git commits:

  • ✅ Pre-commit check - Runs mix dialyzer before any git commit and blocks if type errors found

Hooks Behavior

Pre-commit Check (Blocking)

mix dialyzer
  • Runs before any git commit command
  • Blocks commits when Dialyzer finds type errors
  • Sends violations to Claude via JSON permissionDecision for review
  • Output truncated to 30 lines if needed
  • Exits silently for non-Elixir projects
  • Pattern: Uses JSON permissionDecision with deny status to block commits
  • Context Detection: Automatically finds Mix project root by traversing upward from current directory
  • Timeout: 120 seconds (Dialyzer can take longer than other checks)
  • Note: Skips if project has a precommit alias (defers to precommit plugin)

Why Pre-commit Only?

Unlike Credo or compilation checks, Dialyzer is intentionally only run on commit because:

  • Performance: Dialyzer analysis can take significant time, especially on first run
  • Scope: Dialyzer analyzes the entire codebase, not just individual files
  • Intent: Type safety checks are best validated when you're ready to commit, not on every edit

Setup

Before using this plugin, ensure you've built the PLT:

mix dialyzer --plt

This is a one-time setup (unless you upgrade Erlang/Elixir or add new dependencies).

Changelog

See CHANGELOG.md for version history.

Hooks 1

Sponsors

Details

Marketplace
bradleygolden/claude-marketplace-elixir
Source
plugins/dialyzer
Category
Community
License
MIT
Keywords
elixir, dialyzer, type-checking, static-analysis

More from bradleygolden/claude-marketplace-elixir

All 10