Enforce brand writing guidelines in Claude Code β PostToolUse hook + MCP server
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Brand writing enforcement for Claude Code β automatic, configurable, zero-friction.
Every time Claude writes or edits a Markdown file, brand-voice checks it against your brand guidelines and signals Claude to fix violations before the file saves. No manual review. No rule reminders in every prompt.
Claude reads the violation list, corrects the file, and retries the write β automatically.
Your brand guidelines live in a doc somewhere. Claude doesn't read them unless you paste them into every prompt. Even then, the rules drift over time.
brand-voice makes the rules structural:
.brand-voice-ignore for whole files, <!-- brand-voice-disable-line --> for individual linesOr run without installing:
Requires Node.js 18+.
Run the setup skill inside any Claude Code session:
The skill does everything:
brand-guidelines.md to your projectCLAUDE.md.claude/settings.json.mcp.jsonAfter setup, every .md and .mdx file Claude touches is checked automatically.
Three components work together:
| Component | What it does |
|---|---|
PostToolUse hook (brand-voice-check) | Runs after every Write/Edit/MultiEdit on .md/.mdx; exits 2 with violations so Claude auto-corrects, exits 0 when clean |
MCP server (brand-voice-mcp) | Exposes analyze_readability and apply_suggestions for on-demand analysis and word-level fixes |
CLI (brand-voice) | Standalone checker for CI pipelines, ratchet baselines, and GitHub PR annotations |
| Rule | Severity | Description |
|---|---|---|
| Forbidden terms | error | Whole-word, case-insensitive match β blocks the write |
| Avoid terms | warning | Same matching β signals a preferred alternative |
| Sentence length | warning | Configurable max words per sentence (default: 25) |
| Passive voice | warning | Auxiliary + past-participle pattern detection |
| Readability grade | warning | Flesch-Kincaid grade per sentence vs. your target |
Code blocks, inline code, indented blocks, and table rows are never checked β only prose.
Never checked: physical line length or line breaks. The CLAUDE.md injection always includes a formatting rule telling Claude to write continuous paragraphs and let the renderer word-wrap, but the analyzer itself has no line-width rule and never will β sentence length is measured in words, not characters or lines, so hard-wrapped and unwrapped prose score identically.
| Code | Meaning |
|---|---|
0 | No violations β file accepted |
2 | Violations found β Claude reads output, corrects, and retries |
Exit 1 is never used (it aborts the session rather than triggering a retry).
One Markdown file holds your entire brand configuration. Keep it under 600 words so it fits cleanly in context.
See example/brand-guidelines.md for a complete working example.
## On-Brand Examples and ## Off-Brand Examples are accepted as aliases for ## On-Tone Examples / ## Off-Tone Examples. All other section names are case-insensitive exact matches.
The hook and CLI search for brand-guidelines.md in this order:
~/.claude/brand-guidelines.md (user scope β enforces rules across all your projects).brand-voice-ignoreCreate a .brand-voice-ignore file in your project root. Uses gitignore-style patterns:
Add this comment anywhere on a line to suppress all violations on that line. Useful for one-off exceptions where the violation is intentional.
analyze_readabilityCheck a file or inline text for violations and readability scores.
Inputs:
| Field | Type | Required | Description |
|---|---|---|---|
file | string | one of file/text | Absolute or relative path to a .md/.mdx file |
text | string | one of file/text | Inline Markdown to analyze |
cwd | string | no | Working directory for locating brand-guidelines.md |
Returns: { filePath, passed, violations[], readabilityScores, visualIdentity }
apply_suggestionsApply safe word-level substitutions for forbidden/avoid terms. Does not fix sentence length, passive voice, or grade β those need human judgment.
Inputs:
| Field | Type | Required | Description |
|---|---|---|---|
file | string | yes | Path to the file to fix |
dryRun | boolean | no | Preview diff without writing (default: false) |
Returns: diff + change list (dry run) or confirmation + change list (live)
Tip: Run dryRun: true first to preview, then apply.
brand-voice works independently of Claude Code β add it to any pipeline.
Check all .md files:
Check only files changed in the current branch:
GitHub Actions inline annotations (PR diff comments):
Ratchet enforcement β block regressions without requiring a clean slate:
Example GitHub Actions workflow:
Exit 0 = clean or within baseline. Exit 1 = errors found or baseline exceeded.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/brand-voice)<a href="https://allmcps.com/mcp/brand-voice"><img src="https://allmcps.com/api/badge/brand-voice?style=directory" alt="Brand Voice on AllMCPs" /></a>