DEV Community

Cover image for The .cursorrules + CLAUDE.md + AGENTS.md setup that stopped my AI agent from ignoring me
yangzh991
yangzh991

Posted on • Edited on

The .cursorrules + CLAUDE.md + AGENTS.md setup that stopped my AI agent from ignoring me

Every session, the same problem.

I open Cursor, start a task, and within minutes the AI is:

  • Generating components that already exist
  • Using patterns we explicitly don't use
  • Renaming things I didn't ask it to rename

Sound familiar?

The fix isn't a better prompt. It's better rules files.

Here's the setup I now use on every project:

## .cursorrules

Tells Cursor how to write code in this repo. Mine covers:

  • TypeScript strict patterns (no any, discriminated unions for AI states)
  • Streaming hook conventions with proper abort cleanup
  • Folder structure enforcement
  • Security rules (no API keys in state, sanitize AI output)

## CLAUDE.md

Loaded at the start of every Claude Code session. Includes:

  • Tech stack
  • Current sprint goals
  • Business rules the AI must never violate
  • What it should always/never do

## AGENTS.md

The strictest file. Prevents agents from:

  • Renaming files without permission
  • Deleting code without explaining it first
  • Adding dependencies without listing them

I packaged all three as a starter pack with fill-in-the-blank

templates for React + TypeScript + AI product projects.

If you want to grab it: https://payhip.com/b/BVfGI ($19)
If you want the full setup pre-built and ready to drop in:

https://payhip.com/b/BVfGI ($19)

Or drop a comment and I'll paste the .cursorrules here for free.

Top comments (0)