/harness-build:code-simplificationfrom harness-build
Reduces complexity in working code while preserving exact behaviour, so it is easier to read, change and debug. Use when code works but is deeply nested, overlong, unclearly named or duplicated, when review flags readability, or when asked to simplify, clean up or flatten a function or module.
Ships in harness-build. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Simplify by lowering complexity with behaviour held identical. The goal is not fewer lines; it is code a new teammate understands faster than the original. That is the test for every change.
Do not use when the code is already clear, when you do not yet understand it, when the simpler form would be measurably slower in a hot path, or when the module is about to be rewritten.
Before changing or removing something, learn why it exists. Answer: what is its responsibility, what calls it and what does it call, what are the edge cases and error paths, which tests define its behaviour, why might it be written this way (performance, platform quirk, history), and what does git blame say about the original context. If you cannot answer these, read more first.
Structure
| Signal | Remedy |
|---|---|
| Nesting of 3+ levels | Guard clauses or helper functions |
| Functions of 50+ lines doing several things | Split into named functions |
| Nested ternaries | if/else, switch or lookup table |
| Boolean flag parameters | Options object or separate functions |
| Same condition repeated | A named predicate |
Naming
| Signal | Remedy |
|---|---|
Generic names (data, temp, item) | Name the content |
| Cryptic abbreviations | Full words unless universal (id, url) |
Name contradicts behaviour (a get that mutates) | Rename to match |
| Comment restating the code | Delete it |
| Comment explaining why | Keep it |
Redundancy
| Signal | Remedy |
|---|---|
| 5+ duplicated lines | Shared function |
| Dead code | Remove after confirming it is dead |
| Wrapper that adds nothing | Inline it |
| Factory of factories, one-strategy strategy | Direct approach |
| Redundant type assertions | Remove |
Make a change, run the tests, commit if green, revert and rethink if red. Never batch several untested simplifications. Keep refactors separate from feature or fix work. If a refactor would touch over 500 lines, automate it (codemod or AST transform) rather than editing by hand.
Is the result genuinely easier to follow? Any new patterns foreign to the codebase? Is the diff clean? Would a teammate approve? If it is harder to review or read, revert; not every attempt succeeds.
// Redundant async wrapper
async function getUser(id: string) { return await userService.findById(id); }
// becomes
function getUser(id: string) { return userService.findById(id); }
// Manual filter loop becomes
const activeUsers = users.filter((u) => u.isActive);
// Redundant boolean return
return input.length > 0 && input.length < 100;
# Nested conditionals become guard clauses
def process(data):
if data is None:
raise TypeError("Data is None")
if not data.is_valid():
raise ValueError("Invalid data")
if not data.has_permission():
raise PermissionError("No permission")
return do_work(data)
In UI code, collapse duplicated conditional rendering into computed values. Prop drilling is a judgment call (context or composition may fit better); flag it rather than auto-refactor.
| Rationalization | Reality |
|---|---|
| "It works, leave it" | Hard-to-read working code is hard to fix when it breaks. |
| "Fewer lines is simpler" | A one-line nested ternary is not simpler than five clear lines. |
| "Let me tidy this unrelated code too" | Noisy diffs and regression risk. |
| "Types document it" | Types show structure, not intent. |
| "This abstraction might be useful later" | Speculative abstraction is cost; remove it, re-add when needed. |
| "The author must have had a reason" | Maybe; check blame. Often it is residue of rushed iteration. |
| "I'll refactor while adding the feature" | Separate them. |
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub nx1-org/platformnex-abilities --plugin harness-build8 skills in this plugin
/api-and-interface-designGuides design of stable interfaces that are hard to misuse, covering REST and GraphQL endpoints, module boundaries, type contracts, errors, pagination and idempotency. Use when designing or changing any public interface, or when drawing the boundary between frontend and backend or between modules./context-engineeringCurates what an agent sees (rules files, specs, source, errors, history) so output stays accurate and on-convention. Use when starting a session, when output quality drops or ignores conventions, when switching tasks or areas of a codebase, or when setting up rules and context for a project./doubt-driven-developmentCross-examines non-trivial decisions with a fresh-context, adversarial reviewer before they stand. Use when stakes are high (auth, security logic, migrations, irreversible operations), when working in unfamiliar code, when stress-testing a plan, or whenever a confident answer is cheaper to challenge now than to debug later./frontend-ui-engineeringBuilds accessible, responsive, design-system-consistent user interfaces with proper state, loading, empty and error handling. Use when creating or changing components, pages or layouts, managing UI state, meeting accessibility requirements, or when output must look production-grade rather than generic./git-workflow-and-versioningStructures git practice: atomic commits, clear messages, short-lived branches, worktrees, pre-commit hygiene, semantic versioning, tags and changelogs. Use when committing, branching, splitting a messy working tree into clean commits, writing a commit message or changelog entry, opening or reviewing a pull request, or cutting a release./incremental-implementationDelivers changes as thin, verified slices instead of one large pass. Use when implementing any change that spans more than one file, picking up the next task from a plan, hiding unfinished work behind a flag, or when a task feels too big to land in one step.2 plugins ship this exact skill · first indexed Nov 17, 2026