ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
Official Verified

code-refinement

Improve code quality: duplication, efficiency, clean code, architectural fit, and error handling

skill-install — Terminal

Install via CLI (Recommended)

clawhub install openclaw/skills/skills/athola/nm-pensive-code-refinement
Or

Night 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

#DimensionModuleWhat It Catches
1Duplication & Redundancyduplication-analysisNear-identical blocks, similar functions, copy-paste
2Algorithmic Efficiencyalgorithm-efficiencyO(n^2) where O(n) works, unnecessary iterations
3Clean Code Violationsclean-code-checksLong methods, deep nesting, poor naming, magic values
4Architectural Fitarchitectural-fitParadigm mismatches, coupling violations, leaky abstractions
5Anti-Slop Patternsclean-code-checksPremature abstraction, enterprise cosplay, hollow patterns
6Error Handlingclean-code-checksBare excepts, swallowed errors, happy-path-only

Progressive Loading

Load modules based on refinement focus:

  • modules/duplication-analysis.md (~400 tokens): Duplication detection and consolidation
  • modules/algorithm-efficiency.md (~400 tokens): Complexity analysis and optimization
  • modules/clean-code-checks.md (~450 tokens): Clean code, anti-slop, error handling
  • modules/architectural-fit.md (~400 tokens): Paradigm alignment and coupling

Load all for comprehensive refinement. For focused work, load only relevant modules.

Required TodoWrite Items

  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

Workflow

Step 1: Establish Context (refine:context-established)

Metadata

Author@athola
Stars4473
Views0
Updated2026-05-01
View Author Profile
AI Skill Finder

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 skill
Add to Configuration

Paste this into your clawhub.json to enable this plugin.

{
  "plugins": {
    "official-athola-nm-pensive-code-refinement": {
      "enabled": true,
      "auto_update": true
    }
  }
}
Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.