Skip to content
Back to skills

Preflight

ASecurity

Read-only pre-deploy gate: git state, build, tests, migrations, lock files, secrets and commit conventions, ending in READY or NOT READY. Triggers: preflight, pre-deploy check, ready to deploy, deployment checklist.

  • 25 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 29, 2026
ai-agentstypescriptgojavanodedjangorailsgitapi

Works with

  • cli
  • api

Security analysis

A100/100

Scanned December 1, 2026

npx -y skills add tinh2/skills-hub-registry --skill preflight --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Preflight?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Preflight
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tinh2-preflight/badge)](https://www.skillsdirectory.com/skills/tinh2-preflight)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: preflight
description: "Read-only pre-deploy gate: git state, build, tests, migrations, lock files, secrets and commit conventions, ending in READY or NOT READY. Triggers: preflight, pre-deploy check, ready to deploy, deployment checklist."
version: "2.1.2"
category: qa
platforms:
  - CLAUDE_CODE
---

Verify the current branch is safe to deploy and report. This is read-only: change nothing, including "quick fixes". Run the checks without stopping to ask; note anything you could not run.

## Prerequisites

`git` with a configured `origin` remote, the project's own toolchain for the build and test checks (e.g. `flutter` for Flutter, Node.js/npm for TypeScript, `go`, `cargo`, `sbt`), and the `gh` CLI, authenticated, for the PR-body check.

## Configuration

A deploy flag (e.g. `deploy:prod`, `ship-it`) is required in the last commit message only if the project configures one: `deployFlag` in CLAUDE.md, or `preflight.deployFlag` in package.json / pyproject.toml. Otherwise that check is N/A.

## Checks

1. **Git state**
   - Uncommitted changes: `git status --porcelain` must be empty.
   - Unpushed commits: `git log origin/<branch>..HEAD --oneline` must be empty (list them if not).
   - Behind remote: `git fetch origin` then compare; WARN if the remote has commits you lack.
   - Conflict markers: `git diff --check`.
   - Branch exists on the remote.
2. **Build / static check.** Detect the stack and use its standard check: `sbt compile`, `flutter analyze` (warnings = WARN), `npx tsc --noEmit` or `npm run build`, `mypy`/`ruff`, `go build ./...`, `cargo check`, `mvn compile -q` / `./gradlew compileJava`, Rails `bin/rails assets:precompile` (skip if it needs a DB). Prefer the project's own script if one exists.
3. **Tests.** Run the project's suite (`vitest run`, `jest`, `pytest`, `go test ./...`, `cargo test`, `flutter test`, `ENVIRONMENT=test sbt test`, `rspec`, `mvn test`...). List failures.
4. **Pending migrations** (WARN, not FAIL; N/A if none detected): Prisma `npx prisma migrate status`, Django `showmigrations --plan | grep '\[ \]'`, Flyway / Alembic / Rails / Knex / Sequelize migration files new on this branch.
5. **Lock files.** WARN if any of `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, `pubspec.lock`, `Gemfile.lock`, `poetry.lock`, `uv.lock`, `Pipfile.lock`, `Cargo.lock`, `go.sum` have uncommitted changes.
6. **Secrets in tracked files** (FAIL with file:line): `AKIA[0-9A-Z]{16}`, `sk-[a-zA-Z0-9]{20,}`, `-----BEGIN ... PRIVATE KEY-----`, `ghp_`/`gho_`/`github_pat_`, `xoxb-`/`xoxp-`, and `(password|secret|token|api_key)\s*[:=]\s*['"][^'"]{8,}` unless the value is an env/variable reference. Tracked `.env` files (except `.env.example` / `.env.sample`).
7. **Conventions**
   - Deploy flag present in the last commit (if configured).
   - No `Co-Authored-By` lines on branch commits: `git log <base>..HEAD --format=%b | grep -i co-authored-by`.
   - No AI attribution in the PR body: `gh pr view --json body`.

## If a check fails to run

- **Toolchain missing or not on PATH** (e.g. `flutter analyze: command not found`): mark that check FAIL with "could not run: <error>". An unrun build or test is never PASS.
- **`git fetch` fails** (offline, auth): mark "Branch up to date" WARN with the error and still run the local checks.
- **`gh` not installed or not authenticated:** mark "No AI attribution" N/A with the reason; do not block the verdict on it alone.
- **Tests hang or need services that are not running** (DB, emulator): stop after 10 minutes, mark Tests FAIL with "timed out" or the missing service, and do not start services yourself.

## Output

```
## Preflight Check Results

| # | Check | Status | Details |
|---|-------|--------|---------|
| 1 | Uncommitted changes | PASS/FAIL | |
| 2 | Unpushed commits | PASS/FAIL | |
| 3 | Branch up to date | PASS/WARN | |
| 4 | Merge conflicts | PASS/FAIL | |
| 5 | Build | PASS/FAIL | <stack detected> |
| 6 | Tests | PASS/FAIL | X passed, Y failed |
| 7 | Pending migrations | PASS/WARN/N/A | |
| 8 | Lock files | PASS/WARN | |
| 9 | Secrets scan | PASS/FAIL | |
| 10 | Deploy flag | PASS/FAIL/N/A | |
| 11 | No Co-Authored-By | PASS/FAIL | |
| 12 | No AI attribution | PASS/FAIL | |
| 13 | Branch pushed | PASS/FAIL | |

**VERDICT: READY TO DEPLOY | NOT READY**
```

If NOT READY, list each fix needed as a concrete action (e.g. "commit and push", "run `/hotfix` for the failing tests").

## Telemetry

If a memory directory for this project exists under `~/.claude/projects/`, append to its `skill-telemetry.md`:

```
### /preflight — YYYY-MM-DD
- Outcome: SUCCESS | PARTIAL | FAILED
- Bottleneck: <check that struggled, or none>
- Suggestion: <one-line improvement for /evolve, or none>
```

Skip silently if the directory does not exist.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.