跳到主要内容
知仓学习社ZHICANG

phx-techdebt

Analyze Elixir/Phoenix technical debt — duplicates, refactoring opportunities,

不碰外部(只输出文字)无严重或高危命中oliver-kriska/claude-elixir-phoenix

它会碰到什么

扫了多少1 个文本文件,2 KB
它会碰到什么不碰外部(只输出文字)
命中总数0 处
命中统计严重 0 · 高 0 · 中 0 · 低 0

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

Technical Debt Detection

Find and eliminate duplicate code patterns, anti-patterns, and refactoring opportunities in Elixir/Phoenix projects.

Iron Laws - Never Violate These

  1. Search before refactoring - Understand full scope of duplication before extracting
  2. Three strikes rule - Extract shared code only after 3+ duplications
  3. Prefer composition - Use behaviours and protocols over inheritance-style abstractions
  4. 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:

  1. Location: File paths and line numbers
  2. Pattern: What code is duplicated
  3. Extraction: Suggested shared function/module
  4. 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.

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。

它属于哪个仓库

星标★ 553
本站分层T2
该仓技能数322
原文件路径targets/dsh/skills/phx-techdebt/SKILL.md

同一个仓库里的其他技能

看这个仓库的全部 322 个技能

同名技能的其他版本

有 5 个不同仓库或目录里都有叫 phx-techdebt 的技能。它们内容并不相同,别混用: