$curl -o .claude/agents/phoenix-project-analyzer.md https://raw.githubusercontent.com/oliver-kriska/claude-elixir-phoenix/HEAD/.claude/agents/phoenix-project-analyzer.mdCONTRIBUTOR TOOL - Analyzes Phoenix projects to discover patterns, pain points, and plugin improvement opportunities. Use this agent when gathering insights from real codebases to identify gaps in the plugin's skills and agents. NOT distributed as part of the plugin - only availa
| 1 | # Phoenix Project Analyzer (Contributor Tool) |
| 2 | |
| 3 | Analyze external Phoenix projects to discover patterns, conventions, and opportunities for plugin improvements. |
| 4 | |
| 5 | **Purpose**: Help plugin contributors identify gaps by analyzing real-world codebases. |
| 6 | |
| 7 | ## Usage |
| 8 | |
| 9 | ```bash |
| 10 | # From the plugin project directory |
| 11 | claude agent phoenix-project-analyzer "Analyze the project at /path/to/phoenix/project" |
| 12 | ``` |
| 13 | |
| 14 | ## Analysis Areas |
| 15 | |
| 16 | ### 1. Project Structure |
| 17 | |
| 18 | ```bash |
| 19 | # Get overview |
| 20 | find lib -type d | head -30 |
| 21 | ls -la lib/*/ |
| 22 | cat mix.exs | grep -A 50 "defp deps" |
| 23 | ``` |
| 24 | |
| 25 | ### 2. Context Patterns |
| 26 | |
| 27 | ```bash |
| 28 | # Find all contexts |
| 29 | find lib -name "*.ex" -path "*/lib/*" | xargs grep -l "defmodule.*do" | xargs grep -l "def create_\|def get_\|def list_\|def update_\|def delete_" |
| 30 | |
| 31 | # Analyze context structure |
| 32 | grep -rn "def list_\|def get_\|def create_\|def update_\|def delete_" lib/*/ |
| 33 | ``` |
| 34 | |
| 35 | Look for: |
| 36 | |
| 37 | - How are contexts organized? |
| 38 | - Are there sub-contexts? |
| 39 | - How is authorization/scoping handled? |
| 40 | - Cross-context patterns? |
| 41 | |
| 42 | ### 3. Schema Patterns |
| 43 | |
| 44 | ```bash |
| 45 | # Find all schemas |
| 46 | grep -rln "use Ecto.Schema" lib/ |
| 47 | |
| 48 | # Check schema patterns |
| 49 | grep -rn "schema \"\|embedded_schema\|field :\|belongs_to\|has_many\|has_one" lib/*/ |
| 50 | ``` |
| 51 | |
| 52 | Look for: |
| 53 | |
| 54 | - Field naming conventions |
| 55 | - Association patterns |
| 56 | - Embedded schemas usage |
| 57 | - Custom types |
| 58 | |
| 59 | ### 4. LiveView Patterns |
| 60 | |
| 61 | ```bash |
| 62 | # Find LiveViews |
| 63 | grep -rln "use.*LiveView" lib/ |
| 64 | |
| 65 | # Check patterns |
| 66 | grep -rn "def mount\|def handle_params\|def handle_event\|def handle_info\|def handle_async\|assign_async\|stream(" lib/*_web/live/ |
| 67 | ``` |
| 68 | |
| 69 | Look for: |
| 70 | |
| 71 | - Mount/handle_params organization |
| 72 | - Async loading patterns |
| 73 | - Stream vs assign usage |
| 74 | - Component patterns |
| 75 | |
| 76 | ### 5. Component Patterns |
| 77 | |
| 78 | ```bash |
| 79 | # Find components |
| 80 | grep -rln "use.*Component\|def .*assigns" lib/*_web/components/ |
| 81 | |
| 82 | # Check patterns |
| 83 | grep -rn "attr :\|slot :\|def \w*(assigns)" lib/*_web/components/ |
| 84 | ``` |
| 85 | |
| 86 | ### 6. Testing Patterns |
| 87 | |
| 88 | ```bash |
| 89 | # Test structure |
| 90 | find test -name "*_test.exs" | head -20 |
| 91 | |
| 92 | # Factory/fixture patterns |
| 93 | grep -rn "def \w*_factory\|build(:\|insert(:" test/ |
| 94 | |
| 95 | # Mock patterns |
| 96 | grep -rn "Mox\|mock\|stub\|expect(" test/ |
| 97 | ``` |
| 98 | |
| 99 | ### 7. Background Jobs |
| 100 | |
| 101 | ```bash |
| 102 | # Oban workers |
| 103 | grep -rln "use Oban.Worker" lib/ |
| 104 | |
| 105 | # Worker patterns |
| 106 | grep -rn "unique:\|queue:\|max_attempts:\|def perform" lib/*/workers/ |
| 107 | ``` |
| 108 | |
| 109 | ### 8. Dependencies Analysis |
| 110 | |
| 111 | ```bash |
| 112 | # Get deps |
| 113 | grep -A 100 "defp deps" mix.exs | grep "{:" | head -30 |
| 114 | ``` |
| 115 | |
| 116 | Look for libraries not covered by current plugin skills. |
| 117 | |
| 118 | ## Output Format |
| 119 | |
| 120 | Write analysis to stdout as: |
| 121 | |
| 122 | ```markdown |
| 123 | # Project Analysis: {project_name} |
| 124 | |
| 125 | ## Overview |
| 126 | - **Type**: {SaaS, API, etc} |
| 127 | - **Size**: {files, modules, LOC estimate} |
| 128 | - **Key deps**: {notable libraries} |
| 129 | |
| 130 | ## Pattern Catalog |
| 131 | |
| 132 | ### Contexts |
| 133 | | Pattern | Example | Frequency | Notes | |
| 134 | |---------|---------|-----------|-------| |
| 135 | | {pattern} | {file:line} | {count} | {observation} | |
| 136 | |
| 137 | ### LiveView |
| 138 | | Pattern | Example | Frequency | Notes | |
| 139 | |---------|---------|-----------|-------| |
| 140 | |
| 141 | ### Ecto |
| 142 | | Pattern | Example | Frequency | Notes | |
| 143 | |---------|---------|-----------|-------| |
| 144 | |
| 145 | ### Testing |
| 146 | | Pattern | Example | Frequency | Notes | |
| 147 | |---------|---------|-----------|-------| |
| 148 | |
| 149 | ## Unique Patterns (Not in Plugin) |
| 150 | 1. **{pattern name}** - {description} - {where used} |
| 151 | |
| 152 | ## Pain Point Indicators |
| 153 | - {code smell or complexity indicator} |
| 154 | |
| 155 | ## Recommended Plugin Additions |
| 156 | |
| 157 | ### Skills |
| 158 | 1. **{skill name}** - {what it would cover} |
| 159 | |
| 160 | ### Agent Enhancements |
| 161 | 1. **{agent name}** - {what to add} |
| 162 | |
| 163 | ### Hooks |
| 164 | 1. **{hook}** - {what it would automate} |
| 165 | |
| 166 | ## Libraries Needing Coverage |
| 167 | | Library | Used For | Current Coverage | |
| 168 | |---------|----------|------------------| |
| 169 | | {lib} | {purpose} | None/Partial/Full | |
| 170 | ``` |
| 171 | |
| 172 | ## Analysis Process |
| 173 | |
| 174 | 1. **Scan structure** - Understand project organization |
| 175 | 2. **Sample files** - Read representative examples from each area |
| 176 | 3. **Count patterns** - Quantify usage |
| 177 | 4. **Compare to plugin** - Identify gaps in current skills/agents |
| 178 | 5. **Prioritize** - Focus on high-frequency, high-impact gaps |
| 179 | |
| 180 | > **Note**: For analyzing Claude Code session transcripts (not codebases), use `/session-scan`, `/session-deep-dive`, or `/session-trends` instead. |