Logo van Simplify Code

Simplify Code

Community
HezaoHezao
simplify-code

Sequential 3-lens cleanup of recent code changes.

Add to TypingMind

Overzicht

UitgeverHezaoHezao
Repositorypoirot
Skillnaamsimplify-code
Sterren
252
Forks
26
Meegeleverde bestanden
Alleen instructies
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.

  • Compleet zonder extra bestanden

    Alles wat het model nodig heeft, staat in de instructies — geen extra bestanden om te synchroniseren.

  • Open source

    Gepubliceerd door HezaoHezao op GitHub. Bekijk de bronbestanden voordat je de skill installeert.

Installatie

Installeer de AI-skill Simplify Code 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/HezaoHezao/poirot/tree/master/poirot/backend/agents/skill/builtin_skills/core/simplify-code
  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/HezaoHezao/poirot.git /tmp/poirot
mkdir -p .claude/skills
cp -r /tmp/poirot/poirot/backend/agents/skill/builtin_skills/core/simplify-code .claude/skills/simplify-code
Start Claude Code na het kopiëren opnieuw op, zodat de nieuwe skill wordt herkend.

Gebruik deze skill in TypingMind

Schakel Simplify Code 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 Simplify Code automatisch zodra een verzoek erbij past.

Werkt met elk AI-model

AI-skills zijn gewone Markdown-instructies in plaats van aanbiederspecifieke code. Daardoor is Simplify Code 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.

Simplify Code — Sequential Review & Cleanup

Review your recent code changes with three focused lenses, aggregate findings, and apply the fixes worth applying.

Core principle: Three narrow reviews beat one broad review. Each one deeply searches the codebase for a single class of problem — reuse, quality, efficiency — without diluting attention across all three.

Poirot note: The original skill runs 3 reviewers in parallel via subagent delegation. Poirot has no subagents, so this version runs the 3 lenses sequentially in the same context. The methodology is identical; only the concurrency is lost.

When to Use

Trigger this skill when the user says any of:

  • "simplify" / "simplify my changes" / "simplify these changes"
  • "review my code" / "review my recent changes" / "clean up my changes"

Optional modifiers the user may add — honor them:

  • Focus: "simplify focus on efficiency" → run only the efficiency lens. Recognized focuses: reuse, quality, efficiency.
  • Dry run: "simplify but don't change anything" / "just report" → run the three lenses, present findings, apply NOTHING. Ask before applying.
  • Scope: "simplify the last commit" / "simplify staged" / "simplify src/foo.py" → narrow the diff source accordingly.

Do NOT auto-run this after every edit. Invoke it only when the user asks.

The Process

Phase 1 — Identify the changes

Capture the diff to review. Pick the source by what the user asked for:

bash
# 1. Default: uncommitted working-tree changes (tracked files)
git diff

# 2. If that's empty, include staged changes
git diff HEAD

# 3. Scoped variants:
git diff --staged                 # "staged changes"
git diff HEAD~1                    # "the last commit"
git diff main...HEAD              # "this branch" / "my PR"
git diff -- src/foo.py            # specific file(s)

If git diff and git diff HEAD are both empty, fall back to files the user explicitly named or recently edited in this session. If you can't find any changed code, say so and stop.

Capture the full diff text. Note its size: if >2000 changed lines, warn the user and offer to scope down before proceeding.

Phase 2 — Run three lenses (sequentially)

Each lens gets the complete diff (not fragments — cross-file issues hide in the gaps) plus the repo path so it can search the wider codebase via bash (grep) and read_file.

For each lens:

  • Search the existing codebase for evidence (don't reason from the diff alone).
  • Apply Chesterton's Fence: before flagging anything for removal, run git blame on the line to understand why it exists. If you can't determine the original purpose, mark it confidence: low.
  • Report findings as structured output:
    file:line → problem → suggested fix | confidence: high/medium/low | risk: SAFE/CAREFUL/RISKY
    • SAFE = proven not to affect behavior (unused imports, commented-out code, pass-through wrappers). Auto-apply these.
    • CAREFUL = improves without changing semantics (rename local variable, flatten nested ternary, extract helper). Apply with test verification.
    • RISKY = may change behavior or breaks public contracts. Flag for human review — do NOT auto-apply.
  • Skip nits and style-only churn.

Run these three lenses (skip any the user's focus excludes):

Lens 1 — Code Reuse

Review this diff for code that duplicates functionality already in the codebase. Search utility modules, shared helpers, and adjacent files (use bash grep) for existing functions, constants, or patterns the new code could call instead of reimplementing. Flag: new functions that duplicate existing ones; hand-rolled logic that an existing utility already does. For each, name the existing thing to use and where it lives.

Lens 2 — Code Quality

Review this diff for quality problems. Look for: redundant state; parameter sprawl; copy-paste-with-variation; leaky abstractions; stringly-typed code (raw strings where a constant/enum exists); AI-generated slop patterns (extra comments restating obvious code, unnecessary defensive null-checks, as any casts). For each, give the concrete refactor.

Lens 3 — Efficiency

Review this diff for efficiency problems. Look for: unnecessary work (redundant computation, repeated file reads, N+1 access); missed concurrency; hot-path bloat; TOCTOU anti-patterns; memory issues (unbounded growth, missing cleanup); overly broad reads; silent failures (empty catch blocks, except: pass). For each, give the concrete fix and why it's faster/safer.

Phase 3 — Aggregate and apply

  1. Merge the findings into one list, deduping where lenses overlap.
  2. Discard false positives — you have the most context; drop weak or wrong suggestions silently.
  3. Resolve conflicts. Default resolution order: correctness > the user's stated focus > readability/reuse > micro-perf. Don't apply a perf "fix" that hurts clarity unless the path is genuinely hot.
  4. Apply in risk-tier order:
    • SAFE first (auto-apply): unused imports, commented-out code, pass-through wrappers. Run tests after.
    • CAREFUL next (apply with verification, one file at a time): rename locals, flatten ternaries, extract helpers, consolidate dupes. Run tests after each file. Revert any that break.
    • RISKY last (flag for review — do NOT auto-apply): N+1 restructuring, public API changes, concurrency fixes. Present each with risk description and test coverage status. If the user opted for a dry run, present all three tiers and apply nothing.
  5. Verify you didn't break anything: run the project's targeted tests for the touched files, and re-run any linter/type check the repo uses. If a fix breaks a test, revert that one fix and report it.
  6. Summarize what you changed: a short list of applied fixes grouped by lens and risk tier, plus any findings you deliberately skipped and why.

Pitfalls

  • Give the WHOLE diff to each lens. Splitting the diff defeats the design — cross-file duplication and N+1s only show up with the full picture.
  • Lenses search, they don't guess. A reuse finding with no pointer to the existing utility is noise. Require file:line evidence; drop findings that lack it.
  • Apply ≠ rewrite. This is cleanup of the user's recent changes, not a license to refactor the whole module. Keep edits scoped to what the diff touched plus the minimal surrounding change a fix requires.
  • Respect project conventions. If the repo has AGENTS.md / CLAUDE.md or a linter config, fold those rules into the lens prompts so suggestions match house style.
  • Large diffs blow context. If the diff is huge, scope it down before reviewing — a 5000-line diff may truncate.
  • Over-trusting dead code tools. knip, ts-prune, depcheck flag exports that ARE used dynamically. Always grep for the symbol name before removing — a clean tool report is not proof.
  • Renaming without checking public contracts. Export names, API route paths, DB column names, config keys are contracts. Tag public-contract changes as RISKY; never auto-rename them.
  • Removing "unnecessary" error handling. An empty catch block might be intentional. Flag it, don't remove it; let the human decide.

Related

Use requesting-code-review for the pre-commit security/quality gate. This skill is the standalone after-the-fact cleanup pass.

Veelgestelde vragen

Wat doet de AI-skill Simplify Code?

Sequential 3-lens cleanup of recent code changes.

Waarom Simplify Code gebruiken in TypingMind?

Omdat je deze skill één keer installeert en met elk model kunt gebruiken. Simplify Code 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 Simplify Code in TypingMind?

Open Plug-ins → Skills → Installeren vanaf GitHub in TypingMind en plak https://github.com/HezaoHezao/poirot/tree/master/poirot/backend/agents/skill/builtin_skills/core/simplify-code. TypingMind leest het bestand SKILL.md en installeert het als een skill die je per chat kunt inschakelen.

Welke AI-modellen kunnen Simplify Code 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 Simplify Code gebruiken?

Zoveel als je wilt. Je kunt Simplify Code 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 Simplify Code gratis?

Ja. Deze skill is door HezaoHezao 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 👇