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,144 @@
1
+ # Active Life Backend - Vouchers & Rewards System
2
+
3
+ ## Overview
4
+
5
+ Three reward mechanisms:
6
+ 1. **Vouchers** — Discount codes (fixed or percentage)
7
+ 2. **Spin Rewards** — Lucky wheel with points or voucher prizes
8
+ 3. **Point Redemption** — Exchange loyalty points for rewards
9
+
10
+ ## Vouchers
11
+
12
+ ### Voucher Model
13
+ ```prisma
14
+ model Voucher {
15
+ id String @id @default(uuid())
16
+ code String @unique // e.g., "SUMMER2024"
17
+ type VoucherType // PERCENT or FIXED
18
+ value Float // 10 (10%) or 50000 (50,000 VND)
19
+ minOrder Float? // Minimum order amount to use
20
+ maxDiscount Float? // Cap for PERCENT type
21
+ quantity Int // Total vouchers available
22
+ usedCount Int @default(0) // How many have been used
23
+ expiryDate DateTime?
24
+ isActive Boolean @default(true)
25
+ }
26
+ ```
27
+
28
+ ### Voucher Types
29
+ - `FIXED` — Deducts fixed amount (e.g., 50,000 VND off)
30
+ - `PERCENT` — Deducts percentage (e.g., 10% off, max 100,000 VND)
31
+
32
+ ### Voucher Lifecycle
33
+ ```
34
+ Create → Assign to Clients → Client Uses at Checkout → Mark as Used
35
+
36
+ Deduct from order total
37
+ ```
38
+
39
+ ### Client Voucher Assignment
40
+ ```prisma
41
+ model ClientVoucher {
42
+ clientId String
43
+ voucherId String
44
+ isUsed Boolean @default(false)
45
+ usedAt DateTime?
46
+ @@unique([clientId, voucherId]) // One per client
47
+ }
48
+ ```
49
+
50
+ ### Key Endpoints
51
+ ```
52
+ GET /api/v1/voucher — List vouchers (staff)
53
+ POST /api/v1/voucher — Create voucher (staff)
54
+ PATCH /api/v1/voucher/:id — Update voucher (staff)
55
+ DELETE /api/v1/voucher/:id — Delete voucher (staff)
56
+ POST /api/v1/voucher/redeem — Redeem voucher code (client)
57
+ GET /api/v1/voucher/my-vouchers — Client's available vouchers
58
+ ```
59
+
60
+ ### Voucher Validation Rules
61
+ 1. Code must be unique
62
+ 2. Voucher must be active (`isActive: true`)
63
+ 3. Not expired (`expiryDate > now()`)
64
+ 4. Not fully used (`usedCount < quantity`)
65
+ 5. Client hasn't already used it
66
+ 6. Order meets minimum amount (`totalAmount >= minOrder`)
67
+
68
+ ### Discount Calculation
69
+ ```typescript
70
+ if (voucher.type === 'PERCENT') {
71
+ discount = totalAmount * (voucher.value / 100);
72
+ if (voucher.maxDiscount) {
73
+ discount = Math.min(discount, voucher.maxDiscount);
74
+ }
75
+ } else {
76
+ discount = voucher.value;
77
+ }
78
+ finalAmount = totalAmount - discount + shippingFee;
79
+ ```
80
+
81
+ ## Spin Rewards (Lucky Wheel)
82
+
83
+ ### SpinReward Model
84
+ ```prisma
85
+ model SpinReward {
86
+ id String @id @default(uuid())
87
+ name String // "100 Points", "10% Voucher"
88
+ type RewardType // POINT or VOUCHER
89
+ value Float // Points amount or voucher value
90
+ probability Float // 0-100 chance of winning
91
+ isActive Boolean @default(true)
92
+ }
93
+ ```
94
+
95
+ ### Spin Transaction
96
+ ```prisma
97
+ model SpinTransaction {
98
+ clientId String
99
+ rewardId String
100
+ createdAt DateTime @default(now())
101
+ }
102
+ ```
103
+
104
+ ### Spin Logic
105
+ 1. Client requests a spin (costs points or free daily)
106
+ 2. Server calculates reward based on probabilities
107
+ 3. If POINT reward: adds points to client
108
+ 4. If VOUCHER reward: creates a ClientVoucher
109
+ 5. Records SpinTransaction
110
+
111
+ ## Point System
112
+
113
+ ### How Points Are Earned
114
+ - Order delivered → Points awarded based on order amount
115
+ - Spin wheel → POINT type rewards
116
+
117
+ ### Point Redemption
118
+ ```prisma
119
+ model RedeemTransaction {
120
+ clientId String
121
+ points Int // Points spent
122
+ description String? // What they redeemed for
123
+ createdAt DateTime
124
+ }
125
+ ```
126
+
127
+ ### Point Balance
128
+ Stored directly on `Client.point` field. Updated atomically:
129
+ ```typescript
130
+ await prisma.client.update({
131
+ where: { id: clientId },
132
+ data: { point: { increment: pointsToAdd } },
133
+ });
134
+ ```
135
+
136
+ ## Integration with Orders
137
+
138
+ At checkout:
139
+ 1. Client provides `voucherCode` in `CreateOrderDto`
140
+ 2. Service validates voucher (active, not expired, min order, not used)
141
+ 3. Calculates discount
142
+ 4. Creates order with `discountAmount` and `finalAmount`
143
+ 5. Marks `ClientVoucher.isUsed = true`
144
+ 6. Increments `Voucher.usedCount`
@@ -0,0 +1,247 @@
1
+ ---
2
+ name: ai-asset-generator
3
+ description: |
4
+ **AI Asset Generator**: Generate production-ready images, icons, videos, and visual assets using KIE AI and background removal APIs. Handles text-to-image, image-to-image, image-to-video, background removal, and multi-size icon generation.
5
+ - MANDATORY TRIGGERS: generate asset, generate image, create icon, generate illustration, create hero image, generate banner, app icon, brand assets, AI image, generate visual, asset pipeline, remove background, generate video, KIE AI, create artwork, generate graphics, app assets, mobile assets, feature illustration
6
+ - Use this skill whenever the user wants to create, generate, or produce any visual asset for their project. Also trigger when discussing image generation pipelines, brand asset creation, or background removal workflows, even if the user just says "make me an image" or "I need graphics for this feature".
7
+ ---
8
+
9
+ # AI Asset Generator
10
+
11
+ Generate production-ready visual assets using the KIE AI image/video generation API and background removal APIs. This skill knows the API patterns, prompt engineering techniques, and output pipelines for asset generation.
12
+
13
+ ## How It Works
14
+
15
+ The asset generation pipeline follows these phases:
16
+
17
+ 1. **Define** — Describe what assets are needed (dimensions, style, brand colors)
18
+ 2. **Generate** — Submit tasks to KIE AI API (`nano-banana-pro` model for images, `bytedance/v1-pro-image-to-video` for video)
19
+ 3. **Post-process** — Background removal, resizing, format conversion (WebP)
20
+ 4. **Deliver** — Save to the appropriate project directory
21
+
22
+ All scripts and libraries are in `skills/ai-asset-generator/`. The shared client library handles API communication, polling, and downloads.
23
+
24
+ ## Quick Start
25
+
26
+ To generate assets, you need:
27
+ 1. A `KIE_AI_API_KEY` in the project root `.env` file (see `.env.example`)
28
+ 2. Node.js 18+ (uses native `fetch`)
29
+
30
+ Scaffold a new generator:
31
+ ```bash
32
+ cd skills/ai-asset-generator
33
+ node scripts/scaffold-generator.mjs <name> --assets 3
34
+ ```
35
+
36
+ Output is saved to `ai-asset-generator/output/<name>/` by default.
37
+ Override with `OUTPUT_DIR=/target/path node generate-<name>-assets.mjs`.
38
+
39
+ ## Brand Guidelines
40
+
41
+ Define your project's brand guidelines before generating assets. Example structure:
42
+
43
+ ### Primary Brand
44
+ - Primary Color: `#EC4899` (specify your brand's primary hex)
45
+ - Gradient: Define your brand gradient stops
46
+ - Accent colors for highlight/sparkle effects
47
+ - Aesthetic keywords: e.g., "Premium, minimalist, clean"
48
+
49
+ ### Secondary Brand / Sub-products
50
+ - Define separate color palettes for sub-products if applicable
51
+ - Keep consistent aesthetic language across products
52
+
53
+ ### Common Accent Colors
54
+ - Blue `#3B82F6`, Green `#22C55E`, Purple `#8B5CF6`, Amber `#F59E0B`
55
+
56
+ ## API Reference
57
+
58
+ Read the full API docs in the `docs/` directory when you need exact parameter details:
59
+
60
+ - `docs/gen-image.md` — KIE AI image generation (text-to-image, image-to-image)
61
+ - `docs/genvideo.md` — KIE AI video generation (image-to-video via ByteDance model)
62
+ - `docs/remove-background.md` — Background removal API
63
+
64
+ ### Image Generation (KIE AI)
65
+
66
+ **Endpoint:** `POST https://api.kie.ai/api/v1/jobs/createTask`
67
+
68
+ Key parameters:
69
+ - `model`: `"nano-banana-pro"` (primary image model)
70
+ - `input.prompt`: Detailed description (max 20,000 chars). Be very specific about colors using hex codes, composition, lighting, and what to exclude.
71
+ - `input.aspect_ratio`: `1:1`, `2:3`, `3:2`, `3:4`, `4:3`, `4:5`, `5:4`, `9:16`, `16:9`, `21:9`, `auto`
72
+ - `input.resolution`: `1K`, `2K`, `4K`
73
+ - `input.output_format`: `png` or `jpg`
74
+ - `input.image_input`: Array of up to 8 image URLs for image-to-image transforms
75
+
76
+ **Polling:** `GET https://api.kie.ai/api/v1/jobs/recordInfo?taskId=<id>`
77
+ - States: `waiting` → `queuing` → `generating` → `success` | `fail`
78
+ - Use exponential backoff: start at 5s, multiply by 1.5, cap at 30s
79
+ - Timeout: 300s for images, 600s for video
80
+
81
+ ### Video Generation (ByteDance via KIE AI)
82
+
83
+ Same endpoint, different model:
84
+ - `model`: `"bytedance/v1-pro-image-to-video"`
85
+ - `input.image_url`: Source image URL (required)
86
+ - `input.prompt`: Motion/camera description
87
+ - `input.resolution`: `480p`, `720p`, `1080p`
88
+ - `input.duration`: `"5"` or `"10"` (seconds)
89
+ - `input.camera_fixed`: `true`/`false`
90
+
91
+ ### Background Removal
92
+
93
+ Configure your background removal endpoint in the `lib/bg-remove.mjs` library. Common options:
94
+ - Self-hosted or third-party background removal API
95
+ - Multipart form: `file` (image blob), `cropToForeground` (`true`/`false`), `outputFormat` (`png`)
96
+ - Auth: API key header
97
+ - Returns: Processed image (base64 or binary)
98
+
99
+ ## Writing Generation Scripts
100
+
101
+ When creating a new asset generator script, follow the established pattern:
102
+
103
+ ### Script Structure
104
+
105
+ ```javascript
106
+ #!/usr/bin/env node
107
+
108
+ /**
109
+ * [Feature Name] Asset Generator
110
+ *
111
+ * Purpose: [what it generates]
112
+ * Brand: [relevant brand colors]
113
+ *
114
+ * Assets:
115
+ * 1. [filename] - [description]
116
+ * 2. [filename] - [description]
117
+ */
118
+
119
+ import { join, dirname } from "path";
120
+ import { fileURLToPath } from "url";
121
+ import { loadEnv } from "./lib/env.mjs";
122
+ import { createTask, pollUntilDone, downloadFile, log } from "./lib/kie-client.mjs";
123
+ import { removeBackground } from "./lib/bg-remove.mjs";
124
+
125
+ const __dirname = dirname(fileURLToPath(import.meta.url));
126
+ const OUTPUT_DIR = join(__dirname, "<target-output-directory>");
127
+
128
+ // Define assets as a declarative array
129
+ const IMAGE_ASSETS = [
130
+ {
131
+ name: "asset-name",
132
+ filename: "asset-name.png",
133
+ aspect_ratio: "16:9", // or 1:1, 9:16, etc.
134
+ resolution: "2K", // 1K, 2K, or 4K
135
+ removeBg: false, // true to run background removal after
136
+ prompt: [
137
+ // Break prompt into logical lines for readability
138
+ "Main subject description with specific hex colors.",
139
+ "Composition and layout details.",
140
+ "Lighting and atmosphere.",
141
+ "Style reference (photorealistic, 3D render, illustration, etc.).",
142
+ "Exclusions: No text, no typography, no logos, no people, no watermarks.",
143
+ ].join(" "),
144
+ },
145
+ ];
146
+
147
+ async function main() {
148
+ await loadEnv();
149
+ if (!process.env.KIE_AI_API_KEY) {
150
+ console.error("Error: KIE_AI_API_KEY not found. Check .env");
151
+ process.exit(1);
152
+ }
153
+
154
+ // Phase 1: Submit all tasks in parallel
155
+ const jobs = await Promise.all(
156
+ IMAGE_ASSETS.map(async (asset) => {
157
+ const taskId = await createTask({
158
+ model: "nano-banana-pro",
159
+ input: {
160
+ prompt: asset.prompt,
161
+ aspect_ratio: asset.aspect_ratio,
162
+ resolution: asset.resolution,
163
+ output_format: "png",
164
+ },
165
+ });
166
+ return { ...asset, taskId };
167
+ })
168
+ );
169
+
170
+ // Phase 2: Poll all tasks in parallel
171
+ const results = await Promise.all(
172
+ jobs.map(async (job) => {
173
+ const url = await pollUntilDone(job.taskId, job.name);
174
+ return { ...job, resultUrl: url };
175
+ })
176
+ );
177
+
178
+ // Phase 3: Download
179
+ for (const r of results) {
180
+ await downloadFile(r.resultUrl, join(OUTPUT_DIR, r.filename));
181
+ }
182
+
183
+ // Phase 4: Background removal (where needed)
184
+ for (const r of results.filter(r => r.removeBg)) {
185
+ try {
186
+ const src = join(OUTPUT_DIR, r.filename);
187
+ const dest = join(OUTPUT_DIR, r.filename.replace(".png", "-nobg.png"));
188
+ await removeBackground(src, dest);
189
+ } catch (err) {
190
+ log(` [warn] BG removal failed for ${r.name}: ${err.message}`);
191
+ }
192
+ }
193
+ }
194
+
195
+ main().catch((err) => {
196
+ console.error(`Fatal: ${err.message}`);
197
+ process.exit(1);
198
+ });
199
+ ```
200
+
201
+ ### Prompt Engineering Tips
202
+
203
+ The KIE AI model responds well to these patterns:
204
+
205
+ 1. **Be explicit about colors** — Always include hex codes: "rose-gold (#EC4899)" not just "pink"
206
+ 2. **Specify what to exclude** — Always end with: "No text, no typography, no logos, no people, no watermarks."
207
+ 3. **Use photography/cinema terminology** — "three-point lighting", "soft bokeh", "shallow depth of field", "studio lighting"
208
+ 4. **State the render style** — "Photorealistic 3D render", "flat illustration", "watercolor style"
209
+ 5. **Describe composition** — "centered on pure white background", "left-aligned with negative space on right"
210
+ 6. **Keep prompts focused** — One clear concept per asset. Multi-concept prompts produce confused results.
211
+
212
+ ### Multi-Size Icon Pipeline
213
+
214
+ For app icons that need multiple sizes, add resize steps after generation:
215
+
216
+ 1. Generate one high-res master image (1K, 1:1)
217
+ 2. Remove background (optional)
218
+ 3. Resize using `ffmpeg`:
219
+ ```bash
220
+ ffmpeg -i input.png -vf scale=48:48 -y output@2x.png
221
+ ffmpeg -i input.png -vf scale=48:48 -y output@2x.webp
222
+ ```
223
+
224
+ ## Shared Libraries
225
+
226
+ All in `lib/`:
227
+
228
+ | File | Exports | Purpose |
229
+ |------|---------|---------|
230
+ | `kie-client.mjs` | `createTask`, `queryTask`, `pollUntilDone`, `downloadFile`, `outputDir`, `sleep`, `log` | KIE AI API client with exponential backoff polling and default output dir |
231
+ | `bg-remove.mjs` | `removeBackground(inputPath, outputPath)` | Background removal API client |
232
+ | `env.mjs` | `loadEnv()` | Loads `.env` and `.env.local` from project root |
233
+
234
+ ## Output
235
+
236
+ Default output: `skills/ai-asset-generator/output/<name>/`
237
+
238
+ ```
239
+ output/
240
+ ├── logo/ ← outputDir("logo")
241
+ ├── onboarding/ ← outputDir("onboarding")
242
+ └── ...
243
+ ```
244
+
245
+ Override per-run: `OUTPUT_DIR=/path/to/target node generate-xxx.mjs`
246
+
247
+ The `output/` directory is gitignored. Copy generated assets to your project as needed.
@@ -0,0 +1,274 @@
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
+ "nano-banana-pro"
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
+ A text description of the image you want to generate
41
+
42
+ Max length: 20000 characters
43
+ Example:
44
+
45
+ "Comic poster: cool banana hero in shades leaps from sci-fi pad. Six panels: 1) 4K mountain landscape, 2) banana holds page of long multilingual text with auto translation, 3) Gemini 3 hologram for search/knowledge/reasoning, 4) camera UI sliders for angle focus color, 5) frame trio 1:1-9:16, 6) consistent banana poses. Footer shows Google icons. Tagline: Nano Banana Pro now on Kie AI."
46
+ input.image_input
47
+ Optional
48
+ array(URL)
49
+ Input images to transform or use as reference (supports up to 8 images)
50
+
51
+ Please provide the URL of the uploaded file; Accepted types: image/jpeg, image/png, image/webp; Max size: 30.0MB
52
+ input.aspect_ratio
53
+ Optional
54
+ string
55
+ Aspect ratio of the generated image
56
+
57
+ Available options:
58
+
59
+ 1:1
60
+ -
61
+ 1:1
62
+ 2:3
63
+ -
64
+ 2:3
65
+ 3:2
66
+ -
67
+ 3:2
68
+ 3:4
69
+ -
70
+ 3:4
71
+ 4:3
72
+ -
73
+ 4:3
74
+ 4:5
75
+ -
76
+ 4:5
77
+ 5:4
78
+ -
79
+ 5:4
80
+ 9:16
81
+ -
82
+ 9:16
83
+ 16:9
84
+ -
85
+ 16:9
86
+ 21:9
87
+ -
88
+ 21:9
89
+ auto
90
+ -
91
+ Auto
92
+ Example:
93
+
94
+ "1:1"
95
+ input.resolution
96
+ Optional
97
+ string
98
+ Resolution of the generated image
99
+
100
+ Available options:
101
+
102
+ 1K
103
+ -
104
+ 1K
105
+ 2K
106
+ -
107
+ 2K
108
+ 4K
109
+ -
110
+ 4K
111
+ Example:
112
+
113
+ "1K"
114
+ input.output_format
115
+ Optional
116
+ string
117
+ Format of the output image
118
+
119
+ Available options:
120
+
121
+ png
122
+ -
123
+ PNG
124
+ jpg
125
+ -
126
+ JPG
127
+ Example:
128
+
129
+ "png"
130
+ Request Example
131
+
132
+ cURL
133
+
134
+ JavaScript
135
+
136
+ Python
137
+ curl -X POST "https://api.kie.ai/api/v1/jobs/createTask" \
138
+ -H "Content-Type: application/json" \
139
+ -H "Authorization: Bearer YOUR_API_KEY" \
140
+ -d '{
141
+ "model": "nano-banana-pro",
142
+ "callBackUrl": "https://your-domain.com/api/callback",
143
+ "input": {
144
+ "prompt": "Comic poster: cool banana hero in shades leaps from sci-fi pad. Six panels: 1) 4K mountain landscape, 2) banana holds page of long multilingual text with auto translation, 3) Gemini 3 hologram for search/knowledge/reasoning, 4) camera UI sliders for angle focus color, 5) frame trio 1:1-9:16, 6) consistent banana poses. Footer shows Google icons. Tagline: Nano Banana Pro now on Kie AI.",
145
+ "aspect_ratio": "1:1",
146
+ "resolution": "1K",
147
+ "output_format": "png"
148
+ }
149
+ }'
150
+ Response Example
151
+ {
152
+ "code": 200,
153
+ "message": "success",
154
+ "data": {
155
+ "taskId": "task_12345678"
156
+ }
157
+ }
158
+ Response Fields
159
+ code
160
+ Status code, 200 for success, others for failure
161
+ message
162
+ Response message, error description when failed
163
+ data.taskId
164
+ Task ID for querying task status
165
+ Callback Notifications
166
+ 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).
167
+
168
+ Success Callback Example
169
+ {
170
+ "code": 200,
171
+ "data": {
172
+ "completeTime": 1755599644000,
173
+ "costTime": 8,
174
+ "createTime": 1755599634000,
175
+ "model": "nano-banana-pro",
176
+ "param": "{\"callBackUrl\":\"https://your-domain.com/api/callback\",\"model\":\"nano-banana-pro\",\"input\":{\"prompt\":\"Comic poster: cool banana hero in shades leaps from sci-fi pad. Six panels: 1) 4K mountain landscape, 2) banana holds page of long multilingual text with auto translation, 3) Gemini 3 hologram for search/knowledge/reasoning, 4) camera UI sliders for angle focus color, 5) frame trio 1:1-9:16, 6) consistent banana poses. Footer shows Google icons. Tagline: Nano Banana Pro now on Kie AI.\",\"image_input\":[],\"aspect_ratio\":\"1:1\",\"resolution\":\"1K\",\"output_format\":\"png\"}}",
177
+ "resultJson": "{\"resultUrls\":[\"https://example.com/generated-image.jpg\"]}",
178
+ "state": "success",
179
+ "taskId": "e989621f54392584b05867f87b160672",
180
+ "failCode": null,
181
+ "failMsg": null,
182
+ },
183
+ "msg": "Playground task completed successfully."
184
+ }
185
+ Failure Callback Example
186
+ {
187
+ "code": 501,
188
+ "data": {
189
+ "completeTime": 1755597081000,
190
+ "costTime": 0,
191
+ "createTime": 1755596341000,
192
+ "failCode": "500",
193
+ "failMsg": "Internal server error",
194
+ "model": "nano-banana-pro",
195
+ "param": "{\"callBackUrl\":\"https://your-domain.com/api/callback\",\"model\":\"nano-banana-pro\",\"input\":{\"prompt\":\"Comic poster: cool banana hero in shades leaps from sci-fi pad. Six panels: 1) 4K mountain landscape, 2) banana holds page of long multilingual text with auto translation, 3) Gemini 3 hologram for search/knowledge/reasoning, 4) camera UI sliders for angle focus color, 5) frame trio 1:1-9:16, 6) consistent banana poses. Footer shows Google icons. Tagline: Nano Banana Pro now on Kie AI.\",\"image_input\":[],\"aspect_ratio\":\"1:1\",\"resolution\":\"1K\",\"output_format\":\"png\"}}",
196
+ "state": "fail",
197
+ "taskId": "bd3a37c523149e4adf45a3ddb5faf1a8",
198
+ "resultJson": null,
199
+ },
200
+ "msg": "Playground task failed."
201
+ }
202
+ Important Notes
203
+ The callback content structure is identical to the Query Task API response
204
+ The param field contains the complete Create Task request parameters, not just the input section
205
+ If callBackUrl is not provided, no callback notifications will be sent
206
+
207
+
208
+ GET
209
+ /api/v1/jobs/recordInfo
210
+ Query Task
211
+ Query task status and results by task ID
212
+
213
+ Request Example
214
+
215
+ cURL
216
+
217
+ JavaScript
218
+
219
+ Python
220
+ curl -X GET "https://api.kie.ai/api/v1/jobs/recordInfo?taskId=task_12345678" \
221
+ -H "Authorization: Bearer YOUR_API_KEY"
222
+ Response Example
223
+ {
224
+ "code": 200,
225
+ "message": "success",
226
+ "data": {
227
+ "taskId": "task_12345678",
228
+ "model": "nano-banana-pro",
229
+ "state": "success",
230
+ "param": "{\"model\":\"nano-banana-pro\",\"callBackUrl\":\"https://your-domain.com/api/callback\",\"input\":{\"prompt\":\"Comic poster: cool banana hero in shades leaps from sci-fi pad. Six panels: 1) 4K mountain landscape, 2) banana holds page of long multilingual text with auto translation, 3) Gemini 3 hologram for search/knowledge/reasoning, 4) camera UI sliders for angle focus color, 5) frame trio 1:1-9:16, 6) consistent banana poses. Footer shows Google icons. Tagline: Nano Banana Pro now on Kie AI.\",\"image_input\":[],\"aspect_ratio\":\"1:1\",\"resolution\":\"1K\",\"output_format\":\"png\"}}",
231
+ "resultJson": "{\"resultUrls\":[\"https://example.com/generated-image.jpg\"]}",
232
+ "failCode": "",
233
+ "failMsg": "",
234
+ "costTime": 0,
235
+ "completeTime": 1698765432000,
236
+ "createTime": 1698765400000
237
+ }
238
+ }
239
+ Response Fields
240
+ code
241
+ Status code, 200 for success, others for failure
242
+ message
243
+ Response message, error description when failed
244
+ data.taskId
245
+ Task ID
246
+ data.model
247
+ Model used for generation
248
+ data.state
249
+ Generation state
250
+ data.param
251
+ Complete Create Task request parameters as JSON string (includes model, callBackUrl, input and all other parameters)
252
+ data.resultJson
253
+ Result JSON string containing generated media URLs
254
+ data.failCode
255
+ Error code (when generation failed)
256
+ data.failMsg
257
+ Error message (when generation failed)
258
+ data.completeTime
259
+ Completion timestamp
260
+ data.createTime
261
+ Creation timestamp
262
+ data.costTime
263
+ Cost time in milliseconds
264
+ State Values
265
+ waiting
266
+ Waiting for generation
267
+ queuing
268
+ In queue
269
+ generating
270
+ Generating
271
+ success
272
+ Generation successful
273
+ fail
274
+ Generation failed