$npx -y skills add PHY041/claude-agent-skills --skill xhs-image-genGenerate Xiaohongshu (小红书) carousel images (3:4, 1080x1440) from structured content. Creates professional slide decks with Chinese typography and proper XHS formatting. Triggers on "做小红书图", "xhs images", "generate xhs slides", "小红书配图", "carousel images", or any XHS image generati
| 1 | # XHS Image Generator Skill |
| 2 | |
| 3 | Generate professional Xiaohongshu carousel images from structured content JSON. Outputs 3:4 vertical PNGs (1080x1440) with Chinese typography, ready for upload. |
| 4 | |
| 5 | --- |
| 6 | |
| 7 | ## Setup |
| 8 | |
| 9 | **Clone the skill:** |
| 10 | ```bash |
| 11 | git clone https://github.com/PHY041/claude-agent-skills |
| 12 | cd claude-agent-skills/skills/xhs-image-gen |
| 13 | python3 -m venv venv |
| 14 | venv/bin/pip install -r requirements.txt |
| 15 | ``` |
| 16 | |
| 17 | **Optional — AI cover generation (uses fal.ai):** |
| 18 | ```bash |
| 19 | export FAL_API_KEY="your_fal_api_key" |
| 20 | ``` |
| 21 | |
| 22 | --- |
| 23 | |
| 24 | ## Quick Start |
| 25 | |
| 26 | ```bash |
| 27 | # Template-only (fast, free) |
| 28 | venv/bin/python3 generate.py content.json --output /tmp/xhs-output/ |
| 29 | |
| 30 | # AI cover + template content (recommended) |
| 31 | FAL_API_KEY="..." venv/bin/python3 generate.py content.json --ai-cover --output /tmp/xhs-output/ |
| 32 | ``` |
| 33 | |
| 34 | --- |
| 35 | |
| 36 | ## Workflow |
| 37 | |
| 38 | ### Step 1: Understand the Topic |
| 39 | |
| 40 | When user asks to create XHS content for topic X: |
| 41 | 1. Understand the topic and target audience |
| 42 | 2. Plan 4-6 slides (cover + 2-4 content + summary) |
| 43 | 3. Choose appropriate template |
| 44 | |
| 45 | ### Step 2: Decide on Cover Style |
| 46 | |
| 47 | | Mode | Flag | When to Use | |
| 48 | |------|------|-------------| |
| 49 | | **Gradient cover** (default) | _(none)_ | Clean, fast, no API cost | |
| 50 | | **AI cover** | `--ai-cover` | Eye-catching background via fal.ai | |
| 51 | |
| 52 | AI cover uses flux/schnell to generate an atmospheric background, applies a dark gradient overlay, and renders white text on top. Content slides always use templates (no AI). Cost: ~$0.003 per cover. |
| 53 | |
| 54 | ### Step 3: Generate Content JSON |
| 55 | |
| 56 | ```json |
| 57 | { |
| 58 | "template": "tutorial", |
| 59 | "ai_cover": true, |
| 60 | "slides": [ |
| 61 | { |
| 62 | "type": "cover", |
| 63 | "title": "大标题(简短有力)", |
| 64 | "subtitle": "副标题(补充说明)", |
| 65 | "tag": "分类标签", |
| 66 | "author": "@your_handle", |
| 67 | "ai_prompt": "optional: custom fal.ai prompt for background" |
| 68 | }, |
| 69 | { |
| 70 | "type": "content", |
| 71 | "title": "第一个要点", |
| 72 | "number": 1, |
| 73 | "body": "详细说明\n用换行分段\n每段1-2句话", |
| 74 | "highlight": "可选:重点提示框内容" |
| 75 | }, |
| 76 | { |
| 77 | "type": "list", |
| 78 | "title": "清单/工具列表", |
| 79 | "items": [ |
| 80 | "第一项 — 简短说明", |
| 81 | "第二项 — 简短说明", |
| 82 | "第三项 — 简短说明" |
| 83 | ] |
| 84 | }, |
| 85 | { |
| 86 | "type": "summary", |
| 87 | "title": "总结", |
| 88 | "points": [ |
| 89 | "核心收获一", |
| 90 | "核心收获二", |
| 91 | "核心收获三" |
| 92 | ], |
| 93 | "cta": "关注我获取更多干货" |
| 94 | } |
| 95 | ] |
| 96 | } |
| 97 | ``` |
| 98 | |
| 99 | ### Step 4: Generate Images |
| 100 | |
| 101 | ```bash |
| 102 | cat > /tmp/xhs-content.json << 'EOF' |
| 103 | {... your JSON here ...} |
| 104 | EOF |
| 105 | |
| 106 | venv/bin/python3 generate.py /tmp/xhs-content.json --output /tmp/xhs-output/ |
| 107 | ``` |
| 108 | |
| 109 | ### Step 5: Present to User |
| 110 | |
| 111 | Show the generated images for review. If approved, they're ready for manual upload to Xiaohongshu. |
| 112 | |
| 113 | --- |
| 114 | |
| 115 | ## Available Templates |
| 116 | |
| 117 | | Template | Style | Best For | |
| 118 | |----------|-------|----------| |
| 119 | | `tutorial` | White bg, blue accent | How-to, tutorials, step-by-step | |
| 120 | | `dark` | Dark bg, soft blue accent | Tech, dev tools, coding | |
| 121 | | `warm` | Cream bg, amber accent | Lifestyle, personal stories | |
| 122 | | `nature` | Light green bg, green accent | Wellness, growth, nature | |
| 123 | | `coral` | Light pink bg, red accent | Alerts, hot takes, comparisons | |
| 124 | |
| 125 | Select with `--template dark` or set `"template": "dark"` in JSON. |
| 126 | |
| 127 | ### Custom Accent Color |
| 128 | |
| 129 | Override with `"accent_color": "#FF6B6B"` in the JSON root. |
| 130 | |
| 131 | --- |
| 132 | |
| 133 | ## Content Rules (CRITICAL) |
| 134 | |
| 135 | ### Slide Count |
| 136 | - **Minimum 3 slides** (cover + 1 content + summary) |
| 137 | - **Optimal 4-6 slides** (XHS algorithm favors multi-image carousels) |
| 138 | - **Maximum 9 slides** (beyond this, completion rate drops) |
| 139 | |
| 140 | ### Text Length Per Slide |
| 141 | - **Title:** 6-12 characters (Chinese) — must be scannable |
| 142 | - **Body:** 4-6 lines max per slide — don't cram |
| 143 | - **List items:** 8 max per slide |
| 144 | - **CTA:** Under 12 characters |
| 145 | |
| 146 | ### Language & Tone |
| 147 | - Write in Chinese (simplified) |
| 148 | - 朋友分享 tone — like telling a friend, not marketing |
| 149 | - Short sentences, line breaks between ideas |
| 150 | - Concrete numbers > vague claims ("省90%时间" > "节省大量时间") |
| 151 | |
| 152 | ### What NOT to Do |
| 153 | - No English-only slides (mixed OK, pure English bad for XHS) |
| 154 | - No walls of text (if body > 6 lines, split into 2 slides) |
| 155 | - No generic AI-sounding language |
| 156 | - No hype words: 颠覆、革命性、10倍、全网最强 |
| 157 | |
| 158 | --- |
| 159 | |
| 160 | ## CLI Options |
| 161 | |
| 162 | ``` |
| 163 | generate.py <content.json> [--template NAME] [--output DIR] [--ai-cover] |
| 164 | generate.py --list-templates |
| 165 | ``` |
| 166 | |
| 167 | | Flag | Effect | |
| 168 | |------|--------| |
| 169 | | `--ai-cover` | Generate fal.ai background for cover slide | |
| 170 | | `--template` | Template preset (tutorial, dark, warm, nature, coral) | |
| 171 | | `--output` | Output directory (default: ./outp |