Hey all,

tl;dr: AI coding tools now get proper Airflow guardrails via AGENTS.md, and
Copilot code review will automatically flag common mistakes in PRs --
including AI-slop patterns as long as we add Copilot as reviewer.

We've been getting more AI-generated PRs lately, and reviewers keep
catching the same things: N+1 queries, architecture boundary violations,
assert in production code, fabricated diffs, etc. I wanted to automate that.

I've been using AGENTS.md (CLAUDE.md , Cursor rules, skills and such) with
Cursor, Claude Code, and Copilot and various other AI harnesses since last
year and have iterated on it many times. Three PRs landed today:

   - https://github.com/apache/airflow/pull/62440 -- AGENTS.md overhaul.
   Replaced the sparse doc-index with concrete guidance: environment setup,
   architecture boundaries, coding/testing standards, commit conventions.
   Added nested AGENTS.md for Execution API (Cadwyn versioning) and providers.
   - https://github.com/apache/airflow/pull/62442 -- Copilot code review
   instructions. Added .github/instructions/code-review.instructions.md
   scoped to review only. Covers architecture violations, N+1 queries, run_id
   scoping, unbounded caches, and AI-slop signals (fabricated diffs, narrating
   comments, over-engineered solutions, etc.).
   - https://github.com/apache/airflow/pull/62443 -- Symlink CLAUDE.md to
   AGENTS.md so Claude Code reads the same file.

To validate the Copilot instructions, I opened a test PR (
https://github.com/apache/airflow/pull/62447) with 8 deliberately planted
violations. Copilot caught all 8:

   1. N+1 query (loop calling get_task_instances() per dag run)
   2. time.time() instead of time.monotonic()
   3. assert in production code
   4. Unbounded @lru_cache (no maxsize)
   5. run_id query without dag_id
   6. Narrating comments
   7. Import inside function body
   8. No tests for new behavior

This won't replace human review, but should save time on mechanical
catches. If you have patterns you'd like Copilot to flag, PRs to
.github/instructions/code-review.instructions.md are welcome.

Regards,
Kaxil

Reply via email to