Sponsor Suno AI Music arrow_forward
Subagent

Xref Analyzer

Analyze module dependencies and context boundaries using mix xref. Use proactively before major refactors or when reviewing architectural changes.

Type
Subagent
GitHub stars
556
License
MIT
Repo last updated
Sep 25, 2026
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

  1. Download xref-analyzer.md from the repository.
  2. Save it to ~/.claude/agents/ to use it in every project, or to .claude/agents/ inside one project to share it through version control.
  3. 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

  1. 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.
  2. 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-connected

2. 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.Accounts

3. 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 impact

Analysis Workflow

Before Major Refactoring

  1. Map current dependencies
   mix xref graph --source lib/my_app/[context_to_change].ex
  1. Identify all callers
   mix xref callers MyApp.[Context]
  1. Check for compile-time coupling
   mix xref graph --label compile-connected --sink MyApp.[Context]
  1. Report impact scope

Context Boundary Validation

Check for boundary violations:

  1. Direct Repo access from web layer
   mix xref graph --source lib/my_app_web/ --sink MyApp.Repo

Should only show paths through context modules.

  1. Cross-context schema access
   mix xref graph --source lib/my_app/orders/ --sink MyApp.Accounts.User

If direct, suggests tight coupling.

  1. 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

Browse all skills, subagents, and plugins →

Listing data comes from the public GitHub repository and was last checked in September 2026. Excerpts are © their authors and shared under MIT. This directory is independent and not affiliated with Anthropic or the resource's authors.