One CLAUDE.md Doesn't Fit Every Project: Split Your Templates by Situation, Not by Stack A freelance developer reorganized their Claude Code CLAUDE.md templates around project situations — new projects, inherited codebases, and billable client work — rather than tech stacks, arguing that working rules depend on risk profile rather than framework. They also published a PreToolUse Bash hook that blocks commands touching .env, .envrc, credentials.json and similar secret files, since settings.json deny rules only cover file tools, not shell commands. The hook strips .env.example from the command string before matching so template reads pass while real secrets files are blocked. Most CLAUDE.md templates you'll find are organized by stack: one for React, one for Laravel, one for Rails. When I started using Claude Code for freelance client work, I collected a few of those — and then barely used them. The problem wasn't the stack sections. It was that the working rules I actually needed had almost nothing to do with the framework. They depended on the situation the project was in: Same stack, three completely different rule sets. So I reorganized my templates around situations instead. This post walks through what changes between them, and then covers a second, more mechanical safeguard: a hook that stops .env files from leaking into the session through Bash. On a new project, Claude Code will happily invent conventions if you don't provide any — a different error-handling style in every file, tests for some features and not others. The template's job is to be opinionated early, while decisions are still cheap: Inherited codebases flip most of that on its head. Here the expensive mistake isn't inconsistency, it's breaking something that was working in production. The rules get defensive: Notice that none of this mentions a framework. A legacy Laravel app and a legacy Next.js app need almost identical rules, because the risk profile is the same. Billable work adds a layer that has nothing to do with code at all, and it's the layer where freelancers actually lose money. My client-project template carries it alongside the technical rules: A few habits that made this work in practice: