Back to feed
Dev.to
Dev.to
5/10/2026
How to Write a CLAUDE.md Rule That Actually Gets Enforced

How to Write a CLAUDE.md Rule That Actually Gets Enforced

Short summary

Most instruction files contain unenforceable rules because they're written as judgments rather than verifiable patterns. A rule is enforceable when it maps to concrete checks: AST patterns, file naming, forbidden tokens, or configuration files. The post provides a taxonomy of 12 common intents paired with unenforceable vs. enforceable examples, and explains which static analysis classes can actually verify rules.

  • 74% of 580 public instruction files contain zero machine-extractable rules
  • Enforceable rules must map to concrete patterns: AST checks, file naming, tokens, configuration, or git history
  • Useful but inherently unenforceable content (project context, behavior directives) should remain separate from rule specifications

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Explore more