@justin_666/square-couplets-master-skills 1.0.1 → 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 -2
- package/bin/doufang-init.js +303 -0
- package/package.json +4 -3
- package/skills/README.md +53 -17
package/README.md
CHANGED
|
@@ -136,13 +136,46 @@
|
|
|
136
136
|
|
|
137
137
|
本專案的 Claude Agent Skills 已發布到 npm,可以通過以下方式安裝:
|
|
138
138
|
|
|
139
|
-
###
|
|
139
|
+
### 全域安裝 CLI(推薦)
|
|
140
140
|
|
|
141
141
|
```bash
|
|
142
142
|
npm install -g @justin_666/square-couplets-master-skills
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
-
|
|
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` 命令:
|
|
146
179
|
|
|
147
180
|
```bash
|
|
148
181
|
# 列出所有可用的 skills
|
|
@@ -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",
|
package/skills/README.md
CHANGED
|
@@ -38,13 +38,46 @@ skills 文件位於 `skills/` 目錄中。
|
|
|
38
38
|
npm install @justin_666/square-couplets-master-skills
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
## 🎯 在 Cursor 中使用
|
|
41
|
+
## 🎯 在 Cursor / Windsurf / Antigravity 中使用
|
|
42
42
|
|
|
43
|
-
###
|
|
43
|
+
### 快速設置(推薦)
|
|
44
44
|
|
|
45
|
-
|
|
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
|
+
### 手動設置
|
|
46
79
|
|
|
47
|
-
|
|
80
|
+
如果您想手動設置:
|
|
48
81
|
|
|
49
82
|
1. **確保 skills 目錄在專案根目錄**:
|
|
50
83
|
```
|
|
@@ -59,29 +92,32 @@ Cursor 會自動掃描專案目錄中的 `skills/` 文件夾。有兩種方式
|
|
|
59
92
|
└── ...
|
|
60
93
|
```
|
|
61
94
|
|
|
62
|
-
2.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
```
|
|
95
|
+
2. **創建配置文件**:
|
|
96
|
+
- Cursor: 創建 `.cursorrules` 文件
|
|
97
|
+
- Windsurf: 創建 `.windsurfrules` 文件
|
|
98
|
+
- Antigravity: 創建 `.antigravityrules` 文件
|
|
67
99
|
|
|
68
|
-
|
|
100
|
+
### 使用方式
|
|
69
101
|
|
|
70
|
-
|
|
71
|
-
2. 將 skills 文件複製到該目錄
|
|
72
|
-
3. 在 Cursor 設置中配置 skills 路徑
|
|
102
|
+
#### Slash Command(推薦)
|
|
73
103
|
|
|
74
|
-
|
|
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
|
+
```
|
|
75
111
|
|
|
76
112
|
#### 自動載入
|
|
77
113
|
|
|
78
|
-
|
|
114
|
+
當您在對話中輸入相關任務時,對應的 skill 會自動載入:
|
|
79
115
|
|
|
80
116
|
**示例對話:**
|
|
81
117
|
```
|
|
82
118
|
您: "幫我生成一個關於財富的春聯斗方 prompt"
|
|
83
|
-
|
|
84
|
-
|
|
119
|
+
AI: [自動載入 generate-doufang-prompt skill]
|
|
120
|
+
→ 生成提示詞和祝福語
|
|
85
121
|
```
|
|
86
122
|
|
|
87
123
|
#### 手動調用
|