/claude-mods:push-preflightfrom claude-mods
Runs six pre-push safety checks including gitleaks secret scanning, clean tree verification, forbidden file detection, fast-forward validation, and size/issue advisories. Refuses push on any secret hit.
Ships in claude-mods. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Formalised pre-push safety check. Runs before every git push <remote> where the remote is not a local file path. Refuses on secret hits; warns on size/forbidden-file; confirms intent before pushing.
Use this skill whenever the user asks to push, or before Claude runs git push to any remote. Complements git-ops (which handles the push itself) — this is the gate that runs immediately before.
Why the name. Formerly push-gate. It runs six checks (secret scan, clean tree, forbidden files, fast-forward, size advisory, open-issue advisory), so secret-scan would undersell it, and mislead: it scans only the commits being pushed, never history (that is security-ops). The name matches scripts/preflight.sh. The secret scan leads the description because the description, not the name, is what selects the skill.
.gitleaksignore for gitleaks, .push-preflight-allow for the regex layer — see §False-positive handling), never an inline override. Real secrets force the user to rewrite history and re-invoke the gate.--force push. The gate never passes a force flag. If the user needs to force-push, that's a separate conversation with explicit authorization.--no-verify. Don't skip hooks.git push is called without an explicit remote and branch.Step 1 → Identify remote + branch
Step 2 → git fetch <remote>
Step 3 → Verify working tree clean
Step 4 → Compute pending commits (count + list)
Step 5 → Check divergence (non-ff ⇒ require user to rebase first)
Step 6 → Secret scan ────────┐ gitleaks honours .gitleaksignore,
│ regex layer honours .push-preflight-allow
Step 7 → Forbidden-file scan │ refuse on any hit
Step 8 → Size advisory │
→ Open-issue advisory (github-ops; informational, never gates)
Step 9 → Explicit confirm │
Step 10 → git push <remote> <branch>
Step 11 → Post-push verify (ls-remote matches pushed SHA)
scripts/push-scope.sh decides which commits a push sends. Steps 4, 6 and 7 all use that one answer, so the commit count, the secret scan and the forbidden-file check cover the same commits:
| Case | Commits scanned | Diff base (regex layer, Step 7) |
|---|---|---|
<remote>/<branch> exists | <remote>/<branch>..<branch> | <remote>/<branch> |
| New remote branch; the remote has other refs | <branch> --not --remotes=<remote>: commits no <remote>/* ref reaches | the fork point: the newest already-published parent of those commits |
| The remote has no refs at all | the whole branch, labelled "first push to an empty remote" | the empty tree (every file added) |
So a feature branch's first push scans its own commits, not the main it was cut from. A line already on the remote was published by an earlier push, and auditing it is history work (security-ops). The answer comes from local remote-tracking refs, so it is only as fresh as the last fetch: a ref that is behind the remote only widens the scan. When a branch merges two remote branches that forked separately, the base falls back to their common ancestor. That over-scans: it can refuse a push, but never misses a line. bash "<skill-dir>/scripts/push-scope.sh" <remote> <branch> prints the scope for a push.
# From the repo root (most common)
bash .claude/skills/push-preflight/scripts/preflight.sh <remote> <branch>
# When calling from another skill with a different cwd (e.g. github-ops)
bash $HOME/.claude/skills/push-preflight/scripts/preflight.sh --cwd <repo-root> <remote> <branch>
--cwd must precede the positional arguments. When omitted, the script operates against $PWD.
The script prints a structured report and exits with:
| Exit code | Meaning | What Claude does |
|---|---|---|
| 0 | All gates passed; ready for push | Ask user to confirm, then git push <remote> <branch> |
| 1 | Secret-scanner hit | Report to user; refuse; suggest git filter-repo / BFG |
| 2 | Forbidden file added (.env, key files, .claude/settings.local.json, worktree paths, etc.; env templates .env.example / .env.sample / .env.template are allowed, their content is still secret-scanned in Step 6) | Report; refuse |
| 3 | Dirty working tree | Report; ask user to commit or stash first |
| 4 | Non-ff divergence | Report; ask user to rebase or merge first |
| 5 | Missing dependency (gitleaks) | Report install instructions; refuse |
| 6 | No remote specified / unknown remote | Report; ask for clarification |
| Tool | Purpose | Install |
|---|---|---|
| gitleaks (required) | Secret detection with maintained rule corpus | Windows: scoop install gitleaks or winget install gitleaks.gitleaks / macOS: brew install gitleaks / Linux: apt install gitleaks or binary from https://github.com/gitleaks/gitleaks/releases |
| ripgrep (required) | Regex fallback layer + forbidden-file scan | Usually pre-installed; winget install BurntSushi.ripgrep.MSVC / brew install ripgrep |
| git ≥ 2.30 | Core operations | Standard |
Both secret layers must pass: gitleaks detects known token formats with a maintained corpus; the regex layer catches generic password = "..." / DSN / connection-string patterns that gitleaks may miss. See references/secret-patterns.txt for the regex corpus. Gitleaks runs with references/gitleaks-config.toml (default rule set + an allowlist for public-by-design tokens, e.g. Mapbox pk.*); if that file is absent, the scan falls back to gitleaks' built-in default config.
| User intent | Triggers |
|---|---|
| Direct | "push to origin", "push to github", "push to remote", "git push" |
| Question | "can we push?", "safe to push?", "ready to push?" |
| Explicit | /push-preflight, "run push-preflight" (formerly push-gate) |
Claude should invoke scripts/preflight.sh on any of these. Do not invoke on local pushes (git push <path> or git push .) — those are the updateInstead pattern for cross-worktree landings and don't leave the host.
Both secret layers have a repo-local, committed allowlist. The gate still refuses any hit not explicitly allowed, and the skill will not offer an inline bypass — a confirmed-safe finding earns a reviewed entry in the repo, not a one-off override.
| Layer | Allowlist file (repo root) | Entry format |
|---|---|---|
| gitleaks | .gitleaksignore | gitleaks fingerprint (commit:file:rule:line) |
| regex | .push-preflight-allow | <repo-relative-path>:<line-regex> |
The regex layer also drops common false positives automatically (env-var references, shell fallbacks, placeholders with ...) before the allowlist is consulted.
Legacy name .pushgate-allow (from the push-gate era) is still read, with a one-line deprecation notice on stderr. If both files exist, their entries are combined: each is a reviewed, committed decision, so a half-finished migration never starts refusing pushes that passed before. Migrate with git mv .pushgate-allow .push-preflight-allow (or move the entries across) and commit.
.push-preflight-allow rules:
# comments allowed. Each entry must carry a reason comment directly above it — the scanner warns when one is missing.: — a repo-relative path (forward slashes, no : in the path), then a Rust-regex matched against the added line's full content. No line numbers anywhere: they drift on every edit above them; a content anchor does not.Example:
# reason: test fixture — wire-snapshot key exercised by MCP wire tests, not a credential
packages/mcp/test/client.test.ts:^ apiKey: "wire-snapshot-key",$
ci-cd-ops / git-ops territory.security-ops (broader SAST + dep scanning).| File | Role |
|---|---|
SKILL.md | This file — workflow + rules |
scripts/preflight.sh | Main orchestration (Steps 1–8) |
scripts/scan-secrets.sh | Gitleaks + regex layer (Step 6) |
scripts/push-scope.sh | What the push sends (§Scope); sourced by both scripts above, or run directly to print it |
references/secret-patterns.txt | Regex corpus + false-positive filter words |
references/gitleaks-config.toml | Gitleaks config: default rules + public-token allowlist (used by scan-secrets.sh when present) |
tests/run.sh | Offline behavioural self-test (planted secrets, FP filter, allowlist, stale entries, legacy allowlist name, push scope against a bare remote) |
assets/ | (empty; reserved for future report templates) |
Per-repo (not shipped with the skill): .gitleaksignore and .push-preflight-allow, committed at the scanned repo's root — see §False-positive handling.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
pre-push, secret-scanning, gitleaks, git-safety, commit-gate
npx claudepluginhub 0xdarkmatter/claude-mods --plugin claude-mods116 skills in this plugin
/a11y-opsWeb accessibility end to end: WCAG 2.2 AA, EAA and ADA Title II obligations, audits (axe, pa11y, keyboard, screen reader), the common failures, accessibility statements, and server-rendered Craft CMS/Twig sites (Formie, CKEditor, multi-site lang). Use when asked about a11y, WCAG, EAA, EN 301 549, Section 508, VPAT, NVDA/VoiceOver, focus, skip links, ARIA, landmarks, alt text, form labels or errors, contrast, target size, or 'is my site accessible'./adr-opsAuthor, index, and lint Architecture Decision Records — append-only memory that recovers the WHY behind a system's shape. Triggers on: adr, architecture decision record, decision log, record this decision, supersede an adr, why was this decided, adr template, next adr number./api-design-opsAPI design patterns for REST, gRPC, and GraphQL. Use for: api design, REST, gRPC, GraphQL, protobuf, schema design, api versioning, pagination, rate limiting, error format, OpenAPI, API authentication, JWT, OAuth2, API gateway, webhook, idempotency./astro-opsAstro framework patterns, rendering strategies, and deployment. Use for: astro, islands architecture, content collections, astro cloudflare, view transitions, partial hydration, astrojs, SSG, SSR, hybrid rendering, astro adapter./asus-router-opsASUS router config and hardening: Asuswrt-Merlin, security hardening, encrypted DNS (DoT/DoH), VPN (WireGuard/OpenVPN), guest networks, VLAN/IoT isolation, AiMesh, AiProtection. Triggers on: asus router, asuswrt, merlin, wireguard router, AiProtection, AiMesh, nvram, jffs, IoT isolation./atomiseAtom of Thoughts (AoT) reasoning - decompose complex problems into atomic units with confidence tracking and backtracking. For genuinely complex reasoning, not everyday questions. Triggers on: atomise, complex reasoning, decompose problem, structured thinking, verify hypothesis.Other plugins' skills for the same job