Custom Prompts
yaku ships with a tuned system prompt for translation. If you need full control over the LLM instructions, you can replace the built-in prompt entirely.
Override per command
Section titled “Override per command”yaku --to en --prompt my-prompt.txt "Bonjour le monde"The file content is sent as the system prompt. yaku reads the file as-is — no template variables or merging.
Override for all commands
Section titled “Override for all commands”yaku config set prompt /path/to/my-prompt.txtThis applies to every translation until you remove it:
yaku config set prompt ""A --prompt flag on the command line takes priority over the config value.
Writing a custom prompt
Section titled “Writing a custom prompt”Your prompt replaces yaku’s entire system prompt. You are responsible for all instructions. At minimum, include:
- An instruction to output only the translated text (no explanations or commentary)
- An instruction to preserve paragraph structure and line breaks
- The target language (yaku still passes the text as the user message)
Example prompt file
Section titled “Example prompt file”You are a professional translator specializing in software documentation.
Translate the user's input to the target language.
Rules:- Output ONLY the translated text. No explanations, no wrapping quotes.- Preserve paragraph structure and line breaks exactly.- Keep code identifiers (variables, functions, file paths) in English.- Keep brand names (GitHub, Docker, Kubernetes) unchanged.- Use formal, precise language appropriate for technical documentation.Save as my-prompt.txt and use:
yaku --to en --prompt my-prompt.txt -f docs.fr.mdWhat gets disabled
Section titled “What gets disabled”When using --prompt, the following built-in behaviors are disabled:
- Built-in translation rules — the 8-rule base prompt is not included.
- Polish mode prompt —
--mode polishhas no effect because the custom prompt replaces everything. - Format-specific rules — Markdown preservation rules are not appended (but JSON/YAML extraction still works — see below).
- Context injection —
--contexthas no effect.
These features still work with a custom prompt:
- Glossary keep-original enforcement — terms marked with
~(keep original) are verified in the output after translation. However, glossary translation entries (term → translation) are not injected into a custom prompt. - JSON/YAML extraction — structured format handling is pre-processing, not prompt-based.
- Output sanitization — LLM artifact cleanup runs on all output.
Use cases
Section titled “Use cases”- Domain-specific tone — tailor the prompt for legal, medical, or marketing content.
- Strict output format — enforce specific formatting rules the default prompt does not cover.
- Experimentation — test different prompt strategies to find what works best for your content.
- Start from the built-in prompt. Read yaku’s source code (
internal/prompt/system.go) to see the default rules, then modify from there. - Test with short text first. Verify your prompt produces clean output before running it on large files.
- Keep the “output only” rule. Without it, the LLM tends to add explanations that pollute the output (though yaku’s sanitizer catches common patterns).