run-pre-commit-checks

Runs lint, TypeScript type checking, and Mocha unit tests before every code commit.

1|Updated Aug 31, 2026
One-click install
npx skills add https://github.com/nguyenhungtran18/skill-and-tool-tracker --skill run-pre-commit-checks-nguyenhungtran18
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: run-pre-commit-checks
Source: https://github.com/nguyenhungtran18/skill-and-tool-tracker/tree/main/skills/run-pre-commit-checks
Command: npx skills add https://github.com/nguyenhungtran18/skill-and-tool-tracker --skill run-pre-commit-checks-nguyenhungtran18

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Committing code without validation leads to broken builds, type errors, and regressions slipping into the repository. This Skill enforces a mandatory pre-commit gate so every commit passes lint, type checking, and unit tests first. ## Core Features & Use Cases - Three Required Checks: Runs ESLint via npm run lint, TypeScript compilation via npm run compile-tests, and Mocha unit tests via npm run unittest. - Auto-Fix Support: Supports the --fix flag to automatically resolve lint issues such as import ordering. - Failure Triage Tables: Maps common ESLint and TypeScript error codes (TS2339, TS2345, TS18048) to concrete fixes. - Use Case: After addressing reviewer comments on a pull request, run this Skill to confirm all three checks pass before committing and pushing the changes. ## Quick Start Run the pre-commit checks on my current changes and fix any lint errors before I commit.

Frequently Asked Questions about run-pre-commit-checks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run pre-commit checks before committing code?▼

Run three npm commands in sequence: npm run lint for ESLint rules, npm run compile-tests for TypeScript type checking, and npm run unittest for Mocha unit tests. All three must pass before running git commit.

How to auto-fix ESLint errors in a TypeScript project?▼

Run npm run lint -- --fix to automatically correct fixable issues such as import ordering. For remaining errors like no-unused-vars, remove the variable or prefix it with an underscore.

What does npm run compile-tests check in TypeScript?▼

It compiles the test code to detect TypeScript type errors, missing imports, type mismatches, and strict null check violations. Output goes to the out/ directory and is not used for production builds.

Why does TS18048 possibly undefined error happen?▼

This error occurs under strict null checks when a value may be undefined at the point of use. Fix it by adding a null check, using optional chaining, or narrowing the type with a guard.

When should pre-commit checks be skipped?▼

They should never be skipped. The checks catch type errors that would break the extension, style inconsistencies, and regressions, and they are also enforced by CI on every pull request.