Agent skill
phx:techdebt
Analyze Elixir/Phoenix technical debt — duplicates, refactoring opportunities, credo issues. Use when asked about code quality, cleanup, or what to improve.
Install this agent skill to your Project
npx add-skill https://github.com/oliver-kriska/claude-elixir-phoenix/tree/main/plugins/elixir-phoenix/skills/techdebt
SKILL.md
Technical Debt Detection
Find and eliminate duplicate code patterns, anti-patterns, and refactoring opportunities in Elixir/Phoenix projects.
Iron Laws - Never Violate These
- Search before refactoring - Understand full scope of duplication before extracting
- Three strikes rule - Extract shared code only after 3+ duplications
- Prefer composition - Use behaviours and protocols over inheritance-style abstractions
- Test coverage first - Ensure tests exist before refactoring duplicated code
Analysis Checklist
1. Run Credo for Automated Detection
Run mix credo --strict.
Focus on:
- Design issues (duplication, complexity)
- Consistency issues (naming, patterns)
- Refactoring opportunities
2. Find Duplicate Ecto Query Patterns
Use Grep to search for repeated Repo calls (Repo.get!, Repo.get, Repo.one) in lib/**/*.ex.
Use Grep to find duplicate query patterns (from.*in.*where) in lib/**/*.ex.
3. Find Duplicate Validation Logic
Use Grep with output_mode: "count" to count def changeset occurrences in lib/**/*.ex.
Use Grep to find repeated validations (validate_required, validate_format) in lib/**/*.ex.
4. Find Copy-Pasted Controller Actions
Use Grep to find similar action patterns (def create, def update, def delete) in lib/*_web/**/*.ex.
Common Duplication Patterns
| Pattern | Symptom | Solution |
|---|---|---|
| Repeated queries | Same Repo.get in multiple contexts |
Create shared query module |
| Duplicate validations | Same validate_* calls |
Extract to shared changeset |
| Similar controllers | Copy-pasted CRUD actions | Use Phoenix generators consistently |
| Repeated transforms | Same Enum.map patterns |
Extract to domain module |
Reporting Format
For each duplication found, report:
- Location: File paths and line numbers
- Pattern: What code is duplicated
- Extraction: Suggested shared function/module
- Effort: Low/Medium/High to fix
Usage
Run /phx:techdebt to analyze the codebase and generate a prioritized report of technical debt with specific remediation steps.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
lab:autoresearch
Self-improving loop for plugin skills. Reads program.md, proposes one mutation per iteration, evaluates against deterministic scorer, keeps improvements via git, reverts failures. Targets weakest skill+dimension. Use with /loop for overnight runs.
promote
Generate X/Twitter release promotion posts with ASCII tables and CodeSnap rendering. Use when writing release posts, promotion tweets, plugin announcements, or preparing social media content for new versions.
skill-monitor
Analyze skill effectiveness across sessions. Computes per-skill metrics (action rate, friction, outcomes), identifies degrading skills, and generates improvement recommendations. Requires session-scan data in metrics.jsonl.
session-trends
Analyze trends across session metrics. Computes windowed aggregates, deltas, and compares against MEMORY.md findings. Use periodically for progress tracking.
cc-changelog
CONTRIBUTOR TOOL - Track CC changelog, extract new versions since last check, analyze impact on plugin (breaking changes, opportunities, deprecations). Run periodically or before releases. NOT part of the distributed plugin.
session-scan
Compute metrics for Claude Code sessions. Discovers via ccrider, filters trivial, computes friction/opportunity/fingerprint scores. Use for broad session triage.
Didn't find tool you were looking for?