Files
librefang-registry/workflows/test-generation.toml
T
Evan 05bdf02169 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
2026-04-01 18:21:09 +08:00

73 lines
2.0 KiB
TOML

id = "test-generation"
name = "Test Suite Generation"
description = "Analyse code to generate comprehensive unit tests, integration tests, and edge case coverage."
category = "engineering"
tags = ["testing", "quality", "engineering", "tdd"]
[i18n.zh]
name = "测试用例生成"
description = "分析代码,生成完整的单元测试、集成测试和边界情况覆盖。"
[[parameters]]
name = "code"
description = "Source code to generate tests for"
param_type = "string"
required = true
[[parameters]]
name = "language"
description = "Programming language and test framework to use"
param_type = "string"
required = false
default = "auto-detect"
[[steps]]
name = "code_analysis"
prompt_template = """
Analyse the following {{language}} code as a QA engineer:
1. List every public function/method and its contract (inputs → outputs)
2. Identify all branches and conditional paths
3. Note external dependencies that need mocking
4. Flag complex logic most likely to contain bugs
5. List data types and their valid/invalid ranges
Code:
{{code}}
"""
[[steps]]
name = "edge_cases"
prompt_template = """
Based on the code analysis, enumerate all edge cases and boundary conditions:
- Null/empty/zero inputs
- Maximum/minimum values
- Concurrent access scenarios
- Error propagation paths
- State machine transitions
- External dependency failures
Code analysis:
{{code_analysis}}
"""
depends_on = ["code_analysis"]
[[steps]]
name = "test_suite"
prompt_template = """
Write a complete test suite in {{language}} covering:
1. **Happy path tests** — one per public function
2. **Edge case tests** — from the edge case list
3. **Error handling tests** — each error path
4. **Integration tests** — cross-component interactions
Use descriptive test names following the pattern: `test_<function>_<scenario>_<expected_result>`.
Include setup/teardown where needed. Add a comment explaining the intent of non-obvious tests.
Code:
{{code}}
Edge cases:
{{edge_cases}}
"""
depends_on = ["code_analysis", "edge_cases"]