agentleFS
mirekondromirekondro/The-Pre-Flight-Check/AGENTS.md

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.

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
  1. Distinctive:

    If you are about to produce any of those outputs — stop, run the check first.

    line 29
  2. Very specific:

    If the script outputs ### ❌ PRE-FLIGHT FAILURE: [STAGE_NAME], you are FORBIDDEN from:

    line 49
  3. Distinctive:

    Read that file at that line.

    line 88
  4. Very specific:

    Do not use any, as unknown as X, # type: ignore, or any escape hatch.

    line 90
  5. Distinctive:

    Run the project's auto-fix command first:

    line 96
  6. Distinctive:

    Do not add files to ignore lists.

    line 100
  7. Distinctive:

    Read the assertion message and failing test name from the context block.

    line 105
  8. Distinctive:

    Do not delete, skip, or relax the assertion to make the test pass.

    line 108
  9. Distinctive:

    Do not add the advisory to an ignore list without explicitly stating the risk to the user and getting confirmation.

    line 115
  10. Distinctive:

    When the script prints:

    line 133
  11. Very specific:

    If .pre-flight-check/scripts/run-pipeline.py does not exist, the skill has not been installed for your current project.

    line 146

≈ “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.

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

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 Audit

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.


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.py

The script prints a header per stage as it runs, then emits one of three terminal blocks:

OutputExit codeMeaning
### ✅ PRE-FLIGHT PASSED0All gates green. You may proceed.
### ❌ PRE-FLIGHT FAILURE: [STAGE]1A gate failed. Stop. Fix.
### ⚠️ PRE-FLIGHT SKIPPED: …1Runtime 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:

  1. Stage name — tells you which repair recipe to follow (below).
  2. Command Executed — confirms which tool failed. Do not guess.
  3. 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

  1. Parse the file path and line number from Context for AI Fix.
  2. Read that file at that line.
  3. Fix the type at its source — narrow the type, add a missing field, correct the signature, fix the call site.
  4. 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.
  5. Re-run the pipeline.

LINT failure

  1. Identify the rule ID and file from the context block.
  2. Run the project's auto-fix command first:
    • Node: npx eslint . --fix / npm run lint -- --fix / pnpm lint --fix
    • Python: ruff check . --fix then ruff format . or black .
  3. For rules the auto-fixer can't resolve, edit the file manually.
  4. 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.
  5. Re-run the pipeline.

TEST failure

  1. Read the assertion message and failing test name from the context block.
  2. Determine whether production code is wrong or the test expectation is wrong. Default: production code is wrong.
  3. Fix the root cause in the production code.
  4. Do not delete, skip, or relax the assertion to make the test pass.
  5. Re-run the pipeline.

SECURITY AUDIT failure

  1. Identify the vulnerable package and CVE / advisory ID.
  2. Upgrade to the patched version. If no patch exists, assess whether the affected code path is reachable.
  3. Do not add the advisory to an ignore list without explicitly stating the risk to the user and getting confirmation.
  4. 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 -Project

See INSTALL.md for the full matrix.

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.