How They Use AI  |  Newest

<< Home  |  Work

Stopped Claude from going rogue and ignoring instructions

AreaWork
AI usedClaude Code
Sourcer/ClaudeCode
Posted2026-03-01

The move

Create a CLAUDE.md file in your project root to define strict coding constraints.

Steps

  1. Create a file named CLAUDE.md in your project root directory.
  2. List specific constraints like 'no refactoring unless asked' or 'no extra comments'.
  3. Define preferred coding patterns or architectural styles.
  4. Place additional CLAUDE.md files in subdirectories for folder-specific rules.

Prompt for your AI

Act as a senior developer. Follow these strict rules for all code changes: [Insert rule 1, e.g., No refactoring unless explicitly requested]. [Insert rule 2, e.g., Always follow existing codebase patterns]. [Insert rule 3, e.g., Keep solutions simple and avoid unnecessary abstractions].

What happened

The user struggled with Claude Code constantly adding unwanted docstrings and refactoring working code. By creating a simple CLAUDE.md file with specific rules, the AI began following instructions consistently. This approach also works by placing specific rule files in different subdirectories for monorepos.

Watch out

Overly restrictive rules might prevent the AI from suggesting necessary improvements. Ensure rules are updated if your project's coding standards change.

Give it to your agent

Read https://howtheyuse.ai/p/stopped-claude-from-going-rogue-and-ignoring-instructions.md and help me do this.

Sources



Last updated November 26, 2026.