feat(workflows): expand template library from 9 to 22 + multiline string cleanup (#36)

* feat(workflows): add 13 workflow templates across engineering, business, and productivity

Engineering:
- bug-triage: reproduce path → root cause → fix plan
- api-design: resource model → endpoints → OpenAPI spec
- incident-postmortem: timeline → RCA → full postmortem report
- test-generation: code analysis → edge cases → full test suite
- refactor-plan: smell analysis → prioritised opportunities → migration plan

Business:
- competitor-analysis: profiles → SWOT → strategy report
- product-spec: problem definition → user stories → full PRD
- market-research: landscape → segments → research report

Productivity/Thinking:
- meeting-summary: raw notes → structured summary → follow-up email
- decision-matrix: criteria → weighted scoring → recommendation memo
- learning-plan: gap analysis → roadmap → week-1 day-by-day plan
- job-application: job analysis → tailored resume → cover letter → interview prep
- blog-post: research → outline → draft → SEO optimisation

Closes #1912 on librefang/librefang

* fix(workflows): overhaul existing 9 templates

- data-pipeline: redesigned — original 'extract from URL' step was
  broken (LLMs cannot fetch URLs); replaced with paste-data approach
  (profile → clean_transform → analyse) with analysis_goal parameter
- translate-polish: added target_language and register parameters;
  added back-translation step for accuracy verification
- weekly-report: added team/audience parameters, richer extraction
  step, added Metrics and Notes sections
- content-pipeline: added audience/tone parameters, added outline step
  between research and writing
- content-review: fix category 'content' → 'creation'
- customer-support: fix category 'support' → 'business'

* style(workflows): convert all prompt_template strings to TOML multiline syntax

Replace \n escape sequences with real newlines using triple-quote
multiline strings ("""...""") across all 22 workflow templates.
No content changes — formatting only.

* style(hands): replace \n escape in reddit writer format example with multiline code block
This commit is contained in:
Evan authored and GitHub committed 2026-04-01 18:21:09 +08:00
1 parent ae5d97dc7e
commit 05bdf02169
23 files changed
+1500 -64

No files matched your search

+66 -9
View File
@@ -1,12 +1,12 @@
id = "translate-polish"
name = "Translation & Polish"
description = "Auto-detect language, translate, and review for naturalness"
description = "Translate text into a target language, then review for accuracy, naturalness, and cultural fit."
category = "language"
tags = ["translation", "language", "localization"]
tags = ["translation", "language", "localization", "writing"]
[i18n.zh]
name = "翻译与润色"
description = "自动检测语言,翻译文本,并审校译文的自然度"
description = "将文本翻译为目标语言,再审校准确性、自然度和文化适配性。"
[[parameters]]
name = "source_text"
@@ -14,11 +14,68 @@ description = "The text to translate"
param_type = "string"
required = true
[[steps]]
name = "translator"
prompt_template = "You are an expert translator. Translate the following text. Auto-detect the source language: if it's Chinese, translate to English; if it's English, translate to Chinese; for other languages, translate to both Chinese and English. Preserve the original tone, style, and formatting.\n\nText:\n{{source_text}}"
[[parameters]]
name = "target_language"
description = "Target language (e.g. English, Chinese, Spanish, Japanese, French)"
param_type = "string"
required = false
default = "auto: if Chinese → English, if English → Chinese, otherwise → English"
[[parameters]]
name = "register"
description = "Desired register: formal, casual, technical, literary"
param_type = "string"
required = false
default = "match source"
[[steps]]
name = "reviewer"
prompt_template = "You are a bilingual language expert. Review the following translation for accuracy and naturalness. Check for: 1) Mistranslations or meaning shifts 2) Awkward phrasing that sounds translated 3) Cultural context issues. Output the improved final translation only.\n\nTranslation to review:\n{{translator}}"
depends_on = ["translator"]
name = "translate"
prompt_template = """
You are a professional translator. Translate the following text into {{target_language}}.
Guidelines:
- Preserve the original meaning, tone, and structure as closely as the target language allows
- Use {{register}} register
- For idiomatic expressions, translate the meaning rather than word-for-word
- For proper nouns and technical terms, keep the original with a parenthetical explanation on first use if needed
- If any passage is ambiguous in the source, note the ambiguity briefly after the translation
Source text:
{{source_text}}
"""
[[steps]]
name = "back_translate"
prompt_template = """
Back-translate the following {{target_language}} translation into the source language. Do not look at the original — produce an independent translation from the target language only.
This is used to verify accuracy by comparing the back-translation to the original.
Translation to back-translate:
{{translate}}
"""
depends_on = ["translate"]
[[steps]]
name = "review_and_polish"
prompt_template = """
You are a bilingual editor. Review the translation quality by comparing original, translation, and back-translation.
Check for:
1. Meaning shifts — where the back-translation diverges from the original
2. Unnatural phrasing that sounds translated rather than native
3. Register consistency (target: {{register}})
4. Cultural appropriateness for {{target_language}} readers
Output: the polished final translation only, with a brief note on any changes made.
Original:
{{source_text}}
Translation:
{{translate}}
Back-translation:
{{back_translate}}
"""
depends_on = ["translate", "back_translate"]