Guard

From drn/dots · View interactive version

Guard is an AI agent skill from the GitHub repository drn/dots. Pre-commit safety check for secrets, security antipatterns, and test breakage. Use for pre-commit checks, secret scanning, or verifying test safety.

How to use this skill

Skill file

Pre-commit Guard

Fast safety check before committing. Scans for secrets, security antipatterns, test breakage, and lint issues. Binary pass/fail output.

Arguments

Context

Instructions

Run these checks against all staged files (or all changed files if nothing is staged). Be fast -- this is a pre-commit gate, not a full review.

Check 0: Gitignore Violations

Scan staged/changed files for common files that should not be committed:

Report: WARNING if any found (FAIL in --strict mode).

Check 1: Secrets Detection

Scan staged/changed files for:

Report: FAIL if any found, with file and line number.

Check 2: Security Antipatterns

Scan for common dangerous patterns:

Report: FAIL if any found.

Check 3: Test Breakage

Run a quick test check:

IF project has test framework:
  Run tests targeting changed files only (same mapping as /test)
  Report: PASS or FAIL with failure details
ELSE:
  Report: SKIP (no test framework detected)

Keep this fast -- targeted tests only, not the full suite.

Check 4: Lint Check

IF go.mod exists: run `revive -set_exit_status ./...` or `go vet ./...`
IF package.json exists: run `npx eslint {changed files}` if eslint is configured
IF Gemfile exists: run `bundle exec rubocop {changed files} --force-exclusion` if rubocop is configured
IF pyproject.toml exists: run `ruff check {changed files}` if ruff is configured
IF Cargo.toml exists: run `cargo clippy -- -D warnings`
ELSE: SKIP

Report: FAIL if lint errors found.

Output

IF --strict mode:
  FAIL if ANY check has warnings or failures
ELSE:
  FAIL if ANY check has failures (warnings are noted but pass)

Format:

## Guard Check

| Check | Status | Details |
|-------|--------|---------|
| Gitignore | PASS/WARN | {brief or "Clean"} |
| Secrets | PASS/FAIL | {brief or "Clean"} |
| Security | PASS/FAIL | {brief or "Clean"} |
| Tests | PASS/FAIL/SKIP | {brief or "All passing"} |
| Lint | PASS/FAIL/SKIP | {brief or "Clean"} |

**Result: PASS / FAIL**

{If FAIL: list each issue with file and line number}
{If PASS: "Safe to commit."}

Keep the output concise. This should feel like a quick gate check, not a verbose report.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.