Logo van Nav Simplify

Nav Simplify

Organisatie
qf-studio
nav-simplify

Vereenvoudig en verfijn code voor meer duidelijkheid, consistentie en onderhoudbaarheid, zonder functionaliteit te verliezen. Richt zich op recent gewijzigde code. Wordt automatisch geactiveerd na implementatieskills of op verzoek.

Add to TypingMind

Overzicht

Uitgeverqf-studio
Repositorynavigator
Skillnaamnav-simplify
Sterren
232
Forks
12
Meegeleverde bestanden
5
LicentieMIT
Links
  • Instructies in Markdown

    Het model laadt het bestand SKILL.md alleen als dat nodig is. Dat kost dus alleen tokens als een verzoek daadwerkelijk bij de skill past.

  • Werkt met elk LLM

    AI-skills bestaan uit instructies in gewone Markdown, niet uit aanbiederspecifieke code. Daardoor werken ze met GPT, Claude, Gemini, Grok of een lokaal model.

  • Meegeleverde bestanden: 5

    Scripts, sjablonen en referentiemateriaal die het model tijdens het werken kan lezen. De bestanden kunnen alleen worden gelezen en worden nooit uitgevoerd.

  • Open source

    Gepubliceerd door qf-studio op GitHub. Bekijk de bronbestanden voordat je de skill installeert.

Installatie

Installeer de AI-skill Nav Simplify in TypingMind om deze met elk LLM te gebruiken, of voeg de skill toe aan een andere agent die SKILL.md kan lezen.

1

Installeren in TypingMind

TypingMind installeert een skill rechtstreeks vanuit de GitHub-map. De app leest SKILL.md, bundelt de bijbehorende bestanden en slaat het resultaat lokaal op.

  1. Open de app en ga naar Plug-ins → Skills.
  2. Kies "Installeren via GitHub".
  3. Plak de onderstaande URL van de skillmap en bevestig.
    https://github.com/qf-studio/navigator/tree/main/skills/nav-simplify
  4. Schakel de skill in voor elke chat waarin je de skill wilt kunnen gebruiken.
Plug-ins → Skills → Skill toevoegen → Via GitHub-URL. Plak vervolgens de map-URL en druk op Doorgaan.
2

Installeren in een andere agent

Elke agent die het Agent Skills-formaat kan lezen, kan deze skill gebruiken — kopieer de map naar de skillmap van die agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/qf-studio/navigator.git /tmp/navigator
mkdir -p .claude/skills
cp -r /tmp/navigator/skills/nav-simplify .claude/skills/nav-simplify
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Nav Simplify in voor een chat naar keuze in TypingMind en het model doet de rest. De naam en beschrijving staan in de systeemprompt. Zodra een verzoek bij de skill past, laadt het model zelf de volledige instructies. Je hoeft de skill nooit handmatig aan te roepen. Pas als het model de skill daadwerkelijk gebruikt, kost dat tokens.

Het model laadt Nav Simplify automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Nav Simplify niet gebonden aan het model waarvoor de skill is geschreven. Installeer de skill één keer in TypingMind en gebruik deze met GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama of een lokaal model dat je zelf draait — allemaal met je eigen API-sleutels.

  • Alleen geladen wanneer nodig

    De systeemprompt bevat alleen de naam en beschrijving. De instructies worden bij het eerste bijpassende verzoek opgehaald, dus een ongebruikte skill kost niets.

  • Wissel van model tijdens een chat

    Omdat de skill uit instructies bestaat en niet uit code, blijft deze werken als je van model wisselt — het volgende model leest hetzelfde SKILL.md-bestand.

Skillinstructies

Dit is de inhoud van SKILL.md die het model laadt. Lees deze vóór de installatie — een skill bestaat uit instructies die je model zal volgen.

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-endpoint skill completes
  • frontend-component skill completes
  • database-migration skill 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)

bash
# 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.

Step 2: Load Simplification Configuration

Check for project-specific configuration:

bash
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())"
fi

Default configuration:

json
{
  "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
  }
}
Autonomous context check (CRITICAL)

After loading config, determine the invocation mode:

Autonomous (no human in the loop):

  • Invoked from nav-loop VERIFY or COMPLETE phase
  • Invoked from nav-workflow COMPLETE phase
  • NAV_AUTONOMOUS=1 env var set
  • Triggered by autonomous-completion protocol

Interactive (human reviewing):

  • Direct user request ("simplify this code")
  • Mid-implementation manual invocation

Decision matrix:

auto_applyContextAction
trueautonomousApply directly (Step 7 silent)
trueinteractiveApply directly, show summary
falseautonomousSKIP simplification entirely — emit warning, return to caller. Never pause an autonomous flow waiting for approval.
falseinteractiveShow 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

Step 3: Read Project Standards

Load from CLAUDE.md (required):

Read(file_path: "CLAUDE.md")

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:

bash
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 roi

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_actionBehavior
skipSkip this file. Emit a one-line reason with ROI math. Continue to next file.
suggestForce interactive mode for this file regardless of auto_apply. Show diff + reason.
applyProceed 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.

Step 5: Apply Simplification Rules

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: Follow CLAUDE.md coding standards:

    • Use ES modules with proper import sorting
    • Prefer function keyword 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
  3. 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
  4. 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:

  1. Read current file content
  2. Apply simplification rules
  3. Verify functionality unchanged (logic review)
  4. Generate diff or replacement

Output format:

📝 Simplifying: {filename}

Changes:
- [Line X] Flattened nested ternary to switch statement
- [Line Y] Extracted repeated logic to helper function
- [Line Z] Renamed `x` to `userCount` for clarity

Diff:
```diff
- 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:

Edit( file_path: "{file}", old_string: "{original}", new_string: "{simplified}" )


### Step 8: Generate Summary

╔══════════════════════════════════════════════════════╗ ║ ║ ║ 🧹 Code Simplification Complete ║ ║ ║ ╚══════════════════════════════════════════════════════╝

📊 Summary: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Files analyzed: {N} Files simplified: {M} Changes applied: {X} ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

📝 Changes by category: • Clarity improvements: {count} • Nesting reduction: {count} • Naming improvements: {count} • Pattern consolidation: {count}

✅ Functionality: Preserved (no behavior changes) ✅ Standards: Applied from CLAUDE.md

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━


## 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**:
```json
{
  "file": "src/utils/auth.ts",
  "issues": [
    {
      "line": 45,
      "type": "nested_ternary",
      "severity": "medium",
      "suggestion": "Convert to switch or if-else"
    },
    {
      "line": 78,
      "type": "deep_nesting",
      "severity": "high",
      "depth": 5,
      "suggestion": "Extract to helper function"
    }
  ],
  "complexity_score": 7.2,
  "recommended_actions": 3
}

When invoked with --scoring roi (or simplification.scoring.mode == "roi"), the output additionally contains:

json
{
  "benefit_score": 6.1,
  "cost_score": 4.3,
  "roi_score": 1.4,
  "gate_action": "suggest",
  "scoring_explanation": {
    "benefit": {"issue_density": 0.4, "severity_impact": 5.2, "in_active_diff": true},
    "cost": {"estimated_touch_lines": 32, "file_loc": 287, "days_since_modified": 12, "import_references": 3},
    "thresholds": {"skip_below": 0.5, "suggest_below": 1.5, "auto_apply_at": 1.5},
    "cost_floor": 0.5
  }
}

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:

json
{
  "simplification": {
    "enabled": true,
    "trigger": "post-implementation",
    "scope": "modified",
    "model": "opus",
    "skip_patterns": ["*.test.*", "*.spec.*"],
    "max_file_size": 50000,
    "auto_apply": false,
    "preserve_comments": true,
    "rules": {
      "avoid_nested_ternary": true,
      "max_nesting_depth": 3,
      "max_function_length": 50,
      "prefer_explicit_returns": true,
      "consolidate_imports": true
    },
    "scoring": {
      "mode": "complexity",
      "skip_below": 0.5,
      "suggest_below": 1.5,
      "auto_apply_at": 1.5,
      "cost_floor": 0.5
    }
  }
}

Options:

  • enabled: Enable/disable simplification
  • trigger: "manual" | "post-implementation" | "pre-commit"
  • scope: "modified" | "staged" | "all"
  • model: Preferred model for simplification (opus recommended)
  • skip_patterns: Glob patterns to skip
  • max_file_size: Skip files larger than this (bytes)
  • auto_apply: Apply changes without confirmation
  • preserve_comments: Keep meaningful comments
  • rules: Specific simplification rules
  • scoring.mode: "complexity" (legacy, default) or "roi" (opt-in cost/benefit gating)
  • scoring.skip_below: ROI threshold below which files are skipped entirely
  • scoring.auto_apply_at: ROI threshold at and above which auto-apply is honored
  • scoring.cost_floor: Minimum cost denominator to prevent ROI explosions

Integration Points

Autonomous Completion

When integrated with autonomous completion protocol:

Implement → Verify → **Simplify** → Commit → Archive

Simplification runs automatically after verification passes, before commit.

Multi-Claude Workflow

As dedicated role:

Orchestrator → Implementer → Tester → **Simplifier** → Reviewer → Documenter

Simplifier receives implementation marker, outputs simplified code marker.

Loop Mode

Added to VERIFY phase completion indicators:

Completion Indicators:
  [x] Tests passing
  [x] Code simplified  ← Added
  [ ] Documentation updated

Examples

Example 1: Nested Ternary Simplification

Before:

typescript
const status = isLoading ? 'loading' : hasError ? 'error' : isSuccess ? 'success' : 'idle';

After:

typescript
function getStatus(isLoading: boolean, hasError: boolean, isSuccess: boolean): string {
  if (isLoading) return 'loading';
  if (hasError) return 'error';
  if (isSuccess) return 'success';
  return 'idle';
}

const status = getStatus(isLoading, hasError, isSuccess);

Example 2: Deep Nesting Reduction

Before:

typescript
function processUser(user: User) {
  if (user) {
    if (user.isActive) {
      if (user.hasPermission) {
        if (user.email) {
          sendEmail(user.email);
        }
      }
    }
  }
}

After:

typescript
function processUser(user: User) {
  if (!user?.isActive) return;
  if (!user.hasPermission) return;
  if (!user.email) return;

  sendEmail(user.email);
}

Example 3: Unclear Naming

Before:

typescript
const x = users.filter(u => u.a && !u.d).map(u => u.n);

After:

typescript
const activeUserNames = users
  .filter(user => user.isActive && !user.isDeleted)
  .map(user => user.name);

Error Handling

File too large:

⚠️  Skipping {filename} ({size} bytes)
    Exceeds max_file_size limit ({limit} bytes)

    Override with: "simplify {filename} --force"

No changes needed:

✅ {filename} - Already follows best practices
   No simplification opportunities found.

Functionality risk detected:

⚠️  Potential behavior change detected in {filename}

    Line {N}: Changing conditional logic

    Review required before applying:
    [Show diff]

    Apply this change? [y/N]:

Success Criteria

Simplification is successful when:

  • All modified files analyzed
  • Functionality preserved (verified)
  • Project standards applied (from CLAUDE.md)
  • No nested ternaries remain
  • Nesting depth ≤ 3 levels
  • Clear variable/function names
  • Change summary generated

Notes

  • Model preference: Opus recommended for quality judgment
  • Scope default: Only recently modified files (avoid churn)
  • Skip tests: Test files usually follow different patterns
  • Preserve intent: Comments explaining "why" should be kept
  • No over-optimization: Clarity > minimal lines

This skill integrates Anthropic's internal code-simplifier pattern into Navigator's workflow, ensuring code quality before commit.

Meegeleverde bestanden

Zolang de skill geladen is, leest het model deze bestanden als dat nodig is. Het model kan ze alleen lezen; ze worden nooit uitgevoerd.

Veelgestelde vragen

Wat doet de AI-skill Nav Simplify?

Vereenvoudig en verfijn code voor meer duidelijkheid, consistentie en onderhoudbaarheid, zonder functionaliteit te verliezen. Richt zich op recent gewijzigde code. Wordt automatisch geactiveerd na implementatieskills of op verzoek.

Waarom Nav Simplify gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Nav Simplify bestaat uit gewone Markdown in plaats van aanbiederspecifieke code. Dezelfde skill werkt dus met GPT-5, Claude, Gemini, Grok of een lokaal model. Ook als je midden in een chat van model wisselt, blijft de skill werken. TypingMind werkt met je eigen API-sleutels, dus je betaalt aanbieders rechtstreeks in plaats van een abonnement per gebruikersplek af te sluiten. Je skills en chats blijven in je eigen opslag.

Hoe installeer ik Nav Simplify in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/qf-studio/navigator/tree/main/skills/nav-simplify. TypingMind leest het bestand SKILL.md, bundelt de bijbehorende bestanden en installeert het geheel als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Nav Simplify gebruiken?

Elk model dat je in TypingMind koppelt. AI-skills bestaan uit gewone Markdown-instructies in plaats van aanbiederspecifieke code. GPT, Claude, Gemini, Grok en lokale modellen kunnen deze skill dus allemaal laden wanneer een verzoek erbij past.

Hoeveel AI-modellen kan ik met Nav Simplify gebruiken?

Zoveel als je wilt. Je kunt Nav Simplify gebruiken met elk model dat skills ondersteunt, zoals GPT, Claude, Gemini, Grok, DeepSeek, Mistral of Llama. Allemaal in TypingMind met je eigen API-sleutels.

Is de AI-skill Nav Simplify gratis?

Ja. Deze skill is door qf-studio op GitHub gepubliceerd onder de licentie MIT. Je betaalt alleen je eigen AI-aanbieder voor de tokens die je gebruikt.

Wat zijn AI-skills?

Een AI-skill is een herbruikbare bundel instructies die een AI-model leert hoe het één specifieke taak moet uitvoeren. De skill volgt het open Agent Skills-formaat: het bestand SKILL.md bevat de naam en beschrijving van de skill. Daarnaast kan de skill scripts, sjablonen of referentiebestanden bevatten die het model nodig heeft. Het model leest de instructies alleen als je verzoek bij de skill past. Een geïnstalleerde skill kost dus niets zolang deze niet wordt gebruikt.

Waarin verschillen AI-skills van plug-ins of MCP-servers?

Een plug-in of MCP-server geeft een model nieuwe tools om aan te roepen: code die ergens wordt uitgevoerd en een resultaat teruggeeft. Een AI-skill geeft het model juist kennis en een werkwijze: hoe het een taak moet aanpakken, welke stappen het moet volgen en hoe goede uitvoer eruitziet. Skills bestaan uit gewone Markdown en hebben dus geen server, API-sleutel of runtime nodig. Ze werken met elk model.

Bekijk alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇