| name | precommit-workflow-management |
|---|---|
| description | Rules, architecture, and runbooks for configuring, updating, and operating the intelligent Git pre-commit workflow. |
This skill explains how to maintain, configure, and execute the intelligent pre-commit hook workflow in the GitHub Backup Automation System monorepo.
Important
CREATE A LOCAL BRANCH FIRST: Always start by creating a local branch from main:
git switch -c MishraShardendu22/main/<feature-name>Never make changes directly on main.
The pre-commit workflow lives in .githooks/pre-commit and is tracked directly in version control.
Staged Changes Detected (git diff --cached)
│
├── Only Go files changed ───────► Run Go formatting, vet, tests, build (~1-2s)
├── Only Python files changed ───► Run Pyright typecheck, agent test suite (~3-4s)
├── Only Frontend files changed ─► Run Biome lint, Next.js build (~10-12s)
├── Only Documentation changed ──► Fast-path bypass (<0.2s)
└── Global / Config / Manual ────► Full monorepo validation gate (~20s)
- Selective Staged-File Execution: Avoids unnecessary work by only running checks relevant to the files staged for the commit.
- Fast-Path for Documentation: Commits containing only markdown (
*.md), text (*.txt), or asset files skip expensive build and test pipelines. - Subshell Directory Isolation: Every check runs in a subshell
(cd "${REPO_ROOT}" && ...)to prevent current working directory drift. - Fail-Fast with Remediation: Aborts immediately on failure and outputs exact commands needed to fix the problem.
- Zero External Runtime Dependencies: Implemented in portable POSIX bash, requiring no npm wrapper packages (like Husky) at the repository root.
make hooks-install
# Or: ./scripts/install-hooks.shmake pre-commit# Skip tests for quick drafts
SKIP_TESTS=1 git commit -s -S -m "chore: draft"
# Skip builds for lightweight edits
SKIP_BUILDS=1 git commit -s -S -m "fix: comment"
# Force full validation across all subsystems
PRECOMMIT_ALL=1 git commit -s -S -m "feat: core change"