# Code Preflight

> Run build, typecheck, lint, tests, and security checks for the current project. Auto-detects Python vs Node/Next.js.

- Skill: `gridlock-nyc/code-preflight` (Agent Skill)
- Install (CLI): `npx skillmds@latest add gridlock-nyc/code-preflight`
- Raw SKILL.md: https://api.skillmd.com/api/skills/gridlock-nyc/code-preflight/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Web & Frontend
- Author: GRIDLOCK-NYC (https://skillmd.com/u/gridlock-nyc)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/gridlock-nyc/code-preflight

---


# Verification Skill

Run a complete pre-PR check suite for the current project.

## Step 1: Detect Project Type

Check the current directory for:
- **Python**: `pyproject.toml` or `requirements.txt` present
- **Next.js/Node**: `package.json` present, optionally `next.config.*`
- If both exist, run both suites

## Step 2: Run Checks

### Python Projects
Run sequentially, capture exit codes:
1. **Tests**: `python -m pytest -x --tb=short -q` (FAIL if exit != 0)
2. **Lint**: `ruff check .` (FAIL if exit != 0)
3. **Format**: `ruff format --check .` (FAIL if exit != 0)
4. **Type Check**: `mypy . --ignore-missing-imports` (WARN only — never FAIL on mypy)
5. **Secrets Scan**: `grep -rn "sk-\|API_KEY\s*=\|SECRET\s*=\|TOKEN\s*=" --include="*.py" . | grep -v ".env" | grep -v "__pycache__"` (FAIL if matches found)

### Next.js/Node Projects
Run sequentially, capture exit codes:
1. **Build**: `npm run build` (FAIL if exit != 0)
2. **Type Check**: `npx tsc --noEmit` (FAIL if exit != 0)
3. **Lint**: `npm run lint` (FAIL if exit != 0)
4. **Tests**: `npm run test -- --run` (FAIL if exit != 0, SKIP if no test script)
5. **Secrets Scan**: `grep -rn "sk-\|API_KEY\s*=" --include="*.ts" --include="*.tsx" . | grep -v "node_modules" | grep -v ".env"` (FAIL if matches found)

## Step 3: Format Report

Output exactly this format:

```
=== VERIFICATION REPORT ===
Project: [name] ([Python|Next.js|Both])
Directory: [cwd]
Branch: [git branch --show-current]

[PASS|FAIL|WARN|SKIP] Tests         [1-line summary]
[PASS|FAIL|WARN|SKIP] Lint          [1-line summary]
[PASS|FAIL|WARN|SKIP] Format        [1-line summary]
[PASS|FAIL|WARN|SKIP] Type Check    [1-line summary]
[PASS|FAIL|WARN|SKIP] Secrets Scan  [1-line summary]
[PASS|FAIL|WARN|SKIP] Build         [1-line summary, Node only]

VERDICT: [READY | NOT READY] ([N failures, M warnings])
===========================
```

## Step 4: Verdict Rules

- **READY**: Zero FAILs (WARNs and SKIPs are OK)
- **NOT READY**: One or more FAILs
- For each FAIL, suggest the specific fix but do NOT auto-fix
- If the user passed an argument (e.g., `/code-preflight tests`), only run that specific check

## Important

- Do NOT modify any files. This is read-only + run checks.
- If a tool is missing (ruff, mypy, eslint), mark that check as SKIP with reason.
- Respect the 3-file rule: if the user needs fixes, list them but let the user decide scope.

