From arn-code
This skill should be used when the user says "simplify", "arness code simplify", "simplify code", "code simplification", "clean up code", "reduce complexity", "remove duplication", "check for reuse", "find duplicates", "optimize code", "efficiency review", "simplify implementation", "arn-code-simplify", or wants to review recently implemented code for reuse opportunities, quality issues, and efficiency problems after execution completes. Do NOT use this for full implementation correctness review (use arn-code-review-implementation) or PR review (use arn-code-review-pr).
npx claudepluginhub appsvortex/arness --plugin arn-codeThis skill uses the workspace's default tool permissions.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Compares coding agents like Claude Code and Aider on custom YAML-defined codebase tasks using git worktrees, measuring pass rate, cost, time, and consistency.
Analyze recently implemented code for reuse opportunities, quality issues, and efficiency problems. Dispatches three parallel reviewers (code reuse, code quality, efficiency), merges findings, applies user-approved fixes with test verification, and generates a structured simplification report.
This is a post-execution quality improvement skill. It runs after implementation is complete (after execute-plan, swift, or bug-spec) and before review-implementation.
This is an execution skill. It runs in normal conversation (NOT plan mode).
If no ## Arness section exists in the project's CLAUDE.md, inform the user: "Arness is not configured for this project yet. Run /arn-implementing to get started — it will set everything up automatically." Do not proceed without it.
execute --> **arn-code-simplify** --> review-implementation --> document-project --> ship
Arness-simplify is an optional step between execution and review. It can be triggered:
Read the project's CLAUDE.md and extract the ## Arness section to find:
If the ## Arness section is missing, inform the user: "Arness is not configured for this project yet. Run /arn-implementing to get started — it will set everything up automatically." Do not proceed.
Load pattern documentation from the code patterns directory:
code-patterns.md (required)testing-patterns.md (required)architecture.md (required)ui-patterns.md (if it exists)security-patterns.md (if it exists)If pattern documentation is missing, invoke the arn-code-codebase-analyzer agent to generate fresh analysis. If the analyzer is unavailable, suggest running /arn-implementing to get started.
Hold this context for use throughout the workflow.
Read
${CLAUDE_PLUGIN_ROOT}/skills/arn-code-simplify/references/scope-detection.mdfor the full scope detection algorithm.
If invoked with an explicit scope (e.g., from arn-code-execute-task passing a report path): use the provided scope directly.
If invoked without explicit scope (standalone or wizard gate): auto-detect scope using the priority order defined in scope-detection.md (pipeline > swift > bugfix).
Build the file list from the scope's artifacts. Apply the 30-file cap. If more than 30 files, split into batches as described in scope-detection.md.
Confirm scope and file list with the user before proceeding.
Read
${CLAUDE_PLUGIN_ROOT}/skills/arn-code-simplify/references/review-prompts.mdfor the three reviewer prompt templates and output format.
Dispatch three Agent tool calls in a single message so they run in parallel:
Code Reuse Reviewer -- fill the review-prompts.md template with the file list and pattern documentation. Instruct the agent to focus on duplicated logic, missed utilities, and copy-paste patterns.
Code Quality Reviewer -- fill the template. Instruct the agent to focus on unnecessary complexity, dead code, unclear naming, and overly nested logic.
Efficiency Reviewer -- fill the template. Instruct the agent to focus on N+1 patterns, redundant computations, suboptimal data structures, and unnecessary allocations.
Each agent receives:
{files_to_review}: the file list for the current batch{code_patterns}: content of code-patterns.md{testing_patterns}: content of testing-patterns.md{architecture}: content of architecture.mdPartial failure handling: If one reviewer fails, merge findings from the other two. Record the failure in reviewerStatus with status "failed". Add a warning: "The [axis] reviewer failed. Findings may be incomplete for that axis."
If all files fit in a single batch, dispatch once. If batched, dispatch the three reviewers for each batch sequentially (batch 1 complete, then batch 2, etc.).
Collect findings from all three reviewers.
Deduplicate: if two reviewers flagged the same code location for overlapping reasons, merge into a single finding. Prefer the higher severity and note both axes.
Assign sequential IDs: SIM-001, SIM-002, etc.
Automatically defer findings with effort "large": set status to "deferred" and add a note suggesting a refactoring spec for strategic improvements.
Collect all patternsPreserved entries from all reviewers.
Present findings to the user grouped by axis:
Code Reuse Findings:
Code Quality Findings:
Efficiency Findings:
Deferred (large effort):
Patterns Preserved: N decisions respected documented patterns.
Auto-all mode check: Before prompting, check the resolved value of pipeline.simplification from the two-tier preference lookup. If the value is auto-all:
"approved")This mode is used by batch-implement workers that cannot prompt the user. It follows the same logic as the user selecting "all" but without requiring AskUserQuestion.
Interactive mode (all other preference values):
Ask the user which findings to apply:
"Which findings should I apply? Enter finding IDs (e.g., SIM-001, SIM-003), 'all' to apply everything except deferred, or 'none' to skip."
Process the user's selection:
"approved", rest as "rejected""all": mark all non-deferred findings as "approved""none": mark all as "rejected", skip to Step 7The user may also change individual finding statuses (e.g., "approve SIM-001 but defer SIM-003").
For each approved finding, in dependency order (if finding B depends on finding A's changes, apply A first):
Apply the suggested fix.
Run targeted tests relevant to the modified files:
If tests pass: mark the finding as "applied". Record in applicationResults.
If tests fail: attempt self-healing.
If tests still fail after 3 attempts: revert the changes for this specific finding. Mark as "reverted" with the failure reason. Record in applicationResults and testVerification.revertedFindings.
Proceed to the next finding regardless of whether this one was reverted.
After all approved findings are processed, run one final targeted test pass to verify the cumulative changes are consistent.
Read the SIMPLIFICATION_REPORT_TEMPLATE.json from the template path configured in ## Arness.
Populate all fields:
reportType: "simplification"projectName: from the scope contextscopeContext: "pipeline", "swift", "bugfix", or "task"reportDate: current ISO 8601 timestampreportVersion: 1configuration: files reviewed count, batch count, review axes used, pattern docs loadedfindings: all findings with their final statusespatternsPreserved: all pattern-preservation records from all reviewersapplicationResults: results for each applied findingtestVerification: test run summarysummary: counts of total, approved, rejected, applied, reverted, deferredreviewerStatus: status and finding count per reviewer axiswarnings: any warnings accumulated during the processnextSteps: context-dependent suggestionsWrite the report to the output path determined by scope detection.
Based on the scope context, offer the appropriate next step:
| Scope Context | Next Step Offer |
|---|---|
| Pipeline | "Run /arn-code-review-implementation to review the full implementation." |
| Swift | "Run /arn-code-ship to commit and create a PR." |
| Bugfix | "Run /arn-code-ship to commit and create a PR." |
| Task | "Simplification complete for this task. Returning to execution." |
## Arness config missing -- inform the user: "Arness is not configured for this project yet. Run /arn-implementing to get started."arn-code-codebase-analyzer to generate fresh analysis. If unavailable, suggest running /arn-implementing to get started.reportType, projectName, scopeContext, findings, summary, warnings, nextSteps) and warn the user: "Report template not found. Generated report with minimal structure. Run /arn-implementing to get started."summary.totalFindings: 0 and inform the user: "No simplification opportunities found. The implementation looks clean.""large" are always deferred, never applied during simplification.