Skip to lesson
Exit
Project Rules and AGENTS.md1 / 1

2 min lesson

Rules settings + repo AGENTS.md

Complete "Rules settings + repo AGENTS.md". Check the final state against the lesson before you move on.

Check your understanding

Run this practice: Rules — turn a repeated correction into a checked-in AGENTS.md rule.

Outcome: The new handler opens with validate(FeedbackSchema, body) before the insert — the exact call the rule names, so one glance confirms it took.

Rules — turn a repeated correction into a checked-in AGENTS.md rule
Rules settings + repo AGENTS.md
SayI've corrected Agent on the same thing three times this week: new API route handlers skip our input validation.
DoStop re-typing the correction and open Rules settings to make it durable.
DoDecide the scope. Everyone on the repo follows this, so it is project-level, not a personal user rule.
SeeIt lands in the repository AGENTS.md, checked into git, so every run and every teammate inherits it instead of a rule that lives only on my machine.
Typesrc/app/api/AGENTS.md — "Every route handler validates its request body with validate(schema, body) from src/server/validate.ts before any database call."
SeeThe rule sits in the directory it governs, so agent runs that edit this API folder load it without being reminded.
DoTest it with a small run: ask Agent to add POST /api/feedback, saying nothing about validation.
SeeThe new handler opens with validate(FeedbackSchema, body) before the insert — the exact call the rule names, so one glance confirms it took.
Learn more

Optional practice

Practice: Rules settings + repo AGENTS.md

QYou've applied it. What actually proves the work is done, not just a plausible answer?

Finish the check to continue.