CLAUDE.md best practices: a starter template for reliable agents
Most CLAUDE.md files are a wish list. Here is a battle-tested structure that agents actually respect — plus a copy-paste starter.
Why most CLAUDE.md files fail
They read like a manifesto. Grand principles, no enforcement, no examples. The agent skims and moves on.
A good CLAUDE.md is closer to an onboarding runbook for a new senior engineer: specific, opinionated, and full of concrete examples.
The five sections that matter
- Project context — one paragraph, no marketing.
- How we work — the non-negotiables (tests before merge, no direct pushes to main, etc.).
- Where things live — the directory map, in code-block form.
- Do / don''t — pairs of explicit examples.
- Escalation — what to do when unsure.
A starter template
# Project: <name>
## Context
One paragraph: what this repo does and who uses it.
## Rules
- Always run `bun test` before opening a PR.
- Never edit files under `src/generated/`.
- Never commit changes to `.env` or any file matching `**/secrets/*`.
- Prefer small PRs. Split anything over ~300 changed lines.
## Layout
- `src/routes/` — page routes
- `src/lib/` — shared utilities
- `src/server/` — server-only code, never imported from the client
## Do
- Add a test alongside every bug fix.
- Ask before adding a new dependency.
## Don''t
- Do not "helpfully" refactor unrelated files.
- Do not silently disable failing tests.
## When unsure
Stop and ask. Do not guess at intent.
Beyond the file
A CLAUDE.md is a good start, but it is still just text. Pair it with an enforcement layer — a harness — so the important rules become real. Loop-OS treats your CLAUDE.md as the source of truth and enforces it, so the words on the page match the behavior in the repo.
Frequently asked
Ready to try Loop-OS?
Governance & reliability harness for AI agents
Get Loop-OS →Keep reading
AI Workflow Automation vs Traditional RPA: What Actually Wins
Traditional Robotic Process Automation (RPA) once promised efficiency through task automation. Now, Artificial Intelligence (AI) workflow automation offers a more dynamic approach. This article compares their real-world impact on operations.
What Is AI Agent Workflow Automation?
AI agent workflow automation leverages autonomous AI agents to manage and execute multi-step processes, reducing manual intervention and boosting operational efficiency. This approach moves beyond simple task automation to intelligent, adaptive system coordination.
AI Workflow Automation: The Complete 2026 Guide
AI workflow automation is no longer a futuristic concept but a present-day imperative for businesses aiming for efficiency and scalability. This guide provides an in-depth look at implementing AI in workflows.