Code blocks are used in AI responses when code is present
Why it matters
Code rendered as plain text mashes variable names, file paths, and commands into prose where users cannot distinguish them from English — copy-paste breaks, indentation collapses, and shell commands get executed with the wrong quoting. This violates the inference-contract taxon: your UI renders markdown, but the model was never told to emit it. Developers paste broken snippets, support tickets escalate, and the product looks amateur next to competitors whose code blocks render with syntax highlighting.
Severity rationale
High because every technical response degrades simultaneously, affecting trust and usability across the entire product surface.
Remediation
Add explicit formatting directives to the system prompt telling the model to wrap code in fenced blocks with language specifiers, use inline code for paths and variables, and structure steps as numbered lists. Pair this with a syntax-highlighting renderer such as react-syntax-highlighter in lib/ai/prompts.ts.
const systemPrompt = `Use fenced code blocks with language specifiers for all code. Use inline code for file paths, variable names, and shell commands.`
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the AI Response Quality Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
Taxons
History
- 2026-04-18·v1.0.0·Initial import from ai-response-quality·automated