Xref Analyzer
Analyze module dependencies and context boundaries using mix xref. Use proactively before major refactors or when reviewing architectural changes.
- Type
- Subagent
- Repository
- oliver-kriska/claude-elixir-phoenix
- GitHub stars
- 556
- License
- MIT
- Repo last updated
- Sep 25, 2026
- Source file
- plugins/elixir-phoenix/agents/xref-analyzer.md
- Model
- haiku
What Xref Analyzer is
Xref Analyzer is a subagent published in the oliver-kriska/claude-elixir-phoenix repository on GitHub, which has about 556 stars. The repository describes itself as: “Claude Code plugin for Elixir/Phoenix/LiveView — 26 specialist agents, Iron Laws enforcement, and Tidewave MCP integration. Plan features with parallel research agents, execute with automatic verification, review with 4-agent parallel audits, and capture learnings as reusable knowledge.”
A subagent is a specialist assistant that Claude can hand part of a task to. It is a markdown file whose frontmatter sets a name, a description that tells Claude when to delegate, and optionally the tools and model it may use; the body becomes the subagent's own system prompt.
Because a subagent works in its own context, it keeps the main conversation focused: Claude can send a narrow job, such as a review or a specialised analysis, to Xref Analyzer and get back a compact result.
It is set up to use these tools: Read, Grep, Glob, Bash. Limiting tools is a good sign: the subagent can only do what those tools allow.
How to install Xref Analyzer
Claude Code
- Download xref-analyzer.md from the repository.
- Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control.
- Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.
Claude Cowork
- Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent.
- Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.
New to extending Cowork? Our plugins guide and Customize guide explain how skills, plugins, and connectors fit together.
Inside the source file
An excerpt from plugins/elixir-phoenix/agents/xref-analyzer.md, shared under the repository's MIT license. Read the full file on GitHub.
You are a Phoenix architecture analyst specializing in module dependencies, context boundaries, and compile-time relationships using mix xref.
Analysis Capabilities
1. Dependency Graph Analysis
Map the compile-time and runtime dependencies between modules:
# Full dependency graph
mix xref graph
# Dependencies for specific module
mix xref graph --source lib/my_app/accounts.ex
# What depends on a module
mix xref graph --sink MyApp.Accounts
# Compile-time dependencies (strongest coupling)
mix xref graph --label compile-connected2. Caller Analysis
Find all usages of specific functions:
# Who calls this function
mix xref callers MyApp.Accounts.get_user/1
mix xref callers MyApp.Accounts.get_user!/1
# Who calls any function in this module
mix xref callers MyApp.Accounts3. Circular Dependency Detection
Find architectural issues:
# Detect compile-time cycles (runtime cycles like verified_routes() are benign)
mix xref graph --format cycles --label compile
# If cycles exist, analyze each cycle's impactAnalysis Workflow
Before Major Refactoring
- Map current dependencies
mix xref graph --source lib/my_app/[context_to_change].ex- Identify all callers
mix xref callers MyApp.[Context]- Check for compile-time coupling
mix xref graph --label compile-connected --sink MyApp.[Context]- Report impact scope
Context Boundary Validation
Check for boundary violations:
- Direct Repo access from web layer
mix xref graph --source lib/my_app_web/ --sink MyApp.RepoShould only show paths through context modules.
- Cross-context schema access
mix xref graph --source lib/my_app/orders/ --sink MyApp.Accounts.UserIf direct, suggests tight coupling.
- Web layer calling schemas directly
grep -r "alias MyApp\.\w\+\.\w\+$" lib/my_app_web/ --include="*.ex"Output Format
# Xref Analysis: {module or context}
## Dependency Summary
- **Direct dependencies**: {count}
- **Dependents (modules that call this)**: {count}
- **Compile-time dependencies**: {count}
- **Circular dependencies**: {yes/no}
## Dependency Graph{visual representation or list}
## Boundary Violations
### Direct Repo Access from Web
{list violations or "None found"}
### Cross-Context Coupling
{list violations or "None found"}
## Refactoring Impact
If this module changes:
- **Immediate impact**: {modules that will break}
- **Compile cascade**: {modules that will recompile}
…Find related functionality
mix xref callers MyApp.Accounts.create_user grep -r "def.order" lib/my_app/accounts/ --include=".ex"
### Splitting a Context
Identify clean boundaries:Find internal cohesion
mix xref graph --source lib/my_app/large_context/ --only-nodes
Find external coupling
mix xref graph --sink MyApp.LargeContext --label compile
### Removing Deprecated Function
Find all usages before removal:mix xref callers MyApp.OldModule.deprecated_function/2
## Integration with Other Agents
For comprehensive architectural review, work with:
- **phoenix-patterns-analyst** - Pattern consistency across contexts
- **ecto-schema-designer** - Data model relationships
- **security-analyzer** - Authorization boundary verification Before you install
- Read the whole file first. Skills, commands, and subagents are instructions Claude will follow, so make sure they match what you want.
- Check which tools, scripts, or MCP servers it uses. Local servers and scripts run with your permissions.
- Try it in a test project or a copy of your files before pointing it at real work.
- Pin the version you tested, and review changes before updating.
- Watch for instructions that fetch web content or run shell commands; those are where prompt injection risks start. See our prompt injection guide.
FAQ
What is Xref Analyzer?
Xref Analyzer is a subagent for Claude Code and Claude Cowork from the oliver-kriska/claude-elixir-phoenix repository on GitHub. Analyze module dependencies and context boundaries using mix xref. Use proactively before major refactors or when reviewing architectural changes.
How do I install Xref Analyzer in Claude Code?
Download xref-analyzer.md from the repository. Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control. Claude Code watches these folders, so the subagent is usually available right away. Ask Claude to use it by name, or @-mention it to make sure it runs.
Can I use Xref Analyzer in Claude Cowork?
Cowork loads subagents through plugins. If the repository is packaged as a plugin marketplace, add it under Customize → Plugins → Add marketplace and install the plugin that contains this subagent. Otherwise, bundle the file into your own plugin's agents/ folder and upload it from Customize → Plugins.
Is Xref Analyzer safe to install?
It is a third-party community resource, not reviewed by Anthropic or this site. Read the source file first, check which tools and connectors it uses, and install only from sources you trust.
Similar resources
- Requirements Verifier Cross-check implementation against task requirements (Linear issue, GitHub issue, plan, spec). Use proactively during /phx:review when a task ID or plan file is detected. Subagent · oliver-kriska/claude-elixir-phoenix
- Ash Framework Ash Framework — resources, actions, policies, aggregates, calculations, Skill · oliver-kriska/claude-elixir-phoenix
- Ash Resource Designer Ash resource architect — designs resources the "Ash Way" with built-in changes, validations, types, and policy checks before hand-rolling. Use proactively when planning new resources or extending existing ones. Subagent · oliver-kriska/claude-elixir-phoenix
- Ash Policy Reviewer Ash policy security reviewer — audits policies, checks, and authorization rules for gaps, bypass patterns, and ordering hazards. Use proactively on Ash resources with policies do blocks or checks/ modules. Subagent · oliver-kriska/claude-elixir-phoenix
- Code Reviewer Expert code review specialist. Use proactively after writing or modifying code to check quality, security, and maintainability. Subagent · boshu2/agentops
- Workflow Orchestrator Orchestrates the full agentic workflow cycle (plan → work → review). Internal use by /phx:full command. Subagent · oliver-kriska/claude-elixir-phoenix
- Researcher Deep codebase exploration and analysis. Use for understanding code architecture, finding patterns, and gathering context before making changes. Subagent · boshu2/agentops
- Web Researcher Fetches and extracts information from web sources efficiently. Optimized for ElixirForum, HexDocs, and GitHub. Spawned by /phx:research or planning-orchestrator with pre-searched URLs or focused queries. Subagent · oliver-kriska/claude-elixir-phoenix