code-refinement
Improve code quality: duplication, efficiency, clean code, architectural fit, and error handling
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/athola/nm-pensive-code-refinementNight Market Skill — ported from claude-night-market/pensive. For the full experience with agents, hooks, and commands, install the Claude Code plugin.
Table of Contents
- Quick Start
- When to Use
- Analysis Dimensions
- Progressive Loading
- Required TodoWrite Items
- Workflow
- Tiered Analysis
- Cross-Plugin Dependencies
Code Refinement Workflow
Analyze and improve living code quality across six dimensions.
Quick Start
/refine-code
/refine-code --level 2 --focus duplication
/refine-code --level 3 --report refinement-plan.md
When To Use
- After rapid AI-assisted development sprints
- Before major releases (quality gate)
- When code "works but smells"
- Refactoring existing modules for clarity
- Reducing technical debt in living code
When NOT To Use
- Removing dead/unused code (use conserve:bloat-detector)
- Removing dead/unused code (use conserve:bloat-detector)
Analysis Dimensions
| # | 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 |
Progressive Loading
Load modules based on refinement focus:
modules/duplication-analysis.md(~400 tokens): Duplication detection and consolidationmodules/algorithm-efficiency.md(~400 tokens): Complexity analysis and optimizationmodules/clean-code-checks.md(~450 tokens): Clean code, anti-slop, error handlingmodules/architectural-fit.md(~400 tokens): Paradigm alignment and coupling
Load all for comprehensive refinement. For focused work, load only relevant modules.
Required TodoWrite Items
refine:context-established— Scope, language, framework detectionrefine:scan-complete— Findings across all dimensionsrefine:prioritized— Findings ranked by impact and effortrefine:plan-generated— Concrete refactoring plan with before/afterrefine:evidence-captured— Evidence appendix perimbue:proof-of-work
Workflow
Step 1: Establish Context (refine:context-established)
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-athola-nm-pensive-code-refinement": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
extract
Analyze a codebase and build a knowledge base of business logic, architecture, data flow, and engineering patterns. The foundation for gauntlet challenges and agent integration
discourse
>- Scan community discussion channels (HN, Lobsters, Reddit, tech blogs) for experience reports and opinions on a topic
synthesize
>- Merge, deduplicate, rank, and format research findings from multiple channels into a coherent report. Use after research agents return their results
workflow-monitor
Detect workflow failures and inefficient patterns, then create GitHub issues for improvement via /fix-workflow
architecture-paradigm-hexagonal
Hexagonal (Ports and Adapters) architecture isolating domain logic from infrastructure