mcpField
H
hygiene

hygiene

github.com/microsoftTesting & quality194.4k2.2k installsUpdated today
Repository

About hygiene

A VS Code repository skill for running and understanding the git pre-commit hygiene check. It helps contributors catch staged-file issues that can prevent a commit.

Key features

  1. 01Run the pre-commit hygiene check
  2. 02Scan staged files for issues
  3. 03Check specified files without staging
  4. 04Detect Unicode and quote-style violations
  5. 05Check headers, formatting, and lint

Use cases

  1. 01Checking staged changes before a commit
  2. 02Inspecting selected files directly
  3. 03Finding formatting or lint failures

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/microsoft/vscode --skill hygiene

After installing, type/hygienein Claude Code to confirm it loaded.

Details

From the project README

Hygiene Checks

VS Code runs a hygiene check as a git pre-commit hook. Commits will be rejected if hygiene fails.

Running the hygiene check

Always run the pre-commit hygiene check before declaring work complete. This catches issues that would block a commit.

To run the hygiene check on your staged files:

npm run precommit

This executes node --experimental-strip-types build/hygiene.ts, which scans only staged files (from git diff --cached).

To check specific files directly (without staging them first):

node --experimental-strip-types build/hygiene.ts path/to/file.ts

What it checks

The hygiene linter scans staged files for issues including (but not limited to):

  • Unicode characters: Non-ASCII characters (em-dashes, curly quotes, emoji, etc.) are rejected. Use ASCII equivalents in comments and code. Suppress with // allow-any-unicode-next-line or // allow-any-unicode-comment-file.
  • Double-quoted strings: Only use "double quotes" for externalized (localized) strings. Use 'single quotes' everywhere else.
  • Copyright headers: All files must include the Microsoft copyright header.
  • Indentation: Tabs only, no spaces for indentation.
  • Formatting: TypeScript files must match the formatter output (run Format Document to fix).
  • ESLint: TypeScript files are linted with ESLint.
  • Stylelint: CSS files are linted with stylelint.

Comments

Markdown supported