Aller au contenu
Skillpedia
Programmation générale10k · #12017

simplify

Ce qu’il fait

Ce skill rend un code qui fonctionne plus clair et plus simple, sans modifier son comportement. Il s'adresse aux développeurs qui veulent un code plus facile à lire et à modifier pour les autres.

Quand l’utiliser

  • ✓Quand une fonctionnalité fonctionne et que ses tests passent, mais que le code semble plus lourd que nécessaire.
  • ✓Quand une fonction est longue, fortement imbriquée ou a des noms peu clairs.
  • ✓Quand une revue de code signale des problèmes de lisibilité ou de complexité.

Lien du skill

https://github.com/alvinunreal/oh-my-opencode-slim/blob/master/src/skills/simplify/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/alvinunreal/oh-my-opencode-slim/blob/master/src/skills/simplify/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Cette fonction marche, mais elle est difficile à suivre. Simplifie-la sans changer ce qu'elle fait.”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

Le skill vérifie que le comportement est bien compris, puis réalise des modifications qui gardent les entrées, les sorties et la gestion des erreurs identiques. Il laisse de côté le code déjà clair.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

Code Simplification

Overview

Simplify code by reducing complexity while preserving exact behavior. The goal is not fewer lines - it's code that is easier to read, understand, modify, and debug. Every simplification must pass a simple test: "Would a new team member understand this faster than the original?"

When to Use

  • After a feature is working and tests pass, but the implementation feels heavier than it needs to be
  • During code review when readability or complexity issues are flagged
  • When you encounter deeply nested logic, long functions, or unclear names
  • When refactoring code written under time pressure
  • When consolidating related logic scattered across files
  • After merging changes that introduced duplication or inconsistency

When NOT to use:

  • Code is already clean and readable - don't simplify for the sake of it
  • You don't understand what the code does yet - comprehend before you simplify
  • The code is performance-critical and the "simpler" version would be measurably slower
  • You're about to rewrite the module entirely - simplifying throwaway code wastes effort

The Five Principles

1. Preserve Behavior Exactly

Don't change what the code does - only how it expresses it. All inputs, outputs, side effects, error behavior, and edge cases must remain identical. If you're not sure a simplification preserves behavior, don't make it.

Before every change, ask:

  • Does this produce the same output for every input?
  • Does this maintain the same error behavior?
  • Does this preserve the same side effects and ordering?
  • What proportionate final-state verification will reveal a behavior change?

2. Follow Project Conventions

Simplification means making code more consistent with the codebase, not imposing external preferences.

Before simplifying:

  1. Read AGENTS.md / project conventions
  2. Study how neighboring code handles similar patterns
  3. Match the project's style for imports, naming, function style, error handling, and type annotations

Simplification that breaks project consistency is not simplification - it's churn.

3. Prefer Clarity Over Cleverness

Explicit code is better than compact code when the compact version requires a mental pause to parse.

  • Replace nested ternaries with readable control flow
  • Replace dense inline transforms with named intermediate steps when they clarify intent
  • Keep helpful names even if they cost a few extra lines

4. Maintain Balance

Watch for over-simplification:

  • Don't inline away names that carry meaning
  • Don't merge unrelated logic into one larger function
  • Don't remove abstractions that serve testability or extensibility
  • Don't optimize for line count over comprehension

5. Scope to What Changed

Default to simplifying recently modified code. Avoid unrelated drive-by refactors unless explicitly asked.

Process

Step 1: Understand Before Touching

Before changing or removing anything, understand why it exists.

Answer:

  • What is this code's responsibility?
  • What calls it? What does it call?
  • What are the edge cases and error paths?
  • Are there tests that define expected behavior?
  • Why might it have been written this way?

If you can't answer these, read more context first.

Step 2: Look for Simplification Opportunities

Signals:

  • Deep nesting
  • Long functions with mixed responsibilities
  • Nested ternaries
  • Boolean flag arguments
  • Repeated conditionals
  • Generic or misleading names
  • Duplicated logic
  • Dead code
  • Wrappers or abstractions that add no value

Step 3: Apply Changes Incrementally

Make one simplification at a time.

For each simplification:

  1. Make the change
  2. Use the proportionate final-state verification plan to check preservation
  3. Keep it only when the evidence supports preservation

Separate refactoring from feature work whenever possible.

Step 4: Verify the Result

After simplifying, confirm:

  • The code is genuinely easier to understand
  • The diff is clean and reviewable
  • Project conventions still match
  • No behavior, error handling, or side effects changed

Guidance for This Repository

  • Prefer straightforward TypeScript over clever compression
  • Preserve existing runtime behavior, tests, and hooks
  • Favor explicit names and smaller focused helpers when they improve readability
  • Keep refactors tightly scoped to the task or review feedback

Final-state verification

Use a proportionate final-state verification plan for the final diff. Run checks required by r

Questions fréquentes

Va-t-il modifier le comportement du code ?

Le skill indique que le comportement doit rester exactement le même, il évite donc toute modification dont il n'est pas sûr.

Le but est-il de réduire le nombre de lignes ?

Non. Le but est un code plus facile à lire, à comprendre et à modifier.

Quand doit-il être écarté ?

Lorsque le code est déjà propre, ou lorsque le code est critique pour les performances et que la version simplifiée serait mesurablement plus lente.

Détails

Description originale de l’auteur

Simplifies code for clarity without changing behavior. Use for readability, maintainability, and complexity reduction after behavior is understood.

repo: alvinunreal/oh-my-opencode-slim

Popularité

Étoiles GitHub
10k
Position au classement
#12017
Licence
MIT
Mis à jour
02/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires