Back to Skills

hygiene

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.

187,164stars40,944forksUpdated 7/7/2026

Security Assessment

Safe(100/100)
Security Score100/100

About hygiene

Hygiene Checks documents how the VS Code codebase enforces its code-style and correctness rules through a git pre-commit hook, so that changes clear the same gate the repository applies before a commit is accepted. The hook runs a hygiene linter that scans only staged files, and the guide explains how to invoke it on demand: npm run precommit runs the check over staged files (executing the hygiene script on git diff --cached), while pointing the underlying script at a path lets you check specific files without staging them first. Running the check before declaring work complete is the central recommendation, since a failing hygiene check blocks the commit outright.

The linter enforces several categories of rules. Non-ASCII characters such as em-dashes, curly quotes, and emoji are rejected in favor of ASCII equivalents, with inline suppression comments (allow-any-unicode-next-line or allow-any-unicode-comment-file) available for the rare cases that need an exception. Double quotes are reserved for externalized, localized strings, and single quotes are required everywhere else. Every file must carry the Microsoft copyright header. Indentation must use tabs rather than spaces, and TypeScript files must match the formatter's output, fixable by running Format Document. On top of these structural rules, TypeScript files are linted with ESLint and CSS files with stylelint.

Reach for this when making code changes in the VS Code codebase and you want them to pass the pre-commit gate on the first try, or when a commit has already been rejected and you need to understand which rule tripped and how to fix or suppress it. Because the guidance mirrors the exact behavior of the hook, it doubles as a quick reference for the project's quoting, formatting, indentation, and copyright-header conventions.

FAQ

How do I run the hygiene check?

Run npm run precommit to check your staged files, or run the hygiene script directly against a file path to check specific files without staging them first.

What causes a hygiene failure?

Non-ASCII characters, double-quoted non-localized strings, a missing Microsoft copyright header, space-based indentation, formatting that doesn't match the formatter, or ESLint/stylelint violations.

How do I allow a non-ASCII character when it's genuinely needed?

Suppress the unicode rule with an inline comment: allow-any-unicode-next-line for a single line, or allow-any-unicode-comment-file for a whole file.

When should double quotes be used?

Only for externalized (localized) strings. Everywhere else in the code you must use single quotes.

Does it check CSS as well as TypeScript?

Yes. TypeScript files are linted with ESLint and must match the formatter output, while CSS files are linted with stylelint.

Install hygiene

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill