dotnet-preflight
Skill4 starsChanged 2 months agoMITView on GitHub
Verifies a .NET backend feature branch is safe to open a PR: solution builds cleanly, EF Core migrations are healthy against the local development database resolved from appsettings.Development.json, and the application starts without error. Not for fixing failing builds, broken migrations, or startup errors — verification only
In this repository4 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- code-engineerSkill
- dotnet-warning-auditSkill
- react-preflightSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. About 0 are common, 11 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Run every check in Methodology, including the two that mutate state: applying migrations to the local dev database (Step 3.5–3.6) and …
- Distinctive: line 25
Every project in the solution builds, not just the startup project
- Very specific: line 30
No model change exists that isn't captured by a migration (has-pending-model-changes)
- Distinctive: line 37
No unhandled exception appears in stdout/stderr during startup
- Very specific: line 45
Run dotnet build <solution>.sln -c Debug --nologo.
- Very specific: line 49
Read the connection string from appsettings.Development.json.
- Very specific: line 51
Run dotnet ef migrations has-pending-model-changes --project <ctx> --startup-project <web>.
- Very specific: line 52
Run dotnet ef migrations list --project <ctx> --startup-project <web>.
- Very specific: line 53
Default mode only: run dotnet ef database update --project <ctx> --startup-project <web>
- Distinctive: line 73
Check — what was verified
- Distinctive: line 85
If NOT READY, add a "Required follow-up" list — the exact command or fix needed for each FAIL, not a general suggestion.
- Distinctive: line 88
Do not modify application code, migrations, or configuration files — this skill verifies, it does not fix
- Very specific: line 89
Do not run dotnet ef database update or start the application outside Default mode
- Very specific: line 90
Do not apply migrations to, or start the application against, any connection string other than the one resolved from …
- Distinctive: line 91
Do not print connection string passwords or credentials into the report, even for a local dev database
- Distinctive: line 92
Do not report PASS for a check that did not actually execute
- Distinctive: line 93
Do not leave a process running or a temp file behind once a check completes
- Distinctive: line 94
Do not skip a step because an earlier one looked fine — run every step Steps 1–4 list
- Distinctive: line 95
Do not fix a failing build, migration, or startup error you encounter along the way — report it and stop
≈ “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.
Files
Determine, with evidence you actually executed and observed, whether a .NET backend feature branch is safe to open a PR. Verify the solution builds, EF Core migrations are healthy against the local development database, and the application starts without error. Report findings; never assume a result you have not run and checked yourself
Operating Modes
Default — Full Preflight
Run every check in Methodology, including the two that mutate state: applying migrations to the local dev database (Step 3.5–3.6) and starting the application (Step 4). Only this mode can produce a READY verdict
Fast Mode — Static Only
Activate when the user says "quick check", "static only", "don't touch the db", "don't run it", or otherwise asks to skip execution. Skip dotnet ef database update, idempotent script generation, and starting the application. Run every other check. Mark the skipped checks SKIPPED, never PASS, and the overall verdict INCONCLUSIVE rather than READY
What You Check
Build Health
- Solution compiles with zero errors
- Every project in the solution builds, not just the startup project
Migration Health
- Connection string in
appsettings.Development.jsonresolves to a real, reachable local database - DbContext constructs cleanly through DI (
dotnet ef dbcontext info) - No model change exists that isn't captured by a migration (
has-pending-model-changes) - Migration history is internally consistent — no duplicate names, no ordering conflict with
main - Migrations apply cleanly to the actual local dev database (
dotnet ef database update) - Migrations regenerate as a valid idempotent script (
dotnet ef migrations script --idempotent)
Startup Health
- Compiled application reaches a listening state within a bounded timeout
- No unhandled exception appears in stdout/stderr during startup
- Health endpoint, if one exists, responds successfully once listening
Methodology
Step 1 — Discovery
Confirm you're in a git repository; note the current branch. Locate the .sln and every .csproj not under bin/ or obj/. Identify the web/startup project — the one containing Program.cs and appsettings.Development.json. Identify every DbContext project via : DbContext in source. Confirm dotnet ef is available; install it locally (dotnet tool install --local dotnet-ef) if missing
Step 2 — Build
Run dotnet build <solution>.sln -c Debug --nologo. A non-zero exit is a hard FAIL. Stop here — report the compiler errors, skip every remaining step
Step 3 — Migration Verification
For each DbContext project found in Step 1:
- Read the connection string from
appsettings.Development.json. Redact the password before it appears anywhere in output. - Run
dotnet ef dbcontext info --project <ctx> --startup-project <web> - Run
dotnet ef migrations has-pending-model-changes --project <ctx> --startup-project <web>. Skip with a note if the installed EF Core version doesn't support it - Run
dotnet ef migrations list --project <ctx> --startup-project <web>. Cross-check migrations new on this branch againstgit diff main...HEAD --name-only -- '**/Migrations/*' - Default mode only: run
dotnet ef database update --project <ctx> --startup-project <web> - Default mode only: run
dotnet ef migrations script --idempotent -o /tmp/dotnet-preflight-migrations.sql --project <ctx> --startup-project <web>
A check is PASS only if its command exits zero and its output shows no error. In Fast Mode, 5 and 6 are SKIPPED, never PASS
Step 4 — Startup Verification (Default mode only; SKIPPED in Fast Mode)
Build already succeeded in Step 2. Run the compiled output directly — dotnet <project-dir>/bin/Debug/<tfm>/<AssemblyName>.dll — rather than dotnet run, so there is one process to track instead of a parent and a spawned child. Redirect output to a temp log file. Poll up to 30s for a success marker (Now listening on, Application started) or a failure marker (Unhandled exception, a stack trace). If a health endpoint exists, curl it once listening. Kill the process — and its process group if you used dotnet run instead — regardless of outcome
Step 5 — Report
Produce the Output Format below. Include every check that ran, including SKIPPED ones. Do not stop at the first failure — run every step that doesn't depend on a failed one, and report all failures together
Decision Framework
- Would this check mutate anything outside the local database resolved from
appsettings.Development.json? If yes, only run it in Default mode - Can you support the result with something you actually executed — an exit code, a log line, a generated file? If no, report it as inconclusive, not PASS
- Did an earlier step fail in a way that makes this one meaningless? If yes, mark it N/A and say why — don't run it anyway
- Would resolving this finding require changing application code? If yes, don't change it — report it as required follow-up
- Is a process still running, or a temp file still present, after this check finishes? If yes, clean it up before moving on
Output Format
For each check:
- Check — what was verified
- Command — the exact command run
- Result — PASS / FAIL / SKIPPED / N/A
- Evidence — exit code, matched log line, or error text (redact any credential)
Close with:
## Verdict — branch: <branch-name>
READY FOR PR / NOT READY / INCONCLUSIVE (Fast Mode — mutating checks skipped)If NOT READY, add a "Required follow-up" list — the exact command or fix needed for each FAIL, not a general suggestion.
Hard Limits
- Do not modify application code, migrations, or configuration files — this skill verifies, it does not fix
- Do not run
dotnet ef database updateor start the application outside Default mode - Do not apply migrations to, or start the application against, any connection string other than the one resolved from
appsettings.Development.json - Do not print connection string passwords or credentials into the report, even for a local dev database
- Do not report PASS for a check that did not actually execute
- Do not leave a process running or a temp file behind once a check completes
- Do not skip a step because an earlier one looked fine — run every step Steps 1–4 list
- Do not fix a failing build, migration, or startup error you encounter along the way — report it and stop
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
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.

