claude-code-plugin-ref…
Explain plugin, skill, command, agent, and hook mechanics used here. Use when authoring or debugging plugins. Do not use for ops; use night-market-operations.
Improves code quality across duplication, efficiency, and architectural fit. Use when code passes tests but quality is poor or before a major release.
$ npx -y skills add athola/claude-night-market --skill code-refinement --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/code-refinementContext preview
The summary Claude sees to decide when to auto-load this skill.
Improves code quality across duplication, efficiency, and architectural fit. Use when code passes tests but quality is poor or before a major release.
name: code-refinement description: Improves code quality across duplication, efficiency, and architectural fit. Use when code passes tests but quality is poor or before a major release. alwaysApply: false category: code-quality tags: - refactoring - clean-code - algorithms - duplication - anti-slop - craft tools: [] usage_patterns: - code-quality-improvement - duplication-reduction - algorithm-optimization - clean-code-enforcement complexity: advanced model_hint: deep estimated_tokens: 350 progressive_loading: true dependencies: - pensive:safety-critical-patterns - imbue:proof-of-work - imbue:justify - imbue:review-core - imbue:structured-output modules: - modules/duplication-analysis.md - modules/algorithm-efficiency.md - modules/clean-code-checks.md - modules/architectural-fit.md - modules/insight-generation.md
Analyze and improve living code quality across six dimensions.
/refine-code /refine-code --level 2 --focus duplication /refine-code --level 3 --report refinement-plan.md
dead/unused code (use conserve:bloat-detector)
| # | Dimension | Module | What It Catches | |---|-----------|--------|----------------| | 1 | Duplication & Redundancy | `duplication-analysis` | Near-identical blocks, similar functions, copy-paste | | 2 | Algorithmic Efficiency | `algorithm-efficiency` | O(n^2) where O(n) works, unnecessary iterations | | 3 | Clean Code Violations | `clean-code-checks` | Long methods, deep nesting, poor naming, magic values | | 4 | Architectural Fit | `architectural-fit` | Paradigm mismatches, coupling violations, leaky abstractions | | 5 | Anti-Slop Patterns | `clean-code-checks` | Premature abstraction, enterprise cosplay, hollow patterns | | 6 | Error Handling | `clean-code-checks` | Bare excepts, swallowed errors, happy-path-only | | 7 | Additive Bias | `imbue:justify` | Workarounds over root fixes, test tampering, unnecessary additions |
Detection patterns for plugin and skill codebases where standard code quality heuristics miss structural issues.
A skill that declares "delegates to X" but still carries the full template body is doing double duty. The delegating skill should be a thin wrapper (under 30 lines) that routes to the target. Flag any delegating skill whose body exceeds 50 lines.
Flag skills with 10+ module files where 40% or more of content overlaps. Signal: two modules covering the same API surface from different angles (e.g., both describing the same config options or the same CLI flags).
Flag individual module files exceeding 500 lines as candidates for splitting or trimming. Large modules defeat progressive loading by forcing full-file reads for partial information.
Skills referencing Python commands (`python -m module.name` or `python -c "from module import ..."`) where the referenced module does not exist in the plugin's `src/` directory. These are stale references to renamed or removed code.
Load modules based on refinement focus:
Load all for thorough refinement. For focused work, load only relevant modules.
1. `refine:context-established`: Scope, language, framework detection 2. `refine:scan-complete`: Findings across all dimensions 3. `refine:prioritized`: Findings ranked by impact and effort 4. `refine:plan-generated`: Concrete refactoring plan with before/after 5. `refine:evidence-captured`: Evidence appendix per `imbue:proof-of-work` 6. `refine:findings-verified`: Citations confirmed by `citation_verifier.py` 7. `refine:execution-complete`: All wave-listed candidates closed-or-rationale'd (only required when invocation includes "execute findings" or stronger; see Step 6)
Detect project characteristics:
# Language detection find . -not -path "*/.venv/*" -not -path "*/__pycache__/*" \ -not -path "*/node_modules/*" -not -path "*/.git/*" \ \( -name "*.py" -o -name "*.ts" -o -name "*.rs" -o -name "*.go" \) \ | head -20 # Framework detection ls package.json pyproject.toml Cargo.toml go.mod 2>/dev/null # Size assessment find . -not -path "*/.venv/*" -not -path "*/__pycache__/*" \ -not -path "*/node_modules/*" -not -path "*/.git/*" \ \( -name "*.py" -o -name "*.ts" -o -name "*.rs" \) \ | xargs wc -l 2>/dev/null | tail -1
Load relevant modules and execute analysis per tier level. For dimension 7 (Additive Bias), run `Skill(imbue:justify)` to compute the bias score, check Iron Law compliance, and flag unnecessary additions or workarounds.
Rank findings by:
A plugin marketplace for Claude Code. Install only the plugins you need to run git workflows, code review, spec-driven development, and autonomous agents from inside your Claude Code session.
Explain plugin, skill, command, agent, and hook mechanics used here. Use when authoring or debugging plugins. Do not use for ops; use night-market-operations.
States load-bearing decisions, invariants, and weak points. Use when judging a design change. Do not use for gating; use night-market-change-control.
Rebuild the dev environment: uv, Python tiers, pins, traps. Use when onboarding or toolchain breaks. Do not use for daily commands; use night-market-operations.
Classify, gate, and review changes. Use when landing a PR, releasing, or amending rules. Do not use for failure triage; use night-market-debugging-playbook.
Search and record project memory (Discussions, journal, ADRs). Use before re-investigating anything. Do not use for settled battles; see failure-archaeology.
Bind loop 'done' to unfakeable gates. Use to harden egregore/herald loops or promote completion_integrity. Not for QA gates; use night-market-validation-and-qa.