alekspetrov/navigator/nav-simplify
Claude Code and agent skill by alekspetrov/navigator
- community
Checking that the SKILL.md file is still in the repository.
Simplify and refine code for clarity, consistency, and maintainability while preserving all functionality. Focuses on recently modified code. Auto-invoke after implementation skills or on-demand.
Install
npx vskill@latest install alekspetrov/navigator/nav-simplifySKILL.md
Navigator Code Simplification Skill
Simplify recently modified code for clarity, consistency, and maintainability while preserving exact functionality. Based on Anthropic's internal code-simplifier pattern.
Core Principle
Clarity over brevity. Functionality preserved absolutely.
You are an expert code simplification specialist. Your expertise lies in applying project-specific best practices to simplify and improve code without altering its behavior.
When to Invoke
Auto-invoke after:
backend-endpointskill completesfrontend-componentskill completesdatabase-migrationskill completes- Any implementation task with code changes
Manual invoke when user says:
- "simplify this code"
- "review for clarity"
- "clean up recent changes"
- "refactor for readability"
- "simplify modified files"
DO NOT invoke if:
- No code was modified (docs-only changes)
- User explicitly says "skip simplification"
- Files are configuration only (JSON, YAML)
Execution Steps
Step 1: Identify Modified Code
Option A: Git-based detection (preferred)
Option B: User-specified scope
If user mentions specific files or directories, use those instead.
Option C: Recent conversation context
Analyze conversation for files that were written/edited in this session.
Step 2: Load Simplification Configuration
Check for project-specific configuration:
Default configuration:
Autonomous context check (CRITICAL)
After loading config, determine the invocation mode:
Autonomous (no human in the loop):
- Invoked from
nav-loopVERIFY or COMPLETE phase - Invoked from
nav-workflowCOMPLETE phase NAV_AUTONOMOUS=1env var set- Triggered by autonomous-completion protocol
Interactive (human reviewing):
- Direct user request ("simplify this code")
- Mid-implementation manual invocation
Decision matrix:
auto_apply | Context | Action | |
|---|---|---|---|
true | autonomous | Apply directly (Step 7 silent) | |
true | interactive | Apply directly, show summary | |
false | autonomous | SKIP simplification entirely — emit warning, return to caller. Never pause an autonomous flow waiting for approval. | |
false | interactive | Show diff per file, prompt for approval |
When skipping in autonomous-mode-with-false, emit:
Step 3: Read Project Standards
Load from CLAUDE.md (required):
Extract coding standards:
- Preferred patterns (function vs arrow, explicit returns)
- Naming conventions
- Import ordering
- Error handling patterns
- Framework-specific guidelines
Step 4: Analyze Each File
For each modified file, analyze for simplification opportunities:
Complexity Indicators (look for):
- Deep nesting (> 3 levels)
- Long functions (> 50 lines)
- Redundant code patterns
- Unclear variable names
- Nested ternary operators
- Over-abstraction
- Dead code
- Inconsistent patterns
Run analysis:
Step 4.5: ROI Gate (when scoring.mode = "roi")
If simplification.scoring.mode is "roi" in .agent/.nav-config.json (or --scoring roi was passed), the analyzer emits benefit_score, cost_score, roi_score, and a gate_action field. Honor the gate:
gate_action | Behavior | |
|---|---|---|
skip | Skip this file. Emit a one-line reason with ROI math. Continue to next file. | |
suggest | Force interactive mode for this file regardless of auto_apply. Show diff + reason. | |
apply | Proceed with Step 5+ as normal (honor auto_apply). |
Skip emission format:
{reason} summarizes the dominant cost factor (e.g., "stable file (412 days), 8 import references" or "below skip_below threshold").
Mode is opt-in. When scoring.mode == "complexity" (default), Step 4.5 is a no-op and behavior is unchanged from prior versions.
Step 5: Apply Simplification Rules
Anthropic Simplification Rules:
- Preserve Functionality: Never change what the code does - only how it does it. All original features, outputs, and behaviors must remain intact.
- Apply Project Standards: Follow CLAUDE.md coding standards:
- Use ES modules with proper import sorting
- Prefer
functionkeyword over arrow functions (if project standard) - Use explicit return type annotations
- Follow proper React/Vue component patterns
- Use proper error handling patterns
- Maintain consistent naming conventions
- Enhance Clarity:
- Reduce unnecessary complexity and nesting
- Eliminate redundant code and abstractions
- Improve readability through clear names
- Consolidate related logic
- Remove unnecessary comments that describe obvious code
- AVOID nested ternary operators - use switch/if-else
- Choose clarity over brevity - explicit > compact
- Maintain Balance - Avoid over-simplification that could:
- Reduce code clarity or maintainability
- Create overly clever solutions
- Combine too many concerns
- Remove helpful abstractions
- Prioritize "fewer lines" over readability
- Make code harder to debug or extend
Step 6: Generate Simplified Code
For each file with improvements:
- Read current file content
- Apply simplification rules
- Verify functionality unchanged (logic review)
- Generate diff or replacement
Output format:
- const result = a ? (b ? c : d) : e;
- let result;
- if (a && b) {
- result = c;
- } else if (a) {
- result = d;
- } else {
- result = e;
- }
Step 7: Apply Changes
Branch on the decision matrix from Step 2:
Autonomous + `auto_apply: false`: skip entirely, emit the warning, return.
Autonomous + `auto_apply: true`: apply each change directly with Edit(). Do not prompt.
Interactive + `auto_apply: true`: apply directly, show summary at end.
Interactive + `auto_apply: false`: show diff per file, prompt Apply this change? [y/N], apply only on yes.
When applying:
Step 8: Generate Summary
Predefined Functions
scripts/code_analyzer.py
Purpose: Analyze code file for simplification opportunities
Arguments:
--file: Path to file to analyze--standards: Path to CLAUDE.md (optional)--output: Output format (json, text)
Returns:
When invoked with --scoring roi (or simplification.scoring.mode == "roi"), the output additionally contains:
scripts/simplification_rules.py
Purpose: Apply project-specific simplification rules
Arguments:
--file: Path to file--claude-md: Path to CLAUDE.md for project standards--dry-run: Preview changes without applying
Returns: Simplified code with change annotations
scripts/change_reporter.py
Purpose: Generate human-readable change summary
Arguments:
--changes: JSON array of changes made--format: Output format (markdown, text, json)
Returns: Formatted change report
Configuration Options
Add to .agent/.nav-config.json:
Options:
enabled: Enable/disable simplificationtrigger: "manual" | "post-implementation" | "pre-commit"scope: "modified" | "staged" | "all"model: Preferred model for simplification (opus recommended)skip_patterns: Glob patterns to skipmax_file_size: Skip files larger than this (bytes)auto_apply: Apply changes without confirmationpreserve_comments: Keep meaningful commentsrules: Specific simplification rulesscoring.mode:"complexity"(legacy, default) or"roi"(opt-in cost/benefit gating)scoring.skip_below: ROI threshold below which files are skipped entirelyscoring.auto_apply_at: ROI threshold at and above which auto-apply is honoredscoring.cost_floor: Minimum cost denominator to prevent ROI explosions
Integration Points
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/nav-simplify/SKILL.md
Popularity
- Repository stars
- 195
- Repository forks
- 10
- 7-day trend score
- 26
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 23 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/alekspetrov/navigator/nav-simplify)