shiny-palm-tree
drgaciw/shiny-palm-tree
A suite of Claude Code **skills** (deterministic measurement scripts + guidance) and **subagents** (orchestration roles) that measure software-quality metrics on legacy Java codebases and turn the measurements into prioritized, pattern-mapped refactoring plans.
Instalação
npx convez-ai drgaciw/shiny-palm-tree1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
README
A tradução para o português deste README ainda está na fila.
Java Quality Metrics — Skills & Agents Suite
A suite of Claude Code skills (deterministic measurement scripts + guidance) and subagents (orchestration roles) that measure software-quality metrics on legacy Java codebases and turn the measurements into prioritized, pattern-mapped refactoring plans.
Core principle: scripts measure, the model interprets. Every metric is computed by a parser-based script (tree-sitter-java, no JVM); the LLM does prioritization and refactoring recommendation. All skills emit one common JSON schema so they compose without glue code.
Install
pip install -r requirements.txt
python tests/run_all.py # 37 golden assertions + 2 integration tests
Layout
common/javametrics/ shared parser, kernels, schema, thresholds loader, CLI
common/thresholds.yaml band boundaries + breach rules (one profile per codebase)
tools/merge_metrics.py join multiple metric JSONs on (file, class, method)
skills/<name>/ SKILL.md + scripts/ + tests/ + reference.md
agents/<name>.md subagent definitions
tests/run_all.py full test battery
Skills
| Skill | Granularity | Output |
|---|---|---|
| cyclomatic-complexity-java | method | v(G) + size guards (loc, params, nesting) |
| halstead-metrics-java | method/class | Volume, Difficulty, Effort/Time/Bugs |
| cognitive-complexity-java | method | SonarSource cognitive complexity |
| ck-metrics-java | class | WMC, DIT, NOC, CBO, RFC, LCOM4 + class_loc |
| maintainability-index-java | class | MI (composes Halstead V + v(G) + LOC) |
| hotspot-analysis | file | churn × complexity rank, + JaCoCo coverage |
| refactoring-advisor | target | signature → pattern plan |
Every measurement script runs standalone and emits the common schema:
python skills/cyclomatic-complexity-java/scripts/cyclomatic.py --path src/ --format json
Agents & orchestration flow
main session
├─▶ metrics-scanner (read-only) ─┐ run in parallel, shard large repos
└─▶ hotspot-ranker (read-only) ─┘
│
▼
refactoring-planner (plan mode, no writes)
│
human approval
│
implementation (main session / ddd-refactoring)
│
▼
refactoring-verifier (read-only) — re-measure, diff, confirm no regression
- metrics-scanner — fan out skills 1–5, merge, flag breaches.
- hotspot-ranker — churn-anchored prioritized backlog.
- refactoring-planner — per-target plan with expected metric delta.
- refactoring-verifier — post-change gate; catches complexity relocation.
End-to-end pipeline (manual)
P=src/
python skills/cyclomatic-complexity-java/scripts/cyclomatic.py --path $P > vg.json
python skills/halstead-metrics-java/scripts/halstead.py --path $P > hal.json
python skills/cognitive-complexity-java/scripts/cognitive.py --path $P > cog.json
python skills/ck-metrics-java/scripts/ck.py --path $P > ck.json
python skills/maintainability-index-java/scripts/mi.py --path $P > mi.json
python tools/merge_metrics.py vg.json hal.json cog.json ck.json mi.json > merged.json
python skills/hotspot-analysis/scripts/hotspot.py --repo . --metrics merged.json \
--since "12 months ago" --coverage jacoco.csv > hotspot.json
python skills/refactoring-advisor/scripts/advise.py --metrics merged.json \
--hotspot hotspot.json --format table
Design constraints
- Metrics are a compass, not a gate. Skills report risk bands; they never auto-fail a build (Goodhart's law). The advisor flags when a metric is being gamed (e.g. method splitting that relocates complexity).
- Thresholds live in
thresholds.yaml, not in skill prose — calibrate per codebase. If >40% of methods land in the worst band, tune thresholds, don't mass-refactor. - Measurement agents are read-only. Only the human-approved refactoring loop touches source; the verifier re-measures afterward.
- Known weak signals are demoted: Halstead Effort/Time/Bugs are indicative only; MI is a trend number (1990s regression constants), never an absolute grade.
- Conventions are pinned in each skill's
reference.md(Halstead operator/operand split, decision-point counting, cognitive increments) — golden fixtures encode hand-computed values so the conventions can't silently drift.