01
Skill Schema
JSON
{
"skill_name": "pattern_jewellery_automation",
"version": "1.0.0",
"description": "Automates jewellery product marketing: enhances images, generates lifestyle and product visuals, creates SEO content, and stores outputs in Google Drive for Pattern Jewellery.",
"pattern_jewellery_specs": {
"intricate_design_focus": true,
"high_detail_textures": true,
"fusion_aesthetic": "traditional-modern",
"target_market": "Gulf luxury",
"hallmark": "750"
},
"input_schema": {
"product_image": {
"type": "string",
"format": "url_or_base64",
"required": true,
"description": "Raw product photograph from studio shoot"
},
"product_details": {
"type": "object",
"required": true,
"properties": {
"name": { "type": "string", "example": "Diamond Blue Sapphire Ring" },
"sku": { "type": "string", "example": "R4389" },
"category": { "type": "string", "example": "rings" },
"material": { "type": "string", "example": "18K white gold 2.24gm, natural diamond 0.32ct, blue sapphire 0.78ct" },
"price_now": { "type": "number", "example": 4455 },
"price_was": { "type": "number", "example": 8990 },
"description": { "type": "string", "example": "Oval blue sapphire centrepiece with double diamond halo, prong-set in 18K white gold, hallmarked 750" }
}
}
},
"output_schema": {
"model_image_url": { "type": "string", "description": "URL of generated lifestyle model image" },
"product_image_url": { "type": "string", "description": "URL of generated premium product-only image" },
"caption": { "type": "string", "description": "SEO-optimized social media caption" },
"hashtags": { "type": "array", "items": { "type": "string" } },
"drive_link": { "type": "string", "description": "Google Drive folder URL for all assets" }
},
"steps": [
{
"step": 1,
"id": "prompt_generation",
"agent": "creative_agent",
"depends_on": "vision_agent",
"description": "Generate model and product image prompts from visual analysis and memory"
},
{
"step": 2,
"id": "image_generation",
"agent": "vision_agent",
"tool": "imagen_api",
"parallel": true,
"description": "Generate model lifestyle image and premium product image concurrently"
},
{
"step": 3,
"id": "content_generation",
"agent": "content_agent",
"tool": "claude_llm",
"parallel": true,
"description": "Generate SEO caption and hashtags concurrently with image generation"
},
{
"step": 4,
"id": "storage",
"agent": "storage_agent",
"tool": "drive_api",
"depends_on": ["image_generation", "content_generation"],
"description": "Upload all assets to organized Google Drive folder"
}
]
}
02
Tool Definitions
JSON
[
{
"tool_name": "claude_llm",
"description": "Anthropic Claude for prompt generation and social content creation",
"api_endpoint": "https://api.anthropic.com/v1/messages",
"auth_method": "bearer_token",
"auth_header": "x-api-key",
"model": "claude-3-5-haiku-20241022",
"functions": [
{
"name": "generate_image_prompt",
"description": "Generate optimized Imagen prompts for model and product visuals",
"max_tokens": 300,
"input_schema": {
"image_analysis": {
"type": "object",
"fields": ["design_type", "material_detected", "quality_score"]
},
"product_details": {
"type": "object",
"fields": ["name", "material", "description"]
},
"memory": {
"type": "object",
"fields": ["style", "background_preference"]
}
},
"output_schema": {
"model_prompt": { "type": "string", "max_tokens": 120 },
"product_prompt": { "type": "string", "max_tokens": 120 }
},
"response_format": "json"
},
{
"name": "generate_social_content",
"description": "Generate SEO-optimized Instagram caption and hashtag array",
"max_tokens": 220,
"input_schema": {
"product_details": {
"type": "object",
"fields": ["name", "price_now", "price_was", "material", "description"]
},
"memory": {
"type": "object",
"fields": ["tone", "top_performing_caption"]
}
},
"output_schema": {
"caption": { "type": "string", "max_chars": 220 },
"hashtags": { "type": "array", "max_items": 20 }
},
"response_format": "json"
}
]
},
{
"tool_name": "imagen_api",
"description": "Google Imagen 3 for high-fidelity jewellery image generation",
"api_endpoint": "https://us-central1-aiplatform.googleapis.com/v1/projects/{project_id}/locations/us-central1/publishers/google/models/imagen-3.0-generate-002:predict",
"auth_method": "oauth2_service_account",
"model_version": "imagen-3.0-generate-002",
"functions": [
{
"name": "generate_model_image",
"description": "Generate lifestyle shot of model wearing jewellery",
"input_schema": {
"prompt": { "type": "string", "required": true },
"aspect_ratio": { "type": "string", "default": "4:5", "enum": ["1:1", "4:5", "9:16"] },
"quality": { "type": "string", "default": "ultra" },
"sample_count": { "type": "integer", "default": 1 }
},
"output_schema": {
"image_url": { "type": "string", "format": "gcs_uri" }
}
},
{
"name": "generate_product_image",
"description": "Generate premium product-only image on luxury background",
"input_schema": {
"prompt": { "type": "string", "required": true },
"aspect_ratio": { "type": "string", "default": "1:1", "enum": ["1:1", "4:5"] },
"quality": { "type": "string", "default": "ultra" },
"sample_count": { "type": "integer", "default": 1 }
},
"output_schema": {
"image_url": { "type": "string", "format": "gcs_uri" }
}
}
]
},
{
"tool_name": "drive_api",
"description": "Google Drive for organized asset storage",
"api_endpoint": "https://www.googleapis.com/upload/drive/v3/files",
"auth_method": "oauth2_service_account",
"scopes": ["https://www.googleapis.com/auth/drive.file"],
"folder_structure": "/Pattern_Jewellery/{product_category}/{YYYY-MM-DD}/{sku}/",
"functions": [
{
"name": "upload_to_drive",
"description": "Upload file to structured Drive folder, return shareable link",
"input_schema": {
"file_data": { "type": "string", "format": "binary_or_gcs_uri" },
"folder_path": { "type": "string", "example": "/Pattern_Jewellery/rings/2025-01-15/R4389/" },
"file_name": { "type": "string", "example": "R4389_model_lifestyle.jpg" },
"mime_type": { "type": "string", "default": "image/jpeg" }
},
"output_schema": {
"drive_link": { "type": "string", "format": "https://drive.google.com/drive/folders/{folder_id}" },
"file_id": { "type": "string" }
}
}
]
}
]
03
Prompt Templates
3 Templates
Template 1 · Model Lifestyle Image Prompt · Max 120 tokens
Professional luxury jewellery lifestyle photograph, Gulf market. Elegant Middle Eastern woman, refined pose, manicured hand foregrounded. Wearing {product_name} crafted in {material}. Macro detail: {design_details}. Setting: modern Dubai interior, soft bokeh, neutral silk backdrop. Studio lighting with rim highlight on stone facets and prong setting. Editorial fashion quality. 8K, photorealistic, no text.
≈ 78 tokens · within 120-token limit ✓
Template 2 · Premium Product-Only Image Prompt · Max 120 tokens
Luxury jewellery product photography, no model. {product_name} in {material}. Key features: {key_features}. Surface: white Carrara marble with deep navy velvet accent. Macro lens, tack-sharp stone facets and prong detail. Three-point studio lighting: soft key, hard fill catching diamond brilliance, warm backlight. Floating shadow. 8K, photorealistic, commercial retail grade, no text.
≈ 80 tokens · within 120-token limit ✓
Template 3 · Social Media Content Prompt · Max 180 tokens
Generate Instagram content for Pattern Jewellery, Dubai. Luxury tone, traditional-modern fusion voice.
Product: {product_name}
Price: AED {price_now} (was AED {price_was})
USP: {unique_selling_points}
Return JSON only:
{
"caption": "2–3 sentence luxury caption, highlight offer, end with CTA (link in bio / DM to order)",
"hashtags": ["array", "of", "20", "mixed", "broad+niche", "tags", "no", "spaces"]
}
Brand rules: aspirational, never salesy. Reference craftsmanship. Include price drop naturally.
≈ 102 tokens · within 180-token limit ✓
04
Multi-Agent Workflow Design
4 Agents
Step 0 · Sequential
Vision Agent
IN → product_image (url)
TOOL → Internal vision model
OUT → design_type material_detected quality_score
TOOL → Internal vision model
OUT → design_type material_detected quality_score
↓ image_analysis (3 fields only)
Step 1 · Sequential
Creative Agent
IN → image_analysis product_details memory.style memory.background_preference
TOOL → claude_llm :: generate_image_prompt
OUT → model_prompt product_prompt
TOOL → claude_llm :: generate_image_prompt
OUT → model_prompt product_prompt
↓ prompts dispatched in parallel to Steps 2 & 3
⟳ Parallel Execution (Steps 2 & 3)
Step 2 · Parallel
Image Agent (Vision)
IN → model_prompt product_prompt
TOOL → imagen_api :: generate_model_image
imagen_api :: generate_product_image
OUT → model_image_url product_image_url
TOOL → imagen_api :: generate_model_image
imagen_api :: generate_product_image
OUT → model_image_url product_image_url
|
Step 3 · Parallel
Content Agent
IN → product_details memory.tone memory.top_performing_caption
TOOL → claude_llm :: generate_social_content
OUT → caption hashtags[]
TOOL → claude_llm :: generate_social_content
OUT → caption hashtags[]
→ await both parallel steps complete
↓ all 4 outputs collected
Step 4 · Sequential
Storage Agent
IN → model_image_url product_image_url caption hashtags[] product_details.sku product_details.category
TOOL → drive_api :: upload_to_drive (×3: model img, product img, metadata.json)
FOLDER → /Pattern_Jewellery/rings/2025-01-15/R4389/
OUT → drive_link (folder URL)
TOOL → drive_api :: upload_to_drive (×3: model img, product img, metadata.json)
FOLDER → /Pattern_Jewellery/rings/2025-01-15/R4389/
OUT → drive_link (folder URL)
↓ final skill output returned to user
05
Memory System Structure
JSON + Rules
// memory.json — persistent, lightweight, 4 fields max { "style": "editorial", "tone": "aspirational-luxury", "background_preference": "white-marble", "top_performing_caption": "Timeless elegance, crafted for you. Now at AED 4,455 — link in bio." } // ── UPDATE RULES ────────────────────────────────────────── // WHEN: Only on explicit user correction or positive feedback signal // HOW: Replace field value atomically; no nested objects added // WHERE: /system/memory/pattern_jewellery_memory.json (persistent) // LIMIT: 4 fields hard cap — no expansion permitted // ── INJECTION POINTS ────────────────────────────────────── // Creative Agent receives: style + background_preference // Content Agent receives: tone + top_performing_caption // ── BEFORE / AFTER EXAMPLE ──────────────────────────────── // BEFORE (default state): { "style": "editorial", "tone": "aspirational-luxury", "background_preference": "white-marble", "top_performing_caption": "" } // USER FEEDBACK: "I prefer dark navy velvet backgrounds, they performed better last week" // AFTER (single field updated): { "style": "editorial", "tone": "aspirational-luxury", "background_preference": "deep-navy-velvet", "top_performing_caption": "" } // Creative Agent now injects "deep-navy-velvet" into Template 2 at {background_preference}
06
Caching Logic
JSON + Flow
// cache.json — Redis or local JSON, 30-day TTL { "image_hashes": { "a3f2c1b9_diamond-blue-sapphire-ring-r4389": { "hash": "a3f2c1b9", "created_at": "2025-01-15T08:30:00Z", "expires_at": "2025-02-14T08:30:00Z" } }, "enhanced_prompts": { "a3f2c1b9_diamond-blue-sapphire-ring-r4389": { "model_prompt": "Professional luxury jewellery lifestyle photograph...", "product_prompt": "Luxury jewellery product photography, no model..." } }, "final_outputs": { "a3f2c1b9_diamond-blue-sapphire-ring-r4389": { "model_image_url": "https://drive.google.com/file/d/abc123", "product_image_url": "https://drive.google.com/file/d/def456", "caption": "Timeless elegance, crafted for you...", "hashtags": ["#PatternJewellery", "#DubaiJewellery"], "drive_link": "https://drive.google.com/drive/folders/xyz789" } } } // ── CACHE KEY FORMAT ────────────────────────────────────── // "{pHash_8char}_{product_name_slug}" // Example: "a3f2c1b9_diamond-blue-sapphire-ring-r4389" // ── DETECTION ALGORITHM ─────────────────────────────────── // Algorithm: pHash (perceptual hash) — tolerates JPEG compression artifacts // Match threshold: Hamming distance ≤ 10 (identical/near-identical images) // product_details change detection: SHA1 hash of JSON.stringify(product_details) // ── LOGIC FLOW ──────────────────────────────────────────── // 1. Receive product_image + product_details // 2. Compute pHash(product_image) → hash_key // 3. Compute SHA1(product_details) → detail_fingerprint // 4. cache_key = hash_key + "_" + slug(product_details.name + product_details.sku) // 5. IF cache_key in final_outputs AND NOT expired AND detail_fingerprint unchanged: // RETURN cached final_outputs[cache_key] ← skip all agents // 6. ELSE IF cache_key in enhanced_prompts (image same, details changed): // SKIP vision_agent + creative_agent // RE-RUN content_agent + storage_agent only // 7. ELSE (full miss): // EXECUTE full 4-step workflow // STORE all layers in cache // 8. Expiration: TTL = 30 days. Manual invalidation: cache.delete(cache_key)
07
Token Optimization Strategy
Budget + Rules
Short atomic prompts: Each agent call handles one task only. No multi-instruction prompts. Template variables replace repeated context text.
Cached system prompts: System prompts for claude_llm are cached server-side using Anthropic prompt caching (cache_control: ephemeral). Not resent per call.
JSON-only responses: All LLM outputs use response_format: json. Eliminates preamble, filler, and markdown tokens.
Minimal image_analysis payload: Vision Agent outputs exactly 3 fields (design_type, material_detected, quality_score). No descriptions, no arrays, no nested objects.
Selective memory injection: Creative Agent receives only style + background_preference. Content Agent receives only tone + top_performing_caption. No agent receives the full memory object.
Parallel Step 2 + 3: image_generation and content_generation run concurrently. Eliminates sequential latency and avoids a round-trip token overhead for orchestration.
max_tokens hard caps: claude_llm calls capped at 300 tokens (generate_image_prompt) and 220 tokens (generate_social_content). Model is prevented from over-generating.
Cache-first on repeat images: Full cache hit skips all 4 agents (0 LLM tokens consumed). Partial hit (details changed) skips 2 agents, saving ~170 tokens.
Product details passed as minimal subset: Each agent receives only the fields it requires — never the full product_details object.
Memory limited to 4 string fields: No nested objects, arrays, or metadata stored. Keeps injection payload under 40 tokens per agent call.
Vision Agent
≤ 50
tokens output (3-field JSON)
Creative Agent
≤ 240
tokens output (120 × 2 prompts)
Content Agent
≤ 180
tokens output (caption + hashtags)
Storage Agent
≤ 30
tokens output (drive_link + file_ids)
Total Per Execution
≤ 500
tokens (well under 600 budget)
Cache Hit (full)
0
LLM tokens consumed