--- name: qiaomu-writer description: Content creation skill with web search, Qiaomu writing style, and AI-generated images. Use when user requests to write articles with specific style requirements, needs to research topics before writing, or wants automated image generation for articles. Triggers include phrases like "联网搜索...写一篇文章", "用乔木风格写", "写文章并配图". Also handles self-improving mode when user says "提取写作规则", "我改了这篇文章", "更新写作风格". Automatically handles entire workflow from research to final article with images. --- # Qiaomu Writer Fully automated content creation workflow that produces complete articles in Qiaomu's distinctive style with strategically placed images. **Self-Improving**: Writing rules auto-accumulate from your edits. The style gets better every time you revise an AI draft. ## Core Philosophy **One-Step Execution**: User says "write article with images" → Skill delivers complete article saved to disk. **Failure Resilience**: Image generation failures never block article delivery. If MCP fails, save text-only article and report issue. **Zero User Intervention**: Complete all steps automatically unless user explicitly interrupts. **Self-Improving Loop**: AI draft → You edit → Extract rules → Rules written back to skill → Next draft is more accurate. ## Workflow ``` User Request │ ├─ Research (conditional) → WebSearch │ ├─ Write article → Apply Qiaomu style │ ├─ Plan images → Read image guide, generate prompts │ ├─ Generate images → Call MCP (with error handling) │ ├─ Assemble article → Insert images at strategic positions │ └─ Save to disk → ~/乔木新知识库/10-19 创作/11 公众号-向阳乔木推荐看/YYYY-MM-DD-[slug].md ``` ## Step-by-Step Process ### Step 1: Research (Conditional) **When to execute:** - User provides topic/keyword only - User explicitly requests "联网搜索" **When to skip:** - User provides raw content to rewrite - User says "不用搜索" **Action:** ``` Use WebSearch tool with: - Query: Expand user's topic into 2-3 search queries - Focus: Latest information, diverse perspectives - Limit: Top 10 results sufficient ``` ### Step 2: Write Article **Read style guide and anti-tropes first:** ``` Read /Users/joe/.claude/skills/qiaomu-writer/references/writing-style.md Read /Users/joe/.claude/skills/qiaomu-writer/references/tropes.md ``` **Writing requirements:** 1. **Qiaomu style characteristics:** - Conversational tone with "你" (direct address) - Short paragraphs with visual breathing room - **Bold** for key points - Life analogies for complex concepts - Avoid AI-ish phrases like "不是...而是..." - Use Chinese commas (,) not dashes 2. **Structure:** - Opening hook (1-2 short paragraphs with question) - 3-5 main sections with clear headings - Conclusion that echoes opening theme 3. **Length:** - User specifies: Follow user's requirement (e.g., 2000-3000 characters) - No specification: Aim for 1500-2500 characters 4. **Technical accuracy:** Ensure all facts from research are accurate **IMPORTANT:** Keep article text in memory, do NOT save yet (images need to be inserted first). ### Step 3: Plan Image Strategy **Read image guide first:** ``` Read /Users/joe/.claude/skills/qiaomu-writer/references/image-prompting.md ``` **Selection criteria:** - Opening section: Always include (sets visual tone) - Core argument sections: 2-3 images (reinforces key points) - Conclusion: Optional (echoes opening) - Total: 3-5 images maximum (adjust based on article length) **For each selected section:** 1. **Extract core concept** (one concept, not all details) 2. **Choose visual style** based on article type: - Tech analysis → "赛博朋克" or "商务简约" - Product review → "小清新" or "公众号封面" - Opinion piece → "水彩插画" or "国潮风格" - Tutorial/guide → "商务简约" or "小清新" 3. **Construct prompt:** ``` [seedream模板名称],主题:[核心概念],[2-3个视觉元素],[色调/氛围] ``` 4. **Record metadata:** - Section heading (where to insert) - Position (after heading) - Seedream prompt - Image description (5-10 characters for alt text) ### Step 4: Generate Images with Error Handling **IMPORTANT**: If user said "不需要配图" or "不用配图", skip this step entirely. **For each image prompt:** ```python # Pseudocode for error handling for each image_prompt in image_prompts: try: image = mcp__seedream__seedream_text_to_image( prompt=image_prompt, size="2K", watermark=false, auto_save=true ) if image.url: collected_images.append({ "section": section_name, "url": image.url, "alt": alt_text }) else: # Image generation returned no URL, skip log_warning(f"Image {i} generation returned no URL") continue except Exception as e: # MCP call failed, skip this image log_warning(f"Image {i} generation failed: {e}") continue # Continue regardless of success/failure count ``` **Failure handling rules:** - If ALL images fail: Continue with text-only article - If SOME images fail: Use successful ones - Never abort article due to image issues - Report image failures to user at the end **Collect results:** - Seven Niu cloud URLs (preferred for Markdown) - Or local paths as fallback ### Step 5: Assemble Article **Image insertion logic:** For each successfully generated image: 1. Find the corresponding section heading in article text 2. Insert image immediately after the heading 3. Use format: `![alt_text](image_url)` 4. Add blank line before and after image for readability **Example:** ```markdown ## 人机协作的新范式 ![人机协作](https://newimg.t5t6.com/seedream/...) 你有没有想过,AI工具真正改变的不是你的工作方式... ``` **If no images were generated:** - Use original article text as-is - Add note in completion report that images were skipped ### Step 6: Save Article **File path generation:** ``` ~/乔木新知识库/10-19 创作/11 公众号-向阳乔木推荐看/YYYY-MM-DD-[topic-slug].md ``` **Filename rules:** - Use actual current date (YYYY-MM-DD) - Topic slug: Pinyin or English, simplified (max 30 chars) - Examples: - `2025-11-18-storytelling-skills.md` - `2025-11-18-ai-programming-tools.md` **Create directory if not exists:** ```bash mkdir -p ~/乔木新知识库/10-19 创作/11 公众号-向阳乔木推荐看 ``` **Save action:** ``` Use Write tool to save the complete article (with or without images) ``` ### Step 7: Report Completion and Open Article **Success report format:** ```markdown ✅ 文章已生成并保存 **文件位置**: ~/乔木新知识库/10-19 创作/11 公众号-向阳乔木推荐看/YYYY-MM-DD-[slug].md **字数**: [count] 字 **配图**: [n] 张图片已插入 [If some images failed:] ⚠️ 图片生成: [success_count]/[total_count] 成功 - 第[x]张图片生成失败(已跳过) 📄 文章预览: [Show first 200 characters of article] 📖 已在Obsidian中打开文章 ``` **Open in Obsidian:** ```bash # 自动在Obsidian中打开生成的文章 open "obsidian://open?vault=乔木新知识库&file=10-19 创作/11 公众号-向阳乔木推荐看/YYYY-MM-DD-[slug]" ``` **路径说明**: - 文件保存在知识库的创作区,Obsidian 可直接打开 ## Usage Examples ### Example 1: Full Workflow with Images **User:** "联网搜索AI编程工具的发展趋势,然后用乔木风格写一篇文章,并配图" **Execution:** 1. WebSearch: "AI编程工具 2025", "GitHub Copilot vs Cursor", "AI代码助手 趋势" 2. Write 1800-character article in Qiaomu style 3. Plan 4 image positions 4. Generate prompts and call MCP for each 5. Successfully generate 3/4 images (one fails, continue) 6. Insert 3 images into article 7. Save to `~/乔木新知识库/10-19 创作/11 公众号-向阳乔木推荐看/2025-11-18-ai-programming-trends.md` 8. Report: "✅ 文章已生成,3/4张图片成功" ### Example 2: Content Rewrite with Images **User:** "把这段内容用乔木风格改写成文章并配图:[text]" **Execution:** 1. Skip search (content provided) 2. Rewrite in Qiaomu style 3. Plan 2 image positions 4. Generate and insert images 5. Save article ### Example 3: No Images Requested **User:** "用乔木风格写一篇关于工作流优化的文章,不需要配图" **Execution:** 1. Research topic 2. Write article 3. Skip image generation entirely 4. Save text-only article ### Example 4: All Images Fail (Graceful Degradation) **User:** "写一篇关于Rust编程的文章并配图" **Execution:** 1. Research + Write article 2. Plan 3 images 3. MCP calls all fail (network issue, quota exceeded, etc.) 4. Continue without images 5. Save text-only article 6. Report: "✅ 文章已生成(图片生成失败,已保存纯文本版)" ## Error Handling Principles ### When MCP Tools Unavailable ``` If mcp__seedream__* tools not found: 1. Log warning 2. Continue with text-only article 3. Report MCP unavailability in completion message ``` ### When Individual Image Generation Fails ``` For each image failure: 1. Catch exception 2. Log which image failed and why 3. Continue to next image 4. Never abort article generation ``` ### When All Images Fail ``` If all image generations fail: 1. Save text-only article 2. Report image failure count 3. Suggest checking MCP configuration 4. Still mark task as "successful" (article delivered) ``` ## Quality Standards ### Content Quality - Engaging opening that hooks reader - Clear logical flow between sections - Concrete examples over abstract theory - Natural conversational tone - No AI clichés or formulaic expressions ### Image Quality - Prompts are specific and actionable - Visual style matches article tone - Placement enhances reading flow - Not too many images (avoid distraction) - Each image serves a clear purpose ### Reliability - Never abort due to image failures - Always deliver complete article - Clear error reporting - Predictable file paths ## Important Notes - **Full automation**: Execute all steps without user confirmation - **Error resilience**: Image failures never block article delivery - **User experience first**: Completed article is the priority, images are enhancement - **Clear reporting**: Always tell user what succeeded and what failed ## Self-Improving Mode **Trigger phrases**: "提取写作规则", "我改了这篇文章", "更新写作风格", "帮我从这次修改中提取规则" **When to use**: After you edit an AI-generated article to your satisfaction, feed both versions back to extract style rules. Rules accumulate automatically in `writing-style.md` — zero manual writing. ### Workflow ``` Step 1: Get both files - AI draft: the file Claude saved originally - Revised: your edited version (or paste the content) Step 2: Run diff + extract rules bash /Users/joe/.claude/skills/qiaomu-writer/scripts/extract-style-rules.sh → Generates a Claude prompt with the diff embedded Step 3: Paste that prompt to Claude → Claude analyzes what you changed and extracts reusable rules Step 4: Review extracted rules → You decide which rules are worth keeping (takes 30 seconds) Step 5: Append approved rules to writing-style.md → Claude appends to: references/writing-style.md ``` ### Rule format (auto-generated) ```markdown ## 自动积累的规则(YYYY-MM-DD) ### 规则 N:[规则标题] - **现象**:AI 写了什么(坏的) - **修改**:乔帮主改成了什么(好的) - **原则**:从这次修改提炼的通用规则 ``` ### Manual shortcut (in-conversation) If you paste an AI draft + your revision directly in chat, Claude can extract rules inline without the script: > "这是AI初稿和我的修改版,帮我提取写作规则追加到 writing-style.md" ### Stats tracking After appending rules, report: - Total rules in writing-style.md (count `### 规则` headers) - Rules added this session - Date of last update --- ## References - `references/writing-style.md` - Qiaomu style guide (auto-accumulates rules over time) - `references/tropes.md` - AI writing anti-tropes checklist (30+ patterns to avoid) - `references/image-prompting.md` - Image strategy and prompt engineering - `scripts/extract-style-rules.sh` - Self-improving: diff two article versions → extract rules