Contract
- Input: git-commit event, staged diff, project tooling config.
- Output:
GatePreCommitArtifact with per-check results and terminal state.
- Scope: pre-commit checks only — lint/typecheck on changed files, unit tests on changed files, lightweight dependency vuln check.
- Rule: enforce maxDuration of 10 seconds; skip slow checks rather than exceed budget.
- Rule: scope to changed files only — do not run full suite here.
- Rule: block on failure; commit must not proceed if any check fails.
Provenance
| Question |
Answer |
| What is the source of truth? |
The git-commit event and staged diff |
| What is in scope? |
Changed files since last commit; lint, typecheck, unit tests, dependency vuln check |
| What is explicitly out of scope? |
Full integration suite, security scan, performance tests, E2E tests |
| Who or what consumes this artifact afterward? |
gate-ci or commit process |
| What evidence proves it is done? |
All checks completed within 10s budget, structured result returned, terminal state determined |
| What risk remains? |
Skipped checks due to time budget; lightweight vuln check may miss transitive vulnerabilities |
Artifact
Return GatePreCommitArtifact as structured output in the current response. Do not write local artifact files unless the user explicitly asks for an export.
Process
1. Capture staged diff
Run git diff --cached --name-only to get the list of staged files. If no staged files, report idle.
2. Run lint + typecheck on changed files
Execute linter and type checker against only the staged files. Use project-native tooling (eslint, tsc --noEmit, etc.).
3. Run unit tests for changed files
Map changed files to their corresponding test files. Run only those unit tests. If no test files map, skip with reason.
4. Run lightweight dependency vulnerability check
Execute a fast dependency check (npm audit --audit-level=high, pip-audit, etc.). Limit to direct dependencies only.
5. Enforce time budget
Track elapsed time. If any check risks exceeding 10 seconds total, skip remaining checks and mark them as skipped with reason time-budget-exceeded.
6. Aggregate results
Compile all check results into GatePreCommitArtifact. Terminal state:
- Any
failed → blocked (commit prevented)
- All
passed → completed
- Error →
failed
7. Enforce blockOnFailure
If terminal state is blocked, return exit code 1 to prevent the commit.
Completion
- all applicable checks have run or been skipped with reason
- total duration within 10s budget
- structured result returned
- commit blocked if any check failed
1---2name: gate-pre-commit3category: platform4maturity: stable5version: 16description: Shift-left quality gate triggered on git-commit events. Runs lint + typecheck on changed files only, unit tests for changed files only, lightweight dependency vulnerability check, and blocks on failure within a 10s budget.7license: MIT8capabilities:9 - run scoped checks10 - produce quality gate artifact11 - validate quality gate completion criteria12 - trace gate pre commit decisions across inputs, constraints, and failure paths13 - validate platform outcomes with evidence, assumptions, and explicit next steps14outputs:15 - type: object16 name: GatePreCommitArtifact17 properties:18 trigger: { type: string, enum: [git-commit] }19 checks:20 type: array21 items:22 type: object23 properties:24 name: { type: string }25 status: { type: string, enum: [passed, failed, skipped] }26 durationMs: { type: integer }27 output: { type: string }28 maxDuration: { type: integer }29 blockOnFailure: { type: boolean }30 result: { type: string, enum: [completed, blocked, failed] }31 required: [trigger, checks, maxDuration, blockOnFailure, result]32sideEffects: []33dependencies: []34stopCondition: Shift-left quality gate triggered on git-commit events complete; structured result returned; completion criteria checked.35risk: low36trustTier: 137maxIterations: 338modelTier: fast39promptVersion: "2.0"40artifactType: plan41evaluators:42 - behavioral43 - regression44fixturesPath: .agents/skills/platform/fixtures/behavioral/gate-pre-commit.json45diataxis: how-to46tags: [quality, shift-left, git, gate]47compatibility: [implement, publish-open-pr]48approvalRequired: false49approvalFor: []50metadata:51 source: https://skillmd.com/skills/quantumquirkxyz/gate-pre-commit52---5354## Contract5556- Input: git-commit event, staged diff, project tooling config.57- Output: `GatePreCommitArtifact` with per-check results and terminal state.58- Scope: pre-commit checks only — lint/typecheck on changed files, unit tests on changed files, lightweight dependency vuln check.59- Rule: enforce maxDuration of 10 seconds; skip slow checks rather than exceed budget.60- Rule: scope to changed files only — do not run full suite here.61- Rule: block on failure; commit must not proceed if any check fails.6263## Provenance6465| Question | Answer |66|---|---|67| What is the source of truth? | The git-commit event and staged diff |68| What is in scope? | Changed files since last commit; lint, typecheck, unit tests, dependency vuln check |69| What is explicitly out of scope? | Full integration suite, security scan, performance tests, E2E tests |70| Who or what consumes this artifact afterward? | `gate-ci` or commit process |71| What evidence proves it is done? | All checks completed within 10s budget, structured result returned, terminal state determined |72| What risk remains? | Skipped checks due to time budget; lightweight vuln check may miss transitive vulnerabilities |7374## Artifact7576Return `GatePreCommitArtifact` as structured output in the current response. Do not write local artifact files unless the user explicitly asks for an export.7778## Process7980### 1. Capture staged diff81Run `git diff --cached --name-only` to get the list of staged files. If no staged files, report idle.8283### 2. Run lint + typecheck on changed files84Execute linter and type checker against only the staged files. Use project-native tooling (eslint, tsc --noEmit, etc.).8586### 3. Run unit tests for changed files87Map changed files to their corresponding test files. Run only those unit tests. If no test files map, skip with reason.8889### 4. Run lightweight dependency vulnerability check90Execute a fast dependency check (npm audit --audit-level=high, pip-audit, etc.). Limit to direct dependencies only.9192### 5. Enforce time budget93Track elapsed time. If any check risks exceeding 10 seconds total, skip remaining checks and mark them as `skipped` with reason `time-budget-exceeded`.9495### 6. Aggregate results96Compile all check results into `GatePreCommitArtifact`. Terminal state:97- Any `failed` → `blocked` (commit prevented)98- All `passed` → `completed`99- Error → `failed`100101### 7. Enforce blockOnFailure102If terminal state is `blocked`, return exit code 1 to prevent the commit.103104## Completion105106- all applicable checks have run or been skipped with reason107- total duration within 10s budget108- structured result returned109- commit blocked if any check failed