Less defensive code: 4 AGENTS.md rules
Even a tiny change gets null checks at every layer: Codex checks data once where it comes in, then just uses it.
1.4K saves on X, as of Posted
AGENTS.md rules
- Validate unknown values once at the boundary that owns them. Pass typed values inward instead of repeating `typeof value === "object"` and property-existence checks.
- Do not defensively revalidate values already guaranteed by a schema, constructor, or internal type.
- Do not extract single-use helpers preemptively. Inline the logic at the call site unless the helper is reused, hides a genuinely complex boundary, or has a clear independent name that improves the caller.
- Avoid `try`/`catch` where possibleNext Add them to the AGENTS.md in your project.
Codex writes code way too defensively. Even a tiny change gets null checks at every layer.
Spell it out for Codex: check data once where it comes in, then just use it. Write one-off logic right where it’s used instead of splitting it into a function ahead of time. Skip try/catch wherever you can.
The team behind a 220K-star open-source coding agent on GitHub wrote these rules into their own AGENTS.md.
