⚡ PromptLoot

Home › Coding & Cursor Rules

This Codebase Is Yours: Ownership Rules for Coding Agents

Rules-file lines that tell Claude Code, Codex, or Cursor it owns the code, so it edits and removes code instead of bolting on duplicate functions and wrappers.

Added · Updated

Add this section near the top of AGENTS.md (or CLAUDE.md / .cursor/rules). Edit the bracketed parts.

## You own this codebase
This is your codebase as much as mine. Work on it the way a senior engineer who will maintain it for years would.

- Before writing a new function, component, or helper, search the repo for one that already does the job. Reuse or extend it. Say which file you checked.
- Change existing code in place. Do not add a wrapper, a "v2" copy, or a parallel code path to avoid touching the original.
- When your change makes code unused, delete it in the same change: old functions, dead imports, stale flags, commented-out blocks.
- Keep one way of doing each thing. If you find two, tell me and propose which one to keep.
- Fix the cause, not the symptom. No try/except or `?.` added only to make an error disappear.
- If a fix needs a larger refactor than the task, stop and describe it in 3-5 lines instead of half-doing it.

## Limits on ownership
Ownership does not mean permission for everything:
- Never touch: [secrets/.env files, migrations already run in production, deploy config, billing code].
- Ask before: adding a dependency, changing a public API, deleting a file over [200] lines, or renaming anything used outside this repo.
- Stay inside the task. Note unrelated problems in a "Noticed" list at the end; don't fix them unasked.

## End of every task
Report: files changed, code deleted (with line counts), anything you found duplicated, and the command you ran to verify it works.

How to use it

  1. Click Copy template.
  2. Paste into ChatGPT, Claude, Grok, Cursor, or your agent framework.
  3. Replace the [BRACKETED] parts with your details.

Pairs well with: AI Agent Guardrails Checklist: Prompt Rules vs. Tool Permissions

Sponsor this page · Reach builders who use AI daily. Get details

FAQ

Why tell an AI coding agent the codebase is its own?

Without ownership framing, agents tend to play it safe: they add new functions next to old ones, wrap code instead of changing it, and leave dead code behind. Telling the agent it owns and maintains the code, and spelling out what that means, gets it to reuse, edit in place, and clean up.

Won't this make the agent change too much?

It can, which is why the template pairs ownership with hard limits: a never-touch list, an ask-before list, and a rule to stay inside the task and only note unrelated problems. Real limits on dangerous actions still belong in tool permissions, not just the rules file.

Where do I put these rules?

In the root AGENTS.md if you use several agents, with CLAUDE.md importing it via @AGENTS.md. For Cursor, put it in a .cursor/rules/*.mdc file with alwaysApply: true.

How do I stop the agent creating duplicate functions?

Make searching first a written rule, ask it to name the file it checked, and ask for a list of duplicates found at the end of each task. That turns a vague hope into a step you can see in its report.

Does owning the code mean the agent can clean up anything it sees?

No. It cleans up what its own change touched or made unused, and lists everything else for a separate task. Pair these rules with minimal diff rules to keep each change small, and with check-current-docs rules so new code matches the library versions you actually have installed.

Get 3 new templates every week

Free. Unsubscribe anytime.

Related templates

AGENTS.md Starter Template for Claude Code, Codex & Cursor

A drop-in AGENTS.md (or CLAUDE.md) that tells coding agents how your repo works, how to verify changes, and what never to touch.

Lean CLAUDE.md: Trim a Bloated Rules File to 40 Lines

Your agent ignores half of a long CLAUDE.md or AGENTS.md. This prompt cuts it to a lean core (stack, commands, a few never-do rules) and moves the rest into imported files.

Safe Refactor Prompt

Refactor messy code without changing behavior.

Minimal Diff Rules: Stop AI Agents Rewriting Unrelated Code

Rules for Claude Code, Cursor, and Codex: change only what you asked, no drive-by renames, refactors, or reformatting, and list every changed file.

Check Current Docs First: Stop Agents Using Outdated APIs

Rules that make Claude Code, Cursor, and Codex check your installed versions and current docs before calling any API, cite the version, and flag deprecations.

Browse all Coding & Cursor Rules templates

New on PromptLoot

2D Game Asset Rules for AI Agents: Sprites & Colliders

An ASSETS.md for Claude Code, Cursor, or Codex in Godot, Unity, Phaser, or Canvas: sprite sheet layout, naming, pixel-art import, animations, and colliders.

Agent Auto-Approve Policy: What AI Agents May Merge Alone

A policy file that sorts every PR an AI agent reviews into auto-merge, human review, or blocked: docs and tests yes; payments, auth, and secrets never.
PromptLoot Pro Pack · 200+ advanced templates, agent workflows, and Cursor rules bundles. Coming soon