{"kind":"Skill","metadata":{"namespace":"community","name":"generate-image","version":"0.1.0"},"spec":{"description":"\u003e-","files":{"SKILL.md":"---\nname: generate-image\ndescription: \u003e-\n  Generate images using AI. Use when asked to generate, create, or make images, textures,\n  icons, sprites, artwork, visual assets, or mockups. Supports OpenAI (gpt-image-2) and\n  Google Gemini (Nano Banana). Requires an API key for the chosen provider.\nargument-hint: \"[description of the image to generate]\"\nlicense: MIT\nmetadata:\n  version: \"2.1.0\"\n  providers: \"openai, gemini\"\n---\n\n# Generate Image\n\nYou are an image generation assistant. When invoked, follow the workflow below.\n\n## Workflow\n\n1. **Check for API keys** — check whether `SKILL_IMAGE_GEN_OPENAI_KEY` and/or `SKILL_IMAGE_GEN_GEMINI_KEY` are set in the environment.\n2. **If one key is set** — use that provider. No need to ask.\n3. **If both are set** — pick based on context (OpenAI for polish, Gemini for speed), or ask if the user has a preference.\n4. **If no keys are set** — run the Onboarding section.\n5. **Generate the image** using the appropriate API reference.\n6. **Tell the user** where the image was saved.\n\n## Onboarding\n\nOnly run this if no keys are set. Guide the user conversationally.\n\n1. Ask which provider they'd like to use:\n   - **OpenAI (gpt-image-2)** — High quality, excellent text rendering, paid per image\n   - **Google Gemini (Nano Banana)** — Fast, free tier available, great for iteration\n2. Direct them to get an API key:\n   - OpenAI → https://platform.openai.com/api-keys\n   - Gemini → https://aistudio.google.com/apikey\n3. Once they provide the key, set `SKILL_IMAGE_GEN_OPENAI_KEY` or `SKILL_IMAGE_GEN_GEMINI_KEY` in the current session and persist it to the appropriate shell profile.\n4. Proceed to generate the image they originally asked for.\n\n## API Reference: OpenAI\n\n**Method:** `POST`\n**URL:** `https://api.openai.com/v1/images/generations`\n\n**Headers:**\n- `Authorization: Bearer \u003cSKILL_IMAGE_GEN_OPENAI_KEY\u003e`\n- `Content-Type: application/json`\n\n**Body (JSON):**\n```json\n{\n  \"model\": \"gpt-image-2\",\n  \"prompt\": \"\u003cuser prompt\u003e\",\n  \"n\": 1,\n  \"size\": \"1024x1024\",\n  \"quality\": \"medium\"\n}\n```\n\n| Field | Default | Options |\n|---|---|---|\n| model | `gpt-image-2` | `gpt-image-2`, `gpt-image-1` |\n| size | `1024x1024` | `1024x1024`, `1024x1536`, `1536x1024`, `auto` |\n| quality | `medium` | `low`, `medium`, `high` |\n\n**Response:** `data[0].b64_json` contains the base64-encoded image. Decode it and save to the output path. If `data[0].url` is present instead, download the image from that URL.\n\n## API Reference: Google Gemini (Nano Banana)\n\n**Method:** `POST`\n**URL:** `https://generativelanguage.googleapis.com/v1beta/models/\u003cmodel\u003e:generateContent`\n\n**Headers:**\n- `x-goog-api-key: \u003cSKILL_IMAGE_GEN_GEMINI_KEY\u003e`\n- `Content-Type: application/json`\n\n**Body (JSON):**\n```json\n{\n  \"contents\": [{\"parts\": [{\"text\": \"Generate an image: \u003cuser prompt\u003e\"}]}],\n  \"generationConfig\": {\"responseModalities\": [\"TEXT\", \"IMAGE\"]}\n}\n```\n\n| Field | Default | Options |\n|---|---|---|\n| model (in URL) | `gemini-2.0-flash-exp` | `gemini-2.0-flash-exp`, `gemini-2.5-flash-image` |\n\n**Response:** Find `candidates[0].content.parts[]` — look for a part with `inlineData.data` (base64 image) and `inlineData.mimeType`. Decode and save.\n\n**Error cases:** `error` key (API error), `promptFeedback.blockReason` (safety block), `finishReason: \"SAFETY\"` (filtered).\n\n## Agent Guidelines\n\n- Choose the output path intelligently — save to the project's relevant directory (e.g., `assets/`, `images/`, or the current directory).\n- For game textures, enrich prompts with \"seamless\", \"tileable\", \"game asset\".\n- For batch generation, make multiple API calls in parallel.\n- If the user asks to switch providers or what options are available, explain both and help them set up.\n- Always create the output directory before saving.\n- Ensure special characters in the user's prompt are properly escaped in the JSON body.\n"},"import":{"commit_sha":"541b7819d8c3545c6df122491af4fa1eae415779","imported_at":"2026-05-18T20:05:35Z","license_text":"MIT License\n\nCopyright GitHub, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.","owner":"github","repo":"github/awesome-copilot","source_url":"https://github.com/github/awesome-copilot/tree/541b7819d8c3545c6df122491af4fa1eae415779/plugins/skill-image-gen/skills/generate-image"}},"content_hash":[194,162,58,53,192,162,108,37,105,60,1,93,29,218,51,80,138,241,205,38,77,50,171,160,243,74,12,103,114,6,243,29],"trust_level":"unsigned","yanked":false}
