Create custom translation prompts by extending the master prompt with specialized rules
Wobble-bibble’s prompt system is designed to be extensible. You can create custom prompts by combining the master prompt with your own specialized rules.
Let’s create a custom addon for translating poetry:
import { getMasterPrompt, stackPrompts } from 'wobble-bibble';const poetryAddon = `GENRE: Classical Arabic Poetry (Shiʿr)STRUCTURE:- Preserve verse structure (each bayt/couplet on its own line)- Maintain hemistichs (ṣadr and ʿajuz) with a clear break- Do NOT merge lines or combine versesMETER & RHYME:- Mention meter (baḥr) if explicitly named in source- Preserve rhyme scheme indicators (qāfiyah)- Transliterate metrical terms: baḥr al-ṭawīl, etc.POETIC DEVICES:- Translate jinās (paronomasia) with a note: "wordplay on X"- Translate ṭibāq (antithesis) preserving contrast- Mark tawriyah (double entendre) with parenthetical clarificationVOCABULARY:- Use "ode" for qaṣīdah, "fragment" for qiṭʿah- Transliterate genre names: nasīb, fakhr, rithāʾ, etc.- Translate imagery literally, preserve metaphorsFORMATTING:Poem Title - Poet Nameverse 1a verse 1bverse 2a verse 2b`;const poetryPrompt = stackPrompts(getMasterPrompt(), poetryAddon);
Here’s how you might extend the built-in Tafsir prompt with custom rules:
import { getPrompt, getMasterPrompt, stackPrompts } from 'wobble-bibble';// Get the built-in Tafsir prompt as a baseconst tafsirBase = getPrompt('tafsir');// Add custom rules for a specific Tafsir workconst customTafsirRules = `ADDITIONAL RULES FOR TAFSIR AL-JALALAYN:1. ATTRIBUTION: - Distinguish Jalāl al-Dīn al-Maḥallī vs. Jalāl al-Dīn al-Suyūṭī - Use full names on first mention, then "al-Maḥallī" / "al-Suyūṭī"2. QURANIC INSERTIONS: - When Quran text is embedded mid-explanation, use «guillemets» - Example: He explained «and those who believe» as referring to...3. GRAMMATICAL NOTES: - Translate iʿrāb discussions with English grammar terms - marfūʿ = nominative, manṣūb = accusative, etc.4. BREVITY: - This tafsir is extremely concise - keep translations equally brief - Do NOT expand or add explanatory text`;// Stack: master + tafsir + customconst customPrompt = stackPrompts(tafsirBase.content, customTafsirRules);
LLMs respond better to explicit “DO NOT” statements than soft suggestions.
// ❌ Weak: Soft suggestionconst weak = `Try to preserve line breaks.`;// ✅ Strong: Explicit negationconst strong = `DO NOT merge source lines. Each line must stay separate.`;
Provide examples
Include concrete examples in your addon to reduce ambiguity.
const newsAddon = `MODERN ARABIC NEWS:- Use plain English spellings for place names- Translate political titles literally- Preserve datelines and bylines`;