install
source · Clone the upstream repo
git clone https://github.com/m-ret/awesome-claude-code
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/m-ret/awesome-claude-code "$T" && mkdir -p ~/.claude/skills && cp -r "$T/templates/nodejs/.claude/skills/pre-commit" ~/.claude/skills/m-ret-awesome-claude-code-pre-commit && rm -rf "$T"
manifest:
templates/nodejs/.claude/skills/pre-commit/SKILL.mdsource content
Pre-Commit Checks Skill
Comprehensive validation before committing code.
When to Use
- Before any git commit
- When user runs /pre-commit
- As part of quick-commit workflow
Steps
-
Check for unstaged changes
git status --shortWarn if there are unstaged changes that won't be committed.
-
Type Check (TypeScript)
npx tsc --noEmitSTOP if type errors found.
-
Lint Check
npm run lintSTOP if lint errors found (warnings OK).
-
Format Check
npx prettier --check .Offer to fix if formatting issues found.
-
Run Tests
npm testSTOP if tests fail.
-
Check for Sensitive Files Scan staged files for:
- .env files (should be .env.example only)
- Credentials, API keys, secrets
- Large binary files WARN if found.
-
Verify Git Identity
git config user.emailConfirm correct email for this project.
Output
All Checks Pass
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ PRE-COMMIT CHECK [OK] TypeScript: No errors [OK] ESLint: Passed [OK] Prettier: Formatted [OK] Tests: All passing [OK] No sensitive files [OK] Git identity: your.email@example.com Ready to commit! ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Checks Failed
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ PRE-COMMIT CHECK [OK] TypeScript: No errors [FAIL] ESLint: 3 errors found - src/index.ts:15 - Unexpected any - src/utils.ts:8 - Missing return type - src/utils.ts:12 - Unused variable [--] Prettier: Skipped (lint failed) [--] Tests: Skipped (lint failed) Fix errors before committing. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Auto-Fix Mode
When invoked with "fix" argument:
- Run lint:fix
- Run prettier --write
- Re-run all checks
- Report final status