# Tweet Style Importer

Automatically scrape any X/Twitter tweet and its images, assign the next sequential...

- Repository: https://github.com/yang0/handraw-style (6861 stars)
- Category: Media
- License: see repository
- Last updated: 2026-10-28
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add yang0/handraw-style --skill tweet-style-importer -g -a claude-code -y`
Codex: `npx skills add yang0/handraw-style --skill tweet-style-importer -g -a codex -y`
Cursor: `npx skills add yang0/handraw-style --skill tweet-style-importer -g -a cursor -y`
Gemini CLI: `npx skills add yang0/handraw-style --skill tweet-style-importer -g -a gemini-cli -y`

## Description

Automatically scrape any X/Twitter tweet and its images, assign the next sequential style number, generate a 1024x1024 4-grid generation reference and a 16-grid gallery contact sheet without number badges, register the style, set mandatory image passing, and rebuild the gallery.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Tweet Style Importer (推文画风自动入库 Skill)

本 Skill 用于将 X (Twitter) 上的 AI 生图风格推文（如 Midjourney `--sref` 风格、艺术家作品图集等）一键自动抓取、处理并标准化入库到手绘风格库中。

---

## 核心自动化工作流

当用户提供一个推文链接（例如 `https://x.com/.../status/...`）并要求入库时，执行以下 6 步标准流程：

```
[1. 抓取推文与高清原图]
       ↓
[2. 计算下一位顺延编号 (如 #217)]
       ↓
[3. 生成双轨图像资源]
   ├── 生图参考图：多图时为 1024×1024 四宫格；仅一张原图时直接使用单图
   ├── 风格单图：512×512 纯净风格代表图，严禁压印任何数字编号、作者Handle或角标框 (201-400/217.webp)
   └── 画廊展板：1254×1254 16 宫格画板（#201, 216 使用 G；#217 起使用 H，单图以纯净画面进入展板，不压印角标）
       ↓
[4. 风格库元数据入库 (styles_200_reorganized.md)]
       ↓
[5. 模型能力策略配置 (model_capabilities.json)]
   └── 强制启用传图规则：name_activation=none, traits_activation=none
       ↓
[6. 重建画廊并运行全量校验 (build_library.py & validate_library.py)]
```

---

## 一键执行命令

在工作区直接运行自动化脚本即可完成全流程：

```powershell
# 标准一键执行
python scripts/import_tweet_style.py "https://x.com/username/status/..."

# 支持可选的自定义英文风格名与中文特征描述
python scripts/import_tweet_style.py "https://x.com/username/status/..." --name "Custom Style Name" --traits "核心特征描述"
```

---

## 各步骤规范与产出标准

### 1. 抓取推文与高清原图
- 在发起网络请求前，先按 X/Twitter 状态 ID 检查 `downloads/tweet_{id}/tweet.json`；已抓取的推文直接停止，不下载图片、不分配新编号、不改动风格库或画廊。
- 自动解析推文作者（名称与 Handle）、推文正文、Midjourney `--sref` 风格代码。
- 自动提取全部原图（强制替换为 `?name=orig` 高清尺寸）。
- 数据保存在 `downloads/tweet_{id}/`（包含 `tweet.json` 及原始图片）。
- 成功入库后写入 `import.json`，记录状态 ID、原始链接、风格编号与导入时间；重复输入时会返回已入库编号。没有 `import.json` 的历史下载仅提示“已抓取但未完成登记”，同样不会重复抓取。

The rest: https://github.com/yang0/handraw-style/blob/HEAD/skills/tweet-style-importer/SKILL.md
