If you've worked with Express.js for more than a week, you know the feeling: you ask Claude to add a route, or refactor some middleware, and it hands back code that looks fine — until you run it. The headers are already sent. The error handler has the wrong signature. The async route swallows rejections silently. The middleware mutates req after calling next().
None of these are hard bugs to write. They're easy bugs to write if you don't know Express's specific conventions. And Claude doesn't know your version of Express, your middleware stack, or your error handling contract — unless you tell it.
That's what a CLAUDE.md file is for.
Here are 13 rules that stop the most common AI-generated Express.js mistakes before they reach your codebase.
Rule 1: Declare your Express version and Node version explicitly







