/toolkit:code-simplifyfrom toolkit
Analyzes Python codebases for dead code, duplication, and complexity, then refactors them. Runs static analysis tools and applies LLM-assisted simplifications.
Ships in toolkit. Installing the plugin adds it to Claude Code.
Analyze and refactor Python code to reduce complexity, remove dead code, and eliminate duplication.
Script-first: Run static analysis tools first to produce concrete, actionable findings. Use LLM only to interpret results and plan refactorings that tools cannot automate.
Run these commands first to gather concrete data before any manual analysis:
# Install tools if needed
pip install flake8 vulture pylint radon 2>/dev/null
# === Dead Code Detection ===
flake8 --select=F401,F841,F811 . # Unused imports, variables, redefined
vulture src/ --min-confidence 80 # Comprehensive dead code detection
# === Duplication Detection ===
pylint --disable=all --enable=duplicate-code src/
# === Complexity Measurement ===
radon cc src/ -a -s # Cyclomatic complexity
radon mi src/ -s # Maintainability index
Present tool findings directly to user. Only supplement with manual inspection for patterns tools miss:
if False:, if DEBUG: in prod)| Pattern | Refactoring |
|---|---|
| Similar functions with minor differences | Extract common logic, use parameters |
| Repeated validation logic | Create validator decorator/function |
| Copy-pasted class methods | Extract base class or mixin |
| Repeated try/except blocks | Create context manager |
| Similar data transformations | Create generic transform function |
# BEFORE: Deep nesting
def process(data):
if data:
if data.valid:
if data.ready:
return transform(data)
return None
# AFTER: Guard clauses
def process(data):
if not data or not data.valid or not data.ready:
return None
return transform(data)
# BEFORE: Complex conditional
if (a and b) or (a and c) or (a and d):
...
# AFTER: Factored
if a and (b or c or d):
...
# BEFORE: Repeated attribute access
result = obj.data.items.first.value + obj.data.items.second.value
# AFTER: Local variable
items = obj.data.items
result = items.first.value + items.second.value
When analyzing code, provide:
## Dead Code Found
- `module.py:45` - Function `unused_helper` never called
- `utils.py:12-30` - Class `LegacyParser` not instantiated
## Duplications
- `api.py:20-35` ≈ `handlers.py:45-60` (90% similar)
Recommendation: Extract to `common.validate_request()`
## High Complexity
- `process.py:main_handler` - CC=18 (target: ≤10)
Recommendation: Split into `parse_input`, `transform`, `format_output`
## Recommended Actions
1. Remove `unused_helper` (safe, no usages)
2. Extract validation logic to reduce duplication
3. Refactor `main_handler` using guard clauses
What the command file sets; muted values are Claude Code's defaults
sonnet7-day visitors to each command page
npx claudepluginhub rpatrik96/research-agora --plugin toolkit8 commands in this plugin
/agora-feedbackOpt-in, review-gated usage feedback for Research Agora skills (RFC-0001).
Use when asked to "enable agora feedback", "share skill feedback",
"show my skill usage stats", "submit agora feedback", "report skill usage",
"disable feedback capture", or "purge my feedback spool".
Nothing is ever sent without the user reviewing the exact payload and
explicitly confirming.
/experiment-trackerSync ML experiment results to paper drafts. Use when asked to "update results",
"sync experiments", "pull latest metrics", "update tables from code",
"experiment to paper", "refresh results", or "sync paper with repo".
Extracts metrics from code/logs and updates paper sections.
/figuresMake publication figures for ML papers, in TikZ or matplotlib. Use when asked
to "create a figure", "make a plot", "visualize results", "draw a neural
network", "make a diagram in LaTeX", "TikZ flowchart", "architecture diagram",
"publication figure", "style matplotlib", or "format figures for a
conference". **tikz** draws diagrams whose content you describe; **plot**
renders data you supply, read from real files rather than invented.
/htcondorGenerate HTCondor submission files and wrapper scripts for ML research jobs.
Use when asked to "create condor job", "submit to cluster", "write .sub file",
"htcondor setup", "cluster job", or "batch submission". Supports GPU/CPU jobs,
parameter sweeps, multi-seed experiments, and ablation studies.
/latexBuild, debug and lint a LaTeX paper. Use when asked to "build the pdf",
"recompile", "compile the paper", "why won't my paper compile", "the pdf is
still the old version", "fix latex errors", "debug latex", "parse the log",
"fix LaTeX", "make LaTeX consistent", "check LaTeX style", or "standardize
notation". Three modes over one source tree: **build** compiles with latexmk
and proves the PDF is fresh, **debug** reads the log that build produced and
fixes what it reports, **lint** greps for house-style and notation violations.
/latex-syncKeep a paper's equations and the code implementing them in agreement, via the
latex-code-sync CLI. Use when asked to "set up latex-code-sync", "link
equations to code", "annotate functions with equations", "verify equations
match code", "check the paper against the implementation", or "does my code
match my math". Three modes of one workflow: **setup** bootstraps the package
and CI, **annotate** links functions to equations with decorators, **verify**
runs the checker and reports mismatches.
Other plugins' commands for the same job