run-pre-commit-checks
Skill141 starsChanged 10 months agoMITView on GitHub
Run the mandatory pre-commit checks before committing code. Includes lint, type checking, and unit tests. MUST be run before every commit.
In this repository8 other files it gives its agents.
- cross-platform-pathsSkill
- debug-failing-testSkill
- generate-snapshotSkill
- python-manager-discoverySkill
- run-e2e-testsSkill
- run-integration-testsSkill
- run-smoke-testsSkill
- settings-precedenceSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 10 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
ALWAYS: before committing code changes
- Distinctive: line 14
After fixing reviewer or Copilot review comments
- Distinctive: line 16
When the maintainer agent requests pre-commit validation
- Distinctive: line 20
All three checks must pass before committing:
- Distinctive: line 32
Import ordering and unused imports
- Very specific: line 64
All unit tests in src/test/ pass
- Distinctive: line 103
Read the test failure message carefully
- Distinctive: line 104
Check if you changed behavior that tests depend on
- Distinctive: line 105
Update tests if behavior change is intentional
- Distinctive: line 129
After addressing review comments (manual trigger)
- Distinctive: line 130
Before merging (automated by CI)
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Run Pre-Commit Checks
This skill defines the mandatory checks that must pass before any commit.
When to Use
- ALWAYS before committing code changes
- After fixing reviewer or Copilot review comments
- Before pushing changes
- When the maintainer agent requests pre-commit validation
Required Checks
All three checks must pass before committing:
1. Lint Check (Required)
npm run lintWhat it checks:
- ESLint rules defined in
eslint.config.mjs - TypeScript-specific linting rules
- Import ordering and unused imports
- Code style consistency
To auto-fix issues:
npm run lint -- --fix2. Type Check (Required)
npm run compile-testsWhat it checks:
- TypeScript type errors
- Missing imports
- Type mismatches
- Strict null checks
Output location: out/ directory (not used for production)
3. Unit Tests (Required)
npm run unittestWhat it checks:
- All unit tests in
src/test/pass - Tests run with Mocha framework
- Uses configuration from
build/.mocha.unittests.json
Full Pre-Commit Workflow
# Run all checks in sequence
npm run lint
npm run compile-tests
npm run unittest
# If all pass, commit
git add -A
git commit -m "feat: your change description (Fixes #N)"Common Failures and Fixes
ESLint Errors
| Error | Fix |
@typescript-eslint/no-unused-vars | Remove unused variable or prefix with _ |
import/order | Run npm run lint -- --fix |
@typescript-eslint/no-explicit-any | Add proper type annotation |
no-console | Use traceLog/traceVerbose instead of console.log |
Type Errors
| Error | Fix |
TS2339: Property does not exist | Check property name or add type guard |
TS2345: Argument type not assignable | Check function parameter types |
TS2322: Type not assignable | Add type assertion or fix type mismatch |
TS18048: possibly undefined | Add null check or use optional chaining |
Test Failures
- Read the test failure message carefully
- Check if you changed behavior that tests depend on
- Update tests if behavior change is intentional
- Fix code if behavior change is unintentional
Integration with Review Process
The maintainer agent workflow requires:
Code Change → Reviewer Agent → Pre-Commit Checks → Commit
↓
Fix Issues → Re-run Reviewer → Pre-Commit ChecksNever skip pre-commit checks. They catch:
- Type errors that would break the extension
- Style inconsistencies
- Regressions in existing functionality
Automation Note
These checks should also be run:
- By CI on every PR (automated)
- After addressing review comments (manual trigger)
- Before merging (automated by CI)
The hooks system can automate running lint after file edits (see .github/hooks/).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

