From arn-code
This skill should be used when the user says "batch simplify", "cross-feature simplify", "batch simplification", "simplify all features", "cross-feature quality pass", "batch code cleanup", "consolidate across features", "deduplicate across features", "cleanup after batch merge", "cross-feature deduplication", "arness batch simplify", "arn-code-batch-simplify", "simplify merged features", "post-merge simplify", "find cross-feature duplication", or wants to run a post-merge quality pass that finds duplication and consolidation opportunities across independently implemented features. This requires merged features in .arness/plans/ — run arn-code-batch-merge first if none are merged.
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.
Post-merge cross-feature quality pass that finds duplication and consolidation opportunities across independently implemented features. Uses the same 3-reviewer pattern as regular simplify but with cross-feature context so reviewers can identify duplicated utilities, inconsistent patterns, and shared logic that emerged from parallel development.
This is an execution skill. It runs in normal conversation (NOT plan mode).
Pipeline position:
arn-code-batch-merge -> **arn-code-batch-simplify** -> (optional: review-implementation -> document-project -> ship)
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.
Read ${CLAUDE_PLUGIN_ROOT}/skills/arn-code-ensure-config/references/ensure-config.md and follow its instructions. Extract from ## Arness:
.arness/plans).arness).arness/templates)Hold these values for the remainder of the workflow.
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 any required pattern doc 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 all loaded pattern documentation for use throughout the workflow.
Scan the plans directory for CHANGE_RECORD.json files across all feature subdirectories:
For each CHANGE_RECORD.json found, check:
commitHash is populated (feature was committed)gh pr view if nextSteps contains a PR URL, or verify the feature branch was merged into main via git branch --merged mainFor each merged feature's CHANGE_RECORD.json, collect:
filesModified — files that were changedfilesCreated — files that were addedprojectName — the feature nameceremonyTier — the ceremony level usedchangePath — path to the feature's plan directoryBuild the unified file list: union of all filesModified + filesCreated across all merged features, deduplicated. Exclude files that no longer exist on disk (verify with test -f).
Build the overlap map: for each file that appears in 2+ features, record which features touch it. These are priority review targets.
Exit conditions:
/arn-code-batch-merge first." and exit.Display the batch scope summary:
Cross-Feature Simplification Scope:
| Feature | Tier | Files |
|---------|------|-------|
| F-003 Auth | thorough | 12 |
| F-005 API | standard | 5 |
| F-008 Settings | thorough | 8 |
Total unique files: [N] (across [M] features)
Files touched by 2+ features: [K] (priority review)
Ask (using AskUserQuestion): "Proceed with cross-feature simplification?"
If the user selects "Skip", exit gracefully.
Read ${CLAUDE_PLUGIN_ROOT}/skills/arn-code-batch-simplify/references/cross-feature-prompts.md for the extended reviewer prompt templates.
Build the {cross_feature_context} block from the data collected in Step 2 — listing each feature's name, its files, and its change record path.
Dispatch three Agent tool calls in a single message so they run in parallel:
Code Reuse Reviewer — fill the cross-feature-prompts.md template with the file list, pattern documentation, and cross-feature context. Instruct the agent to focus on duplicated logic, missed utilities, and copy-paste patterns, with special attention to utilities created independently by different features.
Code Quality Reviewer — fill the template. Instruct the agent to focus on unnecessary complexity, dead code, unclear naming, and overly nested logic, with special attention to inconsistent approaches to the same pattern across features.
Efficiency Reviewer — fill the template. Instruct the agent to focus on N+1 patterns, redundant computations, suboptimal data structures, and unnecessary allocations, with special attention to redundant API clients, validators, or error handlers across features.
Each agent receives:
{files_to_review}: the unified file list{code_patterns}: content of code-patterns.md{testing_patterns}: content of testing-patterns.md{architecture}: content of architecture.md{cross_feature_context}: the cross-feature context blockReviewer agent tools: Each reviewer agent should be granted only read-only tools: Read, Grep, Glob.
30-file cap with batching: If more than 30 files in the unified list, batch by grouping related files. Prioritize files touched by 2+ features in the first batch. Dispatch the three reviewers for each batch sequentially (batch 1 complete, then batch 2, etc.).
Partial 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 three reviewers fail, inform the user that cross-feature simplification analysis could not be completed. Suggest retrying.
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.
Tag each finding based on its affectedFeatures array:
affectedFeatures contains 2+ featuresaffectedFeatures contains exactly 1 featureCollect all patternsPreserved entries from all reviewers.
Present findings grouped by cross-feature vs single-feature:
Cross-Feature Findings (spanning 2+ features):
Single-Feature Findings:
Deferred (large effort):
Patterns Preserved: N decisions respected documented patterns.
If zero findings from all reviewers: inform the user "No cross-feature simplification opportunities found. The implementation looks clean across all features." and skip to Step 8.
Auto-all mode check: Read pipeline.simplification using the two-tier preference lookup (see ${CLAUDE_PLUGIN_ROOT}/skills/arn-code-ensure-config/references/preferences-schema.md). If the resolved value is auto-all:
"approved")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 8The 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 {template_path}/BATCH_SIMPLIFICATION_REPORT_TEMPLATE.json where {template_path} is the template path extracted in Step 0. If the template file does not exist at the configured path, fall back to ${CLAUDE_PLUGIN_ROOT}/skills/arn-code-save-plan/report-templates/default/BATCH_SIMPLIFICATION_REPORT_TEMPLATE.json.
Populate all fields:
reportType: "batch-simplification"reportDate: current ISO 8601 timestampreportVersion: 1batchFeatures: array of objects, one per merged feature, containing projectName, ceremonyTier, fileCount, changePathcrossFeatureFindings: count of findings that span 2+ featuressingleFeatureFindings: count of findings that span exactly 1 featureconfiguration: 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 summary including revertedFindingssummary: 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 .arness/plans/BATCH_SIMPLIFICATION_REPORT.json (not inside a feature-specific directory — this spans all features).
If BATCH_SIMPLIFICATION_REPORT_TEMPLATE.json is missing from the template path, generate the report with a minimal structure (reportType, batchFeatures, crossFeatureFindings, findings, summary, warnings, nextSteps) and warn the user: "Report template not found. Generated report with minimal structure."
If any fixes were applied (at least one finding has status "applied"):
Ask (using AskUserQuestion):
"Simplification fixes applied. Run the project's test suite to verify nothing is broken?"
Options:
If Yes, run tests:
Create a separate branch for the simplification — do NOT commit directly to main:
git checkout -b batch-simplify/<date>
Stage all modified files and create a commit:
[batch-simplify] Cross-feature quality improvements
Consolidated [N] findings across [M] features.
[K] cross-feature duplications resolved.
Push the branch and create a PR:
git push -u origin batch-simplify/<date>
github: gh pr create --title "[batch-simplify] Cross-feature quality improvements" --body "<summary of applied findings>"bitbucket: bkt pr create --title "[batch-simplify] Cross-feature quality improvements" --description "<summary>" --source batch-simplify/<date> --destination mainnone: push only, inform user to merge manuallyPresent the PR URL to the user: "Simplification changes are on a separate branch with a PR to main. Review and merge when ready."
Return to main:
git checkout main
If no fixes were applied (all findings were rejected, deferred, or reverted), skip the commit entirely.
## 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.summary.totalFindings: 0 and inform the user: "No cross-feature simplification opportunities found. The implementation looks clean across all features."/arn-code-batch-merge first.""large" are always deferred, never applied during simplification..arness/plans/BATCH_SIMPLIFICATION_REPORT.json, not inside any feature subdirectory.