Porte de non-régression qualité

VérifiéPrudence

Une porte 'ne pas empirer' qui exécute fallow audit ciblé sur les fichiers modifiés, ne signalant que les problèmes introduits. Complémentaire au typecheck, lint et tests.

Spar Skills Guide Bot
DeveloppementIntermédiaire
25/07/2026
Claude Code
#code-quality#static-analysis#pull-request#refactoring#regression-detection

Recommandé pour

Synthèse automatique

Lance `fallow audit` sur les fichiers modifiés d'un diff et un instantané `madge` des dépendances circulaires, en ne signalant que les problèmes de qualité (complexité, duplication, code mort, cycles) que la modification introduit, à titre indicatif.

Points forts

  • Le mode « new-only » distingue les problèmes introduits de la dette héritée, ce qui évite le bruit sur une base de code mature
  • Sortie JSON avec un champ `verdict` et des compteurs `*_introduced` faciles à lire et à citer dans une PR
  • La base de comparaison est détectée automatiquement via le merge-base avec la branche amont ou origin/main, avec possibilité de la fixer explicitement
  • Se combine clairement avec typecheck, lint et tests au lieu de prétendre les remplacer

Limites

  • Le script est volontairement non bloquant (sortie 0 forcée) : le verdict est purement consultatif sauf modification du wrapper dans package.json
  • Fortement lié au dépôt drizzle-cube : il dépend de ses scripts npm et de l'outil `fallow` déjà installé
  • L'instantané `madge` des dépendances circulaires est informatif seulement et ne participe pas au verdict
  • La section décrivant `quality:heal` est tronquée, donc la partie « réparation » n'est pas exploitable en l'état
Quand l'utiliser

À utiliser après un refactor ou une fonctionnalité touchant plusieurs fichiers, juste avant de committer ou d'ouvrir une pull request.

Quand l'éviter

Inutile pour une correction d'une ligne ou une modification limitée à la documentation ou aux tests, où le bruit dépasse la valeur apportée.

Analyse de sécurité

Prudence
Score qualité84/100

The skill is a documentation/process guide for a read-only static-analysis gate. It runs standard dev tooling (fallow audit, madge, npm scripts) that reads the repo and prints reports; the wrapper explicitly forces exit 0, so it cannot break builds. No destructive commands, no secret or token handling, no obfuscated payloads, no attempts to alter agent role or bypass safety. The only real concern is routine execution of unpinned npx packages, hence 'caution' rather than 'safe'.

Points d'attention
  • •Instructs running `npx madge@...` (unpinned, fetched at runtime) plus project npm scripts (`npm run quality`, `quality:health`, `quality:graph`), which executes third-party code and network fetches; low risk but a supply-chain surface worth noting.
  • •Suggests `npx fallow dead-code --trace ...` as an ad-hoc command, another runtime-fetched package invocation.
  • •References an external URL (https://www.drizzle-cube.dev/llms.txt) for documentation context — informational only, no data sent out.
  • •Instructs running `npx madge` (an unpinned package fetched from the npm registry at runtime) for the optional graph/circular-dependency checks; this executes third-party code without a pinned version, though it is a well-known package and the usage is legitimate.
  • •Directs the agent to fetch and review remote content from https://www.drizzle-cube.dev/llms.txt; ingesting arbitrary remote text into agent context is a mild prompt-injection / content-trust vector, not an exfiltration risk.
  • •Relies on `npm run quality` / `quality:health` / `quality:graph` scripts defined in an unseen package.json, including a `sh -c 'fallow audit "$@"; exit 0'` wrapper; behavior depends on repo state not verifiable from this document.
Comment cette analyse est faite

Exemples

Pre-PR quality check
I just refactored the query builder across a bunch of files. Check that this change didn't regress code quality before I open the PR.
Is this PR clean?
Is this PR clean? Run the quality gate and tell me which complexity, duplication or dead-code findings it actually introduced.
Machine-readable verdict
Run the quality gate with JSON output and summarize the verdict plus the introduced vs inherited counts for my PR description.

name: quality-gate description: Use before finishing or opening a PR for a large / multi-file change to drizzle-cube, to ensure code quality does not regress. Runs fallow audit (complexity, duplication, dead code, circular deps scoped to the diff, reporting issues the change introduces) plus a madge circular-dependency snapshot. Report-only — it always exits 0 and never blocks; read the verdict as advice. Use when the user says "check quality", "make sure quality doesn't regress", "is this PR clean", or after a refactor touching many files.

Quality Regression Gate

A "don't make it worse" gate for drizzle-cube. The hard part of static analysis on a mature codebase is noise: there are already 373 high-complexity functions, 120 duplicate clone groups, and 20 circular dependencies. Reporting those on every change is useless.

The gate is built around one tool that solves this: fallow audit scopes analysis to the changed files and distinguishes findings the change introduced from findings it inherited. The default new-only gate fails only on introduced findings. That — and only that — is what "quality doesn't regress" means here. Inherited debt is reported for context but never blocks.

When to use

  • After a refactor or feature touching several files, before committing / opening a PR.
  • When the user asks to verify a change is clean or that quality hasn't regressed.
  • NOT needed for one-line fixes or doc/test-only edits — the gate's value is on large diffs.

This gate is the static-analysis layer. It complements, and does not replace, npm run typecheck, npm run lint, and npm test. For a full pre-PR check, run those too.

Documentation Context

If the change affects public docs, examples, or agent-facing guidance, review https://www.drizzle-cube.dev/llms.txt to understand the published documentation surface before reporting quality findings. Do not run this quality gate solely because of a one-line or documentation-only edit; the guidance above still applies.

The one command that matters

npm run quality                 # fallow audit, base auto-detected (merge-base vs main/origin)

fallow audit auto-detects the base as the git merge-base against the branch's upstream or origin/main, so on a feature branch no argument is needed. To pin the base explicitly (pass args through npm with --):

npm run quality -- --base main
npm run quality -- --base "$(git merge-base main HEAD)"

Report-only: npm run quality always exits 0 — it never fails the build. The wrapper runs fallow audit and then forces a clean exit, so the gate is advisory, not blocking. You still read the verdict (pass / warn / fail) and the introduced findings from the report — treat a fail verdict as "worth a look / mention in the PR," not as a hard stop. The verdict ignores inherited findings — watch for the line audit gate excluded N inherited findings, which confirms pre-existing debt was not counted against the change.

Want it to block again? Drop the sh -c '… ; exit 0' wrapper in the quality script (package.json) back to plain fallow audit, or add --ci for a CI-friendly failing gate.

Reading the result precisely (JSON)

For an unambiguous machine-readable verdict, ask for JSON and read verdict + attribution.*_introduced:

npm run quality --silent -- --format json
{
  "verdict": "pass" | "warn" | "fail",
  "attribution": {
    "gate": "new-only",
    "dead_code_introduced": 0,      // <- these *_introduced fields drive the verdict
    "complexity_introduced": 0,
    "duplication_introduced": 0,
    "dead_code_inherited": 8,       // <- inherited: reported, never affects the verdict
    "complexity_inherited": 17,
    "duplication_inherited": 93
  }
}

A clean change has all three *_introduced fields at 0 and verdict: "pass".

Supplementary snapshot (informational — do NOT gate on it)

quality:health has no new-vs-inherited attribution, so on this codebase it always reports the full backlog. Use it to understand a finding or look at the whole picture — never as a pass/fail signal:

npm run quality:health      # fallow health: full complexity/duplication/maintainability score

Circular dependencies are covered by the gate itself — npm run quality (fallow audit) reports them under "Structure" with introduced-vs-inherited attribution, and quality:health lists them all. There is no separate circular-dependency script.

Occasional architecture check (madge, on demand)

fallow is the source of truth for circular dependencies and ignores import type cycles (not runtime hazards). On the rare occasion you want either (a) a visual dependency graph, or (b) to surface type-only import tangles that fallow deliberately hides, reach for madge via npx — it is intentionally NOT a pinned dependency or part of the gate:

npx madge --circular --extensions ts,tsx src              # includes type-only cycles (noisier)
npm run quality:graph                                      # writes dependency-graph.svg (needs graphviz)

This is an exploratory tool, not a regression check — its output has no introduced-vs-inherited attribution and will always show the full inherited backlog.

Acting on a fail verdict

The gate is report-only, so a fail verdict doesn't stop anything — but the introduced findings are still worth addressing (or calling out in the PR). fallow prints each with a file:line and a docs link. Typical fixes:

| Introduced finding | What to do | |--------------------|------------| | Complexity (function over CRAP / cyclomatic / cognitive threshold) | Extract helpers; split the new function. Most drizzle-cube modules already follow a builder/planner split — mirror it. | | Duplication (new clone group) | Hoist the shared logic. Note existing cross-engine clones in executors//adapters/ are inherited and expected — don't churn them. | | Dead code (new unused export/file) | Delete it, or wire it up. Before deleting an "unused" export, confirm with npx fallow dead-code --trace <file>:<export> (a public API re-exported from an entry point can look unused). | | Circular dependency | Break the cycle, usually by moving a shared type into a leaf types/* module. |

False positives

If a finding is genuinely a false positive (e.g. a public export consumed only by package consumers), suppress it inline rather than restructuring:

// fallow-ignore-next-line complexity
// fallow-ignore-next-line unused-dependencies
// fallow-ignore-file circular-dependencies

Prefer fixing over suppressing. Suppress only with a one-line reason, and never suppress to get a green gate on a finding you actually introduced.

How it's wired

  • fallow@2.95.0 and madge@8.0.0 are pinned devDependencies (package.json).
  • Scripts: quality, quality:health, quality:graph.
  • The quality script is sh -c 'fallow audit "$@"; exit 0' -- — it runs the full audit (forwarding any -- … args) but always exits 0, making the gate report-only / advisory. To restore a blocking gate, change it back to plain fallow audit (or fallow audit --ci).
  • No fallow.config — defaults are used intentionally. The gate is new-only, so inherited debt (the 5 false-positive unused devDeps, 20 circular deps, existing duplication) is reported but never affects the verdict. Add a config only if you later want tunable thresholds or to exclude dist/generated dirs from duplication.

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/quality-regression-gate-mrzxurfk/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/quality-regression-gate-mrzxurfk' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/quality-regression-gate-mrzxurfk/download' --output '.skill-downloads/quality-regression-gate-mrzxurfk/SKILL.md.part' && mv '.skill-downloads/quality-regression-gate-mrzxurfk/SKILL.md.part' '.skill-downloads/quality-regression-gate-mrzxurfk/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/quality-regression-gate-mrzxurfk/SKILL.md' && test -s '.skill-downloads/quality-regression-gate-mrzxurfk/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/quality-gate' && cp -R '.skill-downloads/quality-regression-gate-mrzxurfk' '.claude/skills/quality-gate'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/quality-regression-gate-mrzxurfk'

openskills read 'quality-regression-gate-mrzxurfk'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/quality-regression-gate-mrzxurfk/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires