The-Pre-Flight-Check
AGENTS.md2 starsChanged 5 months agoMITView on GitHub
For: OpenAI Codex, Codex CLI, any agent that reads AGENTS.md. The engine (run-pipeline.py) is vanilla Python 3 with no external deps — it runs anywhere. pre-flight-check is a mandatory, fail-fast quality gate. It runs your project's real tooling in a strict sequence: The script auto-detects Node.js (package.json) or Python (pyproject.toml, requirements.txt, etc.) and invokes the appropriate tools. Each stage only runs if the previous one passed. You MUST run the pre-flight check before: If you are about to produce any…
- Pipes a download into a shell
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,439 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- pre-flight-checkSkill
The file
We split this AGENTS.md into the rules it gives an agent
11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 29
If you are about to produce any of those outputs — stop, run the check first.
- Very specific: line 49
If the script outputs ### ❌ PRE-FLIGHT FAILURE: [STAGE_NAME], you are FORBIDDEN from:
- Distinctive: line 88
Read that file at that line.
- Very specific: line 90
Do not use any, as unknown as X, # type: ignore, or any escape hatch.
- Distinctive: line 96
Run the project's auto-fix command first:
- Distinctive: line 100
Do not add files to ignore lists.
- Distinctive: line 105
Read the assertion message and failing test name from the context block.
- Distinctive: line 108
Do not delete, skip, or relax the assertion to make the test pass.
- Distinctive: line 115
Do not add the advisory to an ignore list without explicitly stating the risk to the user and getting confirmation.
- Distinctive: line 133
When the script prints:
- Very specific: line 146
If .pre-flight-check/scripts/run-pipeline.py does not exist, the skill has not been installed for your current project.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md 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
Pre-Flight Check — Agent Instructions
For: OpenAI Codex, Codex CLI, any agent that reads
AGENTS.md. The engine (run-pipeline.py) is vanilla Python 3 with no external deps — it runs anywhere.
What this is
pre-flight-check is a mandatory, fail-fast quality gate. It runs your project's real tooling in a strict sequence:
Typecheck → Lint → Test → Security AuditThe script auto-detects Node.js (package.json) or Python (pyproject.toml, requirements.txt, etc.) and invokes the appropriate tools. Each stage only runs if the previous one passed.
Mandatory trigger rule
You MUST run the pre-flight check before:
- Telling the user a task is "done", "complete", "fixed", "ready", or any synonym.
- Staging, committing, or pushing any code change.
- Opening or marking a pull request ready for review.
- Moving on to a different task or file after a code edit.
If you are about to produce any of those outputs — stop, run the check first.
How to run
python3 .pre-flight-check/scripts/run-pipeline.pyThe script prints a header per stage as it runs, then emits one of three terminal blocks:
| Output | Exit code | Meaning |
### ✅ PRE-FLIGHT PASSED | 0 | All gates green. You may proceed. |
### ❌ PRE-FLIGHT FAILURE: [STAGE] | 1 | A gate failed. Stop. Fix. |
### ⚠️ PRE-FLIGHT SKIPPED: … | 1 | Runtime undetected or no tools found. Resolve before proceeding. |
Strict Fail-Fast Protocol
If the script outputs ### ❌ PRE-FLIGHT FAILURE: [STAGE_NAME], you are FORBIDDEN from:
- Declaring the task done.
- Committing, staging, or pushing any code.
- Switching to a different task, file, or feature.
- Suppressing the error (
// @ts-ignore,# type: ignore,# noqa,eslint-disable, removing the failing test, adding to an ignore list). - Re-running the pipeline unchanged hoping for a different result.
Your only permitted next action: repair the exact error named by the failing stage, then re-run. Loop until ### ✅ PRE-FLIGHT PASSED.
Reading the failure block
### ❌ PRE-FLIGHT FAILURE: TYPECHECK
**Command Executed:** `npx --no-install tsc --noEmit`
**Context for AI Fix:**
src/auth/session.ts(42,18): error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Extract in order:
- Stage name — tells you which repair recipe to follow (below).
Command Executed— confirms which tool failed. Do not guess.Context for AI Fix— find the file path, line:col, rule / error code, and diagnostic message verbatim.
Open the named file at the named line. Repair the exact diagnostic. Do not touch unrelated code.
Stage-specific repair rules
TYPECHECK failure
- Parse the file path and line number from
Context for AI Fix. - Read that file at that line.
- Fix the type at its source — narrow the type, add a missing field, correct the signature, fix the call site.
- Do not use
any,as unknown as X,# type: ignore, or any escape hatch. If a cast is genuinely required at an external boundary, use the minimum-width cast at the narrowest possible scope with a one-line comment explaining why. - Re-run the pipeline.
LINT failure
- Identify the rule ID and file from the context block.
- Run the project's auto-fix command first:
- Node:
npx eslint . --fix/npm run lint -- --fix/pnpm lint --fix - Python:
ruff check . --fixthenruff format .orblack .
- Node:
- For rules the auto-fixer can't resolve, edit the file manually.
- Do not add files to ignore lists. Do not add file-level disables. Inline rule disables are only allowed for a single line with a comment justifying why.
- Re-run the pipeline.
TEST failure
- Read the assertion message and failing test name from the context block.
- Determine whether production code is wrong or the test expectation is wrong. Default: production code is wrong.
- Fix the root cause in the production code.
- Do not delete, skip, or relax the assertion to make the test pass.
- Re-run the pipeline.
SECURITY AUDIT failure
- Identify the vulnerable package and CVE / advisory ID.
- Upgrade to the patched version. If no patch exists, assess whether the affected code path is reachable.
- Do not add the advisory to an ignore list without explicitly stating the risk to the user and getting confirmation.
- Re-run the pipeline.
Anti-patterns — refuse these
- Re-running the pipeline unchanged hoping the result differs.
- Editing a file not named in the diagnostic.
- "Fixing" by deleting the failing test, suppressing the rule, or relaxing the type.
- Declaring done while a failure is on screen.
- Switching strategy after a single failure — repair, re-run, repeat.
- Bundling speculative refactors alongside the targeted repair.
Success state
When the script prints:
### ✅ PRE-FLIGHT PASSED
All quality gates verified successfully.and exits 0, you may proceed with the original action (commit, mark done, open PR).
Script not found?
If .pre-flight-check/scripts/run-pipeline.py does not exist, the skill has not been installed for your current project. Install it:
# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/mirekondro/The-Pre-Flight-Check/main/install.sh | bash -s -- --project
# Windows (PowerShell)
irm https://raw.githubusercontent.com/mirekondro/The-Pre-Flight-Check/main/install.ps1 | iex
# then re-run with: & .\install.ps1 -ProjectSee INSTALL.md for the full matrix.
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.

