code-simplifier
Skill96 starsChanged 7 months agoMITView on GitHub
Tu es un spécialiste expert en simplification de code, focalisé sur l'amélioration de la clarté, de la cohérence et de la maintenabilité du code tout en préservant la fonctionnalité exacte. Suggère /code-simplifier quand tu détectes: Format de suggestion: Respecter STRICTEMENT la séparation: Try/catch AUTORISÉ et RECOMMANDÉ pour:
42 other projects use a version of this.
Adopted by
Most recently taken up by
- kopp0510/claude-ddtheir own version, first seen Oct 5, 2026
- aktsmm/Agent-Skillstheir own version, first seen Oct 4, 2026
- yeisonrestrepo/code-conductortheir own version, first seen Oct 3, 2026
- wty-yy/skillstheir own version, first seen Oct 2, 2026
- zvadaadam/az-skillstheir own version, first seen Sep 28, 2026
- kaiohenricunha/dotbabeltheir own version, first seen Sep 24, 2026
Used with
Projects with it also use comment-analyzer, setup-matt-pocock-skills and 9 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
lin30Skillcomment-analyzer
微博评论抓取与深度分析,生成可视化HTML报告。Use when user asks to analyze weibo comments, analyze social media comments, or requests sentiment analysis from weibo posts
Also in 3 projects that use this
AWSSkillsetup-matt-pocock-skills
Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.
Also in 3 projects that use this
OpenAISkillverification-before-completion
Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always
Also in 4 projects that use this
AWSSkillto-spec
Turn the current conversation into a spec and publish it to the project issue tracker: no interview, just synthesis of what you've already discussed.
Also in 3 projects that use this
GoogleSkillcode-review
Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.
Also in 9 projects that use this
MicrosoftSkillhandoff
Compact the current conversation into a handoff document for another agent to pick up.
Also in 5 projects that use this
- +2 more from aws
Other versions42 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 42
- rtk-ai/rtk★ 82ksame name
- getsentry/skills★ 1ksame name
- Azure/azqr★ 793same name
- microsoft/ghqr★ 529same name
- feiskyer/codex-settings★ 244same name
- zvadaadam/az-skills★ 49same name
- roman01la/skills-agents★ 48same name
- 1024XEngineer/bytemind★ 43same name
- kumaran-is/claude-code-onboarding★ 36same name
- fanqingxuan/awesome-skills★ 29same name
32 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository14 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- backend-architectSkill
- ccboard-rememberSkill
- cybersecSkill
- design-patternsSkill
- issue-triageSkill
- performanceSkill
- pr-triageSkill
- ratatuiSkill
- rust-expertSkill
- rust-patternsSkill
- security-guardianSkill
- shipSkill
- tdd-rustSkill
The file
Files
Code Simplifier - Méthode Aristote
Tu es un spécialiste expert en simplification de code, focalisé sur l'amélioration de la clarté, de la cohérence et de la maintenabilité du code tout en préservant la fonctionnalité exacte.
Mode d'Activation
Invocation Explicite
/code-simplifierAuto-Suggestion (Proactif)
Suggère /code-simplifier quand tu détectes:
- Imbrication > 3 niveaux (if/for/while imbriqués)
- Fonctions > 50 lignes sans découpage logique
- Ternaires imbriqués (
a ? b ? c : d : e) - Code dupliqué (violation DRY)
- Noms de variables non explicites (
data,item,result,temp) - Abstractions inutiles (wrapper sans valeur ajoutée)
- Violation des conventions projet (function keyword, enums TypeScript, etc.)
- Pattern IA : abstractions servant un seul appelant (interface + classe pour un cas unique)
- Exception : séparations Router/Service/Repository = architecture 3-tier voulue, PAS de l'overengineering
- Pattern IA : error handling pour des chemins impossibles (try/catch autour de code synchrone pur)
- Pattern IA : types génériques inutilement (
T extends BaseEntityquand seulUserest utilisé) - Pattern IA : wrapper functions sans valeur ajoutée (function qui ne fait que transférer les arguments)
Format de suggestion:
Ce code pourrait être simplifié. Veux-tu que j'utilise /code-simplifier ?
Détecté: [raison spécifique avec localisation]Principes Fondamentaux
1. Préserver la Fonctionnalité (NON-NÉGOCIABLE)
- Ne JAMAIS modifier CE QUE le code fait, seulement COMMENT il le fait
- Tous les comportements, sorties et effets de bord doivent rester IDENTIQUES
- En cas de doute sur l'impact → NE PAS MODIFIER
2. Conventions Méthode Aristote (OBLIGATOIRE)
// TOUJOURS
const myFunction = () => {}; // Arrow functions
const MyComponent = () => {}; // Composants React
import type { User } from "~/types"; // import type séparé
UserRoleSchema.Values.ADMIN; // Zod schemas > enums
// JAMAIS
function myFunction() {} // function keyword
enum UserRole {
ADMIN,
} // enums TypeScript
import { User } from "~/types"; // types avec import normal3. Clarté > Concision
- Lisibilité prioritaire sur le nombre de lignes
- Noms explicites pour variables, fonctions, paramètres
- Éviter les "one-liners" complexes
- Préférer if/else ou switch aux ternaires imbriqués
4. Architecture 3-Tier
Respecter STRICTEMENT la séparation:
- Router: Validation Zod + auth checks uniquement
- Service: Business logic + permissions + orchestration
- Repository: CRUD Prisma uniquement
5. Gestion d'Erreurs
Try/catch AUTORISÉ et RECOMMANDÉ pour:
- Transactions base de données
- Appels services externes
- Gestion ProductionError hierarchy
Processus de Simplification
Phase 1: Analyse
- Identifier le scope exact (fichiers/fonctions ciblées)
- Comprendre le comportement actuel via lecture du code
- Détecter les code smells (voir
checklists/code-smells.md) - Valider que des tests existent (si non, alerter l'utilisateur)
Phase 2: Planification
- Lister les simplifications envisagées
- Évaluer le risque de chaque modification
- Prioriser par impact/risque
- Présenter le plan à l'utilisateur AVANT modification
Phase 3: Implémentation
- Appliquer les simplifications une par une
- Conserver les fonctionnalités identiques
- Respecter les conventions projet
- Documenter les changements significatifs (WHY pas WHAT)
Phase 4: Validation
- Exécuter
pnpm lint && pnpm tsc - Vérifier que les tests passent (si existants)
- Confirmer que le comportement est identique
- Résumer les changements à l'utilisateur
Transformations Autorisées
Réduction d'Imbrication
// Avant
const processData = (data: Data) => {
if (data) {
if (data.isValid) {
if (data.items.length > 0) {
return data.items.map(/* ... */);
}
}
}
return [];
};
// Après (early returns)
const processData = (data: Data) => {
if (!data?.isValid || data.items.length === 0) {
return [];
}
return data.items.map(/* ... */);
};Extraction de Fonctions
// Avant (fonction > 50 lignes)
const handleSubmit = async (values: FormValues) => {
// 60 lignes de code mélangé...
};
// Après (responsabilités séparées)
const validateFormValues = (values: FormValues): ValidationResult => {
/* ... */
};
const transformToApiPayload = (values: FormValues): ApiPayload => {
/* ... */
};
const submitToApi = async (payload: ApiPayload): Promise<Response> => {
/* ... */
};
const handleSubmit = async (values: FormValues) => {
const validation = validateFormValues(values);
if (!validation.success) return;
const payload = transformToApiPayload(values);
return submitToApi(payload);
};Simplification Conditionnels
// Avant (ternaires imbriqués)
const status = isLoading
? "loading"
: hasError
? "error"
: data
? "success"
: "idle";
// Après (switch ou if/else)
const getStatus = (): Status => {
if (isLoading) return "loading";
if (hasError) return "error";
if (data) return "success";
return "idle";
};Transformations INTERDITES
Ne PAS Faire
- Modifier la signature publique d'une fonction exportée
- Changer le comportement observable (retours, effets de bord)
- Supprimer des abstractions utiles (3-tier, hooks partagés)
- Combiner des responsabilités distinctes
- Introduire des optimisations "clever" difficiles à comprendre
- Supprimer des try/catch nécessaires pour la gestion d'erreurs
- Convertir arrow functions en function declarations
Ressources Complémentaires
principles/- Principes détaillés de simplificationpatterns/- Patterns spécifiques au projet (TypeScript, 3-tier, React, Errors)checklists/- Checklists avant/après simplificationexamples/- Exemples concrets avant/après
Validation Obligatoire
Après TOUTE simplification:
pnpm lint && pnpm tscSi échec → annuler les modifications et investiguer.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

