Back to skills
SKILL.md
Check
BSecurityLocal pre-push quality and security gate. [--base <ref>] [--staged|--working] [--model <name>] [--config <path>]
- 4 stars
- 0 votes
- 0 copies
- 0 views
- Added December 2, 2026
Works with
Security analysis
75/100- Reads or references SSH private keys
Pro scans all 4 files and shows the line behind each finding
npx -y skills add jskswamy/skills --skill check --agent claude-codeAre you the author of Check?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/jskswamy-check-abe7359d)---
name: check
description: "Local pre-push quality and security gate. [--base <ref>] [--staged|--working] [--model <name>] [--config <path>]"
when_to_use: "Use when vetting changes before pushing commits to trunk or opening a PR (\"gate check\", \"vet my changes\", \"pre-push review\", \"local threat model\", \"run gate before pushing\"); runs deterministic checks and parallel fresh-context security, logic, hygiene, and doc-sync reviewers."
argument-hint: "[--base <ref>] [--staged|--working] [--skip-local-checks] [--model <name>] [--config <path>]"
metadata:
short-description: "Local pre-push quality and security gate. [--base <ref>] [--staged|--working] [--model <name>] [--config <path>]"
---
# Gate Check Skill
Zero-config local pre-push/pre-merge quality and security gate. Requires no config files; layers optional `.greptile/` and `.gate.md` (or `--config <path>`) when present.
## Arguments
- `--base <ref>` / `--staged` / `--working`: Diff scope (mutually exclusive: `<ref>...HEAD`, `--cached`, or `HEAD` + untracked).
- `--skip-local-checks`: Skip Phase 0 (caps confidence `<= 4`).
- `--model <name>`: Override subagent model when harness supports it.
- `--config <path>`: Replace `.gate.md` (coexists with `.greptile/`).
## Codebase Transport
Prefer MCP first. If its tools are absent or the server is unreachable, automatically try the CLI without asking:
```bash
command -v codebase-memory-mcp
codebase-memory-mcp cli --json list_projects
```
Set `codebase_transport` to `mcp`, `cli`, or `none` (fall back to `rg`/`Read`). For CLI, pipe JSON to `codebase-memory-mcp cli --json <tool>` via stdin; inspect `isError` and read `content[]`. Query and indexing errors are not transport failures: report accurately, retry MCP failures via CLI, never auto-install or re-index without consent.
## Execution Flow
### Step 1: Scope, Changed Files and Optional Config
1. Reject conflicting scope flags (`--staged`, `--working`, `--base`). If `--config <path>` is passed, check lexical path against `git rev-parse --show-toplevel` **before** `realpath` (if lexical path is in-repo or traverses an in-repo symlink while `realpath` escapes repo root, reject as escaping symlink -> warn, trigger `gate:threat-modeler`, enforce baseline); else verify readable regular non-binary file `<= 16 KB` and normalize in-repo paths to repo-root-relative POSIX paths (or mark external).
2. On unborn `HEAD` (`git rev-parse --verify HEAD` fails), review `git diff --cached` + untracked non-ignored files.
3. Resolve scope: `--staged` (`git diff --cached`; warn if `git diff --quiet` fails since commands/reads see working tree); `--working` (`git diff HEAD` + untracked); `--base <ref>` (`git diff <ref>...HEAD`, warn if dirty); default (`@{u}` -> `git symbolic-ref --short refs/remotes/origin/HEAD` -> `origin/main` -> `main` -> `master`; commits ahead -> `<base>...HEAD` + dirty warn; unpushed commits with no base -> ask `<base>`; 0 unpushed -> `git diff HEAD` + untracked).
4. Build `changed_files` from `git -c core.quotepath=false diff --name-status ...` + untracked (working modes). Never drop tracked source files. For **untracked** files only, exclude binaries, `> 100 KB`, and secret data (`.env`, `.env.*`, `*.pem`, `*.key`, `id_rsa*`, `*credentials*.json`, `*secret*.{yaml,yml}`) from content passing with a warning. For tracked/staged/committed secret data files, omit raw contents, keep metadata for `gate:threat-modeler`, and emit a `Must fix` finding. Exit `"Nothing to review"` only if both tracked diff and untracked files are empty.
5. Capture `dirty_files` from `git status --porcelain -uall`. If `.greptile/**`, `greptile.json`, `.gate.md`, or `--config <path>` exists on disk **or** appears in `changed_files` (including `D` deletions) / `dirty_files`, read `references/config-and-rules.md` before Step 2. Otherwise proceed zero-config.
### Step 2: Phase 0 Deterministic Checks (Fail Fast)
Skip only if `--skip-local-checks`. Snapshot `HEAD` (`UNBORN`), `git status --porcelain -uall`, `git diff`, `git diff --cached`, and untracked hashes before/after.
1. **Pre-commit** (`.pre-commit-config.yaml` + `pre-commit` on `PATH`): `--staged` -> bare `pre-commit run`; commit -> `--from-ref <base> --to-ref HEAD`; working -> `--files` on `--diff-filter=ACMR` + untracked (skip if empty).
2. **Tests:** Baseline `.gate.md`/`--config` `## Verification Commands`, else first match: `go.mod` -> `go test ./...`, `package.json` -> `npm test`, `Cargo.toml` -> `cargo test`, `pyproject.toml` -> `pytest` (none -> note in `Coverage`). Never auto-run release/deploy/watch/DB-reset; 5m timeout.
3. **Untrusted-source guard:** If any command source (`.gate.md`, normalized `--config`, `.pre-commit-config.yaml`, `Makefile`, `package.json`, `Cargo.toml`, `pyproject.toml`, `go.mod`) is in the union of `changed_files` and `dirty_files` across all scopes (or external `--config` has commands), print exact commands and ask to confirm before executing (declined -> skip Phase 0 with cap `<= 4`, or abort).
4. Stop on failure or workspace mutation.
### Step 3: Codebase Index Freshness
Resolve `## Codebase Transport` (`list_projects` exact `root_path` = `git rev-parse --show-toplevel`). If indexed, run read-only freshness check against `.claude/codebase.local.md` and `index_status` (never auto-call `index_repository`) -> `index_freshness: fresh | stale | unindexed`.
### Step 4: Dispatch Tier and Model Selection
1. Detect dispatch tier **first**:
- **Tier 1:** Registered agents (`gate:threat-modeler`, `gate:logic-reviewer`, `gate:hygiene-reviewer`, `gate:doc-auditor`).
- **Tier 2:** Generic fresh-context subagents -> read lenses from `references/inline-fallback.md`.
- **Tier 3:** No subagents -> skip model selection, warn if `--model` set, run `references/inline-fallback.md` inline (cap `<= 4`).
2. For Tier 1 / Tier 2 (no hardcoded catalogs):
- `--model <name>`: warn and inherit if non-selectable; else validate (fail fast if invalid) and confirm before downgrading below active model (declined -> inherit).
- Otherwise auto-escalate if a strictly higher tier is exposed and announce; at ceiling or non-selectable, announce once and inherit automatically with zero blocking prompts.
### Step 5: Parallel Fan-Out and Workspace Integrity
Capture pre-Step-5 snapshot (same as Step 2). Pass bounded payload (`scope_mode`, `diff_command`, `--stat`, `changed_files`, `untracked_files`, `codebase_transport`, `project`, `index_freshness`, nonce-fenced baseline rules). Exclude binaries, lockfiles, snapshots, and `Ignore Patterns` (never for `gate:threat-modeler`) from inlined diff; inline diff only if `<= 20 KB` and `<= 400` lines (over cap -> pass `gate:doc-auditor` a `<= 20 KB` filtered diff slice of triggered files).
Dispatch triggered reviewers in parallel:
- `gate:threat-modeler` (`auto | always`, never `off`): security/auth/crypto/exec/sandbox/network/paths/CI/hooks/manifests/secrets/rule files or trust boundaries; always if unsure.
- `gate:logic-reviewer`: always (unless `mode: off`, cap `<= 4`).
- `gate:hygiene-reviewer`: any non-prose file changed.
- `gate:doc-auditor`: CLI flags, schemas, public APIs, manifests, docs, or doc-sync globs changed.
- Custom reviewers from `.gate.md` (`<= 4` active; generic read-only subagent or Tier 3 lens).
Verify post-Step-5 snapshot matches pre-Step-5 (mutation -> `INCOMPLETE COVERAGE`, cap `<= 4`, abort fix loop). Validate every reviewer's required sections and `### Findings` / `None.` sentinel.
### Step 6: Consolidate, Score, Verdict and Fix Loop
Read `references/scoring-and-report.md` and follow it.
Files in this skill
- SKILL.md
- references/config-and-rules.md
- references/inline-fallback.md
- references/scoring-and-report.md
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.