@lustepe/pi-elixir
Pi package for Elixir projects: Mix post-edit checks, Expert LSP bridge, commands, LLM tools, and Elixir/Phoenix/Ecto/OTP skills.
Package details
Install @lustepe/pi-elixir from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@lustepe/pi-elixir- Package
@lustepe/pi-elixir- Version
0.3.0- Published
- Apr 27, 2026
- Downloads
- 75/mo ยท 75/wk
- Author
- lustepe
- License
- Apache-2.0
- Types
- extension, skill
- Size
- 80.6 KB
- Dependencies
- 0 dependencies ยท 3 peers
Pi manifest JSON
{
"extensions": [
"./extensions/mix-format.ts",
"./extensions/mix-compile.ts",
"./extensions/mix-credo.ts",
"./extensions/elixir-tools.ts",
"./extensions/elixir-expert.ts",
"./extensions/elixir-session.ts"
],
"skills": [
"./skills"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-elixir
Pi package for Elixir projects: Mix post-edit hooks, Expert LSP bridge, commands, LLM tools, and Elixir/Phoenix/Ecto/OTP skills.
Features
- Auto-detection: Detects Elixir projects via
mix.exsand shows ๐ฎ Expert connection status - Post-edit hooks: Runs
mix format,mix compile, andmix credoautomatically after file edits - Expert LSP bridge: Full language server integration for diagnostics, hover, definitions, references, symbols, completions, rename, and formatting
- LLM tools:
elixir_mixandelixir_experttools callable by the agent - Slash commands:
/elixirand/expertwith argument completions - Skills: Domain-specific thinking skills for Elixir, Phoenix, Ecto, and OTP
- Credo caching: Checks credo availability once per project instead of on every edit
Install
# Global (all projects)
pi install /path/to/pi-elixir
# Project-local (shareable via .pi/settings.json)
pi install -l /path/to/pi-elixir
# Try without installing
pi -e /path/to/pi-elixir
Prerequisites
mixon PATHexperton PATH (for LSP features)
Structure
pi-elixir/
โโโ README.md
โโโ package.json
โโโ extensions/
โ โโโ mix-format.ts # Post-edit: mix format
โ โโโ mix-compile.ts # Post-edit: mix compile --warnings-as-errors
โ โโโ mix-credo.ts # Post-edit: mix credo (cached availability check)
โ โโโ elixir-tools.ts # elixir_mix tool + /elixir command
โ โโโ elixir-expert.ts # elixir_expert tool + /expert command + auto-start
โ โโโ elixir-session.ts # Project detection + system prompt guidance
โ โโโ lib/
โ โโโ elixir-utils.ts # Shared utilities (run commands, find mix root, etc.)
โ โโโ expert-lsp-client.ts # LSP client for Expert language server
โโโ skills/
โโโ elixir-thinking/ # General Elixir design patterns
โโโ phoenix-thinking/ # Phoenix and LiveView patterns
โโโ ecto-thinking/ # Ecto schemas, queries, migrations
โโโ otp-thinking/ # OTP processes, supervisors, fault tolerance
Slash Commands
Mix helpers (/elixir)
/elixir doctor # Check mix, expert, credo availability
/elixir format [file] # Run mix format
/elixir compile # Run mix compile --warnings-as-errors
/elixir credo # Run mix credo
/elixir test [args...] # Run mix test
Expert LSP (/expert)
/expert status # Show session status
/expert start # Start Expert LSP
/expert restart # Restart Expert LSP
/expert shutdown # Shut down Expert LSP
/expert diagnostics [file] # Show diagnostics
/expert hover <file> <line> <char>
/expert definition <file> <line> <char>
/expert references <file> <line> <char>
/expert symbols <file>
/expert completion <file> <line> <char>
/expert rename <file> <line> <char> <newName> [--apply]
/expert format <file> [--apply]
Positions are 1-based for convenience. The extension converts to LSP's 0-based internally.
LLM Tools
elixir_mix
| Action | Description |
|---|---|
doctor |
Check tool availability |
format |
Run mix format |
compile |
Run mix compile --warnings-as-errors |
credo |
Run mix credo (skips if not installed) |
test |
Run mix test |
elixir_expert
| Action | Description |
|---|---|
status / start / restart / shutdown |
Manage Expert sessions |
diagnostics |
Get published diagnostics |
hover |
Symbol information |
definition |
Go to definition |
references |
Find references |
document_symbols |
List file symbols |
completion |
Autocompletion candidates |
rename |
Preview/apply rename edits |
formatting |
Preview/apply formatting edits |
Skills
| Skill | Use when |
|---|---|
/skill:elixir-thinking |
Designing modules, processes, protocols, behaviours |
/skill:phoenix-thinking |
Working on Phoenix, LiveView, controllers, contexts |
/skill:ecto-thinking |
Changing schemas, changesets, queries, migrations |
/skill:otp-thinking |
Implementing GenServer, Supervisor, Task, Registry |
How Expert LSP Works
The bridge in extensions/lib/expert-lsp-client.ts implements a JSON-RPC/LSP client:
- Starts one Expert process per project root on session start
- Sends
initializewith workspace/text-document capabilities - Responds to server requests (
client/registerCapability,workspace/configuration, etc.) - Syncs
.ex,.exs,.heex,.leexfiles withdidOpen/didChange/didSave - Caches
textDocument/publishDiagnosticsnotifications - Exposes LSP features as tools and commands
- Applies text-only workspace edits inside the project root
Configuration
Environment variables
PI_ELIXIR_EXPERT_COMMAND=/path/to/expert # Override Expert binary
PI_ELIXIR_EXPERT_ARGS="--stdio" # Override Expert args
Disable post-edit hooks
In .pi/settings.json:
{
"packages": [
{
"source": "/path/to/pi-elixir",
"extensions": [
"extensions/mix-format.ts",
"extensions/elixir-tools.ts",
"extensions/elixir-expert.ts",
"extensions/elixir-session.ts"
]
}
]
}
This keeps formatting, commands, Expert LSP, and skills but disables automatic compile/credo.
Notes
- Expert starts automatically when opening an Elixir project
- Diagnostics depend on Expert publishing
textDocument/publishDiagnostics; indexing may still be in progress after startup renameandformattingdefault to preview-only; passapply=trueor--applyto write edits- Credo is only active when the dependency is installed in the project