@justin_666/square-couplets-master-skills 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +54 -0
- package/README.md +297 -0
- package/bin/doufang-skills.js +171 -0
- package/package.json +67 -0
- package/skills/generate-doufang-image/SKILL.md +171 -0
- package/skills/generate-doufang-prompt/SKILL.md +108 -0
- package/skills/optimize-doufang-prompt/SKILL.md +154 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
**Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License**
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Justin
|
|
4
|
+
|
|
5
|
+
本作品採用**創用 CC 姓名標示-非商業性-相同方式分享 4.0 國際版**授權條款進行授權。
|
|
6
|
+
|
|
7
|
+
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
|
|
8
|
+
|
|
9
|
+
要查看本授權條款的副本,請造訪:
|
|
10
|
+
To view a copy of this license, visit:
|
|
11
|
+
https://creativecommons.org/licenses/by-nc-sa/4.0/
|
|
12
|
+
|
|
13
|
+
或者寄信至:
|
|
14
|
+
Or send a letter to:
|
|
15
|
+
Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
### 個人使用授權 (Personal Use License)
|
|
20
|
+
|
|
21
|
+
**您可以自由地:**
|
|
22
|
+
You are free to:
|
|
23
|
+
|
|
24
|
+
* **分享** — 在任何媒介以任何形式複製、發行本作品
|
|
25
|
+
Share — copy and redistribute the material in any medium or format
|
|
26
|
+
* **衍生** — 修改、轉換或依本作品進行創作
|
|
27
|
+
Adapt — remix, transform, and build upon the material
|
|
28
|
+
|
|
29
|
+
**惟需遵守下列條件:**
|
|
30
|
+
Under the following terms:
|
|
31
|
+
|
|
32
|
+
* **姓名標示** — 您必須給予適當的署名,並提供本授權條款的連結
|
|
33
|
+
Attribution — You must give appropriate credit and provide a link to the license
|
|
34
|
+
* **非商業性** — 您不得將本作品用於商業目的
|
|
35
|
+
NonCommercial — You may not use the material for commercial purposes
|
|
36
|
+
* **相同方式分享** — 如果您改變、轉變或依據本作品進行創作,您必須採用與原先授權條款相同的授權方式來散布您的貢獻
|
|
37
|
+
ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### 商業授權 (Commercial License)
|
|
42
|
+
|
|
43
|
+
如需將本專案用於商業目的,請聯繫作者以取得商業授權:
|
|
44
|
+
For commercial use, please contact the author for a commercial license:
|
|
45
|
+
|
|
46
|
+
* **GitHub:** https://github.com/poirotw66
|
|
47
|
+
* **Project Issues:** https://github.com/poirotw66/Square_Couplets_Master
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### 免責聲明 (Disclaimer)
|
|
52
|
+
|
|
53
|
+
本軟體按「現狀」提供,不提供任何形式的明示或暗示擔保。
|
|
54
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
|
package/README.md
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
# 春聯斗方大師 (Square Couplets Master)
|
|
2
|
+
|
|
3
|
+
一個使用 Google Gemini AI 生成傳統春聯斗方藝術作品的應用程式。將您的願望轉化為精美的書法藝術作品。
|
|
4
|
+
|
|
5
|
+
View your app in AI Studio: https://ai.studio/apps/drive/134htDa_3SXqpM65lyE57_S7pY5DiemK4
|
|
6
|
+
|
|
7
|
+
## ✨ 功能特色
|
|
8
|
+
|
|
9
|
+
- 🎨 **AI 生成春聯斗方**:輸入關鍵字,自動生成傳統風格的春聯藝術作品
|
|
10
|
+
- 🖼️ **參考圖片支持**:上傳參考圖片,AI 會參考其風格生成作品
|
|
11
|
+
- 📐 **多種解析度**:支持 1K、2K、4K 解析度輸出
|
|
12
|
+
- 🎭 **雙模型選擇**:Gemini 2.5 Flash(快速)和 Gemini 3 Pro(高品質)
|
|
13
|
+
|
|
14
|
+
## 🚀 快速開始
|
|
15
|
+
|
|
16
|
+
### 前置需求
|
|
17
|
+
|
|
18
|
+
- Node.js (建議使用最新 LTS 版本)
|
|
19
|
+
|
|
20
|
+
### 安裝步驟
|
|
21
|
+
|
|
22
|
+
1. **安裝依賴套件:**
|
|
23
|
+
```bash
|
|
24
|
+
npm install
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
2. **設置 API Key:**
|
|
28
|
+
- 在 [.env.local](.env.local) 文件中設置 `GEMINI_API_KEY` 為您的 Gemini API key
|
|
29
|
+
- 或者直接在應用程式的設置中輸入 API key
|
|
30
|
+
|
|
31
|
+
3. **運行應用程式:**
|
|
32
|
+
```bash
|
|
33
|
+
npm run dev
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
4. **打開瀏覽器:**
|
|
37
|
+
- 訪問 `http://localhost:5173`(或終端顯示的地址)
|
|
38
|
+
|
|
39
|
+
## 🌐 部署到 GitHub Pages
|
|
40
|
+
|
|
41
|
+
本專案已配置自動部署到 GitHub Pages。當您推送代碼到 `main` 或 `master` 分支時,GitHub Actions 會自動構建並部署應用程式。
|
|
42
|
+
|
|
43
|
+
### 部署步驟
|
|
44
|
+
|
|
45
|
+
1. **啟用 GitHub Pages:**
|
|
46
|
+
- 前往 GitHub 倉庫的 Settings
|
|
47
|
+
- 點擊左側的 "Pages"
|
|
48
|
+
- 在 "Source" 部分選擇 "GitHub Actions"
|
|
49
|
+
|
|
50
|
+
2. **推送代碼:**
|
|
51
|
+
```bash
|
|
52
|
+
git add .
|
|
53
|
+
git commit -m "Deploy to GitHub Pages"
|
|
54
|
+
git push origin main
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
3. **查看部署狀態:**
|
|
58
|
+
- 前往倉庫的 "Actions" 標籤頁
|
|
59
|
+
- 查看部署工作流程的執行狀態
|
|
60
|
+
|
|
61
|
+
4. **訪問部署的應用:**
|
|
62
|
+
- 部署完成後,應用將在以下地址可用:
|
|
63
|
+
- `https://[您的用戶名].github.io/Square_Couplets_Master/`
|
|
64
|
+
|
|
65
|
+
### 手動觸發部署
|
|
66
|
+
|
|
67
|
+
如果需要手動觸發部署,可以:
|
|
68
|
+
- 前往 "Actions" 標籤頁
|
|
69
|
+
- 選擇 "Deploy to GitHub Pages" 工作流程
|
|
70
|
+
- 點擊 "Run workflow" 按鈕
|
|
71
|
+
|
|
72
|
+
## 💡 使用建議
|
|
73
|
+
|
|
74
|
+
### ⭐ 推薦使用 Gemini 3 Pro 模型以獲得最佳體驗
|
|
75
|
+
|
|
76
|
+
**為什麼選擇 Gemini 3 Pro?**
|
|
77
|
+
|
|
78
|
+
- ✨ **更高品質**:生成的圖片具有更豐富的細節和更精緻的視覺效果
|
|
79
|
+
- 🎨 **更好的風格理解**:對參考圖片的風格理解更準確,生成的作品更貼近您的期望
|
|
80
|
+
- 📐 **支持高解析度**:支持 2K 和 4K 解析度,適合打印和高品質展示
|
|
81
|
+
- 🎯 **更精確的構圖**:對傳統書法和藝術風格的把握更準確
|
|
82
|
+
|
|
83
|
+
**模型對比:**
|
|
84
|
+
|
|
85
|
+
| 特性 | Gemini 2.5 Flash | Gemini 3 Pro |
|
|
86
|
+
|------|-----------------|--------------|
|
|
87
|
+
| 生成速度 | ⚡ 快速 | 🐢 較慢 |
|
|
88
|
+
| 圖片品質 | ✅ 良好 | ⭐ 優秀 |
|
|
89
|
+
| 解析度支持 | 1K 僅 | 1K / 2K / 4K |
|
|
90
|
+
| 風格理解 | ✅ 良好 | ⭐ 優秀 |
|
|
91
|
+
| 推薦用途 | 快速測試、迭代 | 最終作品、打印 |
|
|
92
|
+
|
|
93
|
+
**注意:** Gemini 3 Pro 需要付費 API Key(已啟用帳單)。如果您的 API Key 未啟用帳單,請使用 Gemini 2.5 Flash 模型。
|
|
94
|
+
|
|
95
|
+
## 🎨 範例作品對比
|
|
96
|
+
|
|
97
|
+
以下是使用相同關鍵字「萬馬奔騰」生成的範例作品,展示了兩個模型的差異:
|
|
98
|
+
|
|
99
|
+
### Gemini 2.5 Flash 生成作品
|
|
100
|
+
|
|
101
|
+
<div align="center">
|
|
102
|
+
<img src="images/gemini2-5-萬馬奔騰.png" alt="Gemini 2.5 Flash - 萬馬奔騰" width="512" />
|
|
103
|
+
<p><em>Gemini 2.5 Flash 生成 - 快速生成,品質良好</em></p>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
### Gemini 3 Pro 生成作品
|
|
107
|
+
|
|
108
|
+
<div align="center">
|
|
109
|
+
<img src="images/gemin3-萬馬奔騰.png" alt="Gemini 3 Pro - 萬馬奔騰" width="512" />
|
|
110
|
+
<p><em>Gemini 3 Pro 生成 - 更高品質,細節豐富</em></p>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
### 對比總結
|
|
114
|
+
|
|
115
|
+
從以上範例可以看出:
|
|
116
|
+
|
|
117
|
+
- **Gemini 2.5 Flash**:生成速度快,適合快速測試和迭代,圖片品質良好
|
|
118
|
+
- **Gemini 3 Pro**:生成時間較長,但圖片品質明顯提升,細節更豐富,更適合最終作品和打印用途
|
|
119
|
+
|
|
120
|
+
**建議:** 如果您追求高品質的藝術作品,強烈推薦使用 Gemini 3 Pro 模型。
|
|
121
|
+
|
|
122
|
+
## 📖 使用說明
|
|
123
|
+
|
|
124
|
+
1. **輸入關鍵字**:在輸入框中輸入您的願望或祝福語(例如:財富、健康、愛情等)
|
|
125
|
+
2. **(可選)上傳參考圖片**:點擊上傳區域選擇一張圖片作為風格參考
|
|
126
|
+
3. **選擇模型和解析度**:點擊右上角設置圖標,選擇您偏好的模型和輸出解析度
|
|
127
|
+
4. **生成作品**:點擊「Generate」按鈕,等待 AI 生成您的專屬春聯斗方
|
|
128
|
+
5. **下載作品**:生成完成後,點擊「Download Artwork」下載您的作品
|
|
129
|
+
|
|
130
|
+
## 🛠️ 技術棧
|
|
131
|
+
|
|
132
|
+
- **前端框架**:React 19 + TypeScript
|
|
133
|
+
- **樣式**:Tailwind CSS
|
|
134
|
+
- **AI 模型**:Google Gemini 2.5 Flash / Gemini 3 Pro
|
|
135
|
+
- **構建工具**:Vite
|
|
136
|
+
|
|
137
|
+
## 📦 NPM 安裝
|
|
138
|
+
|
|
139
|
+
本專案的 Claude Agent Skills 已發布到 npm,可以通過以下方式安裝:
|
|
140
|
+
|
|
141
|
+
### 全域安裝(推薦)
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
npm install -g @justin_666/square-couplets-master-skills
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
安裝後,您可以在任何地方使用 `doufang-skills` 命令:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# 列出所有可用的 skills
|
|
151
|
+
doufang-skills list
|
|
152
|
+
|
|
153
|
+
# 查看特定 skill 的內容
|
|
154
|
+
doufang-skills show generate-doufang-prompt
|
|
155
|
+
|
|
156
|
+
# 獲取 skill 文件路徑(用於程序化訪問)
|
|
157
|
+
doufang-skills path generate-doufang-image
|
|
158
|
+
|
|
159
|
+
# 查看幫助
|
|
160
|
+
doufang-skills help
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### 本地安裝
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
npm install @justin_666/square-couplets-master-skills
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
然後在您的專案中使用:
|
|
170
|
+
|
|
171
|
+
```javascript
|
|
172
|
+
import { readFileSync } from 'fs';
|
|
173
|
+
import { join } from 'path';
|
|
174
|
+
|
|
175
|
+
// 獲取 skill 文件路徑
|
|
176
|
+
const skillPath = join(require.resolve('@justin_666/square-couplets-master-skills'), '../skills/generate-doufang-prompt/SKILL.md');
|
|
177
|
+
const skillContent = readFileSync(skillPath, 'utf-8');
|
|
178
|
+
```
|
|
179
|
+
<|tool▁calls▁begin|><|tool▁call▁begin|>
|
|
180
|
+
run_terminal_cmd
|
|
181
|
+
|
|
182
|
+
### 發布到 npm
|
|
183
|
+
|
|
184
|
+
如果您想將此包發布到 npm,請參考 [NPM_PUBLISH.md](NPM_PUBLISH.md) 文件。
|
|
185
|
+
|
|
186
|
+
## 🤖 Claude Agent Skills
|
|
187
|
+
|
|
188
|
+
本專案包含三個 Claude Agent Skills,可在支援該協定的 AI IDE(如 Cursor)中使用:
|
|
189
|
+
|
|
190
|
+
### 📝 generate-doufang-prompt
|
|
191
|
+
**功能**:根據關鍵字生成專業的春聯斗方藝術作品提示詞
|
|
192
|
+
|
|
193
|
+
**使用場景**:
|
|
194
|
+
- 用戶提供關鍵字或願望短語
|
|
195
|
+
- 需要生成傳統中國新年藝術作品提示詞
|
|
196
|
+
- 需要將關鍵字轉換為四字祝福語
|
|
197
|
+
|
|
198
|
+
**示例**:
|
|
199
|
+
```
|
|
200
|
+
"幫我生成一個關於財富的春聯斗方 prompt"
|
|
201
|
+
"為健康長壽主題創建一個 Doufang prompt"
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### 🎨 generate-doufang-image
|
|
205
|
+
**功能**:使用 Google Gemini API 生成實際的春聯斗方藝術作品圖片
|
|
206
|
+
|
|
207
|
+
**使用場景**:
|
|
208
|
+
- 用戶已有提示詞,想要生成實際圖片
|
|
209
|
+
- 需要測試不同模型或解析度
|
|
210
|
+
- 需要生成帶參考圖片風格的藝術作品
|
|
211
|
+
|
|
212
|
+
**支持的模型**:
|
|
213
|
+
- Gemini 2.5 Flash:快速生成,1K 解析度
|
|
214
|
+
- Gemini 3 Pro:高品質,支持 1K/2K/4K 解析度
|
|
215
|
+
|
|
216
|
+
**示例**:
|
|
217
|
+
```
|
|
218
|
+
"用 Gemini 3 Pro 生成 2K 解析度的圖片"
|
|
219
|
+
"使用這個 prompt 生成圖片,參考圖片風格"
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### ✨ optimize-doufang-prompt
|
|
223
|
+
**功能**:優化 Doufang 提示詞,減少過多留白,改善構圖
|
|
224
|
+
|
|
225
|
+
**使用場景**:
|
|
226
|
+
- 生成的圖片留白過多
|
|
227
|
+
- 需要改善提示詞品質
|
|
228
|
+
- 生成的圖片構圖不佳
|
|
229
|
+
- 需要更緊湊的構圖
|
|
230
|
+
|
|
231
|
+
**優化重點**:
|
|
232
|
+
- 將「寬留白」改為「最小留白(2-5%)」
|
|
233
|
+
- 確保 Doufang 佔據 85-95% 的畫面空間
|
|
234
|
+
- 強調視覺衝擊力而非安全邊距
|
|
235
|
+
|
|
236
|
+
**示例**:
|
|
237
|
+
```
|
|
238
|
+
"優化這個 prompt,減少留白"
|
|
239
|
+
"改善構圖,讓 Doufang 佔據更多畫面"
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### 📂 Skills 文件結構
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
skills/
|
|
246
|
+
├── generate-doufang-prompt/
|
|
247
|
+
│ └── SKILL.md
|
|
248
|
+
├── generate-doufang-image/
|
|
249
|
+
│ └── SKILL.md
|
|
250
|
+
└── optimize-doufang-prompt/
|
|
251
|
+
└── SKILL.md
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### 🚀 如何使用
|
|
255
|
+
|
|
256
|
+
在 Cursor 或其他支援 Claude Agent Skills 的 IDE 中:
|
|
257
|
+
|
|
258
|
+
1. **自動載入**:當您提到相關任務時,對應的 skill 會自動載入
|
|
259
|
+
2. **手動調用**:直接使用 skill 名稱來調用特定功能
|
|
260
|
+
3. **組合使用**:可以將多個 skills 組合使用,例如先生成 prompt,再優化,最後生成圖片
|
|
261
|
+
|
|
262
|
+
**注意**:使用 `generate-doufang-image` skill 時,需要配置 Gemini API Key。
|
|
263
|
+
|
|
264
|
+
## 📝 授權 (License)
|
|
265
|
+
|
|
266
|
+
本專案採用 **Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License** (CC BY-NC-SA 4.0) 授權。
|
|
267
|
+
|
|
268
|
+
Copyright (c) 2026 Justin
|
|
269
|
+
|
|
270
|
+
### 您可以自由地:
|
|
271
|
+
|
|
272
|
+
- ✅ **分享** — 在任何媒介以任何形式複製、發行本作品
|
|
273
|
+
- ✅ **衍生** — 修改、轉換或依本作品進行創作
|
|
274
|
+
|
|
275
|
+
### 惟需遵守下列條件:
|
|
276
|
+
|
|
277
|
+
- 📌 **姓名標示** — 您必須給予適當的署名,並提供本授權條款的連結
|
|
278
|
+
- 📌 **非商業性** — 您不得將本作品用於商業目的
|
|
279
|
+
- 📌 **相同方式分享** — 如果您改變、轉變或依據本作品進行創作,您必須採用與原先授權條款相同的授權方式來散布您的貢獻
|
|
280
|
+
|
|
281
|
+
### 商業授權
|
|
282
|
+
|
|
283
|
+
如需將本專案用於商業目的,請聯繫作者以取得商業授權:
|
|
284
|
+
|
|
285
|
+
- **GitHub:** [@poirotw66](https://github.com/poirotw66)
|
|
286
|
+
- **Project Issues:** [Square_Couplets_Master](https://github.com/poirotw66/Square_Couplets_Master)
|
|
287
|
+
|
|
288
|
+
### 授權條款詳情
|
|
289
|
+
|
|
290
|
+
要查看完整的授權條款,請訪問:
|
|
291
|
+
- [Creative Commons BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)
|
|
292
|
+
|
|
293
|
+
或查看專案根目錄的 [LICENSE](LICENSE) 文件。
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
**免責聲明:** 本軟體按「現狀」提供,不提供任何形式的明示或暗示擔保。
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Doufang Skills CLI Tool
|
|
5
|
+
* Provides access to Claude Agent Skills for generating Chinese New Year Doufang artwork
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
import { dirname, join, resolve } from 'path';
|
|
10
|
+
import { readFileSync, readdirSync, statSync } from 'fs';
|
|
11
|
+
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
+
const __dirname = dirname(__filename);
|
|
14
|
+
|
|
15
|
+
// Get package root directory (parent of bin/)
|
|
16
|
+
const packageRoot = resolve(__dirname, '..');
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Get the path to skills directory
|
|
20
|
+
*/
|
|
21
|
+
function getSkillsPath() {
|
|
22
|
+
// Try multiple possible locations
|
|
23
|
+
const possiblePaths = [
|
|
24
|
+
join(packageRoot, 'skills'),
|
|
25
|
+
join(packageRoot, 'node_modules', '@square-couplets-master', 'skills', 'skills'),
|
|
26
|
+
join(process.cwd(), 'node_modules', '@square-couplets-master', 'skills', 'skills'),
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
for (const path of possiblePaths) {
|
|
30
|
+
try {
|
|
31
|
+
if (statSync(path).isDirectory()) {
|
|
32
|
+
return path;
|
|
33
|
+
}
|
|
34
|
+
} catch (e) {
|
|
35
|
+
// Path doesn't exist, try next
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Fallback to package root skills
|
|
40
|
+
return join(packageRoot, 'skills');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* List all available skills
|
|
45
|
+
*/
|
|
46
|
+
function listSkills() {
|
|
47
|
+
const skillsPath = getSkillsPath();
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
const skills = readdirSync(skillsPath, { withFileTypes: true })
|
|
51
|
+
.filter(dirent => dirent.isDirectory())
|
|
52
|
+
.map(dirent => dirent.name);
|
|
53
|
+
|
|
54
|
+
if (skills.length === 0) {
|
|
55
|
+
console.error('No skills found in', skillsPath);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
console.log('\n📚 Available Doufang Skills:\n');
|
|
60
|
+
|
|
61
|
+
for (const skillName of skills) {
|
|
62
|
+
const skillPath = join(skillsPath, skillName, 'SKILL.md');
|
|
63
|
+
try {
|
|
64
|
+
const skillContent = readFileSync(skillPath, 'utf-8');
|
|
65
|
+
const frontmatterMatch = skillContent.match(/^---\n([\s\S]*?)\n---/);
|
|
66
|
+
|
|
67
|
+
if (frontmatterMatch) {
|
|
68
|
+
const frontmatter = frontmatterMatch[1];
|
|
69
|
+
const nameMatch = frontmatter.match(/name:\s*(.+)/);
|
|
70
|
+
const descMatch = frontmatter.match(/description:\s*(.+)/);
|
|
71
|
+
|
|
72
|
+
const name = nameMatch ? nameMatch[1].trim() : skillName;
|
|
73
|
+
const desc = descMatch ? descMatch[1].trim() : 'No description';
|
|
74
|
+
|
|
75
|
+
console.log(` ✨ ${name}`);
|
|
76
|
+
console.log(` ${desc}\n`);
|
|
77
|
+
} else {
|
|
78
|
+
console.log(` ✨ ${skillName}\n`);
|
|
79
|
+
}
|
|
80
|
+
} catch (e) {
|
|
81
|
+
console.log(` ✨ ${skillName} (error reading skill file)\n`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
} catch (error) {
|
|
85
|
+
console.error('Error reading skills directory:', error.message);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Show a specific skill
|
|
92
|
+
*/
|
|
93
|
+
function showSkill(skillName) {
|
|
94
|
+
const skillsPath = getSkillsPath();
|
|
95
|
+
const skillPath = join(skillsPath, skillName, 'SKILL.md');
|
|
96
|
+
|
|
97
|
+
try {
|
|
98
|
+
const skillContent = readFileSync(skillPath, 'utf-8');
|
|
99
|
+
console.log(skillContent);
|
|
100
|
+
} catch (error) {
|
|
101
|
+
console.error(`Error reading skill "${skillName}":`, error.message);
|
|
102
|
+
console.error(`\nAvailable skills:`);
|
|
103
|
+
listSkills();
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Get skill path (for programmatic access)
|
|
110
|
+
*/
|
|
111
|
+
function getSkillPath(skillName) {
|
|
112
|
+
const skillsPath = getSkillsPath();
|
|
113
|
+
return join(skillsPath, skillName, 'SKILL.md');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Main CLI handler
|
|
118
|
+
*/
|
|
119
|
+
function main() {
|
|
120
|
+
const args = process.argv.slice(2);
|
|
121
|
+
const command = args[0];
|
|
122
|
+
|
|
123
|
+
if (!command || command === 'list' || command === 'ls') {
|
|
124
|
+
listSkills();
|
|
125
|
+
} else if (command === 'show' || command === 'view') {
|
|
126
|
+
const skillName = args[1];
|
|
127
|
+
if (!skillName) {
|
|
128
|
+
console.error('Usage: doufang-skills show <skill-name>');
|
|
129
|
+
console.error('\nAvailable skills:');
|
|
130
|
+
listSkills();
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
showSkill(skillName);
|
|
134
|
+
} else if (command === 'path') {
|
|
135
|
+
const skillName = args[1];
|
|
136
|
+
if (!skillName) {
|
|
137
|
+
console.error('Usage: doufang-skills path <skill-name>');
|
|
138
|
+
process.exit(1);
|
|
139
|
+
}
|
|
140
|
+
const path = getSkillPath(skillName);
|
|
141
|
+
console.log(path);
|
|
142
|
+
} else if (command === 'help' || command === '--help' || command === '-h') {
|
|
143
|
+
console.log(`
|
|
144
|
+
Doufang Skills CLI Tool
|
|
145
|
+
|
|
146
|
+
Usage:
|
|
147
|
+
doufang-skills [command] [options]
|
|
148
|
+
|
|
149
|
+
Commands:
|
|
150
|
+
list, ls List all available skills
|
|
151
|
+
show <skill-name> Show a specific skill's content
|
|
152
|
+
path <skill-name> Get the file path to a skill
|
|
153
|
+
help Show this help message
|
|
154
|
+
|
|
155
|
+
Examples:
|
|
156
|
+
doufang-skills list
|
|
157
|
+
doufang-skills show generate-doufang-prompt
|
|
158
|
+
doufang-skills path generate-doufang-image
|
|
159
|
+
|
|
160
|
+
For more information, visit:
|
|
161
|
+
https://github.com/poirotw66/Square_Couplets_Master
|
|
162
|
+
`);
|
|
163
|
+
} else {
|
|
164
|
+
console.error(`Unknown command: ${command}`);
|
|
165
|
+
console.error('Run "doufang-skills help" for usage information.');
|
|
166
|
+
process.exit(1);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Run CLI
|
|
171
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@justin_666/square-couplets-master-skills",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Claude Agent Skills for generating Chinese New Year Doufang (diamond-shaped couplet) artwork using Google Gemini AI",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "bin/doufang-skills.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"doufang-skills": "bin/doufang-skills.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "vite",
|
|
12
|
+
"build": "vite build",
|
|
13
|
+
"preview": "vite preview",
|
|
14
|
+
"prepublishOnly": "node -e \"require('fs').chmodSync('bin/doufang-skills.js', 0o755)\""
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"claude",
|
|
18
|
+
"agent",
|
|
19
|
+
"skills",
|
|
20
|
+
"chinese",
|
|
21
|
+
"calligraphy",
|
|
22
|
+
"gemini",
|
|
23
|
+
"ai",
|
|
24
|
+
"art",
|
|
25
|
+
"doufang",
|
|
26
|
+
"chinese-new-year",
|
|
27
|
+
"couplet",
|
|
28
|
+
"traditional",
|
|
29
|
+
"artwork"
|
|
30
|
+
],
|
|
31
|
+
"author": "Justin",
|
|
32
|
+
"license": "CC-BY-NC-SA-4.0",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/poirotw66/Square_Couplets_Master.git"
|
|
36
|
+
},
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/poirotw66/Square_Couplets_Master/issues"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/poirotw66/Square_Couplets_Master#readme",
|
|
41
|
+
"files": [
|
|
42
|
+
"bin/",
|
|
43
|
+
"skills/",
|
|
44
|
+
"README.md",
|
|
45
|
+
"LICENSE",
|
|
46
|
+
"package.json"
|
|
47
|
+
],
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=18.0.0"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@google/genai": "^1.37.0",
|
|
56
|
+
"react": "^19.2.3",
|
|
57
|
+
"react-dom": "^19.2.3"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/node": "^22.14.0",
|
|
61
|
+
"@vitejs/plugin-react": "^5.0.0",
|
|
62
|
+
"dotenv": "^17.2.3",
|
|
63
|
+
"tsx": "^4.21.0",
|
|
64
|
+
"typescript": "~5.8.2",
|
|
65
|
+
"vite": "^6.2.0"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: generate-doufang-image
|
|
3
|
+
description: Generate Doufang artwork images using Google Gemini API. Use when user wants to create actual artwork images from prompts. Supports both Gemini 2.5 Flash and Gemini 3 Pro models with different resolutions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# generate-doufang-image Skill
|
|
7
|
+
|
|
8
|
+
## Instructions
|
|
9
|
+
|
|
10
|
+
When user wants to generate an actual Doufang artwork image:
|
|
11
|
+
|
|
12
|
+
1. **Check for API key:**
|
|
13
|
+
- First, check for `GEMINI_API_KEY` in environment variables
|
|
14
|
+
- If not found, check for `API_KEY` environment variable
|
|
15
|
+
- If still not found, prompt user to provide API key or configure it in settings
|
|
16
|
+
|
|
17
|
+
2. **Select appropriate model:**
|
|
18
|
+
- **Gemini 2.5 Flash** (`gemini-2.5-flash-image`):
|
|
19
|
+
- Fast generation
|
|
20
|
+
- 1K resolution only (1024×1024)
|
|
21
|
+
- Good for quick iterations and testing
|
|
22
|
+
- Free-friendly (works with free API keys)
|
|
23
|
+
- **Gemini 3 Pro** (`gemini-3-pro-image-preview`):
|
|
24
|
+
- Higher quality with richer details
|
|
25
|
+
- Supports 1K, 2K, and 4K resolutions
|
|
26
|
+
- Better style understanding
|
|
27
|
+
- Requires paid API key (billing enabled)
|
|
28
|
+
|
|
29
|
+
3. **Handle reference image (if provided):**
|
|
30
|
+
- If user provides a reference image, include it in the generation
|
|
31
|
+
- Process the image: compress if needed, convert to base64
|
|
32
|
+
- Pass reference image to both prompt generation and image generation steps
|
|
33
|
+
- Ensure the generated prompt incorporates the reference image's style
|
|
34
|
+
|
|
35
|
+
4. **Generate image using the prompt:**
|
|
36
|
+
- Use the image prompt from `generate-doufang-prompt` skill or user-provided prompt
|
|
37
|
+
- If reference image provided, enhance the prompt with style guidance
|
|
38
|
+
- Handle errors gracefully with user-friendly messages
|
|
39
|
+
- Retry on transient errors (500, 503, network errors)
|
|
40
|
+
|
|
41
|
+
5. **Return the result:**
|
|
42
|
+
- Return base64 encoded image data URL
|
|
43
|
+
- Or save to file if user requests file output
|
|
44
|
+
- Provide download link or file path
|
|
45
|
+
|
|
46
|
+
## Parameters
|
|
47
|
+
|
|
48
|
+
- `prompt` (required): The image generation prompt (from `generate-doufang-prompt` or user-provided)
|
|
49
|
+
- `model` (optional):
|
|
50
|
+
- `"gemini-2.5-flash-image"` (default, fast, 1K only)
|
|
51
|
+
- `"gemini-3-pro-image-preview"` (high quality, supports 1K/2K/4K)
|
|
52
|
+
- `imageSize` (optional):
|
|
53
|
+
- `"1K"` (1024×1024, default, works with both models)
|
|
54
|
+
- `"2K"` (2048×2048, Pro model only)
|
|
55
|
+
- `"4K"` (4096×4096, Pro model only)
|
|
56
|
+
- `apiKey` (optional): Gemini API key (if not in environment)
|
|
57
|
+
- `referenceImage` (optional): Base64 encoded reference image or image file path
|
|
58
|
+
|
|
59
|
+
## Model Selection Guidelines
|
|
60
|
+
|
|
61
|
+
**Use Gemini 2.5 Flash when:**
|
|
62
|
+
- User wants fast generation
|
|
63
|
+
- User has free API key
|
|
64
|
+
- User is testing or iterating
|
|
65
|
+
- 1K resolution is sufficient
|
|
66
|
+
|
|
67
|
+
**Use Gemini 3 Pro when:**
|
|
68
|
+
- User wants highest quality
|
|
69
|
+
- User needs 2K or 4K resolution
|
|
70
|
+
- User wants better style understanding
|
|
71
|
+
- User has paid API key with billing enabled
|
|
72
|
+
- User wants final artwork for printing
|
|
73
|
+
|
|
74
|
+
## Examples
|
|
75
|
+
|
|
76
|
+
### Example 1: Basic Generation with Flash Model
|
|
77
|
+
|
|
78
|
+
**Input:**
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"prompt": "A diamond-shaped Chinese New Year Doufang couplet on antique gold-flecked red Xuan paper...",
|
|
82
|
+
"model": "gemini-2.5-flash-image",
|
|
83
|
+
"imageSize": "1K",
|
|
84
|
+
"apiKey": "user-api-key"
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Output:**
|
|
89
|
+
- Base64 encoded image data URL: `data:image/png;base64,...`
|
|
90
|
+
- Or file saved to: `./output/doufang-招財進寶.png`
|
|
91
|
+
|
|
92
|
+
### Example 2: High-Quality Generation with Pro Model
|
|
93
|
+
|
|
94
|
+
**Input:**
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"prompt": "A diamond-shaped Chinese New Year Doufang couplet...",
|
|
98
|
+
"model": "gemini-3-pro-image-preview",
|
|
99
|
+
"imageSize": "2K",
|
|
100
|
+
"apiKey": "user-api-key"
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Output:**
|
|
105
|
+
- Base64 encoded 2K resolution image
|
|
106
|
+
- Higher quality with more details
|
|
107
|
+
|
|
108
|
+
### Example 3: With Reference Image
|
|
109
|
+
|
|
110
|
+
**Input:**
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"prompt": "A diamond-shaped Chinese New Year Doufang...",
|
|
114
|
+
"model": "gemini-3-pro-image-preview",
|
|
115
|
+
"imageSize": "2K",
|
|
116
|
+
"referenceImage": "data:image/jpeg;base64,/9j/4AAQSkZJRg...",
|
|
117
|
+
"apiKey": "user-api-key"
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Output:**
|
|
122
|
+
- Image generated with reference style incorporated
|
|
123
|
+
- Style elements from reference image preserved
|
|
124
|
+
|
|
125
|
+
## Error Handling
|
|
126
|
+
|
|
127
|
+
### Missing API Key
|
|
128
|
+
```
|
|
129
|
+
Error: API Key is missing. Please configure your Gemini API Key in settings or provide it as a parameter.
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Invalid Model/Size Combination
|
|
133
|
+
```
|
|
134
|
+
Error: Flash model only supports 1K resolution. Please use Pro model for 2K/4K or switch to 1K.
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Billing Required (Pro Model)
|
|
138
|
+
```
|
|
139
|
+
Error: Pro model requires paid API Key (billing enabled). Please switch to Flash model or enable billing for your API key.
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Rate Limit
|
|
143
|
+
```
|
|
144
|
+
Error: Rate limit exceeded. Please wait a moment and try again.
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Network Error
|
|
148
|
+
```
|
|
149
|
+
Error: Network connection error. Please check your internet connection and try again.
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Implementation Notes
|
|
153
|
+
|
|
154
|
+
- Use retry mechanism for transient errors (500, 503, network errors)
|
|
155
|
+
- Compress reference images if they exceed 500KB
|
|
156
|
+
- Validate image formats (JPEG, PNG supported)
|
|
157
|
+
- Handle cancellation signals for long-running requests
|
|
158
|
+
- Provide progress updates for image generation
|
|
159
|
+
|
|
160
|
+
## When to Use
|
|
161
|
+
|
|
162
|
+
- User wants to generate actual artwork image
|
|
163
|
+
- User has a prompt ready and wants to see the result
|
|
164
|
+
- User wants to test different models or resolutions
|
|
165
|
+
- User wants to generate artwork with reference image style
|
|
166
|
+
|
|
167
|
+
## When NOT to Use
|
|
168
|
+
|
|
169
|
+
- User only wants to generate a prompt (use `generate-doufang-prompt` instead)
|
|
170
|
+
- User wants to optimize an existing prompt (use `optimize-doufang-prompt` instead)
|
|
171
|
+
- User doesn't have API key configured
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: generate-doufang-prompt
|
|
3
|
+
description: Generate professional Chinese New Year Doufang (diamond-shaped couplet) artwork prompts based on keywords. Use when user wants to create traditional Chinese calligraphy artwork prompts.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# generate-doufang-prompt Skill
|
|
7
|
+
|
|
8
|
+
## Instructions
|
|
9
|
+
|
|
10
|
+
When user provides a keyword or wish phrase, generate a professional Doufang artwork prompt using the following process:
|
|
11
|
+
|
|
12
|
+
1. **Understand the keyword meaning:**
|
|
13
|
+
- Wealth -> 招財進寶, 富貴吉祥
|
|
14
|
+
- Health -> 龍馬精神, 延年益壽
|
|
15
|
+
- Career/Success -> 大展宏圖, 步步高升
|
|
16
|
+
- Peace/Harmony -> 平安喜樂, 歲歲平安
|
|
17
|
+
- Love -> 永結同心, 花好月圓
|
|
18
|
+
- Study/Wisdom -> 學業有成, 金榜題名
|
|
19
|
+
- General Luck -> 萬事如意, 心想事成
|
|
20
|
+
|
|
21
|
+
2. **Generate a 4-character blessing phrase** that is:
|
|
22
|
+
- Elegant and culturally appropriate
|
|
23
|
+
- Common in Chinese New Year usage
|
|
24
|
+
- If user input is already a suitable 4-character phrase, use it directly
|
|
25
|
+
- Otherwise, transform or upgrade it into a proper 4-character blessing phrase
|
|
26
|
+
|
|
27
|
+
3. **Create detailed image generation prompt** with the following elements:
|
|
28
|
+
- **Format**: Diamond-shaped (rotated square) Doufang
|
|
29
|
+
- **Background**: Antique gold-flecked red Xuan paper
|
|
30
|
+
- **Central theme**: Bold, powerful, energetic traditional Chinese ink wash calligraphy of the 4-character blessing phrase
|
|
31
|
+
- **Decorative elements**: Symbolic elements that visually represent the keyword (e.g., horse, dragon, pine tree, crane, gold ingots, clouds, mountains, sun, plum blossoms)
|
|
32
|
+
- **Style**: Traditional Chinese ink painting mixed with realistic illustration, elegant, prestigious, festive but high-class
|
|
33
|
+
- **Composition**:
|
|
34
|
+
- Doufang fills 85-95% of the frame
|
|
35
|
+
- Centered with minimal elegant margins (2-5% of frame width, just enough to prevent edge cropping)
|
|
36
|
+
- Fully visible inside the frame, not touching edges
|
|
37
|
+
- **Quality**: Ultra high detail, 8k, masterpiece, professional artwork, 1:1 aspect ratio
|
|
38
|
+
- **Lighting**: Soft studio lighting, gentle glow on gold details, museum-quality artwork
|
|
39
|
+
- **Text requirements**: Clear, correct, readable Chinese characters with no typos or deformed text
|
|
40
|
+
|
|
41
|
+
4. **Output format:**
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"blessingPhrase": "四字祝福語",
|
|
45
|
+
"imagePrompt": "詳細的英文圖片生成提示詞"
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Examples
|
|
50
|
+
|
|
51
|
+
### Example 1: Wealth Theme
|
|
52
|
+
|
|
53
|
+
**Input:** "財富" or "wealth"
|
|
54
|
+
|
|
55
|
+
**Output:**
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"blessingPhrase": "招財進寶",
|
|
59
|
+
"imagePrompt": "A diamond-shaped Chinese New Year Doufang couplet on antique gold-flecked red Xuan paper. Central theme: bold, powerful, energetic traditional Chinese ink wash calligraphy of the characters '招財進寶'. Around the calligraphy: symbolic elements that visually represent wealth - gold ingots, coins, treasure chests, and prosperity symbols, painted in traditional Chinese ink painting style. Style: traditional Chinese ink painting mixed with realistic illustration, elegant, prestigious, festive but high-class, not cartoon. Material & texture: real Xuan paper texture, gold flecks, red rice paper, visible paper fibers, natural ink diffusion, subtle embossed gold foil details. Color theme: deep Chinese red, gold, black ink, warm highlights. Lighting: soft studio lighting, gentle glow on gold details, museum-quality artwork. Composition: The diamond-shaped Doufang fills 85-95% of the 1:1 frame, centered with minimal elegant margins (approximately 2-5% of frame width, just enough to prevent edge cropping). The entire artwork is fully visible inside the frame, not touching any edge, not cropped, not cut off. Clean background, symmetrical, perfectly framed, suitable for printing and hanging on wall. Quality: ultra high detail, 8k, masterpiece, professional artwork, 1:1 aspect ratio."
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Example 2: Health Theme
|
|
64
|
+
|
|
65
|
+
**Input:** "健康長壽" or "health longevity"
|
|
66
|
+
|
|
67
|
+
**Output:**
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"blessingPhrase": "延年益壽",
|
|
71
|
+
"imagePrompt": "A diamond-shaped Chinese New Year Doufang couplet on antique gold-flecked red Xuan paper. Central theme: bold, powerful, energetic traditional Chinese ink wash calligraphy of the characters '延年益壽'. Around the calligraphy: symbolic elements that visually represent health and longevity - pine trees, cranes, peaches, and bamboo, painted in traditional Chinese ink painting style. Style: traditional Chinese ink painting mixed with realistic illustration, elegant, prestigious, festive but high-class, not cartoon. Material & texture: real Xuan paper texture, gold flecks, red rice paper, visible paper fibers, natural ink diffusion, subtle embossed gold foil details. Color theme: deep Chinese red, gold, black ink, warm highlights. Lighting: soft studio lighting, gentle glow on gold details, museum-quality artwork. Composition: The diamond-shaped Doufang fills 85-95% of the 1:1 frame, centered with minimal elegant margins (approximately 2-5% of frame width, just enough to prevent edge cropping). The entire artwork is fully visible inside the frame, not touching any edge, not cropped, not cut off. Clean background, symmetrical, perfectly framed, suitable for printing and hanging on wall. Quality: ultra high detail, 8k, masterpiece, professional artwork, 1:1 aspect ratio."
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Example 3: Direct 4-Character Input
|
|
76
|
+
|
|
77
|
+
**Input:** "萬馬奔騰"
|
|
78
|
+
|
|
79
|
+
**Output:**
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"blessingPhrase": "萬馬奔騰",
|
|
83
|
+
"imagePrompt": "A diamond-shaped Chinese New Year Doufang couplet on antique gold-flecked red Xuan paper. Central theme: bold, powerful, energetic traditional Chinese ink wash calligraphy of the characters '萬馬奔騰'. Around the calligraphy: symbolic elements that visually represent energy and vitality - galloping horses, flowing clouds, dynamic movement, painted in traditional Chinese ink painting style. Style: traditional Chinese ink painting mixed with realistic illustration, elegant, prestigious, festive but high-class, not cartoon. Material & texture: real Xuan paper texture, gold flecks, red rice paper, visible paper fibers, natural ink diffusion, subtle embossed gold foil details. Color theme: deep Chinese red, gold, black ink, warm highlights. Lighting: soft studio lighting, gentle glow on gold details, museum-quality artwork. Composition: The diamond-shaped Doufang fills 85-95% of the 1:1 frame, centered with minimal elegant margins (approximately 2-5% of frame width, just enough to prevent edge cropping). The entire artwork is fully visible inside the frame, not touching any edge, not cropped, not cut off. Clean background, symmetrical, perfectly framed, suitable for printing and hanging on wall. Quality: ultra high detail, 8k, masterpiece, professional artwork, 1:1 aspect ratio."
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Key Requirements
|
|
88
|
+
|
|
89
|
+
- The Doufang should fill **85-95% of the frame** (not less)
|
|
90
|
+
- Minimal margins: **2-5% of frame width** (just enough to prevent edge cropping)
|
|
91
|
+
- **No excessive white space** or wide margins
|
|
92
|
+
- Traditional Chinese artistic style (ink wash, calligraphy)
|
|
93
|
+
- High-quality, printable artwork suitable for hanging
|
|
94
|
+
- Clear, correct Chinese characters with no errors
|
|
95
|
+
- No modern elements, no western style, no watermarks
|
|
96
|
+
|
|
97
|
+
## When to Use
|
|
98
|
+
|
|
99
|
+
- User asks to generate a Doufang prompt
|
|
100
|
+
- User provides a keyword or wish phrase
|
|
101
|
+
- User wants to create traditional Chinese New Year artwork
|
|
102
|
+
- User needs a prompt for image generation
|
|
103
|
+
|
|
104
|
+
## When NOT to Use
|
|
105
|
+
|
|
106
|
+
- User already has a complete prompt
|
|
107
|
+
- User wants to modify an existing prompt (use `optimize-doufang-prompt` instead)
|
|
108
|
+
- User wants to generate the actual image (use `generate-doufang-image` instead)
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: optimize-doufang-prompt
|
|
3
|
+
description: Optimize Doufang prompts to reduce excessive white margins and improve composition. Use when generated images have too much white space, poor framing, or when user wants to improve prompt quality.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# optimize-doufang-prompt Skill
|
|
7
|
+
|
|
8
|
+
## Instructions
|
|
9
|
+
|
|
10
|
+
When user reports that generated images have excessive white margins, poor composition, or wants to improve prompt quality:
|
|
11
|
+
|
|
12
|
+
1. **Identify margin-related issues:**
|
|
13
|
+
- Look for phrases like "wide margins", "generous margins", "wide white margins", "blank margins"
|
|
14
|
+
- Check for margin percentages > 5%
|
|
15
|
+
- Look for "generous blank margins around all four corners"
|
|
16
|
+
- Identify any instructions that might cause excessive white space
|
|
17
|
+
|
|
18
|
+
2. **Optimize the prompt by replacing problematic phrases:**
|
|
19
|
+
|
|
20
|
+
**Remove/Replace:**
|
|
21
|
+
- ❌ "with wide white margins"
|
|
22
|
+
- ❌ "with generous blank margins"
|
|
23
|
+
- ❌ "with wide safe margins"
|
|
24
|
+
- ❌ "generous blank margins around all four corners"
|
|
25
|
+
- ❌ "wide safe margins around the artwork"
|
|
26
|
+
|
|
27
|
+
**Replace with:**
|
|
28
|
+
- ✅ "centered with minimal elegant margins (approximately 2-5% of frame width, just enough to prevent edge cropping)"
|
|
29
|
+
- ✅ "minimal margins - the Doufang should fill most of the frame (85-95% of image area)"
|
|
30
|
+
- ✅ "The Doufang should occupy 85-95% of the image area, maximizing visual impact"
|
|
31
|
+
|
|
32
|
+
3. **Add explicit composition instructions:**
|
|
33
|
+
- Add: "The Doufang should fill 85-95% of the frame"
|
|
34
|
+
- Add: "Minimal margins (2-5% of frame width)"
|
|
35
|
+
- Add: "Maximize visual impact by making the Doufang occupy most of the frame"
|
|
36
|
+
- Add: "Avoid excessive white space or wide margins"
|
|
37
|
+
|
|
38
|
+
4. **Update framing requirements:**
|
|
39
|
+
- Ensure instructions specify: "just enough to prevent edge cropping"
|
|
40
|
+
- Emphasize: "maximizing visual impact"
|
|
41
|
+
- Remove any mention of "wide" or "generous" margins
|
|
42
|
+
|
|
43
|
+
## Optimization Rules
|
|
44
|
+
|
|
45
|
+
### Rule 1: Margin Specification
|
|
46
|
+
**Before:**
|
|
47
|
+
```
|
|
48
|
+
"...with wide white margins around all four corners..."
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**After:**
|
|
52
|
+
```
|
|
53
|
+
"...centered with minimal elegant margins (approximately 2-5% of frame width, just enough to prevent edge cropping)..."
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Rule 2: Frame Fill Percentage
|
|
57
|
+
**Before:**
|
|
58
|
+
```
|
|
59
|
+
"...with generous blank margins..."
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**After:**
|
|
63
|
+
```
|
|
64
|
+
"...The Doufang should occupy 85-95% of the image area, maximizing visual impact..."
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Rule 3: Composition Emphasis
|
|
68
|
+
**Before:**
|
|
69
|
+
```
|
|
70
|
+
"...wide safe margins around the artwork..."
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**After:**
|
|
74
|
+
```
|
|
75
|
+
"...minimal margins - the Doufang should fill most of the frame (85-95% of image area)..."
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Examples
|
|
79
|
+
|
|
80
|
+
### Example 1: Fixing Wide Margins
|
|
81
|
+
|
|
82
|
+
**Input Prompt (Problematic):**
|
|
83
|
+
```
|
|
84
|
+
A diamond-shaped Chinese New Year Doufang centered in a 1:1 frame with wide white margins. The artwork is a masterpiece of traditional ink-wash fusion...
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Optimized Prompt:**
|
|
88
|
+
```
|
|
89
|
+
A diamond-shaped Chinese New Year Doufang fills the majority of the 1:1 frame, centered with minimal elegant margins (approximately 2-5% of frame width, just enough to prevent edge cropping). The Doufang should occupy 85-95% of the image area, maximizing visual impact. The artwork is a masterpiece of traditional ink-wash fusion...
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Example 2: Improving Composition Instructions
|
|
93
|
+
|
|
94
|
+
**Input Prompt (Problematic):**
|
|
95
|
+
```
|
|
96
|
+
Composition: The diamond-shaped Doufang is fully visible and centered, with generous blank margins around all four corners. Clear safe area padding around the diamond shape for printing.
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Optimized Prompt:**
|
|
100
|
+
```
|
|
101
|
+
Composition: The diamond-shaped Doufang fills 85-95% of the 1:1 frame, centered with minimal elegant margins (approximately 2-5% of frame width, just enough to prevent edge cropping). The entire artwork is fully visible inside the frame, not touching any edge, not cropped, not cut off. The Doufang should occupy most of the image area, maximizing visual impact. Clean background, symmetrical, perfectly framed, suitable for printing and hanging on wall.
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Example 3: Complete Prompt Optimization
|
|
105
|
+
|
|
106
|
+
**Input Prompt (Problematic):**
|
|
107
|
+
```
|
|
108
|
+
Framing requirements:
|
|
109
|
+
- The entire diamond-shaped Doufang must be fully visible inside the image.
|
|
110
|
+
- Wide safe margins around the artwork.
|
|
111
|
+
- No cropping, no touching edges, no cut-off.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Optimized Prompt:**
|
|
115
|
+
```
|
|
116
|
+
Framing requirements:
|
|
117
|
+
- The entire diamond-shaped Doufang must be fully visible inside the image.
|
|
118
|
+
- Minimal margins - the Doufang should fill most of the frame (85-95% of image area).
|
|
119
|
+
- No cropping, no touching edges, no cut-off.
|
|
120
|
+
- Maximize visual impact by making the Doufang occupy most of the frame.
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Key Optimization Principles
|
|
124
|
+
|
|
125
|
+
1. **Never use "wide" or "generous" margins** - Always specify minimal margins (2-5%)
|
|
126
|
+
2. **Always specify frame fill percentage** - 85-95% of image area
|
|
127
|
+
3. **Emphasize visual impact** - Over safety margins
|
|
128
|
+
4. **Be specific about margin size** - "2-5% of frame width"
|
|
129
|
+
5. **Clarify purpose** - "just enough to prevent edge cropping"
|
|
130
|
+
|
|
131
|
+
## When to Use
|
|
132
|
+
|
|
133
|
+
- User reports images have too much white space
|
|
134
|
+
- User wants to improve prompt quality
|
|
135
|
+
- Generated images have poor composition
|
|
136
|
+
- User wants tighter framing
|
|
137
|
+
- User mentions "too much margin" or "excessive white space"
|
|
138
|
+
|
|
139
|
+
## When NOT to Use
|
|
140
|
+
|
|
141
|
+
- User wants to generate a new prompt (use `generate-doufang-prompt` instead)
|
|
142
|
+
- User wants to generate an image (use `generate-doufang-image` instead)
|
|
143
|
+
- Prompt already has optimal composition instructions
|
|
144
|
+
|
|
145
|
+
## Integration with Other Skills
|
|
146
|
+
|
|
147
|
+
This skill works best when:
|
|
148
|
+
1. Used after `generate-doufang-prompt` if the generated prompt has margin issues
|
|
149
|
+
2. Used before `generate-doufang-image` to ensure optimal composition
|
|
150
|
+
3. Used to fix prompts that resulted in poor image composition
|
|
151
|
+
|
|
152
|
+
## Output Format
|
|
153
|
+
|
|
154
|
+
Return the optimized prompt as a string, maintaining all other aspects of the original prompt while only modifying the composition and margin-related instructions.
|