Pre-Push Compliance Gate
Purpose
The pre-push-compliance subskill is a strict gatekeeping utility designed to prevent insecure, undocumented, or broken codebases from being pushed to upstream remote repositories. It operates as a blocking checkpoint: the AI agent is only authorized to execute git push commands once all pre-push audits report a 100% PASS score.
Interception and Execution Protocol
When a user requests a git push command (e.g., "push to main", "git push with audit") or when the agent is about to execute a push action, the agent MUST intercept the workflow and execute the following checks in order:
Step 1: Run the Pre-Push Audit Checks
The agent must check the following five pillars deterministically in the local repository:
PII Compliance & Secrets Gate
- Verify that no personal names, GitHub handles, or emails are hardcoded in the codebase, issue templates, or markdown files.
- The system must dynamically extract maintainer contacts from the
.env configuration (keys MAINTAINER_NAME and MAINTAINER_EMAIL).
- Ensure that template-driven community files are in sync with
.env values.
Pillar 1: README Structure & Completeness
- Verify that a root
README.md file exists.
- Verify that the root
README.md documents:
- Prerequisites (Node.js/Docker versions, etc.).
- Dependency installation commands (e.g.
npm install, pnpm install).
- Runtime execution scripts (development, build, and test lifecycle commands).
- Environment variable setup instructions (with references to
.env.example).
Pillar 2: GitHub Actions Workflow Security (CI/CD)
Inspect all workflow configurations in .github/workflows/*.yml (if they exist) for the following issues:
- CWE-1395 (Supply Chain): All third-party actions (
uses:) MUST be pinned to a specific SHA-256 commit hash instead of mutable tags (e.g., uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1fd717b0 instead of uses: actions/checkout@v4).
- CWE-250 (Privilege Misconfiguration): Default permissions for
GITHUB_TOKEN must be restricted. The workflow yaml file must specify an explicit permissions: block (e.g., permissions: read-all or minimal scoped read permissions).
- CWE-94 (Code Injection): Untrusted variables from events (such as
github.event.issue.title or github.event.pull_request.title) must NOT be evaluated directly inside shell execution scripts. They must instead be passed as environment variables.
- CWE-798 (Hardcoded Secrets): Verify that secrets (e.g.,
${{ secrets.MY_SECRET }}) are not printed or logged in raw shell output commands.
Pillar 3: Runtime & Package Manager Consistency
- Duplicate Lockfiles: Check the root and subdirectories to ensure no conflicting lockfiles coexist (e.g. having both
package-lock.json and pnpm-lock.yaml in the same directory, which causes deployment non-determinism).
- Runtime Engines Bounding: Verify that
package.json contains a populated and pinned engines block declaring allowed runtimes (Node.js, Bun, or Deno versions).
- Execution Script Match: Ensure scripts in
package.json do not run commands for a different package manager than the one specified by the lockfile (e.g., calling npm run in scripts when a pnpm-lock.yaml lockfile exists).
- Lockfile Synchronization: Ensure the lockfile is up to date and not older than
package.json.
Pillar 4: Dependency Vulnerability Audit
- Identify the active lockfile (
package-lock.json, pnpm-lock.yaml, yarn.lock, or bun.lockb).
- Propose and run the corresponding package manager audit command:
- npm:
npm audit --audit-level=high
- pnpm:
pnpm audit --audit-level=high
- yarn:
yarn audit --level high
- bun:
bun audit
- Verify that zero High or Critical vulnerabilities exist in the dependency tree.
Pillar 5: Automated Dependency Updates
- Verify that an automated version updater configuration exists:
.github/dependabot.yml or renovate.json in the root repository.
- Verify that the config is active and covers core package manager updates.
Step 2: The Gateway Verdict
Based on the audit findings, the agent must enforce the following blocking rules:
❌ AUDIT FAIL (Score < 100%):
If any check in Pillars 1–5 fails, the agent MUST NOT execute the git push command.
The agent must output a detailed compliance failure report outlining:
- The exact gate/pillar that failed.
- The specific file and code line causing the failure.
- Actionable remediation requirements to resolve the audit gap.
The push command is ABORTED.
✅ AUDIT PASS (Score = 100%):
If all checks in Pillars 1–5 pass, the agent is authorized to proceed.
The agent must output a compliance clearance report and then execute the requested git push command.
Output Template for Pre-Push Failures
If the audit fails, output the report using the following format:
# ❌ Pre-Push Compliance Gate Blocked
**Date:** [timestamp] **Operator:** [AI Agent Name]
**Git Target:** [branch/remote]
The repository has failed the pre-push compliance checks. To prevent deployment degradation, the push command has been blocked. Please resolve the following findings:
## ❌ Pillar 2: GitHub Actions Workflow Security (CWE-1395)
- **File:** .github/workflows/deploy.yml#L12
- **Finding:** Action `actions/checkout@v4` is not pinned to a SHA-256 commit hash.
- **Remediation:** Replace `@v4` with `@8ade135a41bc03ea155e62e844d188df1fd717b0` (or appropriate hash).
## ❌ Pillar 3: Runtime & Package Manager Consistency
- **File:** / (Root directory)
- **Finding:** Found conflicting lockfiles: package-lock.json and pnpm-lock.yaml coexist.
- **Remediation:** Remove the unused lockfile to ensure deployment determinism.
## ❌ Pillar 4: Dependency Vulnerability Audit (CWE-1395 / OWASP A03)
- **Audit Tool:** `npm audit`
- **Finding:** Found 2 High vulnerability advisories (e.g. prototype pollution in lodash).
- **Remediation:** Run `npm audit fix` or upgrade the vulnerable packages.
1---2name: pre-push-compliance3description: Enforce a mandatory pre-push audit checking CI/CD, Actions Workflow, Runtime/Package Manager, and README configurations. This skill ONLY allows Git push execution if all checks PASS. Triggers: "pre-push audit", "verify pre-push compliance", "push to main with audit", "git push with audit".4---56# Pre-Push Compliance Gate78## Purpose9The `pre-push-compliance` subskill is a strict gatekeeping utility designed to prevent insecure, undocumented, or broken codebases from being pushed to upstream remote repositories. It operates as a blocking checkpoint: the AI agent is only authorized to execute `git push` commands once all pre-push audits report a 100% **PASS** score.1011---1213## Interception and Execution Protocol1415When a user requests a git push command (e.g., "push to main", "git push with audit") or when the agent is about to execute a push action, the agent **MUST** intercept the workflow and execute the following checks in order:1617### Step 1: Run the Pre-Push Audit Checks1819The agent must check the following five pillars deterministically in the local repository:2021#### PII Compliance & Secrets Gate22- Verify that no personal names, GitHub handles, or emails are hardcoded in the codebase, issue templates, or markdown files.23- The system must dynamically extract maintainer contacts from the `.env` configuration (keys `MAINTAINER_NAME` and `MAINTAINER_EMAIL`).24- Ensure that template-driven community files are in sync with `.env` values.2526#### Pillar 1: README Structure & Completeness27- Verify that a root `README.md` file exists.28- Verify that the root `README.md` documents:29 - Prerequisites (Node.js/Docker versions, etc.).30 - Dependency installation commands (e.g. `npm install`, `pnpm install`).31 - Runtime execution scripts (development, build, and test lifecycle commands).32 - Environment variable setup instructions (with references to `.env.example`).3334#### Pillar 2: GitHub Actions Workflow Security (CI/CD)35Inspect all workflow configurations in `.github/workflows/*.yml` (if they exist) for the following issues:36- **CWE-1395 (Supply Chain):** All third-party actions (`uses:`) MUST be pinned to a specific SHA-256 commit hash instead of mutable tags (e.g., `uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1fd717b0` instead of `uses: actions/checkout@v4`).37- **CWE-250 (Privilege Misconfiguration):** Default permissions for `GITHUB_TOKEN` must be restricted. The workflow yaml file must specify an explicit `permissions:` block (e.g., `permissions: read-all` or minimal scoped read permissions).38- **CWE-94 (Code Injection):** Untrusted variables from events (such as `github.event.issue.title` or `github.event.pull_request.title`) must NOT be evaluated directly inside shell execution scripts. They must instead be passed as environment variables.39- **CWE-798 (Hardcoded Secrets):** Verify that secrets (e.g., `${{ secrets.MY_SECRET }}`) are not printed or logged in raw shell output commands.4041#### Pillar 3: Runtime & Package Manager Consistency42- **Duplicate Lockfiles:** Check the root and subdirectories to ensure no conflicting lockfiles coexist (e.g. having both `package-lock.json` and `pnpm-lock.yaml` in the same directory, which causes deployment non-determinism).43- **Runtime Engines Bounding:** Verify that `package.json` contains a populated and pinned `engines` block declaring allowed runtimes (Node.js, Bun, or Deno versions).44- **Execution Script Match:** Ensure scripts in `package.json` do not run commands for a different package manager than the one specified by the lockfile (e.g., calling `npm run` in scripts when a `pnpm-lock.yaml` lockfile exists).45- **Lockfile Synchronization:** Ensure the lockfile is up to date and not older than `package.json`.4647#### Pillar 4: Dependency Vulnerability Audit48- Identify the active lockfile (`package-lock.json`, `pnpm-lock.yaml`, `yarn.lock`, or `bun.lockb`).49- Propose and run the corresponding package manager audit command:50 - npm: `npm audit --audit-level=high`51 - pnpm: `pnpm audit --audit-level=high`52 - yarn: `yarn audit --level high`53 - bun: `bun audit`54- Verify that **zero** High or Critical vulnerabilities exist in the dependency tree.5556#### Pillar 5: Automated Dependency Updates57- Verify that an automated version updater configuration exists: `.github/dependabot.yml` or `renovate.json` in the root repository.58- Verify that the config is active and covers core package manager updates.5960---6162### Step 2: The Gateway Verdict6364Based on the audit findings, the agent must enforce the following blocking rules:6566- **❌ AUDIT FAIL (Score < 100%):**67 If any check in Pillars 1–5 fails, the agent **MUST NOT** execute the `git push` command.68 The agent must output a detailed compliance failure report outlining:69 1. The exact gate/pillar that failed.70 2. The specific file and code line causing the failure.71 3. Actionable remediation requirements to resolve the audit gap.72 The push command is **ABORTED**.7374- **✅ AUDIT PASS (Score = 100%):**75 If all checks in Pillars 1–5 pass, the agent is authorized to proceed.76 The agent must output a compliance clearance report and then execute the requested `git push` command.7778---7980## Output Template for Pre-Push Failures8182If the audit fails, output the report using the following format:8384```markdown85# ❌ Pre-Push Compliance Gate Blocked8687**Date:** [timestamp] **Operator:** [AI Agent Name]88**Git Target:** [branch/remote]8990The repository has failed the pre-push compliance checks. To prevent deployment degradation, the push command has been blocked. Please resolve the following findings:9192## ❌ Pillar 2: GitHub Actions Workflow Security (CWE-1395)93- **File:** .github/workflows/deploy.yml#L1294- **Finding:** Action `actions/checkout@v4` is not pinned to a SHA-256 commit hash.95- **Remediation:** Replace `@v4` with `@8ade135a41bc03ea155e62e844d188df1fd717b0` (or appropriate hash).9697## ❌ Pillar 3: Runtime & Package Manager Consistency98- **File:** / (Root directory)99- **Finding:** Found conflicting lockfiles: package-lock.json and pnpm-lock.yaml coexist.100- **Remediation:** Remove the unused lockfile to ensure deployment determinism.101102## ❌ Pillar 4: Dependency Vulnerability Audit (CWE-1395 / OWASP A03)103- **Audit Tool:** `npm audit`104- **Finding:** Found 2 High vulnerability advisories (e.g. prototype pollution in lodash).105- **Remediation:** Run `npm audit fix` or upgrade the vulnerable packages.106```