agentleFS
TheophilusChinomonaTheophilusChinomona/idev/skills/pre-ship-verify/SKILL.md

pre-ship-verify

Skill0 starsChanged 5 months agoMITView on GitHub

Migration-aware pre-ship gate — diffs the migration/schema state against code changes, runs build/type-check, and smoke-tests changed API routes against a live DB before allowing a PR. Use before opening a PR when DB-backed code changed.

The file

We split this skill into the rules it gives an agent

11 rules. About 0 are common, 10 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before opening any PR that touches DB schema, models, or API routes

    line 14
  2. Distinctive:

    When asked to "verify before PR", "pre-flight the deploy", or "check migrations"

    line 15
  3. Distinctive:

    Stop. Do not proceed to Phase 3.

    line 72
  4. Very specific:

    Only run if a BASE_URL or APP_URL env var is set, or the app is already running locally (detect via curl -s --max-time 2 …

    line 109
  5. Distinctive:

    If no app is reachable: note "Smoke tests skipped — no running app detected" and continue to Phase 5.

    line 132
  6. Distinctive:

    All checks must pass before allowing a PR:

    line 139
  7. Distinctive:

    Do NOT skip Phase 2 because migrations "look fine" — always run the status command.

    line 161
  8. Distinctive:

    Do NOT open a PR if Phase 2 or Phase 3 fails.

    line 162
  9. Distinctive:

    Do NOT run smoke tests against production — only localhost or staging.

    line 163
  10. Distinctive:

    Do NOT expose DB credentials in output — mask them (Phase 4 uses env vars, not raw strings).

    line 164
  11. Distinctive:

    Do NOT block on smoke-test skips — a missing app is a warning, not a hard failure.

    line 165

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Pre-Ship Verify Skill

Purpose

Prevent the 'still not working' loop caused by missing migrations, wrong credentials, or broken routes that only surface after pushing. Gate the PR on a full green run: schema ↔ code ↔ routes.

Activation

  • Before opening any PR that touches DB schema, models, or API routes
  • When asked to "verify before PR", "pre-flight the deploy", or "check migrations"

Phase 1: Detect Migration System

Scan for the project's migration tool. Check all — do not assume a stack.

# .NET / Entity Framework Core
ls migrations/ Migrations/ */Migrations/ 2>/dev/null | head -3
ls *.csproj */*.csproj 2>/dev/null | head -1 && dotnet ef migrations list 2>/dev/null | tail -20

# Prisma
ls prisma/migrations/ 2>/dev/null && npx prisma migrate status 2>/dev/null

# Alembic (Python)
ls alembic/versions/ 2>/dev/null && alembic current 2>/dev/null && alembic heads 2>/dev/null

# Flyway
ls db/migration/ src/main/resources/db/migration/ 2>/dev/null | head -3

# Knex
ls knex/ migrations/ db/migrations/ 2>/dev/null | head -3

# Rails / Active Record
ls db/migrate/ 2>/dev/null | tail -5 && bin/rails db:migrate:status 2>/dev/null | tail -20

# Django
python manage.py showmigrations 2>/dev/null | grep "\[ \]" | head -10

Record: migration tool name, pending count, last applied.


Phase 2: Schema ↔ Code Diff Check

Get the list of files changed on this branch:

BASE=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null \
  || git rev-parse --abbrev-ref HEAD@{upstream} 2>/dev/null \
  || echo "main")
git diff "$BASE"...HEAD --name-only

For each changed file, determine if it touches DB-backed logic:

  • Models / entities / schema files (any ORM model, @Entity, DbSet<>, models.py, schema.prisma)
  • Migration files (any file under a migration directory)
  • Repository / data-access layer files

If model/schema files changed but NO new migration exists:

[pre-ship-verify] FAIL: Model changes detected but no pending migration found.
  Changed: <file list>
  Run the appropriate migration generate command before shipping.

Stop. Do not proceed to Phase 3.

If migration files changed: Confirm they have been applied or are pending (not already applied and modified). Report status.

If no DB-related files changed: Skip Phase 2 and note it.


Phase 3: Build / Type-Check

Detect and run the project's build (reuse build-check skill logic if active):

# .NET
dotnet build --no-restore 2>&1 | tail -20

# Node/TS
[ -f pnpm-lock.yaml ] && pnpm run typecheck 2>&1 | tail -20 \
  || [ -f bun.lockb ] && bun run typecheck 2>&1 | tail -20 \
  || npm run typecheck --silent 2>&1 | tail -20

# Python
[ -f mypy.ini ] || grep -q "tool.mypy" pyproject.toml 2>/dev/null \
  && mypy . 2>&1 | tail -20

# Go
go build ./... 2>&1 | tail -20

Pass: Proceed. Fail: Report errors, stop. Do not open a PR with a broken build.


Phase 4: API Route Smoke Tests

Only run if a BASE_URL or APP_URL env var is set, or the app is already running locally (detect via curl -s --max-time 2 http://localhost:3000/health or the port from package.json / launchSettings.json).

Get changed route files:

git diff "$BASE"...HEAD --name-only | grep -E "(controller|router|route|endpoint|handler)" -i

For each changed route file, extract the HTTP method + path pattern and construct a minimal smoke-test request:

# Example: GET /api/health → expect non-500
curl -s -o /dev/null -w "%{http_code}" \
  -H "Authorization: Bearer $TEST_TOKEN" \
  "${BASE_URL:-http://localhost:3000}/api/health"

Pass (2xx or 401): Route is reachable. Fail (500 or connection refused): Report which route failed and the response body (first 500 chars). Stop — do not open a PR.

If no app is reachable: note "Smoke tests skipped — no running app detected" and continue to Phase 5.


Phase 5: Gate Decision

All checks must pass before allowing a PR:

CheckResultAction
Migration ↔ model syncPASSContinue
Migration ↔ model syncFAILSTOP — run migrations
Build / type-checkPASSContinue
Build / type-checkFAILSTOP — fix errors
Route smoke testsPASSContinue
Route smoke testsSKIPPEDContinue with note
Route smoke testsFAILSTOP — investigate 500s

All green: Output a single line:

[pre-ship-verify] PASS — migrations synced, build clean, routes OK. Safe to open PR.

Then hand off to the /ship or PR creation workflow.


Anti-Patterns

  1. Do NOT skip Phase 2 because migrations "look fine" — always run the status command.
  2. Do NOT open a PR if Phase 2 or Phase 3 fails.
  3. Do NOT run smoke tests against production — only localhost or staging.
  4. Do NOT expose DB credentials in output — mask them (Phase 4 uses env vars, not raw strings).
  5. Do NOT block on smoke-test skips — a missing app is a warning, not a hard failure.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.