Agent rule pattern

Generated file guards

Names generated files and the command that rebuilds them.

22 of 100 projects

The shape of the rule

  1. Mark generated output
  2. Name its editable source
  3. Give the rebuild command
How to use it

These rules name generated paths and the command that rebuilds them. Some also list related steps, such as deleting a superseded fixture.

Name the generated file, its editable source, and the rebuild command. Say whether to commit the output and which nearby files are still edited by hand.

Examples from real projects

3 examples · Pinned source

Guard generated regions without freezing the whole file

The barrel rule protects only marked generated sections, not hand-maintained indexes or unmarked code. The guide also names the sources for generated AI docs and migration notes.

.agents/AGENTS.mdL39–42
Source excerpt starting at line 39.
Some `index.ts` sections marked with `@barrel` are generated. Do not edit thosesections manually; update their source modules and run `pnpm codegen`.Hand-maintained `index.ts` files and unmarked sections are not covered by thisrule.

Name the generator and permit its legitimate output

The model catalog may not be edited directly. Its generator is the authority, and the rule explicitly permits generated metadata updates that accompany regeneration.

AGENTS.mdL27
Source excerpt starting at line 27.
- Never modify `packages/ai/src/models.generated.ts` directly; update `packages/ai/scripts/generate-models.ts` instead, then regenerate. Including the resulting `models.generated.ts` diff is always OK, even if regeneration includes unrelated upstream model metadata changes.

Name generated outputs and their owners

OpenAPI, native bindings, permissions, and translations each have an owning generation command. Stable regeneration is required; hand-editing output would leave the source of truth unchanged.

AGENTS.mdL61
Source excerpt starting at line 61.
- Regenerate native bindings and permissions using their owning Rust build/generator; do not hand-edit generated output. The macOS desktop job checks `plugins/db/js/bindings.gen.ts`, `plugins/db/permissions/autogenerated`, and `plugins/db/permissions/schemas/schema.json` for drift. Mobile bridge generation belongs to `cargo xtask mobile-bridge`.

Projects using this pattern (22)

Browse in directory →
Show 14 more projects
← All agent rule patterns