Skip to content
Development
Command

/guard

Pre-merge quality checks (TS, lint, tests, secrets)

From plugin
claude-plugin-prd-workflow
1227 skills17 agents27 commands

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/guard

Context preview

What this command does when you run it.

Pre-merge quality checks (TS, lint, tests, secrets)

Command definition

guard.md
name: guard
description: Pre-merge quality checks (TS, lint, tests, secrets)
category: Development Tools
version: 0.4.2

Guard Command

Comprehensive pre-merge quality gate.

Purpose

Catch issues before PR merge:

  • TypeScript compilation
  • Linting errors
  • Test failures
  • Security vulnerabilities
  • Secrets detection
  • Code quality checks

Workflow

1. TypeScript Check

**Run type checking**:

npm run type-check  # or tsc --noEmit

**Report**:

  • Type errors found
  • Files affected
  • Severity level

2. Lint Check

**Run linters**:

npm run lint  # ESLint, Prettier, etc.

**Report**:

  • Lint errors and warnings
  • Fixable vs manual
  • Style violations

3. Test Suite

**Run full test suite**:

npm test

**Report**:

  • Tests passing/failing
  • Coverage metrics
  • Slow tests flagged

4. Security Scan

**Check for vulnerabilities**:

npm audit
git secrets --scan  # or gitleaks

**Report**:

  • Dependency vulnerabilities
  • Secrets in code
  • Security best practices

5. Build Verification

**Verify production build**:

npm run build

**Report**:

  • Build success/failure
  • Bundle size
  • Performance metrics

6. Summary Report

๐Ÿ›ก๏ธ Guard Results

TypeScript: โœ… No errors
Lint: โš ๏ธ  3 warnings (auto-fixable)
Tests: โœ… 248 passing (92% coverage)
Security: โŒ 1 high vulnerability (axios@0.21.1)
Build: โœ… Success (bundle: 324 KB)

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
BLOCKERS
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

๐Ÿ”ด Security: axios vulnerability (high)
   Fix: npm install axios@latest

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
WARNINGS
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

๐ŸŸก Lint: 3 auto-fixable warnings
   Fix: npm run lint:fix

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
VERDICT: โŒ NOT READY TO MERGE
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

Fix blockers before merging.

Blocking vs Non-Blocking

**Blockers** (must fix):

  • TypeScript errors
  • Test failures
  • High/Critical security vulnerabilities
  • Secrets detected
  • Build failures

**Warnings** (should fix):

  • Lint warnings
  • Low coverage
  • Bundle size increase
  • Slow tests

Auto-Fix

**Fixable issues**:

/guard --fix

**Auto-fixes**:

  • Lint errors (Prettier, ESLint --fix)
  • Import sorting
  • Code formatting

**Non-fixable**:

  • Type errors (require manual fix)
  • Test failures (require code changes)
  • Security vulnerabilities (require updates)

Flags

**Options**:

  • `--fix`: Auto-fix what's possible
  • `--strict`: Treat warnings as errors
  • `--skip-tests`: Skip test suite (faster)
  • `--skip-security`: Skip security scan

**Examples**:

/guard              # Full check
/guard --fix        # Check + auto-fix
/guard --strict     # Warnings block merge
/guard --skip-tests # Quick check (no tests)

Configuration

{
  "guard": {
    "block_on": ["typescript", "tests", "security_high"],
    "warn_on": ["lint", "coverage_below_80"],
    "auto_fix": true,
    "min_coverage": 80
  }
}

Success Criteria

  • โœ… All checks run successfully
  • โœ… Blockers identified (if any)
  • โœ… Clear actionable feedback
  • โœ… Auto-fixes applied (if requested)
  • โœ… Verdict clear: Ready/Not Ready

---

**Version**: 0.4.2 **Plugin**: claude-prd-workflow v0.4.2

Read more
Ships withclaude-plugin-prd-workflow

The complete Claude Code plugin for Product-Driven Development Transform PRDs from ideas to shipped features with AI-powered review, guided implementation, and automated quality gates. Never ship unclear requirements again.

Get the whole plugin

Other commands on claude-plugin-prd-workflow.