mirror of
https://github.com/forcedotcom/afv-library.git
synced 2026-08-10 09:41:17 +08:00
update skill
This commit is contained in:
parent
6053de53a7
commit
d152f74a93
68
skills/image-generation/SKILL.md
Normal file
68
skills/image-generation/SKILL.md
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
---
|
||||||
|
name: image-generation
|
||||||
|
description: Orchestrates how to handle image creation requests. Decides whether to delegate to the media-management MCP tool or fall back to a placeholder when the MCP is unavailable. Use when the user asks to add, include, or place an image or media asset in their project.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Media Management
|
||||||
|
|
||||||
|
This skill defines the decision flow for handling image creation requests. It does not generate images itself — it determines what to do based on what is available.
|
||||||
|
|
||||||
|
## Decision Flow
|
||||||
|
|
||||||
|
1. Look at your available tools. If `create_image` is present, proceed to **Using the MCP Tool**.
|
||||||
|
2. If `create_image` is not available, proceed to **Fallback: Placeholder**.
|
||||||
|
|
||||||
|
## Using the MCP Tool
|
||||||
|
|
||||||
|
Delegate image generation to the `create_image` tool from the `media-management` MCP server. (`media-management` here refers to the MCP server name, not this skill.)
|
||||||
|
|
||||||
|
Apply these defaults unless the user specifies otherwise:
|
||||||
|
|
||||||
|
| Parameter | Default | Options |
|
||||||
|
|---|---|---|
|
||||||
|
| `model` | `Standard` | `Standard`, `Premium` |
|
||||||
|
| `size` | `auto` | `auto`, `1024x1024`, `1536x1024`, `1024x1536` (pick closest to requested size) |
|
||||||
|
| `quality` | `medium` | `low`, `medium`, `high` |
|
||||||
|
| `outputCompression` | `75` | `0–100` (webp/jpeg only) |
|
||||||
|
| `outputFormat` | `webp` | `webp`, `jpeg`, `png` |
|
||||||
|
| `background` | `auto` | `auto`, `transparent`, `opaque` |
|
||||||
|
|
||||||
|
**Format rule:** If `outputFormat` is `png`, set `outputCompression` to `100`.
|
||||||
|
|
||||||
|
### After the tool responds
|
||||||
|
|
||||||
|
Download and preview the result:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Retrieve credentials
|
||||||
|
TARGET_ORG=$(sf config get target-org --json | jq -r '.result[0].value')
|
||||||
|
|
||||||
|
# Download
|
||||||
|
mkdir -p "generatedimages"
|
||||||
|
curl -f -H "Authorization: Bearer $ACCESS_TOKEN" "$URL" -o "generatedimages/<responseId>.<outputFormat>"
|
||||||
|
|
||||||
|
# Preview
|
||||||
|
code generatedimages/<responseId>.<outputFormat>
|
||||||
|
```
|
||||||
|
|
||||||
|
Use CSS (`width`, `height`, `object-fit`) to control display size. Never resize using external tools.
|
||||||
|
|
||||||
|
## Fallback: Placeholder
|
||||||
|
|
||||||
|
When `create_image` is not available, use a static placeholder instead of attempting image generation.
|
||||||
|
|
||||||
|
1. Check if `generatedimages/placeholder.svg` already exists.
|
||||||
|
2. If it exists, use it — do not download again.
|
||||||
|
3. If it does not exist, download it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir -p generatedimages
|
||||||
|
curl -f -o generatedimages/placeholder.svg "https://res.cloudinary.com/dveb6nwve/image/upload/v1775081606/placeholderFinal_l03h2n.svg"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Placeholder Policy
|
||||||
|
|
||||||
|
- Only one placeholder exists: `generatedimages/placeholder.svg`.
|
||||||
|
- Do not generate alternative placeholders using Python, ImageMagick, or any other tool.
|
||||||
|
- Do not create resized or reformatted versions of the placeholder.
|
||||||
|
- If the user asks for a placeholder of a different size or format, inform them that only `placeholder.svg` is available and direct them to use CSS to scale it at the point of use.
|
||||||
@ -1,77 +0,0 @@
|
|||||||
---
|
|
||||||
name: media-management
|
|
||||||
description: Generates new images using AI image generation tools. If image generation is not available or fails, uses a placeholder.svg. Use when the user asks to generate, create, or add new images or media assets — not when searching for existing media.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Media Management
|
|
||||||
|
|
||||||
## Workflow
|
|
||||||
|
|
||||||
1. Check if the `media-management` MCP server is configured and its `create_image` tool is available.
|
|
||||||
2. If available, use `create_image` to generate the image.
|
|
||||||
3. If not available, use the placeholder fallback below.
|
|
||||||
|
|
||||||
## MCP: media-management
|
|
||||||
|
|
||||||
**Tool:** `create_image`
|
|
||||||
|
|
||||||
Check your available tools. If `create_image` is present, use it as the primary image generation method — pass the natural language prompt and applicable parameters from the table below.
|
|
||||||
|
|
||||||
If `create_image` is not in your tool list, the `media-management` MCP is not configured — use the placeholder fallback below.
|
|
||||||
|
|
||||||
## Image Generation Parameters
|
|
||||||
|
|
||||||
Use these defaults unless the user specifies otherwise:
|
|
||||||
|
|
||||||
| Parameter | Default | Options |
|
|
||||||
|---|---|---|
|
|
||||||
| `model` | `Standard` | `Standard`, `Premium` |
|
|
||||||
| `size` | `auto` | `auto`, `1024x1024`, `1536x1024`, `1024x1536` (pick closest to user-requested size) |
|
|
||||||
| `quality` | `medium` | `low`, `medium`, `high` |
|
|
||||||
| `outputCompression` | `75` | `0–100` (webp/jpeg only) |
|
|
||||||
| `outputFormat` | `webp` | `webp`, `jpeg`, `png` |
|
|
||||||
| `background` | `auto` | `auto`, `transparent`, `opaque` |
|
|
||||||
|
|
||||||
**Format rule:** If `outputFormat` is `png`, set `outputCompression` to `100`.
|
|
||||||
|
|
||||||
## After Successful Generation
|
|
||||||
|
|
||||||
Automatically download and preview the image:
|
|
||||||
|
|
||||||
**1. Retrieve credentials:**
|
|
||||||
```bash
|
|
||||||
TARGET_ORG=$(sf config get target-org --json | jq -r '.result[0].value')
|
|
||||||
```
|
|
||||||
|
|
||||||
**2. Download the image:**
|
|
||||||
```bash
|
|
||||||
mkdir -p "generatedimages"
|
|
||||||
curl -f -H "Authorization: Bearer $ACCESS_TOKEN" "$URL" -o "generatedimages/<responseId>.<outputFormat>"
|
|
||||||
```
|
|
||||||
|
|
||||||
**3. Preview in VS Code:**
|
|
||||||
```bash
|
|
||||||
code generatedimages/<responseId>.<outputFormat>
|
|
||||||
```
|
|
||||||
|
|
||||||
**Never resize or post-process the generated image with external tools.** To control display dimensions, use CSS properties (e.g. `width`, `height`, `object-fit`) at the point of use.
|
|
||||||
|
|
||||||
## Fallback: Use placeholder.svg
|
|
||||||
|
|
||||||
If image generation fails or is not enabled:
|
|
||||||
|
|
||||||
1. Check if `generatedimages/placeholder.svg` already exists.
|
|
||||||
2. If it exists, use it as-is — do not download again.
|
|
||||||
3. If it does not exist, download it:
|
|
||||||
```bash
|
|
||||||
mkdir -p generatedimages
|
|
||||||
curl -f -o generatedimages/placeholder.svg "https://res.cloudinary.com/dveb6nwve/image/upload/v1775081606/placeholderFinal_l03h2n.svg"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Placeholder Policy
|
|
||||||
|
|
||||||
There is only one placeholder: `generatedimages/placeholder.svg`.
|
|
||||||
|
|
||||||
- **Never** generate alternative placeholder images using Python, ImageMagick, or any other tool.
|
|
||||||
- **Never** resize or create new placeholder files of different dimensions.
|
|
||||||
- If the user requests a placeholder of a specific size or format, inform them that only `placeholder.svg` is available and that it can be scaled to any size using CSS properties (e.g. `width`, `height`, `object-fit`) at the point of use.
|
|
||||||
Loading…
Reference in New Issue
Block a user