Skip to main content
npm version wobble-bibble is a TypeScript library designed for academic-grade Islamic text translation. It provides optimized prompts for LLM translation, output validation to catch hallucinations, and prompt stacking utilities for combining master prompts with specialized domain prompts. Live demo: wobble-bibble.surge.sh

Features

Bundled prompts

8 optimized translation prompts for Hadith, Fiqh, Tafsir, and more with strongly-typed access

Translation validation

Catch LLM hallucinations like malformed segment IDs, Arabic leaks, and forbidden terms

Prompt stacking

Master and specialized prompts combined automatically for optimal results

Gold standards

High-fidelity reference dataset for benchmarking translation quality

Bundled prompts

The library includes 8 specialized prompts optimized through rigorous testing:
Prompt IDNameUse case
master_promptMaster PromptUniversal grounding rules
hadithHadithIsnad-heavy texts, Sharh
fiqhFiqhLegal terminology
tafsirTafsirQuranic exegesis
fatawaFatawaQ&A format
encyclopedia_mixedEncyclopedia MixedPolymath works
jarh_wa_tadilJarh Wa TadilNarrator criticism
usul_al_fiqhUsul Al FiqhLegal methodology
Each specialized prompt is automatically stacked with the master prompt to ensure consistent output quality while maintaining domain-specific requirements.

Translation validation

The validation system catches common LLM translation failures:
  • Invalid marker format: Malformed segment IDs like B1234$5 or P123ab
  • Arabic leak: Arabic script in output (except ﷺ)
  • Invented IDs: Segment IDs that don’t exist in the source corpus
  • Missing ID gaps: Skipped segments between consecutive IDs
  • Duplicate IDs: Same segment ID appearing multiple times
  • Truncated segments: Incomplete translations marked with ... or [INCOMPLETE]
  • Collapsed speakers: Speaker labels appearing mid-line instead of on new lines
  • Empty parentheses: Excessive () patterns indicating failed term-pairs
Every validation error includes precise character ranges pointing to the exact location in the raw response string.

Prompt stacking

Prompt stacking combines the universal master prompt with specialized domain addons:
import { getPrompt } from 'wobble-bibble';

const hadithPrompt = getPrompt('hadith');
console.log(hadithPrompt.content);
// Contains: Master prompt rules + Hadith-specific isnad handling
This ensures all translations follow:
  • ALA-LC transliteration with diacritics
  • Plain text output (no Markdown)
  • Segment ID integrity (no invented or skipped IDs)
  • Domain-specific conventions (e.g., narrator chains for Hadith)

Next steps

Installation

Install wobble-bibble with npm, yarn, pnpm, or bun

Quickstart

Get started with prompts and validation in 5 minutes

Build docs developers (and LLMs) love