Skip to content
Agentmart
Submit a tool

db-preflight

Scans DBScripts/ folder for unapplied database migrations and surfaces them before builds or at session start.

Skill by TheophilusChinomona

IndexedMIT
Write a review

Chalk Labs

Need help deploying db-preflight?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/theophiluschinomona-db-preflight

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Scans DBScripts/ folder for unapplied database migrations and surfaces them before builds or at session start. Prevents 'Invalid object name' 500s caused by hand-applied DBScript migrations being missed. Use when starting a session, before building, or when a runtime DB error mentions a missing table/column.

Use cases: backend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/db-preflight

What's inside

Skill name
db-preflight
Description
Scans DBScripts/ folder for unapplied database migrations and surfaces them before builds or at session start. Prevents 'Invalid object name' 500s caused by hand-applied DBScript migrations being missed. Use when starting a session, before building, or when a runtime DB error mentions a missing table/column.
License
MIT
Instructions
176 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# DB Preflight Skill

## Purpose
Catch unapplied database migrations before they cause runtime 500 errors. Scans the project's `DBScripts/` folder, compares against a list of known-applied scripts, and reports which ones are missing. Maps runtime DB errors back to the specific DBScript that fixes them.

## Activation
- **Session start**: SessionStart hook surfaces unapplied scripts
- **Before build**: build-check runs this as a pre-flight step
- **On DB error**: When a runtime error mentions "Invalid object name", "Invalid column name", or similar schema errors

## How It Works

### State (per project)
| File | Purpose |
|------|---------|
| `.claude/idev/db-preflight/applied.json` | List of scripts the user has confirmed are applied |
| `.claude/idev/db-preflight/known-errors.json` | Maps DB error patterns to their fixing DBScript |

### Scan Process
```
1. Glob for DBScripts/**/*.sql (or DBScripts/**/*.ps1, DBScripts/**/*.sh)
2. Extract script names (sort by date prefix if present: YYYY-MM-DD-*.sql)
3. Compare against applied.json
4. Report unapplied scripts with their date and description
```

### Detection Patterns
The skill detects DBScript folders using these conventions:
```
DBScripts/
DBScripts/YYYY-MM-DD/
db-scripts/
migrations/
```

### Script Naming Convention
Most DBScript folders follow: `YYYY-MM-DD-description.sql`
The date prefix determines execution order.

## Phase 1: Scan for DBScripts

```bash
# Find all SQL scripts in DBScripts folders
find . -path "*/DBScripts/*.sql" -not -path "*/node_modules/*" -not -path "*/bin/*" -not -path "*/obj/*" | sort
```

Or use Glob: `**/DBScripts/**/*.sql`

## Phase 2: Compare Against Applied

Read `.claude/idev/db-preflight/applied.json`:
```json
{
  "applied": [
    "2026-01-15-add-orders-table.sql",
    "2026-01-20-add-customer-column.sql"
  ],
  "lastChecked": "2026-07-29"
}
```

Scripts in DBScripts/ NOT in the `applied` list are unapplied.

## Phase 3: Report

### At session start (brief):
```
[db-preflight] 2 unapplied DBScripts:
  - 2026-07-25-add-role-alias-table.sql
  - 2026-07-28-add-support-portal-mailbox.sql
Run these before building or expect "Invalid object name" errors.
```

### Before build (detailed):
```
DB Preflight Check:
  Total DBScripts: 12
  Applied: 10
  Unapplied: 2
  
  ⚠ UNAPPLIED:
  1. 2026-07-25-add-role-alias-table.sql
     Creates: RoleAlias table
     Affects: Any code referencing RoleAlias entity
     
  2. 2026-07-28-add-support-portal-mailbox.sql
     Creates: SupportPortalMailbox table, Adds: MailboxPassword column
     Affects: Support Portal feature
     
  Apply these scripts to the dev database before building.
```

## Phase 4: Error Mapping

When a runtime DB error occurs, map it to the fixing script:

### Error Pattern Matching
```
"Invalid object name 'RoleAlias'" 
  → Grep DBScripts for "CREATE TABLE.*RoleAlias" or "RoleAlias"
  → Found: 2026-07-25-add-role-alias-table.sql
  → Report: "This error is fixed by applying 2026-07-25-add-role-alias-table.sql"

"Invalid column name 'MailboxPassword'"
  → Grep DBScripts for "MailboxPassword" or "ALTER TABLE.*ADD.*MailboxPassword"
  → Found: 2026-07-28-add-support-portal-mailbox.sql
  → Report: "This error is fixed by applying 2026-07-28-add-support-portal-mailbox.sql"
```

### Building the Error Map
On first run (or when DBScripts change), scan all scripts and extract:
- Tables created (`CREATE TABLE`)
- Columns added (`ALTER TABLE.*ADD`)
- Views created (`CREATE VIEW`)
- Stored procedures (`CREATE PROCEDURE`)

Write to `.claude/idev/db-preflight/known-errors.json`:
```json
{

From TheophilusChinomona/idev, MIT.

More from TheophilusChinomona/idev

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Jul 29, 2026 (3 months ago)
Last release
Jun 25, 2026 (4 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from TheophilusChinomona

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get db-preflight running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying db-preflight?

CallGet help
Cite this page

db-preflight skill. Agent Mart. https://agentmart.dev/skills/theophiluschinomona-db-preflight (last updated 2026-10-24)