From 23e9f6649a107da9ea956b4357e7ec11030adc46 Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 08:26:54 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 12 +++ README.md | 3 + plugin.lock.json | 45 ++++++++ skills/checking-code-quality/SKILL.md | 145 ++++++++++++++++++++++++++ 4 files changed, 205 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 plugin.lock.json create mode 100644 skills/checking-code-quality/SKILL.md diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..9f72894 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,12 @@ +{ + "name": "leapmultix-skill-checking-code-quality", + "description": "Skill checking-code-quality from LeapMultix", + "version": "1.0.0", + "author": { + "name": "Julien LE SAUX", + "email": "contact@jls42.org" + }, + "skills": [ + "./skills" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..75a2f55 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# leapmultix-skill-checking-code-quality + +Skill checking-code-quality from LeapMultix diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..528dc48 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,45 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:jls42/leapmultix:leapmultix-marketplace/skills/checking-code-quality", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "e72cb246b5beb519db7c13a25241c5cb9ae77616", + "treeHash": "7bd0f7fe88b1b2930227fe4aace7e96b13f6c60f56b64bd4938fa5ab2e290e09", + "generatedAt": "2025-11-28T10:19:11.488209Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "leapmultix-skill-checking-code-quality", + "description": "Skill checking-code-quality from LeapMultix", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "df80dc787cceaca123baf138abe881aae7ce132d28062caaf884801cb3fa635e" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "3091d19fc5ee622d895a2071ba468a91e46547eaf872c27c74495eba5862c8f1" + }, + { + "path": "skills/checking-code-quality/SKILL.md", + "sha256": "e2e581186b4c663fc3de80b04d0d4641356708fd096d6486c5518f3a9be4f864" + } + ], + "dirSha256": "7bd0f7fe88b1b2930227fe4aace7e96b13f6c60f56b64bd4938fa5ab2e290e09" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/checking-code-quality/SKILL.md b/skills/checking-code-quality/SKILL.md new file mode 100644 index 0000000..1114bd1 --- /dev/null +++ b/skills/checking-code-quality/SKILL.md @@ -0,0 +1,145 @@ +--- +name: checking-code-quality +description: Executes code quality checks (format:check, ESLint, Jest) before each commit according to leapmultix project standards +allowed-tools: Read, Grep, Glob, Bash +--- + +# Code Quality Gate + +Garantit code respecte standards avant commit (format, lint, tests). + +## Table des matières + +- [Quand utiliser](#quand-utiliser) +- [Workflow OBLIGATOIRE (séquence)](#workflow-obligatoire-séquence) +- [Standards essentiels](#standards-essentiels) +- [ESLint suppressions](#eslint-suppressions) +- [Scripts disponibles](#scripts-disponibles) +- [Configuration](#configuration) +- [Conventions commit](#conventions-commit) +- [Checklist](#checklist) +- [En cas de doute](#en-cas-de-doute) + +## Quand utiliser + +- **TOUJOURS** avant chaque commit +- Avant créer PR +- Après modification JavaScript/CSS +- À la demande + +## Workflow OBLIGATOIRE (séquence) + +1. **Formatage (CRITIQUE) :** + + ```bash + npm run format:check + # Si ✗ → npm run format + ``` + +2. **Linting :** + + ```bash + npm run lint + # Si ✗ → npm run lint:fix + ``` + +3. **Tests :** + + ```bash + npm test + ``` + +4. **Couverture (recommandé) :** + ```bash + npm run test:coverage + ``` + +**Ou tout-en-un :** `npm run verify` (lint + test + coverage) + +## Standards essentiels + +**JavaScript :** + +- Pas variables inutilisées (supprime ou eslint-disable avec justification) +- Pas catch blocks vides (logger erreur) +- Utiliser security-utils pour DOM (`appendSanitizedHTML()`, `setSafeMessage()`) +- Complexité cognitive < 15 (découpe fonctions complexes) + +**CSS :** + +- Notation couleur moderne : `rgb(255 255 255 / 0.9)` pas `rgba(...)` + +**Sécurité :** + +- Jamais `innerHTML` données externes (utiliser security-utils) +- Scripts externes: `crossorigin="anonymous"` +- Integrity hashes bibliothèques (pas analytics, auto-update) +- Valider entrées externes + +## ESLint suppressions + +**Ligne :** `// eslint-disable-next-line rule -- Justification` + +**Bloc :** `/* eslint-disable rule */ ... /* eslint-enable rule */` + +**Règle :** Toujours justifier avec `--` pourquoi sécurisé/intentionnel. + +## Scripts disponibles + +- `npm test` - Tests +- `npm run test:watch` - Mode watch +- `npm run test:coverage` - Couverture +- `npm run verify:dead-code` - Code mort +- `npm run analyze:*` - Globals, jsdoc, dependencies + +## Configuration + +- `eslint.config.js` - Règles ESLint +- `.prettierrc` - Formatage +- `.stylelintrc.json` - CSS +- `jest.config.cjs` - Tests + +## Conventions commit + +- Impératif : "Fix", "Add", "Refactor" +- Concis, descriptif +- Jamais mentionner AI/assistants + +## Checklist + +- [ ] format:check passe +- [ ] lint passe +- [ ] tests passent +- [ ] coverage acceptable +- [ ] Pas console.log oubliés +- [ ] Pas variables inutilisées +- [ ] security-utils pour DOM +- [ ] Message descriptif +- [ ] Pas secrets/API keys + +## En cas de doute + +**Règles absolues :** + +1. `npm run format:check` TOUJOURS d'abord +2. Ne JAMAIS committer si échec +3. Ne JAMAIS désactiver sans justification +4. Exécuter localement AVANT pusher + +**Workflow minimal :** + +```bash +npm run format:check && npm run lint && npm test +``` + +**Workflow complet :** + +```bash +npm run verify +``` + +**Fichiers clés :** + +- CLAUDE.md - Conventions +- eslint.config.js - Règles +- security-utils.js - DOM sécurisé