Auditeur de specs Angular

VérifiéPrudence

Audite indépendamment un fichier de spec Angular selon les règles de migration, avec checklist et contrôle ESLint.

Spar Skills Guide Bot
TestingAvancé
09/11/2026
Claude Code
#angular#unit-testing#jest#testing-library#spec-audit

Recommandé pour

Synthèse automatique

Audite un fichier de spécification de composant Angular par rapport aux règles de migration du projet et corrige les écarts détectés.

Points forts

  • Exécute une vérification ESLint stricte concrète et considère chaque problème signalé comme un échec.
  • Fournit une liste de contrôle PASS/FAIL couvrant la structure, le style d'injection de dépendances et la couverture.
  • Déduit automatiquement les chemins du composant et du template et impose une relecture indépendante.
  • Recommande des correctifs avec TestBed.inject et jest.spyOn plutôt que useValue.

Limites

  • Dépend de fichiers propres au dépôt (.claude/rules/angular-specs.md et .eslintrc.strict-specs.js), donc peu réutilisable tel quel.
  • Le SKILL.md fourni s'arrête au milieu d'une phrase à l'étape 3, ce qui rend la procédure de correction incomplète.
  • Suppose une organisation Angular/Jest précise, notamment des composants non standalone et une gestion ESLint en configuration héritée.
Quand l'utiliser

À utiliser pour auditer ou migrer des fichiers de spécifications Angular/Jest dans un dépôt qui dispose déjà des règles et de la configuration ESLint strictes décrites.

Quand l'éviter

À ne pas utiliser pour des suites de tests non Angular, des projets sans la configuration référencée, ou lorsqu'une revue de tests Angular générique est attendue.

Analyse de sécurité

Prudence
Score qualité90/100

The skill is a legitimate Angular test-auditing workflow and does not attempt exfiltration, obfuscation, or destructive commands. However, it executes a shell command with a user-provided path, may invoke `npx` package resolution, and edits files while declaring no allowed tools, so it is best rated caution rather than safe.

Points d'attention
  • •The skill requires shell execution (`npx eslint`) and file editing, but no allowed-tools are declared, so the agent may need broader permissions than expected.
  • •The ESLint command interpolates a user-supplied spec path without explicit quoting or validation; a path containing shell metacharacters could enable command injection.
  • •`npx eslint` can download and execute packages if ESLint is not already installed, and it loads a project-local config/plugins, which is legitimate but executes code from the repository.
  • •The skill automatically edits the target spec file without an explicit confirmation step; this is expected for the task but is a code-modification risk.
  • •Instructs the agent to run `npx eslint` from `src/main/app`, which executes local Node tooling/config and may fetch/install packages via npx if dependencies are missing.
  • •Requires file-read and file-edit capabilities to inspect specs/components and modify spec files, although no `allowed-tools` are declared.
  • •Edits are scoped to spec files and explicitly forbid touching component source files, limiting blast radius.
Comment cette analyse est faite

Exemples

Audit a dialog spec
/audit-ng-spec-skill src/main/app/src/app/taken/taken-vrijgeven-dialog/taken-vrijgeven-dialog.component.spec.ts
Audit and fix a component test
Run the Angular spec audit on src/main/app/src/app/foo/foo.component.spec.ts and fix every FAIL according to .claude/rules/angular-specs.md.

Angular Spec Auditor

Independently audit an Angular component spec file against the project's migration guidelines.

Usage: /audit-ng-spec-skill $ARGUMENTS $ARGUMENTS = path to the spec file (relative from repo root), e.g. src/main/app/src/app/taken/taken-vrijgeven-dialog/taken-vrijgeven-dialog.component.spec.ts

If $ARGUMENTS is omitted, ask the user for the spec path before proceeding.


You did NOT write this spec. Treat it with completely fresh eyes.

Step 1 — Read context

  1. Read .claude/rules/angular-specs.md.
  2. Read the spec at {SPEC_PATH}.
  3. Derive the component path from the spec path (same directory, .component.ts instead of .component.spec.ts), read it.
  4. Derive the template path (.component.html), read it if it exists.
  5. From src/main/app/, run the check that CI applies to a touched spec, and treat every problem it reports as a FAIL: ESLINT_USE_FLAT_CONFIG=false npx eslint -c .eslintrc.strict-specs.js <spec path relative to src/main/app>. It already covers any, NO_ERRORS_SCHEMA, DOM queries outside Testing Library (By.css, querySelector, node access such as .children or .closest()), fireEvent instead of userEvent.setup(), rendering in beforeEach, and object literals cast through unknown. Fix those as .claude/rules/angular-specs.md describes; never replace one banned query with another. It does not catch debugElement.query(By.directive(…)) or within(fixture.nativeElement); mark those FAIL yourself.

Step 2 — Audit

For each item, mark PASS or FAIL with a one-line reason and the exact line(s) involved.

Rules

  • [ ] No : void return type annotations anywhere in the spec
  • [ ] No trivial smoke tests (it("should create", ...) or similar)
  • [ ] Variable naming: no single-letter or abbreviated names (el, f, res, btn). Use full descriptive names (element, fixtureRef, result, button).
  • [ ] SPDX header: new file → <current year> INFO.nl only; existing file → INFO.nl added only if completely absent from the existing line

Spec structure

  • [ ] describe(ClassName.name, ...) — class name reference, not a string literal
  • [ ] declarations: [Component] used (component is standalone: false), OR imports: [Component] if already standalone
  • [ ] Services should use TestBed.inject() + jest.spyOn() — avoid useValue: mockObject.
    • Reason: type safety. useValue accepts any object — typos, missing methods, wrong return types all silently pass. jest.spyOn is checked against the real service type, so the compiler catches mismatches.
    • Strongly preferred pattern:
      providers: [provideHttpClient(), provideRouter([]), MyService],
      // ...
      myService = TestBed.inject(MyService);
      jest.spyOn(myService, "someMethod").mockReturnValue(of(result));
      
    • useValue is acceptable when genuinely difficult to avoid (e.g. a service with a deeply complex DI tree that cannot be satisfied without significant setup). Flag it with a comment explaining why.
    • Always acceptable exceptions: Angular built-in injection tokens (MAT_DIALOG_DATA, LOCALE_ID, APP_BASE_HREF, etc.) where no real class exists to inject.
    • TranslateService → use provideTranslateService() in providers, then TestBed.inject(TranslateService) + jest.spyOn.
    • Services using ZacHttpClient → add provideHttpClient() to providers.
    • Services using Router → add provideRouter([]) to providers.
  • [ ] provideHttpClient() present if any service in the tree uses ZacHttpClient
  • [ ] provideRouter([]) present if any service in the tree uses Router

Coverage

  • [ ] Every test asserts meaningful behaviour
  • [ ] ≥90% of template behaviours covered (buttons, conditionals, outputs, form states)
  • [ ] Protected/private members accessed via bracket notation: component["member"]

Step 3 — Fix

For each FAIL: edit the spec file with the correct fix. Do NOT touch any component source files.

After all fixes are applied, re-read the spec to confirm no violations remain.

Step 4 — Report

AUDIT: PASS                         (if nothing needed fixing)
AUDIT: PASS (N issues fixed)        (if fixes were applied)

Issues fixed:
- Line X: <description of fix>
- ...

If a violation cannot be auto-fixed (e.g. missing test coverage that requires understanding domain logic), list it as a manual action required item and do not mark the audit PASS until the user addresses it.

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/angular-spec-auditor-mvj1ocui/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/angular-spec-auditor-mvj1ocui' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/angular-spec-auditor-mvj1ocui/download' --output '.skill-downloads/angular-spec-auditor-mvj1ocui/SKILL.md.part' && mv '.skill-downloads/angular-spec-auditor-mvj1ocui/SKILL.md.part' '.skill-downloads/angular-spec-auditor-mvj1ocui/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

Le fichier ne fournit pas un en-tête name/description exploitable pour cette procédure native. Le téléchargement reste disponible pour lecture ; utilisez le mode manuel ci-dessous.

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/angular-spec-auditor-mvj1ocui/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