backend-endpoint
Create REST/GraphQL API endpoint with validation, error handling, and tests. Auto-invoke when user says "add endpoint", "create API", "new route", or "add…
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.
$ npx -y skills add alekspetrov/navigator --skill nav-simplify --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/nav-simplifyContext preview
The summary Claude sees to decide when to auto-load this skill.
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.
name: nav-simplify description: 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. allowed-tools: Read, Write, Edit, Bash, Glob, Grep version: 1.0.0 model: opus
Simplify recently modified code for clarity, consistency, and maintainability while preserving exact functionality. Based on Anthropic's internal code-simplifier pattern.
**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.
**Auto-invoke after**:
**Manual invoke when user says**:
**DO NOT invoke if**:
**Option A: Git-based detection (preferred)**
# Get files modified in current session/commits git diff --name-only HEAD~3 -- '*.ts' '*.tsx' '*.js' '*.jsx' '*.py' '*.go' '*.rs' 2>/dev/null || \ git diff --name-only --cached -- '*.ts' '*.tsx' '*.js' '*.jsx' '*.py' '*.go' '*.rs' 2>/dev/null || \ git diff --name-only -- '*.ts' '*.tsx' '*.js' '*.jsx' '*.py' '*.go' '*.rs'
**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.
Check for project-specific configuration:
if [ -f ".agent/.nav-config.json" ]; then
python3 -c "import json; c=json.load(open('.agent/.nav-config.json')); s=c.get('simplification',{}); print('auto_apply=' + str(s.get('auto_apply', False)).lower()); print('enabled=' + str(s.get('enabled', True)).lower())"
fiDefault configuration:
{
"simplification": {
"enabled": true,
"trigger": "post-implementation",
"scope": "modified",
"model": "opus",
"skip_patterns": ["*.test.*", "*.spec.*", "*.md", "*.json", "*.yaml"],
"max_file_size": 50000,
"auto_apply": false,
"preserve_comments": true
}
}After loading config, determine the invocation mode:
**Autonomous** (no human in the loop):
**Interactive** (human reviewing):
**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:
⚠️ nav-simplify skipped: auto_apply=false but invoked autonomously. To enable: set simplification.auto_apply=true in .agent/.nav-config.json To disable cleanly: set simplification.enabled=false
**Load from CLAUDE.md** (required):
Read(file_path: "CLAUDE.md")
Extract coding standards:
For each modified file, analyze for simplification opportunities:
**Complexity Indicators** (look for):
**Run analysis**:
PLUGIN_DIR="${CLAUDE_PLUGIN_ROOT:-$HOME/.claude/plugins/cache/navigator-marketplace/navigator}"
[ -d "$PLUGIN_DIR" ] || PLUGIN_DIR="$HOME/.claude/plugins/marketplaces/navigator-marketplace"
# Pass --scoring roi to enable cost/benefit gating (default: complexity,
# legacy behavior).
python3 "$PLUGIN_DIR/skills/nav-simplify/scripts/code_analyzer.py" --file "$file" --scoring roiIf `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**:
⏭️ {file} — low ROI (B={B}/10, C={C}/10, ROI={R}). Skipping.
{reason}`{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.
**Anthropic Simplification Rules**:
1. **Preserve Functionality**: Never change what the code does - only how it does it. All original features, outputs, and behaviors must remain intact.
2. **Apply Project Standards**: Foll
Finish What You Start Sessions that last. AI that learns. Features that ship.
Repo: alekspetrov/navigator
Create REST/GraphQL API endpoint with validation, error handling, and tests. Auto-invoke when user says "add endpoint", "create API", "new route", or "add…
Generate backend tests (unit, integration, mocks) for existing code. Auto-invoke when user says "write test for", "add test", "test this", or "create test".
Create database migration with schema changes and rollback. Auto-invoke when user says "create migration", "add table", "modify schema", or "change database".
Create React/Vue component with TypeScript, tests, and styles. Auto-invoke when user says "create component", "add component", "new component", or "build…
Generate frontend component tests (React Testing Library, Vue Test Utils, snapshot) for existing components. Auto-invoke when user says "test this component",…
Render a one-screen intent brief (Goal/Scope/Approach/Limits/Verify/Won't-do/Contradiction) before implementing ambiguous task-shaped prompts, triggered by the…