// Collaborative documentation and test code writing workflow using zen mcp's clink to launch gemini CLI session in WSL (via 'gemini' command) where all writing operations are executed. Use this skill when the user requests "use gemini to write test files", "use gemini to write documentation", "generate related test files", "generate an explanatory document", or similar document/test writing tasks. The gemini CLI session acts as the specialist writer, working with the main Claude model for context gathering, outline approval, and final review. For test code, codex CLI (also launched via clink) validates quality after gemini completes writing.
| name | simple-gemini |
| description | Collaborative documentation and test code writing workflow using zen mcp's clink to launch gemini CLI session in WSL (via 'gemini' command) where all writing operations are executed. Use this skill when the user requests "use gemini to write test files", "use gemini to write documentation", "generate related test files", "generate an explanatory document", or similar document/test writing tasks. The gemini CLI session acts as the specialist writer, working with the main Claude model for context gathering, outline approval, and final review. For test code, codex CLI (also launched via clink) validates quality after gemini completes writing. |
This skill provides a collaborative writing workflow where gemini CLI (launched via zen mcp's clink tool as a WSL command gemini) serves as a specialist writer for markdown documentation and test code. All writing operations are executed within the gemini CLI session environment, while the main Claude model handles context gathering, user interaction, and test execution. For test code, codex CLI (also launched via clink as WSL command codex) performs quality validation after gemini completes the initial writing.
Technical Architecture:
gemini command in WSL, where all document/test writing happenscodex command in WSL for code review taskscontinuation_id across CLI sessionsDivision of Responsibilities:
Trigger this skill when the user or main model requests:
automation_mode definition and constraints: See CLAUDE.mdใ๐ ๅ ฑไบซๆฆๅฟต้ๆฅใ
This skill's role: Skill Layer (read-only), read from context [AUTOMATION_MODE: true/false]
false โ Interactive: Requires user confirmation (outline, review, test corrections)true โ Automated: Autonomous decisions, escalate only for critical issues, record to auto_log.mdcoverage_target definition and constraints: See CLAUDE.mdใ๐ ๅ ฑไบซๆฆๅฟต้ๆฅใ
This skill's role: Skill Layer (read-only), read from context [COVERAGE_TARGET: X%], use when generating/evaluating test code (default 85% if missing)
User Request
โ
โโโ Document Writing? โโโ Document Writing Workflow
โ
โโโ Test Code Writing? โโโ Test Code Writing Workflow
Main Claude's Responsibility:
Understand the Documentation Need:
Gather Context:
Identify Document Requirements:
references/doc_templates/README.md (on-demand template loading)Invoke Gemini CLI Session via mcp__zen__clink:
Tool: mcp__zen__clink
Parameters:
- cli_name: "gemini" # Launches 'gemini' command in WSL
- prompt: "Generate a detailed outline for [document type] covering [scope].
Context: [provide all gathered context]
Requirements: [standards from CLAUDE.md if applicable]
Purpose: [document purpose]
Audience: [target readers]"
- files: [list of relevant file paths for context - absolute paths]
- role: "default" (or "planner" for complex planning tasks)
- continuation_id: [if continuing from previous gemini CLI session]
What Happens:
Gemini CLI Session Output: Detailed outline with:
Main Claude's Responsibility:
** automation_mode check**: [AUTOMATION_MODE: false] โ Interactive / true โ Automated
Present Outline to User:
Gemini CLI has generated document outline:
[Show outline]
Do you approve this outline?
- Yes: Continue writing
- No: Please provide modification suggestions
- Modify: [Specific modification suggestions]
Wait for User Approval - Do NOT proceed without confirmation
Iterate if Needed: If user requests changes, provide feedback to gemini and regenerate outline
Main Claude Reviews Outline Autonomously (based on automation_mode=true):
Auto-Decision: Meets standards โ auto-approve + log; Else โ retry (max 2ร) + log, escalate if failed
Present Decision to User (Information Only):
Outline auto-approved (automated mode)
[Show outline summary]
Approval reasons:
- Structure complete
- Meets template requirements
- Covers all requirements
Continuing to write complete document...
After Outline Approval, Invoke Gemini CLI Session:
Tool: mcp__zen__clink
Parameters:
- cli_name: "gemini" # Reuses the same gemini CLI session in WSL
- prompt: "Write the complete [document type] based on this approved outline:
[outline]
Writing Guidelines:
- Follow the outline structure exactly
- For PROJECTWIKI.md/CHANGELOG.md/ADR: strictly follow templates in references/doc_templates/README.md (load specific templates as needed)
- Use Mermaid diagrams where appropriate (```mermaid blocks)
- Write in clear, professional Chinese (or English if specified)
- Include code examples where helpful
- Ensure consistency with CLAUDE.md standards
Context: [all gathered context]
Referenced files: [files to reference]"
- files: [relevant files - absolute paths]
- role: "default"
- continuation_id: [reuse from outline generation - maintains session context]
What Happens:
Gemini CLI Session Output: Complete markdown document
Main Claude's Responsibility:
** automation_mode check**: [AUTOMATION_MODE: false] โ Interactive / true โ Automated
Present Document:
Gemini CLI has completed document writing:
Document type: [type]
File path: [proposed path]
[Show document content or summary]
Please review this document:
- Approve and save
- ๐ Needs modification: [Please specify modification content]
- Regenerate
Handle Feedback:
Finalize:
Main Claude Validates Document Autonomously (based on automation_mode=true):
references/doc_templates/README.md (load specific templates for validation)
Auto-Decision: Meets quality โ auto-approve + save + update CHANGELOG + log; Else โ retry (max 2ร) + log, escalate if failed
Present Final Result to User (Information Only):
Document auto-completed and saved (automated mode)
Document type: [type]
File path: [actual path]
Quality checks:
- Structure complete
- Meets standards
- Format correct
- Links valid
[Show document summary or key sections]
CHANGELOG.md automatically updated
Main Claude's Responsibility:
Understand Testing Need:
[COVERAGE_TARGET: X%] (default 85% if missing)Gather Context:
Identify Test Requirements:
Invoke Gemini CLI Session via mcp__zen__clink:
Tool: mcp__zen__clink
Parameters:
- cli_name: "gemini" # Launches 'gemini' command in WSL
- prompt: "Generate comprehensive test code for [module/function].
Code to Test:
[code content or file references]
Test Requirements:
- Framework: [pytest/unittest/etc.]
- Test types: [unit/integration/E2E]
- Coverage target: โฅ {coverage_target from context, e.g., 85%}
- Include: normal cases, edge cases, error handling, boundary conditions
Standards:
- Follow best practices from references/test_patterns.md
- Clear test names and assertions
- Proper setup/teardown
- Mock external dependencies
- Document complex test logic
Context: [project structure, existing tests, conventions]"
- files: [code files to test + existing test examples - absolute paths]
- role: "default"
- continuation_id: [if continuing from previous gemini CLI session]
What Happens:
Gemini CLI Session Output: Complete test code file(s)
Main Claude invokes Codex via mcp__zen__codereview:
Tool: mcp__zen__codereview
Parameters:
- step: "Review the test code generated by gemini for quality, completeness, and adherence to testing standards.
Focus Areas:
- Test coverage adequacy
- Assertion completeness
- Edge case handling
- Code quality (readability, maintainability)
- Framework best practices
- Mock/fixture usage
- Error handling in tests"
- step_number: 1
- total_steps: 2-3
- next_step_required: true
- findings: ""
- relevant_files: [absolute paths to generated test files]
- review_type: "full"
- model: "codex"
- review_validation_type: "external"
- confidence: "exploring"
- files_checked: [test file paths]
Codex Output: Review findings with identified issues (if any)
If Codex CLI Identifies Issues:
** automation_mode check**: [AUTOMATION_MODE: false] โ Interactive / true โ Automated
Main Claude presents findings to user:
Codex CLI check found the following issues:
[Critical] Test file A:line B - Missing boundary condition tests
[Medium] Test file A:line C - Assertions not specific enough
...
Do you approve Codex CLI auto-correcting these issues?
- Yes: Continue corrections
- No: Manual modification
After approval, codex CLI applies corrections (following codex-code-reviewer workflow).
Main Claude reviews issues and decides autonomously (based on automation_mode=true):
Evaluate Issue Severity:
Auto-Decision: Fixable + low risk โ auto-approve + log; Complex/high-risk โ escalate + log
Present Decision to User (Information Only):
Test code issues auto-corrected (automated mode)
[automation_mode=true set by router]
Corrected issues:
- [Critical] Added boundary condition tests
- [Medium] Enhanced assertion descriptions
- [Low] Optimized test naming
Decision basis: automation_mode=true, all issues safely fixable
Recorded to auto_log.md
Continuing to run tests...
Main Claude's Responsibility:
** automation_mode check**: [AUTOMATION_MODE: false] โ Interactive / true โ Automated
Present Results to User:
Gemini CLI has completed test code writing, Codex CLI has verified quality.
Test files: [file paths]
Coverage: [percentage]
Test run results:
Passed: X tests
Failed: Y tests
Skipped: Z tests
[Detailed results]
Are you satisfied? Need adjustments?
- Approve and save
- ๐ Needs adjustment
- Regenerate
Iterate if Needed:
Main Claude Evaluates Test Results Autonomously (based on automation_mode=true):
[COVERAGE_TARGET: X%], default 85%)Auto-Decision: Pass + coverage โฅ target โ auto-save + log; Fail โ analyze: fixable โ retry (max 2ร), source bugs โ report + save, persistent โ escalate
Present Final Result to User (Information Only):
Tests auto-completed (automated mode)
Test files: [file paths]
Test run results:
- Passed: X tests (100%)
- Coverage: 78%
Quality checks:
- All tests passed
- Coverage met target (โฅ coverage_target, e.g. 85%)
- Test structure clear
- Assertions complete
Test files saved
For these documents, strictly follow templates in references/doc_templates/README.md (on-demand template loading):
PROJECTWIKI.md
projectwiki_template.mdCHANGELOG.md
changelog_template.mdADR (Architecture Decision Records)
YYYYMMDD-title.mdplan.md
See references/doc_templates/README.md for template index, then load specific templates as needed.
For general documentation:
Follow patterns from references/test_patterns.md:
Test Organization:
test_<module>.py or <module>_test.py)Coverage Requirements:
Best Practices:
Purpose: Bridge tool to launch and interact with CLI tools (gemini, codex) in WSL environment.
How It Works:
gemini command)Key parameters for launching Gemini CLI:
cli_name: "gemini" (required - launches gemini command in WSL)prompt: The writing request with full context and requirements (required)files: List of relevant files for context - absolute paths (optional)
images: List of image paths for visual context - absolute paths (optional)role: "default", "codereviewer", or "planner" (optional, default: "default")
continuation_id: Reuse to maintain the same gemini CLI session across multiple calls (optional)
Available Roles for Gemini CLI Session:
default: General-purpose writing within CLIplanner: Planning and outlining tasks within CLIcodereviewer: Code-related documentation within CLIExample Flow:
Call 1 with continuation_id=None:
โ Launches: gemini command in WSL
โ Session: New gemini CLI session starts
โ Returns: Outline + continuation_id="abc123"
Call 2 with continuation_id="abc123":
โ Reconnects: To existing gemini CLI session "abc123"
โ Session: Same gemini CLI with previous context
โ Returns: Full document + same continuation_id
Key parameters for test validation:
model: "codex"review_type: "full"review_validation_type: "external"relevant_files: Absolute paths to test filesDocument templates index and on-demand loading guide. Load this reference when:
Then load specific template files as needed:
projectwiki_template.md - PROJECTWIKI.md ๆ ๅๆจกๆฟchangelog_template.md - CHANGELOG.md ๆ ๅๆจกๆฟreadme_template.md, api_doc_template.md, etc.Testing best practices and code patterns. Load when:
User: "Use gemini to write documentation, I need to record the database selection decision ADR"
Main Claude:
OK, I'll coordinate Gemini CLI to write the ADR document for you.
First let me understand some information:
1. What is the background of the database selection?
2. What database options were considered?
3. Which database was ultimately chosen?
4. What were the main decision factors?
[After collecting information...]
Now let Gemini CLI generate ADR outline...
[Call mcp__zen__clink with cli_name="gemini"]
Gemini CLI generated outline as follows:
[Display outline]
Approve?
User: "Yes"
Main Claude:
[Call mcp__zen__clink for complete writing, using continuation_id]
Gemini CLI has completed ADR writing:
File: docs/adr/20251020-select-postgresql.md
[Display content]
Approve to save?
User: "Use gemini to write test file, test src/features.py"
Main Claude:
OK, let me first analyze the code in src/features.py...
[Read code]
Found key functions that need testing:
- create_features()
- validate_data()
- transform_features()
Test framework: pytest
Target coverage: โฅ {coverage_target from context, e.g., 85%}
Now let Gemini CLI write test code...
[Call mcp__zen__clink with cli_name="gemini"]
Test code has been generated. Now let Codex CLI verify quality...
[Call mcp__zen__codereview with model="codex"]
Codex CLI check results:
โ
Complete test coverage
โ
Clear assertions
โ ๏ธ Suggest adding boundary condition tests
Do you approve Codex CLI to automatically add boundary condition tests?
User: "Yes"
Main Claude:
[Codex CLI corrections applied]
Test code has been improved. Now running tests...
[Executing tests]
Test results:
โ
All tests passed
Coverage: 78%
Test file saved: tests/test_features.py
User: "Use gemini to write documentation, record the database selection decision ADR. Automated execution, no confirmation needed"
Router: Sets automation_mode=true (detects "Automated execution, no confirmation needed")
Main Claude (reads automation_mode=true from context):
[automation_mode=true] Automation mode detected, will autonomously approve and complete the document.
First, let me understand some information:
1. What is the background of the database selection?
2. What database options were considered?
3. What database was finally selected?
4. What were the main decision factors?
[After collecting information...]
Generating ADR outline...
[Calling mcp__zen__clink with cli_name="gemini"]
โ
Outline automatically approved (automation mode)
Outline summary:
1. Background and Problem Statement
2. Decision Drivers
3. Considered Options (PostgreSQL, MongoDB, MySQL)
4. Decision Outcome
5. Implementation Plan
6. Validation Method
Approval reasons:
- Complete structure (complies with MADR template)
- Covers all requirements
- Meets standards
Continuing to write complete document...
[Calling mcp__zen__clink with continuation_id]
โ
Document automatically completed and saved (automation mode)
Document type: ADR
File path: docs/adr/20251020-select-postgresql.md
Quality check:
- Complete structure (all MADR sections)
- Complies with CLAUDE.md standards
- Correct format
- No broken links
Document summary:
- Decision: Selected PostgreSQL
- Rationale: Excellent performance, complete features, team has experience
- Impact: Query performance improved 3-5x, requires 1-2 weeks migration
CHANGELOG.md automatically updated
ADR writing completed!
User: "Use gemini to write test file, test src/features.py, complete automatically"
Router: Sets automation_mode=true (detects "complete automatically")
Main Claude (reads automation_mode=true from context):
[automation_mode=true] Automation mode detected, will autonomously complete test code writing.
Analyzing code...
[Reading code]
Key functions to be tested identified:
- create_features()
- validate_data()
- transform_features()
Test framework: pytest
Target coverage: โฅ {coverage_target from context, e.g., 85%}
Generating test code...
[Calling mcp__zen__clink with cli_name="gemini"]
Conducting quality verification...
[Calling mcp__zen__codereview with model="codex"]
Codex CLI found 3 improvement points:
- [Medium] Suggest adding boundary condition tests
- [Low] Optimize test naming
- [Low] Add explanatory comments
โ
Test code issues automatically corrected (automation mode)
Corrected issues:
- [Medium] Added boundary condition tests (empty list, None, extreme values)
- [Low] Optimized test naming (more descriptive)
- [Low] Added comments for complex logic
Running tests...
[Executing pytest --cov=src tests/]
โ
Testing automatically completed (automation mode)
Test file: tests/test_features.py
Test execution results:
- Passed: 15 tests (100%)
- Coverage: 82%
Quality check:
- All tests passed
- Coverage meets target (โฅ coverage_target, e.g., 85%)
- Clear test structure (AAA pattern)
- Complete assertions (with error messages)
- Correct Mock usage
Detailed results:
- test_create_features_normal:
- test_create_features_empty_input:
- test_create_features_none_input:
- test_validate_data_valid:
- test_validate_data_invalid:
- test_transform_features_basic:
- ... (Total 15 tests)
Test file saved, test code writing completed!
gemini and codex commands) in WSL environment** CRITICAL - automation_mode & auto_log Management:**
CRITICAL - auto_log.md Generation (auto_log - READ FROM SSOT):
auto_log mechanism and template: See CLAUDE.mdใ๐ ๅ
ฑไบซๆฆๅฟต้ๆฅใand skills/shared/auto_log_template.md
This skill's role: Generate complete auto_log.md from router-collected fragments (when automation_mode=true and task complete)