Getting Available Prompts
UsegetPrompts() to retrieve all available prompts at once:
All addon prompts (like
hadith, fiqh, tafsir) are automatically stacked with the master prompt. You don’t need to combine them manually.Getting a Specific Prompt
For most use cases, you’ll want to retrieve a specific prompt by ID:Type Safety
ThegetPrompt() function is strongly typed, so TypeScript will catch invalid prompt IDs at compile time:
Available Prompt IDs
UsegetPromptIds() to get a list of all available prompt IDs (useful for dropdowns or validation):
Using Prompts with LLMs
Here’s a complete example of using a prompt with an LLM to translate Arabic segments:Getting Just the Content
If you only need the prompt text (not the metadata), usegetStackedPrompt():
Prompt Structure
Master Prompt
The master prompt contains universal rules that apply to all translations:
- Output format requirements (plain text, no Markdown)
- ID integrity rules (preserve segment IDs exactly)
- Transliteration standards (ALA-LC with diacritics)
- Forbidden patterns (no Arabic script except ﷺ)
Addon Prompt
Each specialized addon adds domain-specific rules:
- Hadith: Isnad chain formatting, narrator name handling
- Fiqh: Legal terminology, ruling formats
- Tafsir: Quranic verse references, exegesis style
- Fatawa: Q&A structure, speaker label preservation
Choosing the Right Prompt
Hadith - Prophetic traditions with chains of transmission
Hadith - Prophetic traditions with chains of transmission
Use for texts containing:
- Isnad chains (e.g., “عن أبي هريرة عن النبي”)
- Hadith commentary (Sharh)
- Narrator criticism embedded in hadith discussions
Fiqh - Islamic jurisprudence and legal rulings
Fiqh - Islamic jurisprudence and legal rulings
Use for texts containing:
- Legal rulings (wājib, mandūb, ḥarām, etc.)
- Fiqh terminology (ṭahārah, ṣalāh, etc.)
- Legal reasoning and arguments
Tafsir - Quranic exegesis and commentary
Tafsir - Quranic exegesis and commentary
Use for texts containing:
- Verse-by-verse Quran commentary
- Quranic references and citations
- Linguistic analysis of Quranic words
Fatawa - Q&A format between questioner and scholar
Fatawa - Q&A format between questioner and scholar
Use for texts containing:
- Question and answer dialogues
- Speaker labels (السائل, الشيخ)
- Multi-turn conversations
Encyclopedia Mixed - Polymath works switching between disciplines
Encyclopedia Mixed - Polymath works switching between disciplines
Use for texts that mix multiple genres:
- Works by scholars like Ibn Taymiyyah or Al-Albani
- Texts that switch between hadith, fiqh, and other topics
- No mode tags will appear in output
Working with the Master Prompt
If you need to create a custom addon, you can access the master prompt directly:Practical Examples
Building a Translation UI
Batch Translation with Different Prompts
Next Steps
Validating Output
Learn how to validate LLM translations for errors
Custom Prompts
Create custom prompts for specialized use cases