Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
backend ruleP1universalStack: node
llmprompt-injectioncorrectnessai
Delimit user content from instructions in LLM prompts
When appending instructions around user-provided text, use explicit delimiters or a separate system message so the model can't conflate instructions with the content to process.
PR: hegnar-journalist-boost · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | const prompt = basePrompt + userContent + englishExtensionText; // extension blends into content |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const messages = [ |
| 2 | new SystemMessage(englishExtensionText), |
| 3 | new SystemMessage('Text to be proofread follows between <content> tags.'), |
| 4 | new HumanMessage(`<content>${userContent}</content>`), |
| 5 | ]; |
Explanation (EN)
Objašnjenje (HR)