Home
cd ../playbooks
Developer ToolsBeginner

LLM Coding Guardrails

Four behavioral guidelines that reduce the most common Claude coding mistakes: silent assumptions, overcomplication, scope creep, and vague success criteria.

2 minutes
By communitySource
#claude-md#guardrails#code-quality#best-practices#prompting

Claude confidently ships 200 lines when 50 would do, refactors code you didn't ask it to touch, and declares 'done' before verifying anything works — these four rules put a stop to it.

Who it's for: software engineers, tech leads, senior developers, staff engineers, engineering managers using Claude Code daily

Example

"Add input validation to the signup form" → Claude states assumptions, asks about edge cases, writes a failing test, adds the minimum validation to pass it, and stops — no adjacent refactors, no speculative config flags

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

# CLAUDE.md

Behavioral guidelines to reduce common LLM coding mistakes. Merge with project-specific instructions as needed.

**Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.

## 1. Think Before Coding

**Don't assume. Don't hide confusion. Surface tradeoffs.**

Before implementing:
- State your assumptions explicitly. If uncertain, ask.

Get new playbooks like this one

One email a week with new Claude Code workflows. Free, like everything here.

No spam. Unsubscribe anytime.

README.md

What This Does

Drops four behavioral rules into your project's CLAUDE.md that target the failure modes Claude exhibits most often in coding tasks:

  1. Think Before Coding — surface assumptions and ambiguity instead of silently picking an interpretation
  2. Simplicity First — no speculative abstractions, no unrequested features, no error handling for impossible cases
  3. Surgical Changes — edit only what the task requires; don't "improve" adjacent code
  4. Goal-Driven Execution — translate tasks into verifiable success criteria and loop until met

The guidelines bias toward caution over speed — use judgment on trivial tasks.


Quick Start

Step 1: Download the template

Click Download above to grab the CLAUDE.md content.

Step 2: Merge into your project's CLAUDE.md

Append the four sections to the existing CLAUDE.md at your repo root, or drop it in as-is if you don't have one yet. It composes cleanly with project-specific instructions.

Step 3: Observe the diffs

You should notice: smaller diffs, fewer unrelated changes, clarifying questions arriving before implementation instead of after a rewrite.

Tips

  • Keep it near the top of CLAUDE.md. Behavioral rules work best when loaded early in context.
  • Customize rule 4 with your test commands. Replace generic "write a test" language with the actual command (npm test, pytest -k, etc.) for better loop execution.
  • Pair with a test-first workflow. Rule 4 assumes tests exist or can be written — weak on codebases without any test harness.

When to Skip These Rules

The source notes explicitly: for trivial tasks, use judgment. One-line fixes, typos, or throwaway scripts don't need a five-step verification plan. The guardrails earn their weight on multi-file changes, ambiguous requests, and work in unfamiliar codebases.

Signals It's Working

  • Diffs touch only lines that trace to the request
  • Clarifying questions arrive before the first edit, not after a rewrite
  • Fewer "I also cleaned up X while I was there" moments
  • Multi-step tasks come with a numbered plan and per-step verification checks

$Related Playbooks

Developer Tools

LangSmith Fetch

Debug LangChain and LangGraph agents by fetching execution traces from LangSmith Studio for error analysis and performance optimization.

10 minutes
Intermediate
Developer Tools

Long-Horizon Agent Prompting

Design the launch prompt for an agent working autonomously for hours or days — a pseudo-formal task brief with an exact success predicate, an enumerated non-counting-outcomes list, adversarial verification, and effort floors, because persistence pressure against a loose spec produces confident non-solutions.

10 minutes
Advanced
Developer Tools

Loopy: Build and Reuse Agent Loops

Mine your codebase and coding history for repeated work, turn it into bounded agent loops, and audit the loops you already have

10 minutes
Intermediate
Developer Tools

MCP Server Hub Manager

Access 1200+ AI Agent tools via Model Context Protocol (MCP)

10 minutes
Advanced
Developer Tools

MCP Server Builder

Guide for creating high-quality Model Context Protocol (MCP) servers that enable LLMs to interact with external services and APIs.

30 minutes
Advanced
Developer Tools

Minimalist UI Design Skill: Editorial, Monochrome Interfaces

A frontend design system that enforces warm monochrome, bento grids, and editorial typography — the Notion/Linear look, banned from gradients, heavy shadows, and Inter

5 minutes
Beginner
Developer Tools

Mermaid Tools

Extract Mermaid diagrams from markdown files and render them to high-quality PNG images using bundled scripts — turning text diagrams into shareable visuals.

5 minutes
Beginner
Developer Tools

Minimalist MVP Scoping

Scope a weekend-shippable MVP using the manual → processized → productized progression. Build as little as possible; charge from day one.

5 minutes
Beginner
Developer Tools

n8n Workflow Builder

Automate document workflows with n8n - 7800+ workflow templates

10 minutes
Advanced
Developer Tools

Nuxt UI Component Guidance

Build interfaces correctly with @nuxt/ui v4 — five core rules (UApp wrapper, semantic colors, reading generated theme files for real slot names, override priority, icon naming), a task-to-focus-area routing table, the Nuxt UI MCP server for live component API lookups, and full installation for both Nuxt and standalone Vue.

5 minutes
Beginner
Developer Tools

React Native Video (v6 & v7)

Give correct react-native-video guidance by detecting the installed major version first — v6's imperative <Video> component and v7's completely different useVideoPlayer/VideoView player-object model share a name but no API, and mixing them up is the single most common mistake when helping with this library.

5 minutes
Intermediate
Developer Tools

React Three Fiber Animation Reference

Animate React Three Fiber scenes correctly — useFrame fundamentals with render priority, full GLTF animation control via useAnimations (playback, crossfade, event listeners, speed-based blending between Idle/Walk/Run), @react-spring/three physics animations with gesture and chain integration, and the five performance rules that keep per-frame updates from triggering React re-renders.

10 minutes
Intermediate

Browse all Developer Tools playbooks →