跳到正文
FunCoding

memtrace-quality

Find dead code, complexity hotspots, and refactoring candidates in indexed source code. Use when the user asks about source-code quality, dead code, unused functions, zero callers, complexity, cyclomatic complexity, hotspots, refactoring candidates, or code smell questions. Do not use Grep, Glob, rg, or manual reference search for unused code; Memtrace uses graph reachability and complexity metrics.

Star
516
最近提交
2026年11月30日

plugins/memtrace-skills/skills/memtrace-quality/SKILL.md

在 GitHub 上查看

Overview

Code quality via graph analysis — dead code, complexity hotspots, repository stats.

Quick Reference

ToolPurposeRequiredKey optional
find_dead_codeZero-caller symbolsrepo_idinclude_tests, limit, kinds[]
find_most_complex_functionsRanked complexity hotspotsrepo_idtop_n (def 20) — not limit
calculate_cyclomatic_complexityScore one symbolrepo_id, target—
get_repository_statsRepository overviewrepo_idbranch

Parameter types: numbers must be JSON numbers — limit: 20, never "20" (MCP error -32602).

Full parameter spec for every Memtrace tool: references/mcp-parameters.md (bundled at the memtrace-skills plugin root).

Steps

1. Repository overview

{ "repo_id": "memdb" }

2. Dead code

{ "repo_id": "memdb", "include_tests": false, "limit": 50 }

Exported symbols and entry points excluded by default. Results are candidates, not proof — callers via dynamic dispatch or reflection are invisible to the graph; verify before deleting.

3. Complexity hotspots

{ "repo_id": "memdb", "top_n": 10 }

Ordered by call-graph out-degree.

ScoreRatingAction
<5LowFine
5-10MediumConsider simplifying
10-20HighRefactor candidate
>20CriticalRefactor priority

4. Single symbol complexity

{ "repo_id": "memdb", "target": "processOrder" }

Output

ResultCarries
Dead-code entry (find_dead_code)Symbol name + kind with zero graph callers — e.g. format_legacy (Function)
Complexity row (find_most_complex_functions)Symbol, complexity score, risk level — e.g. processOrder — 27, Critical
Single score (calculate_cyclomatic_complexity)Cyclomatic complexity for target
Stats (get_repository_stats)Node counts by kind, edge counts, community and process counts for repo_id/branch

Common Mistakes

MistakeReality
find_most_complex_functions(limit: 10)Param is top_n
calculate_cyclomatic_complexity(symbol_id=...)Required param is target
Only looking at the highest complexityMedium-complexity functions that are growing (check get_evolution) are often more urgent

相似的 Skill

rea-analysis-optimization

MOmorluto/rea485k近 7 天新增 9,215 个 star

codebase-design

MAmattpocock/skills336k近 7 天新增 5,004 个 star

精选

diagnosing-bugs

诊断困难 bug 和性能回归,用测试或脚本构建反馈循环定位问题。

MAmattpocock/skills336k近 7 天新增 5,004 个 star

setup-ts-deep-modules

MAmattpocock/skills336k近 7 天新增 5,004 个 star

code-review

MAmattpocock/skills336k近 7 天新增 5,004 个 star

implement

MAmattpocock/skills336k近 7 天新增 5,004 个 star