PluginBench
Skill
Official
Review
Audit score 70

hygiene

microsoft/vscode

Enforce VS Code's code quality standards: unicode, quotes, headers, indentation, formatting, and linting.

What is hygiene?

Runs VS Code's pre-commit hygiene checks on staged files to catch code style violations before commit. Covers unicode restrictions, quote rules, copyright headers, indentation, formatting, ESLint, and stylelint. Use this before declaring code changes complete.

  • Scans staged files for non-ASCII unicode characters and rejects them unless suppressed
  • Enforces single quotes for regular strings and double quotes only for localized/externalized strings
  • Validates Microsoft copyright headers are present in all files
  • Checks indentation uses tabs only, no spaces
  • Verifies TypeScript formatting matches the configured formatter output
  • Runs ESLint on TypeScript files

How to install hygiene

npx skills add https://github.com/microsoft/vscode --skill hygiene
Prerequisites
  • Node.js with experimental-strip-types support
  • Git repository with staged files or files to check
Claude Code
Cursor
Windsurf
Cline

How to use hygiene

  1. 1.Run `npm run precommit` to check all staged files before committing
  2. 2.Or run `node --experimental-strip-types build/hygiene.ts path/to/file.ts` to check specific files directly
  3. 3.Review any reported violations in the output
  4. 4.Fix unicode issues by using ASCII equivalents or adding `// allow-any-unicode-next-line` or `// allow-any-unicode-comment-file` suppressions
  5. 5.Fix quote violations by changing double quotes to single quotes (except for localized strings)
  6. 6.Add missing copyright headers to new files
  7. 7.Convert space indentation to tabs
  8. 8.Run `Format Document` to fix formatting issues

Use cases

Good for
  • Before committing code changes to catch hygiene violations that would block the commit
  • Checking specific files directly without staging them first
  • Validating code style compliance in CI/CD pipelines
  • Ensuring consistent code formatting across the VS Code codebase
Who it's for
  • VS Code contributors
  • TypeScript developers working on VS Code
  • Teams maintaining strict code style standards

hygiene FAQ

What happens if hygiene checks fail?

Git commits will be rejected. You must fix all hygiene violations before the commit can proceed.

How do I suppress unicode character errors?

Add `// allow-any-unicode-next-line` before a single line or `// allow-any-unicode-comment-file` at the top of a file to suppress unicode checks for that scope.

Can I check files without staging them first?

Yes, run `node --experimental-strip-types build/hygiene.ts path/to/file.ts` to check specific files directly.

What's the difference between single and double quotes?

Use single quotes for regular strings and double quotes only for externalized (localized) strings that will be translated.

Does this tool fix issues automatically?

No, you must fix violations manually. However, running `Format Document` will fix formatting issues in TypeScript files.

Full instructions (SKILL.md)

Source of truth, from microsoft/vscode.


name: hygiene description: Use when making code changes to ensure they pass VS Code's hygiene checks. Covers the pre-commit hook, unicode restrictions, string quoting rules, copyright headers, indentation, formatting, ESLint, and stylelint. Run the hygiene check before declaring work complete.

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.