@justin_666/square-couplets-master-skills 1.0.0 → 1.0.2
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/README.md +35 -7
- package/bin/doufang-init.js +303 -0
- package/package.json +13 -8
- package/skills/README.md +408 -0
package/README.md
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
一個使用 Google Gemini AI 生成傳統春聯斗方藝術作品的應用程式。將您的願望轉化為精美的書法藝術作品。
|
|
4
4
|
|
|
5
|
-
View your app in AI Studio: https://ai.studio/apps/drive/134htDa_3SXqpM65lyE57_S7pY5DiemK4
|
|
6
|
-
|
|
7
5
|
## ✨ 功能特色
|
|
8
6
|
|
|
9
7
|
- 🎨 **AI 生成春聯斗方**:輸入關鍵字,自動生成傳統風格的春聯藝術作品
|
|
@@ -138,13 +136,46 @@ View your app in AI Studio: https://ai.studio/apps/drive/134htDa_3SXqpM65lyE57_S
|
|
|
138
136
|
|
|
139
137
|
本專案的 Claude Agent Skills 已發布到 npm,可以通過以下方式安裝:
|
|
140
138
|
|
|
141
|
-
###
|
|
139
|
+
### 全域安裝 CLI(推薦)
|
|
142
140
|
|
|
143
141
|
```bash
|
|
144
142
|
npm install -g @justin_666/square-couplets-master-skills
|
|
145
143
|
```
|
|
146
144
|
|
|
147
|
-
|
|
145
|
+
### 在您的專案中初始化 Skills
|
|
146
|
+
|
|
147
|
+
安裝後,前往您的專案目錄並初始化 skills:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# 前往您的專案
|
|
151
|
+
cd /path/to/your/project
|
|
152
|
+
|
|
153
|
+
# 為 Cursor 初始化
|
|
154
|
+
doufang init --ai cursor
|
|
155
|
+
|
|
156
|
+
# 或為 Windsurf 初始化
|
|
157
|
+
doufang init --ai windsurf
|
|
158
|
+
|
|
159
|
+
# 或為 Antigravity 初始化
|
|
160
|
+
doufang init --ai antigravity
|
|
161
|
+
|
|
162
|
+
# 或為 Claude Code 初始化
|
|
163
|
+
doufang init --ai claude
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### 使用 Slash Command
|
|
167
|
+
|
|
168
|
+
初始化後,在 Cursor / Windsurf / Antigravity 中使用 slash command:
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
/doufang Generate a prompt for wealth theme
|
|
172
|
+
/doufang Create a 2K image using Gemini 3 Pro
|
|
173
|
+
/doufang Optimize this prompt to reduce white space
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### CLI 工具命令
|
|
177
|
+
|
|
178
|
+
安裝後,您還可以使用 `doufang-skills` 命令:
|
|
148
179
|
|
|
149
180
|
```bash
|
|
150
181
|
# 列出所有可用的 skills
|
|
@@ -179,9 +210,6 @@ const skillContent = readFileSync(skillPath, 'utf-8');
|
|
|
179
210
|
<|tool▁calls▁begin|><|tool▁call▁begin|>
|
|
180
211
|
run_terminal_cmd
|
|
181
212
|
|
|
182
|
-
### 發布到 npm
|
|
183
|
-
|
|
184
|
-
如果您想將此包發布到 npm,請參考 [NPM_PUBLISH.md](NPM_PUBLISH.md) 文件。
|
|
185
213
|
|
|
186
214
|
## 🤖 Claude Agent Skills
|
|
187
215
|
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Doufang Skills Initialization Tool
|
|
5
|
+
* Sets up skills for Cursor / Windsurf / Antigravity
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
import { dirname, join, resolve } from 'path';
|
|
10
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync, copyFileSync, statSync, readdirSync } from 'fs';
|
|
11
|
+
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
+
const __dirname = dirname(__filename);
|
|
14
|
+
|
|
15
|
+
// Get package root directory
|
|
16
|
+
const packageRoot = resolve(__dirname, '..');
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Get the path to skills directory
|
|
20
|
+
*/
|
|
21
|
+
function getSkillsPath() {
|
|
22
|
+
const possiblePaths = [
|
|
23
|
+
join(packageRoot, 'skills'),
|
|
24
|
+
join(packageRoot, 'node_modules', '@justin_666', 'square-couplets-master-skills', 'skills'),
|
|
25
|
+
join(process.cwd(), 'node_modules', '@justin_666', 'square-couplets-master-skills', 'skills'),
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
for (const path of possiblePaths) {
|
|
29
|
+
try {
|
|
30
|
+
if (statSync(path).isDirectory()) {
|
|
31
|
+
return path;
|
|
32
|
+
}
|
|
33
|
+
} catch (e) {
|
|
34
|
+
// Path doesn't exist, try next
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return join(packageRoot, 'skills');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Copy directory recursively
|
|
43
|
+
*/
|
|
44
|
+
function copyDir(src, dest) {
|
|
45
|
+
if (!existsSync(dest)) {
|
|
46
|
+
mkdirSync(dest, { recursive: true });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const entries = readdirSync(src, { withFileTypes: true });
|
|
50
|
+
|
|
51
|
+
for (const entry of entries) {
|
|
52
|
+
const srcPath = join(src, entry.name);
|
|
53
|
+
const destPath = join(dest, entry.name);
|
|
54
|
+
|
|
55
|
+
if (entry.isDirectory()) {
|
|
56
|
+
copyDir(srcPath, destPath);
|
|
57
|
+
} else {
|
|
58
|
+
copyFileSync(srcPath, destPath);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Initialize for Cursor
|
|
65
|
+
*/
|
|
66
|
+
function initCursor(projectPath) {
|
|
67
|
+
const skillsPath = getSkillsPath();
|
|
68
|
+
const targetSkillsPath = join(projectPath, 'skills');
|
|
69
|
+
|
|
70
|
+
console.log('📦 Setting up Doufang Skills for Cursor...');
|
|
71
|
+
|
|
72
|
+
// Copy skills directory to project
|
|
73
|
+
if (existsSync(skillsPath)) {
|
|
74
|
+
console.log(` Copying skills from ${skillsPath}...`);
|
|
75
|
+
copyDir(skillsPath, targetSkillsPath);
|
|
76
|
+
console.log(` ✅ Skills copied to ${targetSkillsPath}`);
|
|
77
|
+
} else {
|
|
78
|
+
console.error(` ❌ Skills directory not found at ${skillsPath}`);
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Create .cursorrules file
|
|
83
|
+
const cursorRulesPath = join(projectPath, '.cursorrules');
|
|
84
|
+
const cursorRules = `# Doufang Skills Configuration
|
|
85
|
+
|
|
86
|
+
This project uses Doufang Skills for generating Chinese New Year artwork.
|
|
87
|
+
|
|
88
|
+
## Available Skills
|
|
89
|
+
|
|
90
|
+
- \`generate-doufang-prompt\`: Generate professional Doufang artwork prompts
|
|
91
|
+
- \`generate-doufang-image\`: Generate Doufang artwork images using Gemini API
|
|
92
|
+
- \`optimize-doufang-prompt\`: Optimize prompts to reduce white margins
|
|
93
|
+
|
|
94
|
+
## Usage
|
|
95
|
+
|
|
96
|
+
Use the slash command: \`/doufang\` followed by your request.
|
|
97
|
+
|
|
98
|
+
Examples:
|
|
99
|
+
- \`/doufang Generate a prompt for wealth theme\`
|
|
100
|
+
- \`/doufang Create a 2K image using Gemini 3 Pro\`
|
|
101
|
+
- \`/doufang Optimize this prompt to reduce white space\`
|
|
102
|
+
|
|
103
|
+
Skills are located in the \`skills/\` directory.
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
writeFileSync(cursorRulesPath, cursorRules);
|
|
107
|
+
console.log(` ✅ Created ${cursorRulesPath}`);
|
|
108
|
+
|
|
109
|
+
console.log('\n✨ Cursor setup complete!');
|
|
110
|
+
console.log('\n📝 Usage:');
|
|
111
|
+
console.log(' Type "/doufang" in Cursor chat followed by your request');
|
|
112
|
+
console.log(' Example: /doufang Generate a prompt for wealth theme');
|
|
113
|
+
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Initialize for Windsurf
|
|
119
|
+
*/
|
|
120
|
+
function initWindsurf(projectPath) {
|
|
121
|
+
const skillsPath = getSkillsPath();
|
|
122
|
+
const targetSkillsPath = join(projectPath, 'skills');
|
|
123
|
+
|
|
124
|
+
console.log('📦 Setting up Doufang Skills for Windsurf...');
|
|
125
|
+
|
|
126
|
+
// Copy skills directory
|
|
127
|
+
if (existsSync(skillsPath)) {
|
|
128
|
+
console.log(` Copying skills from ${skillsPath}...`);
|
|
129
|
+
copyDir(skillsPath, targetSkillsPath);
|
|
130
|
+
console.log(` ✅ Skills copied to ${targetSkillsPath}`);
|
|
131
|
+
} else {
|
|
132
|
+
console.error(` ❌ Skills directory not found at ${skillsPath}`);
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Create .windsurfrules file
|
|
137
|
+
const windsurfRulesPath = join(projectPath, '.windsurfrules');
|
|
138
|
+
const windsurfRules = `# Doufang Skills Configuration
|
|
139
|
+
|
|
140
|
+
This project uses Doufang Skills for generating Chinese New Year artwork.
|
|
141
|
+
|
|
142
|
+
## Available Skills
|
|
143
|
+
|
|
144
|
+
- \`generate-doufang-prompt\`: Generate professional Doufang artwork prompts
|
|
145
|
+
- \`generate-doufang-image\`: Generate Doufang artwork images using Gemini API
|
|
146
|
+
- \`optimize-doufang-prompt\`: Optimize prompts to reduce white margins
|
|
147
|
+
|
|
148
|
+
## Usage
|
|
149
|
+
|
|
150
|
+
Use the slash command: \`/doufang\` followed by your request.
|
|
151
|
+
|
|
152
|
+
Examples:
|
|
153
|
+
- \`/doufang Generate a prompt for wealth theme\`
|
|
154
|
+
- \`/doufang Create a 2K image using Gemini 3 Pro\`
|
|
155
|
+
- \`/doufang Optimize this prompt to reduce white space\`
|
|
156
|
+
|
|
157
|
+
Skills are located in the \`skills/\` directory.
|
|
158
|
+
`;
|
|
159
|
+
|
|
160
|
+
writeFileSync(windsurfRulesPath, windsurfRules);
|
|
161
|
+
console.log(` ✅ Created ${windsurfRulesPath}`);
|
|
162
|
+
|
|
163
|
+
console.log('\n✨ Windsurf setup complete!');
|
|
164
|
+
console.log('\n📝 Usage:');
|
|
165
|
+
console.log(' Type "/doufang" in Windsurf chat followed by your request');
|
|
166
|
+
console.log(' Example: /doufang Generate a prompt for wealth theme');
|
|
167
|
+
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Initialize for Antigravity
|
|
173
|
+
*/
|
|
174
|
+
function initAntigravity(projectPath) {
|
|
175
|
+
const skillsPath = getSkillsPath();
|
|
176
|
+
const targetSkillsPath = join(projectPath, 'skills');
|
|
177
|
+
|
|
178
|
+
console.log('📦 Setting up Doufang Skills for Antigravity...');
|
|
179
|
+
|
|
180
|
+
// Copy skills directory
|
|
181
|
+
if (existsSync(skillsPath)) {
|
|
182
|
+
console.log(` Copying skills from ${skillsPath}...`);
|
|
183
|
+
copyDir(skillsPath, targetSkillsPath);
|
|
184
|
+
console.log(` ✅ Skills copied to ${targetSkillsPath}`);
|
|
185
|
+
} else {
|
|
186
|
+
console.error(` ❌ Skills directory not found at ${skillsPath}`);
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Create .antigravityrules file
|
|
191
|
+
const antigravityRulesPath = join(projectPath, '.antigravityrules');
|
|
192
|
+
const antigravityRules = `# Doufang Skills Configuration
|
|
193
|
+
|
|
194
|
+
This project uses Doufang Skills for generating Chinese New Year artwork.
|
|
195
|
+
|
|
196
|
+
## Available Skills
|
|
197
|
+
|
|
198
|
+
- \`generate-doufang-prompt\`: Generate professional Doufang artwork prompts
|
|
199
|
+
- \`generate-doufang-image\`: Generate Doufang artwork images using Gemini API
|
|
200
|
+
- \`optimize-doufang-prompt\`: Optimize prompts to reduce white margins
|
|
201
|
+
|
|
202
|
+
## Usage
|
|
203
|
+
|
|
204
|
+
Use the slash command: \`/doufang\` followed by your request.
|
|
205
|
+
|
|
206
|
+
Examples:
|
|
207
|
+
- \`/doufang Generate a prompt for wealth theme\`
|
|
208
|
+
- \`/doufang Create a 2K image using Gemini 3 Pro\`
|
|
209
|
+
- \`/doufang Optimize this prompt to reduce white space\`
|
|
210
|
+
|
|
211
|
+
Skills are located in the \`skills/\` directory.
|
|
212
|
+
`;
|
|
213
|
+
|
|
214
|
+
writeFileSync(antigravityRulesPath, antigravityRules);
|
|
215
|
+
console.log(` ✅ Created ${antigravityRulesPath}`);
|
|
216
|
+
|
|
217
|
+
console.log('\n✨ Antigravity setup complete!');
|
|
218
|
+
console.log('\n📝 Usage:');
|
|
219
|
+
console.log(' Type "/doufang" in Antigravity chat followed by your request');
|
|
220
|
+
console.log(' Example: /doufang Generate a prompt for wealth theme');
|
|
221
|
+
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Main CLI handler
|
|
227
|
+
*/
|
|
228
|
+
function main() {
|
|
229
|
+
const args = process.argv.slice(2);
|
|
230
|
+
const command = args[0];
|
|
231
|
+
|
|
232
|
+
// Parse --ai option
|
|
233
|
+
let aiOption = null;
|
|
234
|
+
for (let i = 0; i < args.length; i++) {
|
|
235
|
+
if (args[i] === '--ai' && args[i + 1]) {
|
|
236
|
+
aiOption = args[i + 1];
|
|
237
|
+
break;
|
|
238
|
+
} else if (args[i]?.startsWith('--ai=')) {
|
|
239
|
+
aiOption = args[i].replace('--ai=', '');
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (command !== 'init') {
|
|
245
|
+
console.log(`
|
|
246
|
+
Doufang Skills Initialization Tool
|
|
247
|
+
|
|
248
|
+
Usage:
|
|
249
|
+
doufang init --ai <ai-assistant>
|
|
250
|
+
|
|
251
|
+
Options:
|
|
252
|
+
--ai <assistant> AI assistant to configure (cursor, windsurf, antigravity, or claude)
|
|
253
|
+
|
|
254
|
+
Examples:
|
|
255
|
+
doufang init --ai cursor
|
|
256
|
+
doufang init --ai windsurf
|
|
257
|
+
doufang init --ai antigravity
|
|
258
|
+
doufang init --ai claude
|
|
259
|
+
|
|
260
|
+
For more information, visit:
|
|
261
|
+
https://github.com/poirotw66/Square_Couplets_Master
|
|
262
|
+
`);
|
|
263
|
+
process.exit(1);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (!aiOption) {
|
|
267
|
+
console.error('❌ Error: Please specify an AI assistant with --ai option');
|
|
268
|
+
console.error(' Example: doufang init --ai cursor');
|
|
269
|
+
process.exit(1);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const projectPath = process.cwd();
|
|
273
|
+
const ai = aiOption.toLowerCase();
|
|
274
|
+
|
|
275
|
+
let success = false;
|
|
276
|
+
|
|
277
|
+
switch (ai) {
|
|
278
|
+
case 'cursor':
|
|
279
|
+
success = initCursor(projectPath);
|
|
280
|
+
break;
|
|
281
|
+
case 'windsurf':
|
|
282
|
+
success = initWindsurf(projectPath);
|
|
283
|
+
break;
|
|
284
|
+
case 'antigravity':
|
|
285
|
+
success = initAntigravity(projectPath);
|
|
286
|
+
break;
|
|
287
|
+
case 'claude':
|
|
288
|
+
// Claude Code uses same setup as Cursor
|
|
289
|
+
success = initCursor(projectPath);
|
|
290
|
+
break;
|
|
291
|
+
default:
|
|
292
|
+
console.error(`❌ Error: Unknown AI assistant "${ai}"`);
|
|
293
|
+
console.error(' Supported: cursor, windsurf, antigravity, claude');
|
|
294
|
+
process.exit(1);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (!success) {
|
|
298
|
+
process.exit(1);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// Run CLI
|
|
303
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justin_666/square-couplets-master-skills",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Claude Agent Skills for generating Chinese New Year Doufang (diamond-shaped couplet) artwork using Google Gemini AI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "bin/doufang-skills.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"doufang-skills": "bin/doufang-skills.js"
|
|
8
|
+
"doufang-skills": "bin/doufang-skills.js",
|
|
9
|
+
"doufang": "bin/doufang-init.js"
|
|
9
10
|
},
|
|
10
11
|
"scripts": {
|
|
11
12
|
"dev": "vite",
|
|
12
13
|
"build": "vite build",
|
|
13
14
|
"preview": "vite preview",
|
|
14
|
-
"prepublishOnly": "node -e \"require('fs').chmodSync('bin/doufang-skills.js', 0o755)
|
|
15
|
+
"prepublishOnly": "node -e \"const fs = require('fs'); fs.chmodSync('bin/doufang-skills.js', 0o755); fs.chmodSync('bin/doufang-init.js', 0o755);\""
|
|
15
16
|
},
|
|
16
17
|
"keywords": [
|
|
17
18
|
"claude",
|
|
@@ -51,17 +52,21 @@
|
|
|
51
52
|
"engines": {
|
|
52
53
|
"node": ">=18.0.0"
|
|
53
54
|
},
|
|
54
|
-
"dependencies": {
|
|
55
|
-
"@google/genai": "^1.37.0",
|
|
56
|
-
"react": "^19.2.3",
|
|
57
|
-
"react-dom": "^19.2.3"
|
|
58
|
-
},
|
|
55
|
+
"dependencies": {},
|
|
59
56
|
"devDependencies": {
|
|
57
|
+
"@google/genai": "^1.37.0",
|
|
60
58
|
"@types/node": "^22.14.0",
|
|
61
59
|
"@vitejs/plugin-react": "^5.0.0",
|
|
62
60
|
"dotenv": "^17.2.3",
|
|
61
|
+
"react": "^19.2.3",
|
|
62
|
+
"react-dom": "^19.2.3",
|
|
63
63
|
"tsx": "^4.21.0",
|
|
64
64
|
"typescript": "~5.8.2",
|
|
65
65
|
"vite": "^6.2.0"
|
|
66
|
+
},
|
|
67
|
+
"overrides": {
|
|
68
|
+
"axios": ">=1.11.0",
|
|
69
|
+
"qs": ">=6.14.1",
|
|
70
|
+
"body-parser": ">=2.2.0"
|
|
66
71
|
}
|
|
67
72
|
}
|
package/skills/README.md
ADDED
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
# 春聯斗方大師 - Claude Agent Skills 使用指南
|
|
2
|
+
|
|
3
|
+
本目錄包含三個 Claude Agent Skills,可在 Cursor 或其他支援 Claude Agent Skills 協定的 AI IDE 中使用,用於生成傳統中國新年春聯斗方藝術作品。
|
|
4
|
+
|
|
5
|
+
## 📦 安裝方式
|
|
6
|
+
|
|
7
|
+
### 方式 1:從 npm 安裝(推薦)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @justin_666/square-couplets-master-skills
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
安裝後,您可以使用 CLI 工具訪問 skills:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# 列出所有可用的 skills
|
|
17
|
+
doufang-skills list
|
|
18
|
+
|
|
19
|
+
# 查看特定 skill 的內容
|
|
20
|
+
doufang-skills show generate-doufang-prompt
|
|
21
|
+
|
|
22
|
+
# 獲取 skill 文件路徑
|
|
23
|
+
doufang-skills path generate-doufang-image
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 方式 2:從 GitHub 克隆
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
git clone https://github.com/poirotw66/Square_Couplets_Master.git
|
|
30
|
+
cd Square_Couplets_Master
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
skills 文件位於 `skills/` 目錄中。
|
|
34
|
+
|
|
35
|
+
### 方式 3:本地安裝到專案
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install @justin_666/square-couplets-master-skills
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 🎯 在 Cursor / Windsurf / Antigravity 中使用
|
|
42
|
+
|
|
43
|
+
### 快速設置(推薦)
|
|
44
|
+
|
|
45
|
+
1. **安裝 CLI 工具**:
|
|
46
|
+
```bash
|
|
47
|
+
npm install -g @justin_666/square-couplets-master-skills
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
2. **前往您的專案**:
|
|
51
|
+
```bash
|
|
52
|
+
cd /path/to/your/project
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
3. **初始化 Skills**:
|
|
56
|
+
```bash
|
|
57
|
+
# Cursor
|
|
58
|
+
doufang init --ai cursor
|
|
59
|
+
|
|
60
|
+
# Windsurf
|
|
61
|
+
doufang init --ai windsurf
|
|
62
|
+
|
|
63
|
+
# Antigravity
|
|
64
|
+
doufang init --ai antigravity
|
|
65
|
+
|
|
66
|
+
# Claude Code
|
|
67
|
+
doufang init --ai claude
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
4. **使用 Slash Command**:
|
|
71
|
+
在 Cursor / Windsurf / Antigravity 的聊天中輸入:
|
|
72
|
+
```
|
|
73
|
+
/doufang Generate a prompt for wealth theme
|
|
74
|
+
/doufang Create a 2K image using Gemini 3 Pro
|
|
75
|
+
/doufang Optimize this prompt to reduce white space
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 手動設置
|
|
79
|
+
|
|
80
|
+
如果您想手動設置:
|
|
81
|
+
|
|
82
|
+
1. **確保 skills 目錄在專案根目錄**:
|
|
83
|
+
```
|
|
84
|
+
您的專案/
|
|
85
|
+
├── skills/
|
|
86
|
+
│ ├── generate-doufang-prompt/
|
|
87
|
+
│ │ └── SKILL.md
|
|
88
|
+
│ ├── generate-doufang-image/
|
|
89
|
+
│ │ └── SKILL.md
|
|
90
|
+
│ └── optimize-doufang-prompt/
|
|
91
|
+
│ └── SKILL.md
|
|
92
|
+
└── ...
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
2. **創建配置文件**:
|
|
96
|
+
- Cursor: 創建 `.cursorrules` 文件
|
|
97
|
+
- Windsurf: 創建 `.windsurfrules` 文件
|
|
98
|
+
- Antigravity: 創建 `.antigravityrules` 文件
|
|
99
|
+
|
|
100
|
+
### 使用方式
|
|
101
|
+
|
|
102
|
+
#### Slash Command(推薦)
|
|
103
|
+
|
|
104
|
+
使用 `/doufang` 後跟您的請求:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
/doufang Generate a prompt for wealth theme
|
|
108
|
+
/doufang Create a 2K image using Gemini 3 Pro
|
|
109
|
+
/doufang Optimize this prompt to reduce white space
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
#### 自動載入
|
|
113
|
+
|
|
114
|
+
當您在對話中輸入相關任務時,對應的 skill 會自動載入:
|
|
115
|
+
|
|
116
|
+
**示例對話:**
|
|
117
|
+
```
|
|
118
|
+
您: "幫我生成一個關於財富的春聯斗方 prompt"
|
|
119
|
+
AI: [自動載入 generate-doufang-prompt skill]
|
|
120
|
+
→ 生成提示詞和祝福語
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### 手動調用
|
|
124
|
+
|
|
125
|
+
您也可以直接提及 skill 名稱:
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
您: "使用 generate-doufang-prompt skill 為健康主題創建一個 Doufang prompt"
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
#### 組合使用
|
|
132
|
+
|
|
133
|
+
可以將多個 skills 組合使用:
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
您: "先生成一個關於龍馬精神的 prompt,然後優化它減少留白,最後用 Gemini 3 Pro 生成 2K 圖片"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## 📚 Skills 詳細說明
|
|
140
|
+
|
|
141
|
+
### 1. 📝 generate-doufang-prompt
|
|
142
|
+
|
|
143
|
+
**功能**:根據關鍵字生成專業的春聯斗方藝術作品提示詞
|
|
144
|
+
|
|
145
|
+
**使用場景**:
|
|
146
|
+
- 用戶提供關鍵字或願望短語(如:財富、健康、愛情)
|
|
147
|
+
- 需要生成傳統中國新年藝術作品提示詞
|
|
148
|
+
- 需要將關鍵字轉換為四字祝福語
|
|
149
|
+
|
|
150
|
+
**輸入示例**:
|
|
151
|
+
```
|
|
152
|
+
"幫我生成一個關於財富的春聯斗方 prompt"
|
|
153
|
+
"為健康長壽主題創建一個 Doufang prompt"
|
|
154
|
+
"生成一個關於事業成功的春聯斗方提示詞"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**輸出格式**:
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"blessingPhrase": "招財進寶",
|
|
161
|
+
"imagePrompt": "A diamond-shaped Chinese New Year Doufang couplet..."
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**關鍵字映射**:
|
|
166
|
+
- 財富 → 招財進寶, 富貴吉祥
|
|
167
|
+
- 健康 → 龍馬精神, 延年益壽
|
|
168
|
+
- 事業 → 大展宏圖, 步步高升
|
|
169
|
+
- 平安 → 平安喜樂, 歲歲平安
|
|
170
|
+
- 愛情 → 永結同心, 花好月圓
|
|
171
|
+
- 學業 → 學業有成, 金榜題名
|
|
172
|
+
|
|
173
|
+
### 2. 🎨 generate-doufang-image
|
|
174
|
+
|
|
175
|
+
**功能**:使用 Google Gemini API 生成實際的春聯斗方藝術作品圖片
|
|
176
|
+
|
|
177
|
+
**使用場景**:
|
|
178
|
+
- 用戶已有提示詞,想要生成實際圖片
|
|
179
|
+
- 需要測試不同模型或解析度
|
|
180
|
+
- 需要生成帶參考圖片風格的藝術作品
|
|
181
|
+
|
|
182
|
+
**支持的模型**:
|
|
183
|
+
- **Gemini 2.5 Flash** (`gemini-2.5-flash-image`)
|
|
184
|
+
- ⚡ 快速生成
|
|
185
|
+
- 📐 僅支持 1K 解析度 (1024×1024)
|
|
186
|
+
- ✅ 免費 API Key 友好
|
|
187
|
+
- 🎯 適合快速測試和迭代
|
|
188
|
+
|
|
189
|
+
- **Gemini 3 Pro** (`gemini-3-pro-image-preview`)
|
|
190
|
+
- ⭐ 高品質,細節豐富
|
|
191
|
+
- 📐 支持 1K / 2K / 4K 解析度
|
|
192
|
+
- 🎨 更好的風格理解
|
|
193
|
+
- 💰 需要付費 API Key(已啟用帳單)
|
|
194
|
+
- 🖼️ 適合最終作品和打印
|
|
195
|
+
|
|
196
|
+
**使用示例**:
|
|
197
|
+
```
|
|
198
|
+
"用 Gemini 3 Pro 生成 2K 解析度的圖片"
|
|
199
|
+
"使用這個 prompt 生成圖片,參考圖片風格"
|
|
200
|
+
"用 Flash 模型快速生成一個測試圖片"
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**參數**:
|
|
204
|
+
- `prompt` (必需): 圖片生成提示詞
|
|
205
|
+
- `model` (可選): `gemini-2.5-flash-image` 或 `gemini-3-pro-image-preview`
|
|
206
|
+
- `imageSize` (可選): `1K`, `2K`, `4K`(Pro 模型支持所有尺寸,Flash 僅支持 1K)
|
|
207
|
+
- `apiKey` (可選): Gemini API Key(如果未設置環境變數)
|
|
208
|
+
- `referenceImage` (可選): 參考圖片的 base64 編碼或文件路徑
|
|
209
|
+
|
|
210
|
+
### 3. ✨ optimize-doufang-prompt
|
|
211
|
+
|
|
212
|
+
**功能**:優化 Doufang 提示詞,減少過多留白,改善構圖
|
|
213
|
+
|
|
214
|
+
**使用場景**:
|
|
215
|
+
- 生成的圖片留白過多
|
|
216
|
+
- 需要改善提示詞品質
|
|
217
|
+
- 生成的圖片構圖不佳
|
|
218
|
+
- 需要更緊湊的構圖
|
|
219
|
+
|
|
220
|
+
**優化重點**:
|
|
221
|
+
- ❌ 移除「寬留白」、「generous margins」等描述
|
|
222
|
+
- ✅ 改為「最小留白(2-5%)」
|
|
223
|
+
- ✅ 確保 Doufang 佔據 85-95% 的畫面空間
|
|
224
|
+
- ✅ 強調視覺衝擊力而非安全邊距
|
|
225
|
+
|
|
226
|
+
**使用示例**:
|
|
227
|
+
```
|
|
228
|
+
"優化這個 prompt,減少留白"
|
|
229
|
+
"改善構圖,讓 Doufang 佔據更多畫面"
|
|
230
|
+
"這個 prompt 生成的圖片留白太多,幫我優化一下"
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**優化規則**:
|
|
234
|
+
- 將「wide white margins」改為「minimal elegant margins (2-5%)」
|
|
235
|
+
- 將「generous blank margins」改為「Doufang occupies 85-95% of image area」
|
|
236
|
+
- 添加「maximize visual impact」等強調語句
|
|
237
|
+
|
|
238
|
+
## 🔄 工作流程示例
|
|
239
|
+
|
|
240
|
+
### 完整工作流程
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
1. 生成 Prompt
|
|
244
|
+
→ "幫我生成一個關於財富的春聯斗方 prompt"
|
|
245
|
+
→ [使用 generate-doufang-prompt]
|
|
246
|
+
→ 獲得: blessingPhrase + imagePrompt
|
|
247
|
+
|
|
248
|
+
2. (可選)優化 Prompt
|
|
249
|
+
→ "優化這個 prompt,減少留白"
|
|
250
|
+
→ [使用 optimize-doufang-prompt]
|
|
251
|
+
→ 獲得: 優化後的 imagePrompt
|
|
252
|
+
|
|
253
|
+
3. 生成圖片
|
|
254
|
+
→ "用 Gemini 3 Pro 生成 2K 解析度的圖片"
|
|
255
|
+
→ [使用 generate-doufang-image]
|
|
256
|
+
→ 獲得: 生成的圖片(base64 或文件)
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### 快速測試流程
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
1. "生成一個關於健康的 prompt 並用 Flash 模型快速生成圖片"
|
|
263
|
+
→ [自動組合使用 generate-doufang-prompt + generate-doufang-image]
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### 高品質作品流程
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
1. "生成一個關於龍馬精神的 prompt"
|
|
270
|
+
2. "優化這個 prompt,確保構圖緊湊"
|
|
271
|
+
3. "用 Gemini 3 Pro 生成 4K 解析度的圖片,參考這張圖片風格"
|
|
272
|
+
→ [上傳參考圖片]
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## ⚙️ 配置要求
|
|
276
|
+
|
|
277
|
+
### API Key 設置
|
|
278
|
+
|
|
279
|
+
使用 `generate-doufang-image` skill 時需要 Google Gemini API Key:
|
|
280
|
+
|
|
281
|
+
**方法 1:環境變數(推薦)**
|
|
282
|
+
```bash
|
|
283
|
+
export GEMINI_API_KEY="your-api-key-here"
|
|
284
|
+
# 或
|
|
285
|
+
export API_KEY="your-api-key-here"
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**方法 2:在對話中提供**
|
|
289
|
+
```
|
|
290
|
+
您: "使用這個 API Key: xxxxx 生成圖片"
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
**獲取 API Key**:
|
|
294
|
+
1. 前往 [Google AI Studio](https://aistudio.google.com/)
|
|
295
|
+
2. 登入您的 Google 帳號
|
|
296
|
+
3. 創建新的 API Key
|
|
297
|
+
4. 複製並保存(只顯示一次)
|
|
298
|
+
|
|
299
|
+
### 模型選擇建議
|
|
300
|
+
|
|
301
|
+
| 用途 | 推薦模型 | 解析度 | 原因 |
|
|
302
|
+
|------|---------|--------|------|
|
|
303
|
+
| 快速測試 | Gemini 2.5 Flash | 1K | 速度快,免費友好 |
|
|
304
|
+
| 迭代設計 | Gemini 2.5 Flash | 1K | 快速反饋 |
|
|
305
|
+
| 最終作品 | Gemini 3 Pro | 2K/4K | 高品質,細節豐富 |
|
|
306
|
+
| 打印用途 | Gemini 3 Pro | 4K | 最高解析度 |
|
|
307
|
+
|
|
308
|
+
## 🐛 常見問題
|
|
309
|
+
|
|
310
|
+
### Q: Cursor 無法識別 skills?
|
|
311
|
+
|
|
312
|
+
**A**: 確保:
|
|
313
|
+
1. `skills/` 目錄在專案根目錄
|
|
314
|
+
2. 每個 skill 都有 `SKILL.md` 文件
|
|
315
|
+
3. `SKILL.md` 文件包含正確的 frontmatter(name, description)
|
|
316
|
+
|
|
317
|
+
### Q: 如何確認 skills 已載入?
|
|
318
|
+
|
|
319
|
+
**A**: 在 Cursor 中,當您提到相關任務時,AI 應該會自動使用對應的 skill。您也可以直接問:
|
|
320
|
+
```
|
|
321
|
+
"列出可用的 Doufang skills"
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Q: 生成的圖片留白太多?
|
|
325
|
+
|
|
326
|
+
**A**: 使用 `optimize-doufang-prompt` skill:
|
|
327
|
+
```
|
|
328
|
+
"優化這個 prompt,減少留白,讓 Doufang 佔據 85-95% 的畫面"
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Q: Flash 模型不支持 2K/4K?
|
|
332
|
+
|
|
333
|
+
**A**: 正確。Flash 模型僅支持 1K (1024×1024)。如需更高解析度,請使用 Gemini 3 Pro 模型。
|
|
334
|
+
|
|
335
|
+
### Q: Pro 模型需要付費?
|
|
336
|
+
|
|
337
|
+
**A**: 是的,Gemini 3 Pro 需要已啟用帳單的 API Key。如果您的 API Key 未啟用帳單,請使用 Gemini 2.5 Flash 模型。
|
|
338
|
+
|
|
339
|
+
### Q: 如何添加參考圖片?
|
|
340
|
+
|
|
341
|
+
**A**: 在對話中提及參考圖片:
|
|
342
|
+
```
|
|
343
|
+
"使用這個 prompt 生成圖片,參考這張圖片 [上傳圖片]"
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
或使用文件路徑:
|
|
347
|
+
```
|
|
348
|
+
"使用這個 prompt 生成圖片,參考圖片路徑: ./images/reference.png"
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
## 📖 更多資源
|
|
352
|
+
|
|
353
|
+
- **專案主頁**: https://github.com/poirotw66/Square_Couplets_Master
|
|
354
|
+
- **npm 包**: https://www.npmjs.com/package/@justin_666/square-couplets-master-skills
|
|
355
|
+
- **問題回報**: https://github.com/poirotw66/Square_Couplets_Master/issues
|
|
356
|
+
|
|
357
|
+
## 📝 Skills 文件結構
|
|
358
|
+
|
|
359
|
+
```
|
|
360
|
+
skills/
|
|
361
|
+
├── README.md # 本文件
|
|
362
|
+
├── generate-doufang-prompt/
|
|
363
|
+
│ └── SKILL.md # 生成提示詞 skill
|
|
364
|
+
├── generate-doufang-image/
|
|
365
|
+
│ └── SKILL.md # 生成圖片 skill
|
|
366
|
+
└── optimize-doufang-prompt/
|
|
367
|
+
└── SKILL.md # 優化提示詞 skill
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
每個 `SKILL.md` 文件包含:
|
|
371
|
+
- **Frontmatter**: name, description
|
|
372
|
+
- **Instructions**: 詳細的使用說明
|
|
373
|
+
- **Examples**: 使用示例
|
|
374
|
+
- **Parameters**: 參數說明
|
|
375
|
+
|
|
376
|
+
## 🎓 學習資源
|
|
377
|
+
|
|
378
|
+
### 了解 Claude Agent Skills
|
|
379
|
+
|
|
380
|
+
Claude Agent Skills 是一個協定,允許 AI IDE(如 Cursor)載入和使用預定義的技能。每個 skill 是一個 Markdown 文件,包含:
|
|
381
|
+
- 技能名稱和描述
|
|
382
|
+
- 使用說明
|
|
383
|
+
- 示例和參數
|
|
384
|
+
|
|
385
|
+
### 最佳實踐
|
|
386
|
+
|
|
387
|
+
1. **明確描述需求**:清楚地說明您想要什麼
|
|
388
|
+
2. **逐步執行**:對於複雜任務,分步驟執行
|
|
389
|
+
3. **提供上下文**:如果使用參考圖片,明確說明
|
|
390
|
+
4. **檢查輸出**:生成後檢查結果,必要時優化
|
|
391
|
+
|
|
392
|
+
## 🤝 貢獻
|
|
393
|
+
|
|
394
|
+
歡迎提交問題和改進建議!如果您想:
|
|
395
|
+
- 報告 bug
|
|
396
|
+
- 請求新功能
|
|
397
|
+
- 改進文檔
|
|
398
|
+
- 提交 Pull Request
|
|
399
|
+
|
|
400
|
+
請前往 [GitHub Issues](https://github.com/poirotw66/Square_Couplets_Master/issues)
|
|
401
|
+
|
|
402
|
+
---
|
|
403
|
+
|
|
404
|
+
**授權**: CC BY-NC-SA 4.0 (Creative Commons Attribution-NonCommercial-ShareAlike 4.0)
|
|
405
|
+
|
|
406
|
+
**作者**: Justin
|
|
407
|
+
|
|
408
|
+
**最後更新**: 2026-01-19
|