agentsclimarketplace

Xhs image gen

Skill PHY041/claude-agent-skills/skills/xhs-image-gen

Collection of Claude Code Agent Skills for founders, indie hackers, and growth engineers

Install
npx -y skills add PHY041/claude-agent-skills --skill xhs-image-gen

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 18 stars18 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Generate 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 generation request.

SKILL.md

5.6 KB, as published. Nobody here has run it

XHS Image Generator Skill

Generate professional Xiaohongshu carousel images from structured content JSON. Outputs 3:4 vertical PNGs (1080x1440) with Chinese typography, ready for upload.


Setup

Clone the skill:

git clone https://github.com/PHY041/claude-agent-skills
cd claude-agent-skills/skills/xhs-image-gen
python3 -m venv venv
venv/bin/pip install -r requirements.txt

Optional — AI cover generation (uses fal.ai):

export FAL_API_KEY="your_fal_api_key"

Quick Start

# Template-only (fast, free)
venv/bin/python3 generate.py content.json --output /tmp/xhs-output/

# AI cover + template content (recommended)
FAL_API_KEY="..." venv/bin/python3 generate.py content.json --ai-cover --output /tmp/xhs-output/

Workflow

Step 1: Understand the Topic

When user asks to create XHS content for topic X:

  1. Understand the topic and target audience
  2. Plan 4-6 slides (cover + 2-4 content + summary)
  3. Choose appropriate template

Step 2: Decide on Cover Style

ModeFlagWhen to Use
Gradient cover (default)(none)Clean, fast, no API cost
AI cover--ai-coverEye-catching background via fal.ai

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.

Step 3: Generate Content JSON

{
  "template": "tutorial",
  "ai_cover": true,
  "slides": [
    {
      "type": "cover",
      "title": "大标题(简短有力)",
      "subtitle": "副标题(补充说明)",
      "tag": "分类标签",
      "author": "@your_handle",
      "ai_prompt": "optional: custom fal.ai prompt for background"
    },
    {
      "type": "content",
      "title": "第一个要点",
      "number": 1,
      "body": "详细说明\n用换行分段\n每段1-2句话",
      "highlight": "可选:重点提示框内容"
    },
    {
      "type": "list",
      "title": "清单/工具列表",
      "items": [
        "第一项 — 简短说明",
        "第二项 — 简短说明",
        "第三项 — 简短说明"
      ]
    },
    {
      "type": "summary",
      "title": "总结",
      "points": [
        "核心收获一",
        "核心收获二",
        "核心收获三"
      ],
      "cta": "关注我获取更多干货"
    }
  ]
}

Step 4: Generate Images

cat > /tmp/xhs-content.json << 'EOF'
{... your JSON here ...}
EOF

venv/bin/python3 generate.py /tmp/xhs-content.json --output /tmp/xhs-output/

Step 5: Present to User

Show the generated images for review. If approved, they're ready for manual upload to Xiaohongshu.


Available Templates

TemplateStyleBest For
tutorialWhite bg, blue accentHow-to, tutorials, step-by-step
darkDark bg, soft blue accentTech, dev tools, coding
warmCream bg, amber accentLifestyle, personal stories
natureLight green bg, green accentWellness, growth, nature
coralLight pink bg, red accentAlerts, hot takes, comparisons

Select with --template dark or set "template": "dark" in JSON.

Custom Accent Color

Override with "accent_color": "#FF6B6B" in the JSON root.


Content Rules (CRITICAL)

Slide Count

  • Minimum 3 slides (cover + 1 content + summary)
  • Optimal 4-6 slides (XHS algorithm favors multi-image carousels)
  • Maximum 9 slides (beyond this, completion rate drops)

Text Length Per Slide

  • Title: 6-12 characters (Chinese) — must be scannable
  • Body: 4-6 lines max per slide — don't cram
  • List items: 8 max per slide
  • CTA: Under 12 characters

Language & Tone

  • Write in Chinese (simplified)
  • 朋友分享 tone — like telling a friend, not marketing
  • Short sentences, line breaks between ideas
  • Concrete numbers > vague claims ("省90%时间" > "节省大量时间")

What NOT to Do

  • No English-only slides (mixed OK, pure English bad for XHS)
  • No walls of text (if body > 6 lines, split into 2 slides)
  • No generic AI-sounding language
  • No hype words: 颠覆、革命性、10倍、全网最强

CLI Options

generate.py <content.json> [--template NAME] [--output DIR] [--ai-cover]
generate.py --list-templates
FlagEffect
--ai-coverGenerate fal.ai background for cover slide
--templateTemplate preset (tutorial, dark, warm, nature, coral)
--outputOutput directory (default: ./output)

AI cover also activatable via JSON: set "ai_cover": true in the root object.

Output

  • Files named slide-01-cover.png, slide-02-content.png, etc.
  • All 1080x1440px (3:4 vertical)
  • PNG format, ready for XHS upload

Example

Test with the bundled example:

venv/bin/python3 generate.py example.json --output /tmp/xhs-test/
open /tmp/xhs-test/  # Preview on macOS

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.