ginskill-init 2.7.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.
Files changed (128) hide show
  1. package/.wrangler/cache/pages.json +4 -0
  2. package/.wrangler/cache/wrangler-account.json +6 -0
  3. package/DEVELOPMENT.md +510 -0
  4. package/README.md +104 -0
  5. package/agents/developer.md +56 -0
  6. package/agents/frontend-design.md +69 -0
  7. package/agents/mobile-reviewer.md +36 -0
  8. package/agents/review-code.md +49 -0
  9. package/agents/security-scanner.md +50 -0
  10. package/agents/tester.md +72 -0
  11. package/bin/cli.js +461 -0
  12. package/landing/ai-build-ai.png +0 -0
  13. package/landing/index.html +1495 -0
  14. package/landing/logo.png +0 -0
  15. package/package.json +37 -0
  16. package/skills/active-life-dev/SKILL.md +157 -0
  17. package/skills/active-life-dev/docs/auth.md +187 -0
  18. package/skills/active-life-dev/docs/customers.md +216 -0
  19. package/skills/active-life-dev/docs/integrations.md +209 -0
  20. package/skills/active-life-dev/docs/inventory.md +192 -0
  21. package/skills/active-life-dev/docs/modules.md +181 -0
  22. package/skills/active-life-dev/docs/orders.md +180 -0
  23. package/skills/active-life-dev/docs/patterns.md +319 -0
  24. package/skills/active-life-dev/docs/products.md +216 -0
  25. package/skills/active-life-dev/docs/schema.md +502 -0
  26. package/skills/active-life-dev/docs/setup.md +169 -0
  27. package/skills/active-life-dev/docs/vouchers.md +144 -0
  28. package/skills/ai-asset-generator/SKILL.md +247 -0
  29. package/skills/ai-asset-generator/docs/gen-image.md +274 -0
  30. package/skills/ai-asset-generator/docs/genvideo.md +341 -0
  31. package/skills/ai-asset-generator/docs/remove-background.md +19 -0
  32. package/skills/ai-asset-generator/lib/bg-remove.mjs +34 -0
  33. package/skills/ai-asset-generator/lib/env.mjs +48 -0
  34. package/skills/ai-asset-generator/lib/kie-client.mjs +100 -0
  35. package/skills/ai-build-ai/SKILL.md +127 -0
  36. package/skills/ai-build-ai/docs/agent-teams.md +293 -0
  37. package/skills/ai-build-ai/docs/checkpointing.md +161 -0
  38. package/skills/ai-build-ai/docs/create-agent.md +399 -0
  39. package/skills/ai-build-ai/docs/create-mcp.md +395 -0
  40. package/skills/ai-build-ai/docs/create-skill.md +299 -0
  41. package/skills/ai-build-ai/docs/headless-mode.md +614 -0
  42. package/skills/ai-build-ai/docs/hooks.md +578 -0
  43. package/skills/ai-build-ai/docs/memory-claude-md.md +375 -0
  44. package/skills/ai-build-ai/docs/output-styles.md +208 -0
  45. package/skills/ai-build-ai/docs/overview.md +162 -0
  46. package/skills/ai-build-ai/docs/permissions.md +391 -0
  47. package/skills/ai-build-ai/docs/plugins.md +396 -0
  48. package/skills/ai-build-ai/docs/sandbox.md +262 -0
  49. package/skills/ai-build-ai/docs/team-lead-workflow.md +648 -0
  50. package/skills/ant-design/SKILL.md +323 -0
  51. package/skills/ant-design/docs/components.md +160 -0
  52. package/skills/ant-design/docs/data-entry.md +406 -0
  53. package/skills/ant-design/docs/display.md +594 -0
  54. package/skills/ant-design/docs/feedback.md +451 -0
  55. package/skills/ant-design/docs/key-components.md +414 -0
  56. package/skills/ant-design/docs/navigation.md +310 -0
  57. package/skills/ant-design/docs/pro-components.md +543 -0
  58. package/skills/ant-design/docs/setup.md +213 -0
  59. package/skills/ant-design/docs/theme.md +265 -0
  60. package/skills/flutter-performance/SKILL.md +803 -0
  61. package/skills/flutter-performance/references/flutter-patterns.md +595 -0
  62. package/skills/icon-generator/SKILL.md +270 -0
  63. package/skills/mobile-app-review/SKILL.md +321 -0
  64. package/skills/mobile-app-review/references/apple-review.md +132 -0
  65. package/skills/mobile-app-review/references/google-play-review.md +203 -0
  66. package/skills/mongodb/SKILL.md +667 -0
  67. package/skills/mongodb/references/mongoose-patterns.md +368 -0
  68. package/skills/nestjs-architecture/SKILL.md +1086 -0
  69. package/skills/nestjs-architecture/references/advanced-patterns.md +590 -0
  70. package/skills/performance/SKILL.md +509 -0
  71. package/skills/react-fsd-architecture/SKILL.md +693 -0
  72. package/skills/react-fsd-architecture/references/fsd-patterns.md +747 -0
  73. package/skills/react-native-expo/SKILL.md +128 -0
  74. package/skills/react-native-expo/references/data-layer.md +252 -0
  75. package/skills/react-native-expo/references/design-system.md +252 -0
  76. package/skills/react-native-expo/references/navigation.md +199 -0
  77. package/skills/react-native-expo/references/performance.md +229 -0
  78. package/skills/react-native-expo/references/platform-services.md +179 -0
  79. package/skills/react-native-expo/references/state-management.md +209 -0
  80. package/skills/react-native-expo/references/ui-patterns.md +301 -0
  81. package/skills/react-query/SKILL.md +685 -0
  82. package/skills/react-query/references/query-patterns.md +365 -0
  83. package/skills/review-code/SKILL.md +374 -0
  84. package/skills/review-code/references/clean-code-principles.md +395 -0
  85. package/skills/review-code/references/frontend-patterns.md +136 -0
  86. package/skills/review-code/references/nestjs-patterns.md +184 -0
  87. package/skills/security-scanner/SKILL.md +366 -0
  88. package/skills/security-scanner/references/nestjs-security.md +260 -0
  89. package/skills/security-scanner/references/nextjs-security.md +201 -0
  90. package/skills/security-scanner/references/react-native-security.md +199 -0
  91. package/skills/traefik/SKILL.md +105 -0
  92. package/skills/traefik/docs/advanced-routing.md +186 -0
  93. package/skills/traefik/docs/auth-providers.md +137 -0
  94. package/skills/traefik/docs/cicd-devops.md +396 -0
  95. package/skills/traefik/docs/core-config.md +171 -0
  96. package/skills/traefik/docs/distributed-config.md +96 -0
  97. package/skills/traefik/docs/docker-compose.md +182 -0
  98. package/skills/traefik/docs/ha-performance.md +177 -0
  99. package/skills/traefik/docs/kubernetes.md +278 -0
  100. package/skills/traefik/docs/middleware.md +205 -0
  101. package/skills/traefik/docs/monitoring.md +357 -0
  102. package/skills/traefik/docs/security.md +391 -0
  103. package/skills/traefik/docs/tls-acme.md +155 -0
  104. package/skills/ui-ux-pro-max/SKILL.md +377 -0
  105. package/skills/ui-ux-pro-max/data/charts.csv +26 -0
  106. package/skills/ui-ux-pro-max/data/colors.csv +97 -0
  107. package/skills/ui-ux-pro-max/data/icons.csv +101 -0
  108. package/skills/ui-ux-pro-max/data/landing.csv +31 -0
  109. package/skills/ui-ux-pro-max/data/products.csv +97 -0
  110. package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  111. package/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  112. package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  113. package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  114. package/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  115. package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  116. package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  117. package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  118. package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  119. package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  120. package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  121. package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  122. package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  123. package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  124. package/skills/ui-ux-pro-max/data/styles.csv +68 -0
  125. package/skills/ui-ux-pro-max/data/typography.csv +58 -0
  126. package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  127. package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  128. package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
@@ -0,0 +1,341 @@
1
+ POST
2
+ /api/v1/jobs/createTask
3
+ Create Task
4
+ Create a new generation task
5
+
6
+ Request Parameters
7
+ The API accepts a JSON payload with the following structure:
8
+
9
+ Request Body Structure
10
+ {
11
+ "model": "string",
12
+ "callBackUrl": "string (optional)",
13
+ "input": {
14
+ // Input parameters based on form configuration
15
+ }
16
+ }
17
+ Root Level Parameters
18
+ model
19
+ Required
20
+ string
21
+ The model name to use for generation
22
+
23
+ Example:
24
+
25
+ "bytedance/v1-pro-image-to-video"
26
+ callBackUrl
27
+ Optional
28
+ string
29
+ Callback URL for task completion notifications. Optional parameter. If provided, the system will send POST requests to this URL when the task completes (success or failure). If not provided, no callback notifications will be sent.
30
+
31
+ Example:
32
+
33
+ "https://your-domain.com/api/callback"
34
+ Input Object Parameters
35
+ The input object contains the following parameters based on the form configuration:
36
+
37
+ input.prompt
38
+ Required
39
+ string
40
+ The text prompt used to generate the video
41
+
42
+ Max length: 10000 characters
43
+ Example:
44
+
45
+ "A golden retriever dashing through shallow surf at the beach, back angle camera low near waterline, splashes frozen in time, blur trails in waves and paws, afternoon sun glinting off wet fur, overcast day, dramatic clouds"
46
+ input.image_url
47
+ Required
48
+ string(URL)
49
+ The URL of the image used to generate video
50
+
51
+ Please provide the URL of the uploaded file; Accepted types: image/jpeg, image/png, image/webp; Max size: 10.0MB
52
+ Example:
53
+
54
+ "https://file.aiquickdraw.com/custom-page/akr/section-images/1755179021328w1nhip18.webp"
55
+ input.resolution
56
+ Optional
57
+ string
58
+ Video resolution - 480p for faster generation, 720p for balance, 1080p for higher quality
59
+
60
+ Available options:
61
+
62
+ 480p
63
+ -
64
+ 480p
65
+ 720p
66
+ -
67
+ 720p
68
+ 1080p
69
+ -
70
+ 1080p
71
+ Example:
72
+
73
+ "720p"
74
+ input.duration
75
+ Optional
76
+ string
77
+ Duration of the video in seconds
78
+
79
+ Available options:
80
+
81
+ 5
82
+ -
83
+ 5s
84
+ 10
85
+ -
86
+ 10s
87
+ Example:
88
+
89
+ "5"
90
+ input.camera_fixed
91
+ Optional
92
+ boolean
93
+ Whether to fix the camera position
94
+
95
+ Boolean value (true/false)
96
+ Example:
97
+
98
+ false
99
+ input.seed
100
+ Optional
101
+ number
102
+ Random seed to control video generation. Use -1 for random.
103
+
104
+ Min: -1, Max: 2147483647, Step: 1
105
+ Example:
106
+
107
+ -1
108
+ input.enable_safety_checker
109
+ Optional
110
+ boolean
111
+ The safety checker is always enabled in Playground. It can only be disabled by setting false through the API.
112
+
113
+ Boolean value (true/false)
114
+ Example:
115
+
116
+ true
117
+ Request Example
118
+
119
+ cURL
120
+
121
+ JavaScript
122
+
123
+ Python
124
+ curl -X POST "https://api.kie.ai/api/v1/jobs/createTask" \
125
+ -H "Content-Type: application/json" \
126
+ -H "Authorization: Bearer YOUR_API_KEY" \
127
+ -d '{
128
+ "model": "bytedance/v1-pro-image-to-video",
129
+ "callBackUrl": "https://your-domain.com/api/callback",
130
+ "input": {
131
+ "prompt": "A golden retriever dashing through shallow surf at the beach, back angle camera low near waterline, splashes frozen in time, blur trails in waves and paws, afternoon sun glinting off wet fur, overcast day, dramatic clouds",
132
+ "image_url": "https://file.aiquickdraw.com/custom-page/akr/section-images/1755179021328w1nhip18.webp",
133
+ "resolution": "720p",
134
+ "duration": "5",
135
+ "camera_fixed": false,
136
+ "seed": -1,
137
+ "enable_safety_checker": true
138
+ }
139
+ }'
140
+ Response Example
141
+ {
142
+ "code": 200,
143
+ "message": "success",
144
+ "data": {
145
+ "taskId": "task_12345678"
146
+ }
147
+ }
148
+ Response Fields
149
+ code
150
+ Status code, 200 for success, others for failure
151
+ message
152
+ Response message, error description when failed
153
+ data.taskId
154
+ Task ID for querying task status
155
+ Callback Notifications
156
+ When you provide the callBackUrl parameter when creating a task, the system will send POST requests to the specified URL upon task completion (success or failure).
157
+
158
+ Success Callback Example
159
+ {
160
+ "code": 200,
161
+ "data": {
162
+ "completeTime": 1755599644000,
163
+ "costTime": 8,
164
+ "createTime": 1755599634000,
165
+ "model": "bytedance/v1-pro-image-to-video",
166
+ "param": "{\"callBackUrl\":\"https://your-domain.com/api/callback\",\"model\":\"bytedance/v1-pro-image-to-video\",\"input\":{\"prompt\":\"A golden retriever dashing through shallow surf at the beach, back angle camera low near waterline, splashes frozen in time, blur trails in waves and paws, afternoon sun glinting off wet fur, overcast day, dramatic clouds\",\"image_url\":\"https://file.aiquickdraw.com/custom-page/akr/section-images/1755179021328w1nhip18.webp\",\"resolution\":\"720p\",\"duration\":\"5\",\"camera_fixed\":false,\"seed\":-1,\"enable_safety_checker\":true}}",
167
+ "resultJson": "{\"resultUrls\":[\"https://example.com/generated-image.jpg\"]}",
168
+ "state": "success",
169
+ "taskId": "e989621f54392584b05867f87b160672",
170
+ "failCode": null,
171
+ "failMsg": null,
172
+ },
173
+ "msg": "Playground task completed successfully."
174
+ }
175
+ Failure Callback Example
176
+ {
177
+ "code": 501,
178
+ "data": {
179
+ "completeTime": 1755597081000,
180
+ "costTime": 0,
181
+ "createTime": 1755596341000,
182
+ "failCode": "500",
183
+ "failMsg": "Internal server error",
184
+ "model": "bytedance/v1-pro-image-to-video",
185
+ "param": "{\"callBackUrl\":\"https://your-domain.com/api/callback\",\"model\":\"bytedance/v1-pro-image-to-video\",\"input\":{\"prompt\":\"A golden retriever dashing through shallow surf at the beach, back angle camera low near waterline, splashes frozen in time, blur trails in waves and paws, afternoon sun glinting off wet fur, overcast day, dramatic clouds\",\"image_url\":\"https://file.aiquickdraw.com/custom-page/akr/section-images/1755179021328w1nhip18.webp\",\"resolution\":\"720p\",\"duration\":\"5\",\"camera_fixed\":false,\"seed\":-1,\"enable_safety_checker\":true}}",
186
+ "state": "fail",
187
+ "taskId": "bd3a37c523149e4adf45a3ddb5faf1a8",
188
+ "resultJson": null,
189
+ },
190
+ "msg": "Playground task failed."
191
+ }
192
+ Important Notes
193
+ The callback content structure is identical to the Query Task API response
194
+ The param field contains the complete Create Task request parameters, not just the input section
195
+ If callBackUrl is not provided, no callback notifications will be sent
196
+
197
+ GET
198
+ /api/v1/jobs/recordInfo
199
+ Query Task
200
+ Query task status and results by task ID
201
+
202
+ Request Example
203
+
204
+ cURL
205
+
206
+ JavaScript
207
+
208
+ Python
209
+ curl -X GET "https://api.kie.ai/api/v1/jobs/recordInfo?taskId=task_12345678" \
210
+ -H "Authorization: Bearer YOUR_API_KEY"
211
+ Response Example
212
+ {
213
+ "code": 200,
214
+ "message": "success",
215
+ "data": {
216
+ "taskId": "task_12345678",
217
+ "model": "bytedance/v1-pro-image-to-video",
218
+ "state": "success",
219
+ "param": "{\"model\":\"bytedance/v1-pro-image-to-video\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"input\":{\"prompt\":\"A golden retriever dashing through shallow surf at the beach, back angle camera low near waterline, splashes frozen in time, blur trails in waves and paws, afternoon sun glinting off wet fur, overcast day, dramatic clouds\",\"image_url\":\"https://file.aiquickdraw.com/custom-page/akr/section-images/1755179021328w1nhip18.webp\",\"resolution\":\"720p\",\"duration\":\"5\",\"camera_fixed\":false,\"seed\":-1,\"enable_safety_checker\":true}}",
220
+ "resultJson": "{\"resultUrls\":[\"https://example.com/generated-image.jpg\"]}",
221
+ "failCode": "",
222
+ "failMsg": "",
223
+ "costTime": 0,
224
+ "completeTime": 1698765432000,
225
+ "createTime": 1698765400000
226
+ }
227
+ }
228
+ Response Fields
229
+ code
230
+ Status code, 200 for success, others for failure
231
+ message
232
+ Response message, error description when failed
233
+ data.taskId
234
+ Task ID
235
+ data.model
236
+ Model used for generation
237
+ data.state
238
+ Generation state
239
+ data.param
240
+ Complete Create Task request parameters as JSON string (includes model, callBackUrl, input and all other parameters)
241
+ data.resultJson
242
+ Result JSON string containing generated media URLs
243
+ data.failCode
244
+ Error code (when generation failed)
245
+ data.failMsg
246
+ Error message (when generation failed)
247
+ data.completeTime
248
+ Completion timestamp
249
+ data.createTime
250
+ Creation timestamp
251
+ data.costTime
252
+ Cost time in milliseconds
253
+ State Values
254
+ waiting
255
+ Waiting for generation
256
+ queuing
257
+ In queue
258
+ generating
259
+ Generating
260
+ success
261
+ Generation successful
262
+ fail
263
+ Generation failed
264
+
265
+
266
+ example input
267
+ GET
268
+ /api/v1/jobs/recordInfo
269
+ Query Task
270
+ Query task status and results by task ID
271
+
272
+ Request Example
273
+
274
+ cURL
275
+
276
+ JavaScript
277
+
278
+ Python
279
+ curl -X GET "https://api.kie.ai/api/v1/jobs/recordInfo?taskId=task_12345678" \
280
+ -H "Authorization: Bearer YOUR_API_KEY"
281
+ Response Example
282
+ {
283
+ "code": 200,
284
+ "message": "success",
285
+ "data": {
286
+ "taskId": "task_12345678",
287
+ "model": "bytedance/v1-pro-image-to-video",
288
+ "state": "success",
289
+ "param": "{\"model\":\"bytedance/v1-pro-image-to-video\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"input\":{\"prompt\":\"A golden retriever dashing through shallow surf at the beach, back angle camera low near waterline, splashes frozen in time, blur trails in waves and paws, afternoon sun glinting off wet fur, overcast day, dramatic clouds\",\"image_url\":\"https://file.aiquickdraw.com/custom-page/akr/section-images/1755179021328w1nhip18.webp\",\"resolution\":\"720p\",\"duration\":\"5\",\"camera_fixed\":false,\"seed\":-1,\"enable_safety_checker\":true}}",
290
+ "resultJson": "{\"resultUrls\":[\"https://example.com/generated-image.jpg\"]}",
291
+ "failCode": "",
292
+ "failMsg": "",
293
+ "costTime": 0,
294
+ "completeTime": 1698765432000,
295
+ "createTime": 1698765400000
296
+ }
297
+ }
298
+ Response Fields
299
+ code
300
+ Status code, 200 for success, others for failure
301
+ message
302
+ Response message, error description when failed
303
+ data.taskId
304
+ Task ID
305
+ data.model
306
+ Model used for generation
307
+ data.state
308
+ Generation state
309
+ data.param
310
+ Complete Create Task request parameters as JSON string (includes model, callBackUrl, input and all other parameters)
311
+ data.resultJson
312
+ Result JSON string containing generated media URLs
313
+ data.failCode
314
+ Error code (when generation failed)
315
+ data.failMsg
316
+ Error message (when generation failed)
317
+ data.completeTime
318
+ Completion timestamp
319
+ data.createTime
320
+ Creation timestamp
321
+ data.costTime
322
+ Cost time in milliseconds
323
+ State Values
324
+ waiting
325
+ Waiting for generation
326
+ queuing
327
+ In queue
328
+ generating
329
+ Generating
330
+ success
331
+ Generation successful
332
+ fail
333
+ Generation failed
334
+
335
+
336
+ ouput
337
+ {
338
+ "resultUrls": [
339
+ "https://file.aiquickdraw.com/custom-page/akr/section-images/17551796948046brblmi1.mp4"
340
+ ]
341
+ }
@@ -0,0 +1,19 @@
1
+ curl -X 'POST' \
2
+ 'https://api.styai.app/api/v1/media/remove-background' \
3
+ -H 'accept: application/json' \
4
+ -H 'X-API-Key: pat_lJ8bAVjHn2_moLH1zxdTm9NnU8rvUcw8HyiQtuHg' \
5
+ -H 'Content-Type: multipart/form-data' \
6
+ -F 'file=@intro-step1.png;type=image/png' \
7
+ -F 'cropToForeground=false' \
8
+ -F 'targetSize=1024 768' \
9
+ -F 'outputFormat=png'
10
+
11
+
12
+ output
13
+ {
14
+ buffer: "base64",
15
+ contentType: "image/png",
16
+ size: 300000,
17
+ processingTime: 1000,
18
+ sucess: true
19
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Shared background removal via Sty AI API.
3
+ */
4
+
5
+ import { writeFile, readFile } from "fs/promises";
6
+ import { log } from "./kie-client.mjs";
7
+
8
+ export async function removeBackground(inputPath, outputPath) {
9
+ const fileBuffer = await readFile(inputPath);
10
+ const blob = new Blob([fileBuffer], { type: "image/png" });
11
+
12
+ const formData = new FormData();
13
+ formData.append("file", blob, "image.png");
14
+ formData.append("cropToForeground", "true");
15
+ formData.append("outputFormat", "png");
16
+
17
+ const res = await fetch("https://api.styai.app/api/v1/media/remove-background", {
18
+ method: "POST",
19
+ headers: {
20
+ accept: "application/json",
21
+ "X-API-Key": "pat_lJ8bAVjHn2_moLH1zxdTm9NnU8rvUcw8HyiQtuHg",
22
+ },
23
+ body: formData,
24
+ });
25
+
26
+ const json = await res.json();
27
+ if (!json.sucess && !json.success) {
28
+ throw new Error("Background removal failed");
29
+ }
30
+
31
+ const buffer = Buffer.from(json.buffer, "base64");
32
+ await writeFile(outputPath, buffer);
33
+ log(` [bg-removed] ${outputPath}`);
34
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Shared .env loader for ai-asset-generator scripts.
3
+ *
4
+ * Search order:
5
+ * 1. Project root (skills/) — the single source of truth for all env vars
6
+ * 2. ai-asset-generator/ dir — legacy fallback
7
+ * 3. Monorepo root (skills/../../) — fallback for monorepo setups
8
+ *
9
+ * Files checked: .env, .env.local (values from earlier files win).
10
+ */
11
+
12
+ import { readFile } from "fs/promises";
13
+ import { join, dirname } from "path";
14
+ import { fileURLToPath } from "url";
15
+
16
+ const __dirname = dirname(fileURLToPath(import.meta.url));
17
+ const GENERATOR_DIR = join(__dirname, "..");
18
+ const PROJECT_ROOT = join(__dirname, "..", "..", ".."); // skills/
19
+ const MONOREPO_ROOT = join(__dirname, "..", "..", "..", ".."); // one above skills/
20
+
21
+ export async function loadEnv() {
22
+ const searchPaths = [PROJECT_ROOT, GENERATOR_DIR, MONOREPO_ROOT];
23
+ const envFiles = [".env", ".env.local"];
24
+
25
+ for (const dir of searchPaths) {
26
+ for (const envFile of envFiles) {
27
+ try {
28
+ const raw = await readFile(join(dir, envFile), "utf8");
29
+ let loaded = 0;
30
+ for (const line of raw.split("\n")) {
31
+ const trimmed = line.trim();
32
+ if (!trimmed || trimmed.startsWith("#")) continue;
33
+ const eq = trimmed.indexOf("=");
34
+ if (eq === -1) continue;
35
+ const key = trimmed.slice(0, eq).trim();
36
+ const val = trimmed.slice(eq + 1).trim();
37
+ if (!process.env[key]) {
38
+ process.env[key] = val;
39
+ loaded++;
40
+ }
41
+ }
42
+ if (loaded > 0) console.log(` [env] Loaded ${loaded} vars from ${dir}/${envFile}`);
43
+ } catch {
44
+ // File doesn't exist, continue
45
+ }
46
+ }
47
+ }
48
+ }
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Shared KIE AI API client.
3
+ *
4
+ * Provides: createTask, queryTask, pollUntilDone, downloadFile
5
+ * All scripts use the same API base and auth pattern.
6
+ */
7
+
8
+ import { writeFile, mkdir } from "fs/promises";
9
+ import { existsSync } from "fs";
10
+ import { dirname, join } from "path";
11
+ import { fileURLToPath } from "url";
12
+
13
+ const __lib = dirname(fileURLToPath(import.meta.url));
14
+ const SKILL_DIR = join(__lib, "..");
15
+
16
+ // ─── Helpers ────────────────────────────────────────────────
17
+ export const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
18
+ export const log = (msg) => console.log(msg);
19
+
20
+ /**
21
+ * Default output directory: ai-asset-generator/output/<name>/
22
+ * Each generator gets its own subfolder under the skill's output/ dir.
23
+ */
24
+ export function outputDir(name) {
25
+ return join(SKILL_DIR, "output", name);
26
+ }
27
+
28
+ // ─── API Client ─────────────────────────────────────────────
29
+ const API = "https://api.kie.ai/api/v1/jobs";
30
+
31
+ function headers() {
32
+ return {
33
+ "Content-Type": "application/json",
34
+ Authorization: `Bearer ${process.env.KIE_AI_API_KEY}`,
35
+ };
36
+ }
37
+
38
+ export async function createTask(payload) {
39
+ const res = await fetch(`${API}/createTask`, {
40
+ method: "POST",
41
+ headers: headers(),
42
+ body: JSON.stringify(payload),
43
+ });
44
+ const json = await res.json();
45
+ if (json.code !== 200) {
46
+ throw new Error(`createTask failed (${json.code}): ${json.message}`);
47
+ }
48
+ return json.data.taskId;
49
+ }
50
+
51
+ export async function queryTask(taskId) {
52
+ const res = await fetch(`${API}/recordInfo?taskId=${taskId}`, {
53
+ headers: { Authorization: `Bearer ${process.env.KIE_AI_API_KEY}` },
54
+ });
55
+ const json = await res.json();
56
+ if (json.code !== 200) {
57
+ throw new Error(`queryTask failed (${json.code}): ${json.message}`);
58
+ }
59
+ return json.data;
60
+ }
61
+
62
+ /**
63
+ * Poll a task until it reaches success/fail.
64
+ * Uses increasing delay: 5s → 8s → 12s → … capped at 30s.
65
+ */
66
+ export async function pollUntilDone(taskId, label, timeoutMs = 300_000) {
67
+ const t0 = Date.now();
68
+ let delay = 5_000;
69
+
70
+ while (Date.now() - t0 < timeoutMs) {
71
+ const task = await queryTask(taskId);
72
+
73
+ if (task.state === "success") {
74
+ const urls = JSON.parse(task.resultJson).resultUrls;
75
+ log(` [done] ${label}`);
76
+ return urls[0];
77
+ }
78
+
79
+ if (task.state === "fail") {
80
+ throw new Error(`${label} failed: ${task.failMsg || "unknown"}`);
81
+ }
82
+
83
+ const elapsed = Math.round((Date.now() - t0) / 1000);
84
+ log(` [${task.state}] ${label} (${elapsed}s, next poll in ${Math.round(delay / 1000)}s)`);
85
+ await sleep(delay);
86
+ delay = Math.min(Math.round(delay * 1.5), 30_000);
87
+ }
88
+
89
+ throw new Error(`${label} timed out after ${timeoutMs / 1000}s`);
90
+ }
91
+
92
+ export async function downloadFile(url, dest) {
93
+ const dir = dirname(dest);
94
+ if (!existsSync(dir)) await mkdir(dir, { recursive: true });
95
+ const res = await fetch(url);
96
+ if (!res.ok) throw new Error(`Download failed: ${res.status} ${url}`);
97
+ const buf = Buffer.from(await res.arrayBuffer());
98
+ await writeFile(dest, buf);
99
+ log(` [saved] ${dest}`);
100
+ }
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: ai-build-ai
3
+ description: |
4
+ **AI Build AI**: Master guide for extending Claude Code — creating skills, custom subagents (agents), MCP servers, hooks, plugins, agent teams, running Claude programmatically, and more.
5
+ - MANDATORY TRIGGERS: create skill, new skill, add skill, write skill, build skill, create agent, new agent, add subagent, custom agent, create MCP, add MCP server, connect MCP, build MCP, headless mode, agent SDK, run claude programmatically, claude -p, how to extend claude, claude extensibility, how to create, how to build, hooks, plugin, agent team, team lead, multi-agent, multi-pass, verification workflow, orchestrate agents, sandbox, checkpoint, rewind, output style
6
+ - Use this skill when the user wants to: create or design a new Claude Code skill, build a custom subagent/agent, connect an MCP server or build their own, run Claude programmatically via CLI or SDK, configure hooks, build a plugin, set up agent teams, configure sandboxing, use checkpointing, or change output styles.
7
+ - Invoke the correct tutorial based on the topic argument.
8
+ argument-hint: "[skill | agent | mcp | headless | hooks | plugins | teams | team-lead | memory | permissions | sandbox | checkpoint | output-styles]"
9
+ disable-model-invocation: false
10
+ ---
11
+
12
+ # AI Build AI
13
+
14
+ You are an expert guide for extending Claude Code. Load the right tutorial based on what the user wants to build.
15
+
16
+ ## Tutorial Routing
17
+
18
+ Run this to load the relevant tutorial:
19
+
20
+ !`bash skills/skills/ai-build-ai/scripts/load-tutorial.sh $ARGUMENTS`
21
+
22
+ ---
23
+
24
+ ## How to Use This Skill
25
+
26
+ After reading the tutorial above, help the user build their extension by:
27
+
28
+ 1. **Understanding their goal** — What do they want to create? What problem does it solve?
29
+ 2. **Choosing the right type** — Skill vs Agent vs MCP vs Headless (see decision table below)
30
+ 3. **Following the tutorial** — Apply the patterns from the loaded tutorial
31
+ 4. **Creating files** — Write the actual SKILL.md / agent .md / scripts / config
32
+ 5. **Testing** — Guide them through testing the new extension
33
+
34
+ ---
35
+
36
+ ## Decision Table: What Should I Build?
37
+
38
+ | Goal | Build This |
39
+ |------|-----------|
40
+ | Teach Claude a repeatable workflow (code review, PR creation, deploy) | **Skill** |
41
+ | Add domain knowledge Claude should always apply (API conventions, style guide) | **Skill** (`user-invocable: false`) |
42
+ | Run heavy/verbose operations without polluting main context | **Subagent** |
43
+ | Give Claude access to GitHub, Slack, databases, external APIs | **MCP Server** |
44
+ | Run Claude in CI/CD, scripts, or automation | **Headless / Agent SDK** |
45
+ | Run Claude in GitHub Actions | **Headless** (`/ai-build-ai headless`) |
46
+ | Build an app that uses Claude as the AI backend | **Agent SDK** |
47
+ | Isolate tool access (read-only, specific commands) | **Subagent** |
48
+ | Auto-format files, block dangerous commands, send notifications | **Hooks** |
49
+ | Distribute extensions to a team or community | **Plugin** |
50
+ | Parallel work where teammates need to communicate | **Agent Teams** |
51
+ | Orchestrate multi-agent workflow with quality gates and multi-pass review | **Team Lead** (`/ai-build-ai team-lead`) |
52
+ | Persist coding standards across sessions | **CLAUDE.md / Memory** |
53
+ | Restrict what files/commands Claude can touch | **Permissions** |
54
+ | Add OS-level protection for bash commands | **Sandbox** |
55
+ | Undo mistakes or experiment safely | **Checkpointing** |
56
+ | Change Claude's tone, verbosity, or teaching style | **Output Style** |
57
+
58
+ ---
59
+
60
+ ## Topic Commands
61
+
62
+ The user can invoke with a specific topic to load the deep tutorial immediately:
63
+
64
+ | Command | What Loads |
65
+ |---------|-----------|
66
+ | `/ai-build-ai skill` | Create SKILL.md, frontmatter, arguments, dynamic context, supporting files |
67
+ | `/ai-build-ai agent` | Create subagents, tools, models, memory, hooks, worktree isolation |
68
+ | `/ai-build-ai mcp` | Connect remote/local MCP servers, build your own MCP server |
69
+ | `/ai-build-ai headless` | `claude -p`, output formats, GitHub Actions, CI/CD, Python/TypeScript SDK |
70
+ | `/ai-build-ai hooks` | All hook events, types, exit codes, matchers, notification matchers, recipes |
71
+ | `/ai-build-ai plugins` | Plugin manifest, structure, skills/agents/hooks/MCP in plugins, distribution |
72
+ | `/ai-build-ai teams` | Agent teams: enable, start, control, display modes, use cases |
73
+ | `/ai-build-ai team-lead` | Team lead workflow: multi-agent orchestration, multi-pass verification, quality gates |
74
+ | `/ai-build-ai memory` | CLAUDE.md, .claude/rules/, auto memory, imports, monorepo setup |
75
+ | `/ai-build-ai permissions` | Allow/deny rules, modes, Bash/Read/Edit/WebFetch/MCP/Agent rules |
76
+ | `/ai-build-ai sandbox` | OS-level enforcement, filesystem rules, network filtering |
77
+ | `/ai-build-ai checkpoint` | Rewind, fork, session management, summarize from here |
78
+ | `/ai-build-ai output-styles` | Built-in styles, custom styles, keep-coding-instructions |
79
+ | `/ai-build-ai` | Overview of all 13 extension types + decision table |
80
+
81
+ ---
82
+
83
+ ## Supporting Files
84
+
85
+ - `docs/overview.md` — Overview + decision table (loaded when no topic given)
86
+ - `docs/create-skill.md` — Complete skill creation guide with examples
87
+ - `docs/create-agent.md` — Complete agent creation guide with examples
88
+ - `docs/create-mcp.md` — MCP server setup + building your own
89
+ - `docs/headless-mode.md` — Programmatic usage, GitHub Actions, CI/CD, Agent SDK
90
+ - `docs/hooks.md` — All hook events, types, matchers, notification matchers, recipes
91
+ - `docs/plugins.md` — Plugin manifest, structure, distribution
92
+ - `docs/agent-teams.md` — Team architecture, display modes, use cases
93
+ - `docs/team-lead-workflow.md` — Team lead orchestration, multi-pass verification, specialist definitions
94
+ - `docs/memory-claude-md.md` — CLAUDE.md, rules/, auto memory, imports
95
+ - `docs/permissions.md` — Permission modes, rule syntax, examples
96
+ - `docs/sandbox.md` — OS-level sandboxing, filesystem and network rules
97
+ - `docs/checkpointing.md` — Rewind, fork, session management
98
+ - `docs/output-styles.md` — Built-in and custom output styles
99
+ - `scripts/load-tutorial.sh` — Routes to the right doc based on argument
100
+
101
+ ---
102
+
103
+ ## After Creating an Extension
104
+
105
+ ### For Skills
106
+ 1. Test auto-trigger: describe your use case naturally, confirm Claude loads the skill
107
+ 2. Test direct invoke: `/skill-name [args]`
108
+ 3. Check `SKILL.md` is under 500 lines — move excess to `docs/`
109
+ 4. Add to `ginstudio-skills/skills/` to share with the team (this repo)
110
+
111
+ ### For Agents
112
+ 1. Run `/agents` to verify the agent appears
113
+ 2. Ask Claude: "Use the [agent-name] agent to [task]"
114
+ 3. Check tool restrictions work correctly
115
+ 4. Enable `memory` if the agent should learn across sessions
116
+
117
+ ### For MCP Servers
118
+ 1. Run `claude mcp list` to confirm the server is registered
119
+ 2. In Claude Code, type `/mcp` to check server status
120
+ 3. Try using an MCP tool naturally: "Check GitHub for open PRs"
121
+ 4. Use `--scope project` + commit `.mcp.json` to share with your team
122
+
123
+ ### For Headless
124
+ 1. Test with a simple prompt first: `claude -p "hello" --output-format json`
125
+ 2. Verify tool permissions: use `--allowedTools` explicitly
126
+ 3. Check output format: pipe through `jq` to validate JSON structure
127
+ 4. Add to CI/CD workflow as a step