init
This commit is contained in:
123
.opencode/skills/ai-artist/SKILL.md
Normal file
123
.opencode/skills/ai-artist/SKILL.md
Normal file
@@ -0,0 +1,123 @@
|
||||
---
|
||||
name: ck:ai-artist
|
||||
description: "Generate images via Nano Banana with 129 curated prompts. Mandatory validation interview refines style/mood/colors (use --skip to bypass). 3 modes: search, creative, wild. Styles: Ukiyo-e, Bento grid, cyberpunk, cinematic, vintage patent."
|
||||
metadata:
|
||||
author: claudekit
|
||||
version: 3.1.0
|
||||
argument-hint: "[concept] [--mode search|creative|wild|all] [--skip]"
|
||||
---
|
||||
|
||||
# AI Artist - Nano Banana Image Generation
|
||||
|
||||
Generate images using 129 curated prompts from awesome-nano-banana-pro-prompts collection.
|
||||
|
||||
**Validation interview is mandatory** (use `--skip` to bypass).
|
||||
|
||||
## Workflow
|
||||
|
||||
**IMPORTANT:** Follow `references/validation-workflow.md` when this skill is activated.
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
python3 scripts/generate.py "<concept>" -o <output.png> [--mode MODE]
|
||||
```
|
||||
|
||||
### Generation Modes
|
||||
|
||||
| Mode | Description |
|
||||
|------|-------------|
|
||||
| `search` | Find best matching prompt from 129 curated prompts (default) |
|
||||
| `creative` | Remix elements from top 3 matching prompts |
|
||||
| `wild` | Out-of-the-box creative interpretation (random style transform) |
|
||||
| `all` | Generate all 3 variations |
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Default search mode
|
||||
python3 scripts/generate.py "tech conference banner" -o banner.png -ar 16:9
|
||||
|
||||
# Creative remix (combines multiple prompts)
|
||||
python3 scripts/generate.py "AI workshop" -o workshop.png --mode creative
|
||||
|
||||
# Wild/experimental (random artistic transformation)
|
||||
python3 scripts/generate.py "product showcase" -o product.png --mode wild
|
||||
|
||||
# Generate all 3 variations at once
|
||||
python3 scripts/generate.py "futuristic city" -o city.png --mode all -v
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `-o, --output` | Output path (required) |
|
||||
| `-m, --mode` | search, creative, wild, or all |
|
||||
| `-ar, --aspect-ratio` | 1:1, 16:9, 9:16, etc. |
|
||||
| `--model` | flash2 (default, fast+quality), flash (previous), pro (quality/4K) |
|
||||
| `-v, --verbose` | Show matched prompts and details |
|
||||
| `--dry-run` | Show prompt without generating |
|
||||
| `--skip` | Bypass validation interview |
|
||||
|
||||
---
|
||||
|
||||
## Prompt Database
|
||||
|
||||
**129 curated prompts** extracted from awesome-nano-banana-pro-prompts:
|
||||
|
||||
```bash
|
||||
# Search prompts
|
||||
python3 scripts/search.py "<query>" --domain awesome
|
||||
|
||||
# View all prompts
|
||||
cat data/awesome-prompts.csv
|
||||
```
|
||||
|
||||
### Categories include:
|
||||
- **Profile/Avatar**: Thought-leader headshots, mirror selfies
|
||||
- **Infographics**: Bento grid, chalkboard, ingredient labels
|
||||
- **Social Media**: Quote cards, banners, thumbnails
|
||||
- **Product**: Commercial shots, e-commerce, Apple-style
|
||||
- **Artistic**: Ukiyo-e, patent documents, vaporwave, cyberpunk
|
||||
- **Character**: Anime, chibi, comic storyboards
|
||||
|
||||
---
|
||||
|
||||
## Wild Mode Transformations
|
||||
|
||||
The `wild` mode randomly applies one of these artistic transformations:
|
||||
|
||||
- Japanese Ukiyo-e woodblock print
|
||||
- Premium liquid glass Bento grid infographic
|
||||
- Vintage 1800s patent document
|
||||
- Surreal dreamscape with volumetric god rays
|
||||
- Cyberpunk neon aesthetic with holograms
|
||||
- Hand-drawn chalkboard explanation
|
||||
- Isometric 3D diorama
|
||||
- Cinematic movie poster
|
||||
- Vaporwave aesthetic with glitch effects
|
||||
- Apple-style product showcase
|
||||
|
||||
---
|
||||
|
||||
## References
|
||||
|
||||
| Topic | File |
|
||||
|-------|------|
|
||||
| **Validation Workflow** | `references/validation-workflow.md` |
|
||||
| All Prompts | `data/awesome-prompts.csv` |
|
||||
| Nano Banana Guide | `references/nano-banana.md` |
|
||||
| Image Prompting | `references/image-prompting.md` |
|
||||
| Source | `references/awesome-nano-banana-pro-prompts.md` |
|
||||
|
||||
---
|
||||
|
||||
## Scripts
|
||||
|
||||
| Script | Purpose |
|
||||
|--------|---------|
|
||||
| `generate.py` | Main image generation with 3 modes |
|
||||
| `search.py` | Search prompts database |
|
||||
| `extract_prompts.py` | Extract prompts from markdown |
|
||||
| `core.py` | BM25 search engine |
|
||||
3592
.opencode/skills/ai-artist/data/awesome-prompts.csv
Normal file
3592
.opencode/skills/ai-artist/data/awesome-prompts.csv
Normal file
File diff suppressed because it is too large
Load Diff
19
.opencode/skills/ai-artist/data/lighting.csv
Normal file
19
.opencode/skills/ai-artist/data/lighting.csv
Normal file
@@ -0,0 +1,19 @@
|
||||
STT,Lighting Type,Category,Keywords,Description,Mood,Best For,Prompt Keywords,Technical Notes
|
||||
1,Golden Hour,Natural,"golden, sunset, warm, soft, magic hour, golden light","Warm directional sunlight during first/last hour of day","Romantic, warm, dreamy, nostalgic","Portraits, landscapes, lifestyle","golden hour lighting, warm sunset light, magic hour, soft directional sunlight","Sun 15-20° above horizon; warm color temp ~3000K; long shadows"
|
||||
2,Blue Hour,Natural,"blue, twilight, dusk, dawn, cool, moody, serene","Cool ambient light just after sunset or before sunrise","Calm, mysterious, ethereal, melancholic","Cityscapes, moody portraits, atmospheric scenes","blue hour, twilight lighting, cool ambient light, pre-dawn atmosphere","No direct sun; sky as diffused light source; ~4000-6000K; city lights mix well"
|
||||
3,Overcast,Natural,"overcast, cloudy, diffused, soft, even, flat","Evenly diffused light from cloud cover","Neutral, natural, intimate, documentary","Portraits, products, nature close-ups","overcast lighting, soft diffused daylight, cloudy day light","Giant softbox effect; minimal shadows; color temp ~6500K; flattering for skin"
|
||||
4,Harsh Midday,Natural,"harsh, midday, direct, high contrast, hard shadows","Direct overhead sunlight with strong shadows","Dramatic, bold, stark, energetic","Fashion, architectural, dramatic scenes","harsh midday sun, direct overhead lighting, high contrast sunlight","Sun directly overhead; hard shadows under features; challenging for portraits"
|
||||
5,Rembrandt,Portrait,"rembrandt, dramatic, chiaroscuro, triangle, classic","Single light source creating triangle on cheek","Dramatic, artistic, classic, serious","Dramatic portraits, fine art, character studies","Rembrandt lighting, triangle light on cheek, chiaroscuro, single source dramatic","45° angle, slightly above; small triangle under eye on shadow side"
|
||||
6,Butterfly,Portrait,"butterfly, paramount, glamour, beauty, hollywood, classic","Light directly in front and above subject","Glamorous, elegant, flattering, hollywood","Beauty shots, fashion, headshots","butterfly lighting, paramount lighting, beauty light, overhead frontal","Creates shadow under nose; symmetrical; very flattering; fill from below optional"
|
||||
7,Split,Portrait,"split, half lit, dramatic, mysterious, moody","Light illuminating exactly half the face","Mysterious, dramatic, intense, artistic","Dramatic portraits, conceptual, film noir","split lighting, half-face illumination, dramatic side lighting","Light at 90° to face; maximum drama; villain lighting; strong emotion"
|
||||
8,Loop,Portrait,"loop, natural, versatile, slight shadow, classic","Slight shadow from nose toward cheek","Natural, approachable, versatile, professional","Professional headshots, corporate, general portraits","loop lighting, natural portrait light, slight nose shadow","Between butterfly and Rembrandt; 30-45° from camera; most versatile"
|
||||
9,Rim Light,Accent,"rim, back, edge, separation, halo, outline","Light from behind creating edge highlight","Dramatic, separated, defined, ethereal","Silhouettes, product separation, dramatic portraits","rim lighting, backlight, edge light, hair light, subject separation","Behind subject; creates outline; great for hair; adds depth"
|
||||
10,Volumetric,Atmospheric,"volumetric, god rays, light rays, foggy, atmospheric","Visible light rays in atmosphere","Mystical, spiritual, dramatic, cinematic","Forests, churches, dramatic scenes, fantasy","volumetric lighting, god rays, light beams, atmospheric fog lighting","Requires particles/fog; directional light source; dramatic effect"
|
||||
11,Neon,Artificial,"neon, cyberpunk, colorful, glow, synthetic, urban","Colored artificial light sources creating glow","Futuristic, edgy, urban, energetic","Cyberpunk, night scenes, portraits, gaming","neon lighting, cyberpunk glow, colored light sources, neon signs","Multiple color sources; pink/cyan common; creates color mixing on skin"
|
||||
12,Studio Softbox,Studio,"softbox, studio, professional, even, controlled","Large diffused artificial light source","Professional, clean, commercial, polished","Product shots, headshots, e-commerce","studio softbox lighting, professional studio light, soft even illumination","Large source = soft light; multiple setups possible; controllable"
|
||||
13,Ring Light,Studio,"ring light, even, beauty, catchlight, influencer","Circular light source around camera lens","Modern, clean, beauty, social media","Beauty content, vlogs, product reviews, selfies","ring light, circular catchlight, even facial illumination","Creates distinctive circular catchlight in eyes; very even; popular for influencers"
|
||||
14,Natural Window,Indoor,"window, natural indoor, side light, soft ambient","Daylight coming through windows","Intimate, natural, homey, authentic","Lifestyle, portraits, indoor scenes","natural window light, side lighting from window, soft indoor daylight","Direction and quality vary with time; curtains diffuse; very flattering"
|
||||
15,Low Key,Mood,"low key, dark, moody, shadows, dramatic, noir","Mostly shadow with selective illumination","Mysterious, dramatic, artistic, moody","Film noir, dramatic portraits, conceptual","low key lighting, dramatic shadows, selective illumination, dark mood","High contrast; dark background; minimal fill; emphasis on shadows"
|
||||
16,High Key,Mood,"high key, bright, clean, minimal shadows, airy","Bright even illumination with minimal shadows","Clean, optimistic, fresh, commercial","Commercial, beauty, product, children","high key lighting, bright even illumination, minimal shadows, clean white","Multiple light sources; white/light backgrounds; reduced contrast"
|
||||
17,Practical,Scene,"practical, motivated, realistic, in-scene, diegetic","Light sources visible within the scene","Realistic, cinematic, grounded, authentic","Interior scenes, realistic settings, film","practical lighting, motivated light sources, in-scene illumination","Lamps, candles, screens as light sources; adds realism; matches setting"
|
||||
18,Color Gel,Creative,"gel, colored, creative, mood, theatrical","Artificially colored light for creative effect","Creative, emotional, theatrical, stylized","Creative portraits, music, events, artistic","colored gel lighting, theatrical colored light, mood lighting","Colors convey emotion; complementary or contrasting; theatrical effect"
|
||||
|
17
.opencode/skills/ai-artist/data/nano-banana-templates.csv
Normal file
17
.opencode/skills/ai-artist/data/nano-banana-templates.csv
Normal file
@@ -0,0 +1,17 @@
|
||||
Category,Template Name,Keywords,Prompt Template,Aspect Ratio,Tips
|
||||
Quote Card,Wide Quote Card Portrait,"quote,inspiration,motivational,portrait,typography","A wide quote card featuring a famous person, with a {background_color} background and a {font_color} serif font for the quote: ""{quote}"" and smaller text: ""—{author}."" There is a large, subtle quotation mark before the text. The portrait of the person is on the left, the text on the right. The text occupies two-thirds of the image and the portrait one-third, with a slight gradient transition effect on the portrait.",16:9,Use brown/earthy backgrounds with light-gold text for elegance
|
||||
Infographic,Bento Grid Product Infographic,"infographic,product,bento,glass,premium,educational","Premium liquid glass Bento grid product infographic with 8 modules. Product: {product}. Language: {language}. 1) Hero card (28-30%): Product photo/3D glass rendering. 2) Core Benefits: 4 key benefits with icons. 3) How to Use: 4 usage methods with icons. 4) Key Metrics: 5 data points. 5) Who It's For: 4 recommended + 3 caution groups. 6) Important Notes: 4 precautions. 7) Quick Reference: Specs/certifications. 8) Did You Know: 3 interesting facts. Background: Apple liquid glass cards (85-90% transparent). Ethereal macro/pattern/context background.",16:9,Use consistent icon style; ensure text legibility at mobile size
|
||||
Header Banner,Hand-drawn Blog Header,"header,banner,blog,hand-drawn,gradient,tech","A header image for a blog article where a person introduces ""{topic}"". Aspect ratio: horizontal 16:9. Style: simple, hand-drawn style, italic lines. Colors: {color1} and {color2} gradient. Title text: ""{title}"" in clean typography.",16:9,Keep space for text overlay; use complementary gradient colors
|
||||
Map,Watercolor Map with Labels,"map,watercolor,educational,geography,artistic","Generate a map of {country} in watercolor style, on which all {regions} are labeled in ballpoint pen handwriting. Soft color gradients for each region. Paper texture visible.",1:1,Use muted watercolor palette; ensure label readability
|
||||
Portrait,2x2 Grid Photo Studio,"portrait,grid,fashion,studio,magazine","High-end photo studio 2x2 grid photo. Top-left panel ({color1} background): Subject wears {outfit1}, holds prop with ""{text1}"". Top-right panel ({color2} background): Same person in {outfit2}, holds prop with ""{text2}"". Bottom-left panel ({color3} background): Same person in {outfit3}, holds prop with ""{text3}"". Bottom-right panel ({color4} background): Same person in {outfit4}, completing the composition. Clear makeup, bright ring light, 85mm lens, f/1.8 aperture, fashion magazine style. MUST maintain consistent facial features across all panels.",1:1,Maintain identity lock across panels; use complementary color scheme
|
||||
Patent,Vintage Patent Document,"patent,vintage,technical,document,invention","A vintage patent document for {invention}, styled after late 1800s United States Patent Office filings. Precise technical drawings with numbered callouts (Fig. 1, Fig. 2, Fig. 3) showing front, side, and exploded views. Handwritten annotations in fountain-pen ink describe mechanisms. Aged ivory paper with foxing stains and soft fold creases. Official embossed seal and red wax stamp in corner. Hand-signed inventor's name and date at bottom. Authoritative, historic, slightly mysterious feel.",3:4,Include multiple figure views; add authentic aging effects
|
||||
Chalkboard,Chalkboard News Summary,"educational,chalkboard,news,diagram,hand-written","Using the following content, summarize the information in a chalkboard-style, hand-written look. Break it down with diagrams and easy-to-understand expressions as if a teacher had written it. Topic: {topic}. Key points to cover: {points}. Include arrows, boxes, and visual connections between concepts.",16:9,Use chalk texture; include visual hierarchy with boxes and arrows
|
||||
Mirror Selfie,Otaku Room Mirror Selfie,"selfie,mirror,room,lifestyle,casual","Scene: Mirror selfie in an otaku-style room corner, {color} tone. Subject: {gender}, around {age}, {ethnicity}, {body_type}. Outfit: {clothing}. Room elements: {room_details}. Smartphone held for selfie via mirror. Natural lighting from window. Authentic lifestyle photography feel.",9:16,Include room context; ensure natural pose
|
||||
Style Transform,Ukiyo-e Modern Reimagining,"ukiyo-e,Japanese,woodblock,artistic,transformation","A Japanese Edo-period Ukiyo-e woodblock print reimagining {modern_scene}. Collaboration between masters like Hokusai and Hiroshige, reimagining modern technology through an ancient lens. Characters wear Edo-era kimono but perform modern actions. Tech transformation: {modern_item} becomes {traditional_item}. Composition: Flattened perspective, bold ink outlines. Texture: Wood grain, paper fibers, pigment bleeding. Colors: Prussian blue, vermilion red, muted ochre. Include vertical Japanese calligraphy and red artist seal.",3:4,Transform modern elements into period equivalents
|
||||
Social Banner,Tech Conference Announcement,"conference,tech,announcement,professional,corporate","A professional tech conference promotional image. Scene: Futuristic {venue_type} where humans and AI work together harmoniously. Holographic display shows ""{date}"". Color palette: deep {primary_color} as primary, electric {accent_color} as accent, pure white text elements. {style} aesthetic. Clean minimal design with subtle gradient lighting. Professional photography style, soft ambient lighting. Text overlay area at bottom for event details. NEVER include unwanted text. DO NOT add watermarks.",16:9,Reserve bottom 20% for text overlay; use corporate color scheme
|
||||
Product Hero,Premium Product on Surface,"product,commercial,studio,luxury,hero","A premium {product} positioned on {surface}. Materials: {material_finish} finish catching light. Lighting: {lighting_setup} creating {mood} mood. Camera: {angle} angle, 85mm lens, f/2.8. Background: {background_type}, slightly out of focus. Style: {style} commercial photography. Highlights on edges, subtle reflections. NEVER add text or watermarks.",1:1,Use 3-point lighting; include subtle reflections
|
||||
Character,Cyberpunk Character Portrait,"character,cyberpunk,neon,portrait,sci-fi","A {style} character portrait in cyberpunk setting. Subject: {description} with {distinctive_features}. Outfit: {outfit} with neon accents. Background: Rain-slicked street with holographic ads, neon signs in {colors}. Lighting: Neon rim light from behind, soft key light on face. Atmosphere: Moody, atmospheric fog. Camera: 85mm portrait lens, shallow DOF. STRICT identity lock if reference provided.",2:3,Use complementary neon colors; include atmospheric effects
|
||||
Food,Overhead Food Photography,"food,overhead,culinary,lifestyle,restaurant","Overhead shot of {dish} on {surface}. Plating: {plating_style} presentation. Props: {props} arranged around main dish. Lighting: {lighting} creating appetizing shadows. Include human element: {human_element}. Steam/freshness visible. Color palette: {colors}. Style: {magazine} magazine quality. NEVER add text.",1:1,Include human hand or utensil for scale; show steam/freshness
|
||||
Architecture,Interior Visualization,"interior,architecture,modern,visualization,lifestyle","A {style} interior photograph of {room_type}. View: {view_angle} angle capturing full space. Materials: {materials} creating {atmosphere} feel. Lighting: {time_of_day} light through {window_type}. Furniture: {furniture_style} pieces. Decorative elements: {decor}. Camera: Wide angle architectural lens, everything in focus. NEVER include people unless specified.",16:9,Use natural lighting; show material textures
|
||||
Speaker,Conference Speaker Spotlight,"speaker,conference,professional,portrait,tech","Professional conference speaker promotional image. Subject: {demographics} presenting on stage or in modern setting. Background: Abstract flowing data visualizations, {topic}-related holographic elements. Color scheme: {primary}, {secondary}, {accent}. Lighting: Cinematic with soft key light on face, dramatic rim lighting. Modern corporate photography style. Clean space at bottom for speaker name/title overlay. NEVER include text in image.",1:1,Leave space for text overlay; use brand colors
|
||||
Event CTA,Event Registration Urgency,"event,registration,urgency,countdown,promotional","Dynamic call-to-action promotional image for {event_type}. Scene: Excited people entering modern {venue} with {brand} elements. Countdown visualization floating in air. Golden VIP pass/ticket element representing {benefit}. Limited seats visual metaphor. Color palette: urgent {color1}, premium {color2}, trust {color3}. Energy and excitement atmosphere with motion blur on crowd. Clean bottom area for registration CTA. NEVER include specific text.",1:1,Use motion blur for energy; include urgency elements
|
||||
|
11
.opencode/skills/ai-artist/data/platforms.csv
Normal file
11
.opencode/skills/ai-artist/data/platforms.csv
Normal file
@@ -0,0 +1,11 @@
|
||||
STT,Platform,Type,Keywords,Prompt Style,Key Parameters,Strengths,Limitations,Aspect Ratios,Best Practices
|
||||
1,Midjourney,Commercial,"midjourney, MJ, Discord, v6, stylize, chaos, artistic","[prompt] --ar 16:9 --style raw --v 6.1","--ar (aspect), --style (raw/default), --stylize (0-1000), --chaos (0-100), --weird (0-3000), --seed, --no","Artistic interpretation, consistent style, excellent composition, great for concepts","No API, Discord-only, limited control, no inpainting in v6","1:1, 16:9, 9:16, 4:3, 3:2, 21:9, 2:3","Multi-prompt weighting cat::2; use /describe for reverse prompting; --style raw for photorealism"
|
||||
2,DALL-E 3,Commercial,"dalle, dall-e, openai, gpt-4, natural language, API","Natural language description without parameters. Be descriptive, conversational.","HD quality (in prompt), vivid style (in prompt), natural size (in prompt)","Excellent text rendering, natural language understanding, API access, safety guardrails","Limited style control, no parameters, no negative prompts, can refuse prompts","1024x1024, 1792x1024, 1024x1792","Write like describing to a human; specify text content, font, placement explicitly; avoid keyword lists"
|
||||
3,Stable Diffusion,Open Source,"SD, SDXL, ComfyUI, A1111, local, open source, LoRA","(important:1.3), normal, (less:0.8) + Negative: ugly, blurry, deformed","CFG Scale (7-12), Sampler (DPM++), Steps (20-50), LoRA, Embeddings, Weights (word:1.2)","Full control, local/private, LoRAs, inpainting, ControlNet, customizable","Learning curve, requires hardware, quality varies by model","Custom any ratio","Use (word:1.2) for emphasis; negative prompts essential; CFG 7-12; DPM++ 2M Karras sampler"
|
||||
4,Flux,Open Source,"flux, schnell, dev, pro, BFL, open source, fast","Natural language, weighted prompts, --guidance scale","--guidance (strength), aspect ratio in prompt","Fast generation, good quality, natural prompts, open weights","Newer platform, fewer resources, limited community models","Various via prompt","Use natural descriptions; specify style directly; guidance scale 3.5 for balanced results"
|
||||
5,Nano Banana Pro,Google,"nano banana, gemini, google, imagen, multimodal, text rendering","Narrative paragraphs. 32K context. ALL CAPS emphasis. Hex colors #9F2B68.","aspect_ratio (1:1 to 21:9), image_size (1K/2K/4K), responseModalities","Best text rendering, multimodal input (14 images), search grounding, thinking mode","Newer platform, learning curve, style consistency","1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9","Narrative > keywords; ALL CAPS for critical; hex colors for precision; NEVER for negatives; photography terms anchor quality"
|
||||
6,Imagen 4,Google,"imagen, google, photorealistic, high quality, commercial","Natural language, descriptive, aspect ratio in text","Quality level, aspect ratio specified in prompt text","Photorealistic quality, good text rendering, commercial use","Limited style range, newer platform","Various via prompt","Be descriptive; specify aspect in prompt text; use photography terminology"
|
||||
7,Veo 3.1,Google,"veo, video, google, AI video, motion, cinematography","Descriptive cinematography language, camera movements, scene transitions","Duration, camera movements (pan, tilt, dolly), scene transitions (cut, fade)","Video generation, cinematography understanding, smooth motion","Video-only, newer, generation time","16:9, 9:16","Use cinematography keywords; describe camera movements explicitly; include scene transitions"
|
||||
8,Ideogram,Commercial,"ideogram, text, typography, logo, creative, accurate text","Natural language with emphasis on text content and styling","Aspect ratio, magic prompt (on/off), style type","Excellent typography, good for logos, creative designs","Fewer style options, focused on text/design use cases","1:1, 16:9, 9:16, 4:3, 3:4","Describe text content precisely; specify font characteristics; great for logos and typography"
|
||||
9,Leonardo AI,Commercial,"leonardo, AI, creative, finetune, custom models, game assets","Natural language + negative prompts, model selection","Models, Alchemy, PhotoReal, Fidelity, Contrast, seed","Game assets, custom model training, good controls, consistent style","Subscription tiers, model selection complexity","1:1, 16:9, 9:16, others","Use Alchemy for enhanced results; PhotoReal for photography; explore different models for styles"
|
||||
10,Adobe Firefly,Commercial,"firefly, adobe, creative cloud, commercial safe, enterprise","Natural language, style references, structure references","Style intensity, effects, structure reference","Commercially safe, Adobe integration, reference images, good for design","Limited to Adobe ecosystem, conservative outputs","Various","Use for commercial projects; leverage style references; integrates with Photoshop/Illustrator"
|
||||
|
26
.opencode/skills/ai-artist/data/styles.csv
Normal file
26
.opencode/skills/ai-artist/data/styles.csv
Normal file
@@ -0,0 +1,26 @@
|
||||
STT,Style Name,Category,Keywords,Description,Key Characteristics,Color Palette,Best For,Platforms,Prompt Keywords
|
||||
1,Photorealistic,Photography,"photo, realistic, camera, natural, authentic, real, photography","Ultra-realistic images that mimic professional photography","Natural lighting, authentic textures, camera-specific artifacts, realistic proportions","Natural colors, realistic skin tones, environmental colors","Portraits, product shots, scenes","Nano Banana, Midjourney, SD","photorealistic, ultra realistic, 8K, RAW photo, natural lighting, professional photography"
|
||||
2,Cinematic,Photography,"film, movie, cinematic, dramatic, theatrical, hollywood, widescreen","Film-like imagery with dramatic lighting and composition","Anamorphic lens effects, color grading, shallow DOF, dramatic lighting, widescreen","Teal-orange, desaturated, film stock colors","Movie scenes, dramatic portraits, storytelling","Midjourney, Nano Banana","cinematic, film still, anamorphic, color graded, shallow depth of field, dramatic lighting"
|
||||
3,Anime Manga,Illustration,"anime, manga, Japanese, otaku, animated, cel-shaded","Japanese animation and comic style artwork","Large expressive eyes, stylized proportions, cel shading, dynamic poses, speed lines","Vibrant, saturated, anime-typical palettes","Characters, fan art, storytelling, avatars","Midjourney, SD, Nano Banana","anime style, manga, cel shaded, Japanese animation, vibrant colors, expressive eyes"
|
||||
4,3D Render,Digital,"3D, render, CGI, Blender, Cinema4D, octane, dimensional","Computer-generated 3D imagery with realistic or stylized rendering","Material reflections, global illumination, subsurface scattering, hard/soft shadows","Scene-dependent, PBR materials","Products, characters, architecture, abstract","Midjourney, SD, Nano Banana","3D render, octane render, Cinema4D, Blender, CGI, ray tracing, PBR materials"
|
||||
5,Illustration,Art,"illustrated, drawn, digital art, vector, graphic, artistic","Digital or traditional illustration styles","Clean lines, stylized forms, artistic interpretation, consistent style","Style-dependent, often bold or pastel","Editorial, children's books, branding","Midjourney, DALL-E, SD","illustration, digital art, illustrated, artistic, stylized, graphic design"
|
||||
6,Pixel Art,Retro,"pixel, 8-bit, 16-bit, retro, game, sprite, nostalgic","Retro video game aesthetic with visible pixels","Grid-based, limited color palette, dithering, nostalgic feel, sprite-like","Limited palette, 8-bit/16-bit colors","Games, avatars, nostalgic content","Midjourney, SD","pixel art, 8-bit, 16-bit, retro gaming, sprite, pixelated"
|
||||
7,Watercolor,Traditional,"watercolor, paint, artistic, soft, flowing, traditional, aquarelle","Traditional watercolor painting aesthetic","Soft edges, color bleeds, paper texture, transparent layers, organic flow","Soft, flowing, often pastel or earthy","Portraits, landscapes, artistic content","Midjourney, SD, DALL-E","watercolor painting, aquarelle, soft edges, color bleed, paper texture, artistic"
|
||||
8,Oil Painting,Traditional,"oil, painting, classical, fine art, canvas, masterpiece, textured","Classical oil painting technique","Visible brushstrokes, rich textures, layered colors, impasto, chiaroscuro","Rich, deep, Old Master palette","Portraits, landscapes, fine art","Midjourney, SD, DALL-E","oil painting, impasto, brushstrokes, classical art, canvas texture, fine art"
|
||||
9,Sketch Line Art,Drawing,"sketch, line art, drawing, pencil, ink, minimal, outlined","Hand-drawn sketch or line art style","Clean or rough lines, minimal shading, crosshatching, pen/pencil textures","Monochrome, limited color","Concepts, technical, artistic","Midjourney, SD, DALL-E","sketch, line art, pencil drawing, ink drawing, hand-drawn, crosshatching"
|
||||
10,Ink Chinese Style,Traditional,"ink wash, Chinese, Japanese, sumi-e, brush, traditional, Eastern","East Asian ink wash painting technique","Brush strokes, ink gradients, negative space, calligraphic elements, minimalism","Black ink, subtle grays, minimal color accents","Nature, calligraphy, cultural art","Midjourney, SD","ink wash, sumi-e, Chinese painting, brush strokes, traditional Asian art"
|
||||
11,Chibi Q-Style,Illustration,"chibi, kawaii, cute, SD, super deformed, adorable, tiny","Super-deformed cute character style","Oversized head, small body, simple features, kawaii expressions, round shapes","Bright, pastel, candy colors","Mascots, stickers, merchandise","Midjourney, SD","chibi, kawaii, super deformed, cute, big head, small body, adorable"
|
||||
12,Isometric,Technical,"isometric, flat, geometric, technical, diagram, 30-degree","Isometric projection technical illustration","30-degree angles, no vanishing point, geometric precision, clean lines","Often bold, flat colors","Infographics, games, technical","Midjourney, SD, DALL-E","isometric, isometric view, 30 degree angle, flat design, geometric, technical illustration"
|
||||
13,Cyberpunk Sci-Fi,Genre,"cyberpunk, neon, future, sci-fi, dystopian, tech noir, blade runner","Futuristic dystopian aesthetic","Neon lights, rain-slicked streets, high-tech low-life, holographics, chrome","Neon pink, cyan, purple on dark","Sci-fi, gaming, urban","Midjourney, SD, Nano Banana","cyberpunk, neon lights, dystopian future, sci-fi, blade runner, tech noir"
|
||||
14,Retro Vintage,Nostalgic,"retro, vintage, old school, nostalgia, classic, throwback, period","Nostalgic imagery from past eras","Era-specific aesthetics, grain/texture, period-accurate colors, vintage wear","Muted, sepia, era-specific palettes","Period pieces, nostalgia marketing","Midjourney, DALL-E, SD","vintage, retro, 1950s/60s/70s/80s, nostalgic, old school, period accurate"
|
||||
15,Minimalism,Modern,"minimal, clean, simple, modern, white space, essential, less","Clean, essential design with maximum white space","Simple forms, limited elements, high contrast, essential details only","Monochrome, limited accent colors","Modern branding, UI/UX, editorial","Midjourney, DALL-E","minimalist, minimal, clean design, simple, white space, essential"
|
||||
16,Vaporwave,Aesthetic,"vaporwave, aesthetic, 90s, glitch, synthwave, retro-futuristic, nostalgic","90s-inspired surreal aesthetic","Glitch effects, Roman statues, gradient skies, grid patterns, Japanese text","Pink, purple, cyan, sunset gradients","Music, artistic, aesthetic content","Midjourney, SD","vaporwave, aesthetic, synthwave, 90s, glitch, roman statue, sunset gradient"
|
||||
17,Glassmorphism,UI,"glass, frosted, transparent, blur, modern, UI, Apple","Frosted glass UI aesthetic","Transparency, backdrop blur, subtle borders, layered depth, vibrant backgrounds","Translucent white on vibrant BG","UI mockups, modern design","Nano Banana, Midjourney","glassmorphism, frosted glass, backdrop blur, translucent, modern UI"
|
||||
18,Claymorphism,UI,"clay, soft, 3D, playful, rounded, bubbly, toy-like","Soft 3D clay-like UI aesthetic","Rounded forms, soft shadows, pastel colors, toy-like appearance, friendly","Soft pastels, warm tones","Friendly apps, children's content","Midjourney, SD","claymorphism, clay 3D, soft shadows, rounded, pastel, playful"
|
||||
19,Portrait Photography,Photography,"portrait, headshot, face, professional, fashion, editorial, beauty","Professional portrait photography","Lighting setups (Rembrandt, butterfly), skin detail, eye focus, composition","Natural skin tones, background depends on style","Portraits, headshots, fashion","Nano Banana, Midjourney","portrait photography, professional headshot, studio lighting, 85mm lens, bokeh"
|
||||
20,Fashion Editorial,Photography,"fashion, editorial, vogue, model, haute couture, magazine, runway","High fashion magazine photography","Dramatic poses, designer clothing, artistic lighting, editorial composition","High fashion palettes, often bold or muted","Fashion, luxury, editorial","Midjourney, Nano Banana","fashion editorial, vogue, haute couture, model photography, dramatic lighting"
|
||||
21,Product Commercial,Photography,"product, commercial, advertising, studio, hero shot, professional","Professional product photography","Clean isolation, material accuracy, controlled lighting, hero angles","Product-accurate, often neutral BG","E-commerce, advertising","Nano Banana, Midjourney, SD","product photography, commercial, studio lighting, white background, hero shot"
|
||||
22,Landscape Nature,Photography,"landscape, nature, outdoor, scenic, wilderness, vista, environment","Natural landscape photography","Wide vistas, natural lighting, composition rules, atmospheric effects","Natural greens, blues, earth tones","Travel, nature, wallpapers","Midjourney, SD, Nano Banana","landscape photography, nature, scenic, golden hour, wide angle, vista"
|
||||
23,Street Documentary,Photography,"street, documentary, candid, urban, lifestyle, real, authentic","Candid street and documentary photography","Authentic moments, urban settings, available light, spontaneous composition","Natural, urban colors","Lifestyle, journalism, authentic","Midjourney, Nano Banana","street photography, documentary, candid, urban, authentic, lifestyle"
|
||||
24,Macro Close-up,Photography,"macro, close-up, detail, micro, extreme detail, texture","Extreme close-up detail photography","Shallow DOF, extreme detail, texture visibility, scale distortion","Subject-dependent","Products, nature, textures","Midjourney, SD, Nano Banana","macro photography, close-up, extreme detail, shallow depth of field, texture"
|
||||
25,Ukiyo-e,Traditional,"ukiyo-e, Japanese, woodblock, Hokusai, Hiroshige, Edo, waves","Traditional Japanese woodblock print style","Flat colors, bold outlines, wave patterns, woodgrain texture, calligraphy","Prussian blue, vermilion, muted ochre","Japanese themes, artistic","Midjourney, SD","ukiyo-e, Japanese woodblock print, Hokusai, flat colors, bold outlines"
|
||||
|
19
.opencode/skills/ai-artist/data/techniques.csv
Normal file
19
.opencode/skills/ai-artist/data/techniques.csv
Normal file
@@ -0,0 +1,19 @@
|
||||
STT,Technique,Category,Keywords,Description,When to Use,Syntax Example,Platforms,Tips
|
||||
1,Emphasis Capitalization,Formatting,"caps, emphasis, important, critical, priority, MUST","Use ALL CAPS for critical requirements that must not be ignored","When specific elements are non-negotiable","MUST include blue sky. NEVER add watermarks. DO NOT modify face.","Nano Banana, DALL-E","Use sparingly - 2-3 emphasis points max; overuse dilutes impact"
|
||||
2,Weighted Prompting,Control,"weight, emphasis, priority, stronger, weaker, balance","Assign numerical weights to prompt terms for relative importance","When balancing multiple elements or emphasizing specific aspects","(important term:1.3), (less important:0.7) OR cat::2 dog::1","SD, Flux, Midjourney","1.0 is default; 1.2-1.5 for emphasis; 0.5-0.8 to reduce; Midjourney uses :: syntax"
|
||||
3,Negative Prompts,Refinement,"negative, avoid, exclude, remove, no, without, ban","Specify what to exclude from the generated image","To prevent common artifacts or unwanted elements","Negative: ugly, blurry, deformed, watermark, extra limbs","SD, Flux, Leonardo","Essential for SD/Flux; organize by category (anatomy, quality, style); keep concise"
|
||||
4,Multi-Image Reference,Identity,"reference, identity lock, face match, style transfer, consistency","Use multiple images to maintain subject identity or style","For consistent character generation or style matching","Upload 6 object + 5 human refs (Nano Banana up to 14 images)","Nano Banana, Midjourney, SD","Collage multiple refs into single image for efficiency; specify which image for what purpose"
|
||||
5,JSON Structured Prompts,Organization,"JSON, structured, organized, layered, metadata, schema","Use JSON format for complex, multi-layer prompt organization","For detailed scene descriptions with many parameters","{ ""subject"": {}, ""environment"": {}, ""camera"": {}, ""lighting"": {} }","Nano Banana, any","Helps organize complex prompts; include meta_data, subject_layer, environment_layer, composition_and_tech"
|
||||
6,Narrative Description,Natural,"narrative, paragraph, story, descriptive, natural language","Write prompts as flowing paragraphs like briefing a photographer","For models that understand natural language well (32K+ context)","A professional portrait of a woman in her 30s, standing in an urban setting at golden hour...","Nano Banana, DALL-E","More effective than keyword lists for Gemini; include context, mood, and intention"
|
||||
7,Photography Anchoring,Quality,"photography, camera, lens, DSLR, professional, shot","Use photography terms to anchor quality and realism","For photorealistic results and specific camera aesthetics","Captured with Canon EOS 90D, 85mm lens, f/1.8, shallow DOF, natural lighting","All platforms","Include camera model, lens, aperture, lighting setup; triggers photorealistic training data"
|
||||
8,Color Precision,Accuracy,"hex, color code, precise color, #, RGB, specific color","Use hex color codes instead of vague color names","When exact colors are critical","Background: #9F2B68 (dark magenta) instead of 'dark magenta'","Nano Banana, any","Hex codes are unambiguous; include color name for context; use for brand colors"
|
||||
9,Aspect Ratio Control,Composition,"aspect ratio, ar, dimensions, ratio, format, orientation","Specify exact aspect ratio for output dimensions","When specific dimensions are required","--ar 16:9 (Midjourney) OR aspect_ratio='16:9' (Nano Banana)","All platforms","Match platform requirements; 1:1 social, 9:16 stories, 16:9 widescreen, 21:9 cinematic"
|
||||
10,Iterative Refinement,Workflow,"iteration, refine, version, variation, A/B test, improve","Generate variations and refine based on results","For achieving optimal results through multiple generations","Generate 4 variations → Select best → Refine weights → Upscale","All platforms","Start broad, narrow down; save seeds for reproducibility; document successful prompts"
|
||||
11,Scene Layering,Composition,"foreground, midground, background, layers, depth, z-index","Describe scene in distinct depth layers","For complex scenes with depth","Foreground: cherry blossoms. Midground: person walking. Background: Mount Fuji at sunset.","All platforms","Creates visual depth; helps AI understand spatial relationships"
|
||||
12,Style Mixing,Creative,"blend, mix, fusion, combine, hybrid, mashup","Combine multiple artistic styles","For unique hybrid aesthetics","Art nouveau meets cyberpunk, or '80s synthwave crossed with ukiyo-e woodblock print","Midjourney, SD, Nano Banana","Use 'meets', 'crossed with', 'fusion of'; weight styles if needed"
|
||||
13,Negative Constraints,Safety,"NEVER, avoid, exclude, prohibit, ban, NO","Explicit statements of what must not appear","To prevent unwanted content or artifacts","NEVER include text or watermarks. DO NOT add any UI elements. Avoid red tones.","Nano Banana, DALL-E","More effective than negative prompts for some models; be specific and explicit"
|
||||
14,Camera Movement (Video),Motion,"pan, tilt, dolly, tracking, crane, zoom, motion","Specify camera movements for video generation","For AI video generation","Slow dolly forward, then gentle pan right revealing the landscape. Fade to next scene.","Veo, video platforms","Use cinematography terms; specify speed and direction; include transitions"
|
||||
15,Identity Lock,Consistency,"identity, face lock, same person, consistent, preserve","Techniques to maintain subject identity across generations","For consistent character representation","Use reference as EXACT facial reference. STRICT identity lock. NO face modification.","Nano Banana, SD (LoRA)","Upload clear reference; explicitly state preservation requirements; use JSON locks"
|
||||
16,Multi-Panel Composition,Layout,"panel, grid, collage, multi-image, split, diptych","Request images with multiple panels or sections","For comics, comparisons, before/after","2x2 grid showing: [top-left description], [top-right description], [bottom-left], [bottom-right]","Nano Banana, Midjourney","Describe each panel clearly; maintain consistency across panels; specify layout (2x2, 1x3, etc.)"
|
||||
17,Search Grounding,Real-time,"search, real-time, current, live data, grounding, factual","Enable real-time data for accurate current information","For current events, accurate data visualization","tools=[{'google_search': {}}] - enables real-time weather, charts, events","Nano Banana only","Use for infographics with current data; weather-accurate scenes; current event imagery"
|
||||
18,Thinking Mode,Complex,"thinking, reasoning, complex, planning, elaborate","Enable AI reasoning for complex compositions","For intricate scenes requiring planning","Enable thinking mode for complex multi-character scenes with specific interactions","Nano Banana Pro only","Response includes part.thought; use for complex logic like 'kittens MUST have eyes matching fur'"
|
||||
|
16
.opencode/skills/ai-artist/data/use-cases.csv
Normal file
16
.opencode/skills/ai-artist/data/use-cases.csv
Normal file
@@ -0,0 +1,16 @@
|
||||
STT,Use Case,Category,Keywords,Prompt Template,Key Elements,Best Platforms,Aspect Ratios,Tips,Example
|
||||
1,Profile Avatar,Portrait,"avatar, profile, headshot, professional, LinkedIn, social media, portrait","A professional {style} portrait of [subject], {background}, {lighting}. High-quality, sharp focus on eyes.","Subject appearance, background, lighting style, expression","Nano Banana, Midjourney, DALL-E","1:1, 4:5","Use reference image for identity lock; specify skin texture preference","Professional LinkedIn headshot with soft daylight, blurred office background"
|
||||
2,Social Media Post,Marketing,"social, Instagram, Twitter, viral, engagement, post, story, reel","A {style} image for social media showing [concept]. {composition}. Vibrant colors, eye-catching, shareable.","Main subject, brand colors, call-to-action elements, mobile-first composition","DALL-E, Midjourney, Nano Banana","1:1, 9:16, 4:5","Design for mobile viewing; use bold colors; include negative space for text overlay","Minimalist product flat-lay for Instagram with pastel background"
|
||||
3,YouTube Thumbnail,Marketing,"thumbnail, YouTube, clickbait, attention, video, preview, engaging","A {style} YouTube thumbnail showing [scene]. Bold text '{text}' in {font}. High contrast, {emotion} expression.","Subject with expressive face, bold readable text, contrasting colors, clear focal point","Nano Banana, Midjourney","16:9","Use surprised/excited expressions; limit text to 3-5 words; ensure 1080p quality","Shocked reaction face with glowing background and 'YOU WON'T BELIEVE THIS' text"
|
||||
4,Product Marketing,Commercial,"product, commercial, advertising, e-commerce, hero, marketing, lifestyle","A {style} product shot of [product] on {surface}. {lighting} creating {mood}. {camera_angle} view.","Product as hero, clean background, professional lighting, brand consistency","Nano Banana, DALL-E, SD","1:1, 4:3, 3:2","Use studio lighting terms; specify material reflections; include lifestyle context","Premium cosmetic bottle on marble surface with soft rim lighting"
|
||||
5,E-commerce Main Image,Commercial,"e-commerce, Amazon, Shopify, product, main image, white background, listing","A clean {style} product image of [product] on pure white background. Studio lighting, multiple angles available.","Product isolation, pure white (#FFFFFF) background, consistent lighting, accurate colors","Nano Banana, SD, Midjourney","1:1, 4:3","Match platform requirements; ensure color accuracy; remove all shadows or use soft drop shadow","Wireless earbuds case on pure white background with soft shadows"
|
||||
6,Infographic Visual,Educational,"infographic, educational, diagram, chart, visual, data, explainer","A {style} infographic about [topic]. Bento grid layout, {color_scheme} palette, icons for each section.","Clear hierarchy, data visualization, iconography, readable text, logical flow","Nano Banana, DALL-E","16:9, 4:3, 1:1","Use Bento grid for modules; limit to 8 sections max; ensure text legibility","Glass-style infographic about nutrition with 8 data modules"
|
||||
7,Comic Storyboard,Narrative,"comic, manga, storyboard, panel, sequence, narrative, story","A {panels}-panel {style} comic showing [story]. Consistent character design, speech bubbles, {mood} atmosphere.","Panel layout, character consistency, speech bubbles, visual flow, action lines","Midjourney, SD, Nano Banana","2:3, 3:4, 16:9","Maintain character identity across panels; use manga techniques for action; clear panel boundaries","4-panel manga sequence showing character discovering a secret message"
|
||||
8,Game Asset,Gaming,"game, asset, sprite, character, icon, item, UI, gaming","A {style} game asset: [item/character]. Transparent background ready, {view} view, consistent with {art_style} aesthetic.","Isolation-ready design, consistent art style, multiple states/angles, scalable","SD, Midjourney","1:1, varies","Design for transparency; create sprite sheets; maintain style consistency across assets","Pixel art treasure chest with open/closed states"
|
||||
9,Poster Flyer,Print,"poster, flyer, print, event, promotional, announcement, advertising","A {style} poster for [event/product]. Headline: '{headline}', {layout} composition, {color_scheme} colors.","Typography hierarchy, visual hook, brand elements, print-ready composition","DALL-E, Midjourney, Nano Banana","3:4, 2:3, A4","Use CMYK-safe colors; ensure 300dpi concept; include bleed area concept","Vintage music festival poster with psychedelic typography and sunset gradient"
|
||||
10,App Web Design,UI/UX,"app, web, UI, UX, mockup, interface, screen, dashboard","A {style} {device} mockup showing [app/website]. {color_scheme} palette, {layout} layout, modern UI elements.","Device frame, UI components, realistic content, responsive hints","Nano Banana, Midjourney, DALL-E","varies by device","Show realistic content; use design system patterns; include status bar details","iPhone mockup showing a meditation app with glassmorphism cards"
|
||||
11,Quote Card,Social,"quote, inspiration, motivational, card, typography, wisdom","A {style} quote card with text: '{quote}' — {author}. {background} background, {font_style} typography.","Quote text, author attribution, decorative elements, readable font","Nano Banana, DALL-E","1:1, 4:5, 16:9","Use large quotation marks; ensure text contrast; add subtle decorative elements","Brown gradient quote card with Steve Jobs quote and portrait silhouette"
|
||||
12,Header Banner,Marketing,"header, banner, hero, website, blog, article, cover","A {style} header image for [topic]. {composition}, {mood} atmosphere, horizontal format ready for text overlay.","Wide aspect ratio, focal point consideration, text-safe zones, brand alignment","DALL-E, Midjourney, Nano Banana","16:9, 21:9, 3:1","Leave negative space for text; ensure horizontal composition; consider responsive cropping","Hand-drawn style header for tech blog with blue-green gradient"
|
||||
13,Character Design,Creative,"character, OC, original, design, concept, persona, avatar","A {style} character design of [description]. {pose} pose, {outfit} outfit, {personality} expression.","Full body or bust, consistent proportions, outfit details, personality expression","Midjourney, SD, Nano Banana","2:3, 3:4, 1:1","Include turnaround views; specify body proportions; describe personality through visual cues","Anime-style female character with cyberpunk outfit and neon accessories"
|
||||
14,Architecture Interior,Visualization,"architecture, interior, room, space, design, rendering, visualization","A {style} {view} of [space type]. {materials} materials, {lighting} lighting, {atmosphere} atmosphere.","Spatial composition, material textures, lighting quality, furnishing details","Midjourney, SD","16:9, 4:3, 3:2","Use architectural photography terms; specify time of day; describe material finishes","Modern minimalist living room with floor-to-ceiling windows and warm afternoon light"
|
||||
15,Food Photography,Commercial,"food, culinary, recipe, dish, restaurant, cooking, delicious","A {style} food photo of [dish]. {plating} presentation, {lighting} lighting, {props} styling.","Hero dish focus, complementary props, appetizing lighting, styled setting","Nano Banana, Midjourney","1:1, 4:5, 4:3","Use overhead or 45-degree angles; include human elements for scale; describe steam/freshness","Overhead shot of artisan pizza with stretchy cheese pull and rustic wooden board"
|
||||
|
184
.opencode/skills/ai-artist/references/advanced-techniques.md
Normal file
184
.opencode/skills/ai-artist/references/advanced-techniques.md
Normal file
@@ -0,0 +1,184 @@
|
||||
# Advanced Prompt Engineering
|
||||
|
||||
## Prompt Optimization
|
||||
|
||||
### DSPy Framework
|
||||
Automatic prompt optimization through:
|
||||
1. Define task with input/output signatures
|
||||
2. Compile with optimizer (BootstrapFewShot, MIPRO)
|
||||
3. Model learns optimal prompting strategy
|
||||
4. Export optimized prompts for production
|
||||
|
||||
### Meta-Prompting
|
||||
```
|
||||
You are a prompt engineer. Create 5 variations for [task]:
|
||||
1. Direct instruction approach
|
||||
2. Role-based approach
|
||||
3. Few-shot example approach
|
||||
4. Chain of thought approach
|
||||
5. Constraint-focused approach
|
||||
|
||||
Evaluate each, select best.
|
||||
```
|
||||
|
||||
### Self-Refinement Loop
|
||||
```
|
||||
Generate: [Initial response]
|
||||
Critique: "What's wrong? Score 1-10."
|
||||
Refine: "Fix issues, improve score."
|
||||
Repeat until score ≥ 8.
|
||||
```
|
||||
|
||||
## Prompt Chaining
|
||||
|
||||
### Sequential Chain
|
||||
```
|
||||
Chain 1: [Input] → Extract key points
|
||||
Chain 2: Key points → Create outline
|
||||
Chain 3: Outline → Write draft
|
||||
Chain 4: Draft → Edit and polish
|
||||
```
|
||||
|
||||
### Parallel Chain
|
||||
Run independent subtasks simultaneously, merge results.
|
||||
|
||||
### Conditional Chain
|
||||
```
|
||||
If [condition A]: Execute prompt variant 1
|
||||
If [condition B]: Execute prompt variant 2
|
||||
Else: Execute default prompt
|
||||
```
|
||||
|
||||
### Loop Pattern
|
||||
```
|
||||
While not [success condition]:
|
||||
Generate attempt
|
||||
Evaluate against criteria
|
||||
If pass: break
|
||||
Else: refine with feedback
|
||||
```
|
||||
|
||||
## Evaluation Methods
|
||||
|
||||
### LLM-as-Judge
|
||||
```
|
||||
Rate this [output] on:
|
||||
1. Accuracy (1-10)
|
||||
2. Completeness (1-10)
|
||||
3. Clarity (1-10)
|
||||
4. Relevance (1-10)
|
||||
|
||||
Provide reasoning for each score.
|
||||
Final: Pass/Fail threshold = 7 average.
|
||||
```
|
||||
|
||||
### A/B Testing Protocol
|
||||
1. Single variable per test
|
||||
2. 20+ samples minimum
|
||||
3. Score on defined criteria
|
||||
4. Statistical significance check (p < 0.05)
|
||||
5. Document winner, roll out
|
||||
|
||||
### Regression Testing
|
||||
- Maintain test set of critical examples
|
||||
- Run before deploying prompt changes
|
||||
- Compare scores to baseline
|
||||
- Block deployment if regression detected
|
||||
|
||||
## Agent Prompting
|
||||
|
||||
### Tool Use Design
|
||||
```
|
||||
You have access to these tools:
|
||||
- search(query): Search the web
|
||||
- calculate(expression): Math operations
|
||||
- code(language, code): Execute code
|
||||
|
||||
To use: <tool_name>arguments</tool_name>
|
||||
Wait for result before continuing.
|
||||
```
|
||||
|
||||
### Planning Prompt
|
||||
```
|
||||
Task: [Complex goal]
|
||||
|
||||
Before acting:
|
||||
1. Break into subtasks
|
||||
2. Identify dependencies
|
||||
3. Plan execution order
|
||||
4. Note potential blockers
|
||||
|
||||
Then execute step by step.
|
||||
```
|
||||
|
||||
### Reflection Pattern
|
||||
```
|
||||
After each step:
|
||||
- What worked?
|
||||
- What didn't?
|
||||
- Adjust approach for next step.
|
||||
```
|
||||
|
||||
## Parameter Tuning
|
||||
|
||||
| Parameter | Low | High | Use Case |
|
||||
|-----------|-----|------|----------|
|
||||
| Temperature | 0.0-0.3 | 0.7-1.0 | Factual vs Creative |
|
||||
| Top-P | 0.8 | 0.95 | Focused vs Diverse |
|
||||
| Top-K | 10 | 100 | Conservative vs Exploratory |
|
||||
|
||||
**Rule**: Tune temperature first. Only adjust top-p if needed. Never both at once.
|
||||
|
||||
## Safety Patterns
|
||||
|
||||
### Output Filtering
|
||||
```
|
||||
Before responding, check:
|
||||
- No PII exposure
|
||||
- No harmful content
|
||||
- No policy violations
|
||||
- Aligned with guidelines
|
||||
|
||||
If any fail: "I can't help with that."
|
||||
```
|
||||
|
||||
### Jailbreak Prevention
|
||||
- Clear system boundaries upfront
|
||||
- Repeat constraints at end
|
||||
- "Ignore previous" pattern detection
|
||||
- Role-lock: "You are ONLY [role], never anything else"
|
||||
|
||||
### Confidence Calibration
|
||||
```
|
||||
For each claim, provide:
|
||||
- Confidence: High/Medium/Low
|
||||
- Source: [citation if available]
|
||||
- Caveat: [limitations]
|
||||
```
|
||||
|
||||
## Production Patterns
|
||||
|
||||
### Version Control
|
||||
- Git for prompt files
|
||||
- Semantic versioning (1.0.0, 1.1.0)
|
||||
- Changelog per version
|
||||
- Rollback capability
|
||||
|
||||
### Caching
|
||||
- Cache common queries
|
||||
- TTL based on content freshness
|
||||
- Invalidate on prompt update
|
||||
|
||||
### Fallbacks
|
||||
```
|
||||
Try: Primary prompt
|
||||
If fail: Simplified fallback prompt
|
||||
If still fail: Human escalation
|
||||
Log all failures for analysis.
|
||||
```
|
||||
|
||||
### Cost Optimization
|
||||
- Shorter prompts = fewer tokens
|
||||
- Remove redundant examples
|
||||
- Use smaller model for simple tasks
|
||||
- Batch similar requests
|
||||
File diff suppressed because it is too large
Load Diff
66
.opencode/skills/ai-artist/references/domain-code.md
Normal file
66
.opencode/skills/ai-artist/references/domain-code.md
Normal file
@@ -0,0 +1,66 @@
|
||||
# Code Generation Patterns
|
||||
|
||||
## Function Implementation
|
||||
```
|
||||
Write a [language] function:
|
||||
- Input: [params with types]
|
||||
- Output: [return type]
|
||||
- Behavior: [logic]
|
||||
|
||||
Requirements:
|
||||
- Edge cases: [list]
|
||||
- Error handling: [approach]
|
||||
- Performance: O([complexity])
|
||||
```
|
||||
|
||||
## Code Review
|
||||
```
|
||||
Review for:
|
||||
1. Bugs/logic errors
|
||||
2. Security vulnerabilities
|
||||
3. Performance issues
|
||||
4. Style violations
|
||||
5. Missing edge cases
|
||||
|
||||
Format: Issue, line number, severity, fix.
|
||||
```
|
||||
|
||||
## Refactoring
|
||||
```
|
||||
Refactor to:
|
||||
- [Improvement goal]
|
||||
- Maintain backward compatibility
|
||||
- Keep public API
|
||||
- Add comments for complex logic
|
||||
Show before/after.
|
||||
```
|
||||
|
||||
## Debugging
|
||||
```
|
||||
<error>[Error message/behavior]</error>
|
||||
<code>[Relevant code]</code>
|
||||
<context>[When it occurs]</context>
|
||||
|
||||
Analyze:
|
||||
1. Root cause
|
||||
2. Why it happens
|
||||
3. Fix with explanation
|
||||
4. Prevention strategy
|
||||
```
|
||||
|
||||
## Test Generation
|
||||
```
|
||||
Generate tests for [function/class]:
|
||||
- Framework: [jest/pytest/etc]
|
||||
- Coverage: happy path, edge cases, errors
|
||||
- Include: setup, assertion, cleanup
|
||||
- Mock: [external dependencies]
|
||||
```
|
||||
|
||||
## Documentation
|
||||
```
|
||||
Document this [function/class/API]:
|
||||
- Format: [JSDoc/docstring/OpenAPI]
|
||||
- Include: description, params, returns, examples
|
||||
- Note: edge cases, errors, deprecations
|
||||
```
|
||||
72
.opencode/skills/ai-artist/references/domain-data.md
Normal file
72
.opencode/skills/ai-artist/references/domain-data.md
Normal file
@@ -0,0 +1,72 @@
|
||||
# Data & Analysis Patterns
|
||||
|
||||
## Structured Extraction
|
||||
```
|
||||
Extract from text:
|
||||
<text>[content]</text>
|
||||
|
||||
Return JSON:
|
||||
{
|
||||
"field1": "value or null",
|
||||
"field2": ["array"]
|
||||
}
|
||||
|
||||
Rules:
|
||||
- Exact matches only
|
||||
- Confidence score if uncertain
|
||||
- null for missing
|
||||
```
|
||||
|
||||
## Document Analysis
|
||||
```
|
||||
Analyze [document type]:
|
||||
1. Summary (2-3 sentences)
|
||||
2. Key entities (people, orgs, dates)
|
||||
3. Main topics (ranked)
|
||||
4. Sentiment: positive/neutral/negative
|
||||
5. Action items
|
||||
```
|
||||
|
||||
## Comparison
|
||||
```
|
||||
Compare [A] and [B]:
|
||||
| Criterion | A | B |
|
||||
|-----------|---|---|
|
||||
| [Factor 1] | | |
|
||||
| [Factor 2] | | |
|
||||
|
||||
Recommendation: [choice] for [use case]
|
||||
```
|
||||
|
||||
## Problem Solving
|
||||
```
|
||||
Problem: [description]
|
||||
|
||||
Analyze:
|
||||
1. Root cause (5 whys)
|
||||
2. Contributing factors
|
||||
3. Options (pros/cons)
|
||||
4. Recommendation
|
||||
5. Implementation steps
|
||||
6. Risk mitigation
|
||||
```
|
||||
|
||||
## Data Transformation
|
||||
```
|
||||
Transform data:
|
||||
- Input format: [CSV/JSON/etc]
|
||||
- Output format: [target]
|
||||
- Rules: [mapping logic]
|
||||
- Validation: [constraints]
|
||||
|
||||
Handle: missing values, type mismatches.
|
||||
```
|
||||
|
||||
## Summarization
|
||||
```
|
||||
Summarize [content]:
|
||||
- Length: [sentences/words]
|
||||
- Focus: [key themes]
|
||||
- Audience: [technical/general]
|
||||
- Preserve: [critical details]
|
||||
```
|
||||
66
.opencode/skills/ai-artist/references/domain-marketing.md
Normal file
66
.opencode/skills/ai-artist/references/domain-marketing.md
Normal file
@@ -0,0 +1,66 @@
|
||||
# Marketing Copy Patterns
|
||||
|
||||
## Headlines
|
||||
```
|
||||
Write 5 headline variations for [product].
|
||||
Frameworks:
|
||||
1. How to [benefit]
|
||||
2. [Number] ways to [solve problem]
|
||||
3. The secret to [outcome]
|
||||
4. Why [audience] love [product]
|
||||
5. [Timeframe] to [transformation]
|
||||
```
|
||||
|
||||
## Product Descriptions
|
||||
```
|
||||
<product>[Name, features]</product>
|
||||
<audience>[Demographics, pain points]</audience>
|
||||
|
||||
Write description that:
|
||||
- Opens with benefit (not feature)
|
||||
- Addresses [main objection]
|
||||
- Social proof placeholder
|
||||
- Clear CTA
|
||||
- Tone: [brand voice]
|
||||
- Length: [word count]
|
||||
```
|
||||
|
||||
## Email Subject Lines
|
||||
```
|
||||
Generate 10 subject lines for [campaign].
|
||||
Mix approaches:
|
||||
- Curiosity gap
|
||||
- Urgency/scarcity
|
||||
- Personalization
|
||||
- Question format
|
||||
- Number/list
|
||||
Under 50 chars. Test 2-3 with emojis.
|
||||
```
|
||||
|
||||
## Ad Copy
|
||||
```
|
||||
Platform: [Google/Meta/LinkedIn]
|
||||
Objective: [awareness/conversion]
|
||||
Character limit: [limit]
|
||||
|
||||
Create [N] variations with:
|
||||
- Hook (first 5 words critical)
|
||||
- Value proposition
|
||||
- Social proof element
|
||||
- CTA matching platform norms
|
||||
```
|
||||
|
||||
## Landing Pages
|
||||
```
|
||||
<offer>[Product/service]</offer>
|
||||
<goal>[signup/purchase/download]</goal>
|
||||
|
||||
Write sections:
|
||||
1. Hero headline + subhead
|
||||
2. Problem agitation
|
||||
3. Solution introduction
|
||||
4. 3-5 benefit bullets
|
||||
5. Social proof
|
||||
6. CTA with urgency
|
||||
7. FAQ (3 objections)
|
||||
```
|
||||
33
.opencode/skills/ai-artist/references/domain-patterns.md
Normal file
33
.opencode/skills/ai-artist/references/domain-patterns.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# Domain-Specific Prompt Patterns
|
||||
|
||||
Quick reference index. Load specific domain file for detailed patterns.
|
||||
|
||||
## Domains
|
||||
|
||||
| Domain | File | Use Cases |
|
||||
|--------|------|-----------|
|
||||
| Marketing | `domain-marketing.md` | Headlines, product copy, emails, ads |
|
||||
| Code | `domain-code.md` | Functions, review, refactoring, debugging |
|
||||
| Writing | `domain-writing.md` | Stories, characters, dialogue, editing |
|
||||
| Data | `domain-data.md` | Extraction, analysis, comparison, reasoning |
|
||||
|
||||
## Universal Pattern
|
||||
|
||||
All domain prompts follow:
|
||||
```
|
||||
<context>
|
||||
[Domain-specific background]
|
||||
</context>
|
||||
|
||||
<task>
|
||||
[Specific action]
|
||||
</task>
|
||||
|
||||
<constraints>
|
||||
[Quality criteria, format, length, tone]
|
||||
</constraints>
|
||||
|
||||
<output>
|
||||
[Expected structure]
|
||||
</output>
|
||||
```
|
||||
68
.opencode/skills/ai-artist/references/domain-writing.md
Normal file
68
.opencode/skills/ai-artist/references/domain-writing.md
Normal file
@@ -0,0 +1,68 @@
|
||||
# Creative Writing Patterns
|
||||
|
||||
## Story Outline
|
||||
```
|
||||
Create [length] story outline:
|
||||
- Genre: [genre]
|
||||
- Protagonist: [brief]
|
||||
- Conflict: [type]
|
||||
- Setting: [time/place]
|
||||
|
||||
Structure:
|
||||
1. Hook/Opening
|
||||
2. Inciting incident
|
||||
3. Rising action (3 beats)
|
||||
4. Climax
|
||||
5. Resolution
|
||||
```
|
||||
|
||||
## Character Voice
|
||||
```
|
||||
Write as [character]:
|
||||
- Background: [history]
|
||||
- Speech: [patterns, vocab]
|
||||
- Emotion: [current state]
|
||||
- Goal: [scene objective]
|
||||
|
||||
Maintain voice consistency.
|
||||
```
|
||||
|
||||
## Dialogue
|
||||
```
|
||||
Write dialogue between [A] and [B]:
|
||||
- Scene: [context]
|
||||
- Tension: [conflict source]
|
||||
- Subtext: [what's unsaid]
|
||||
|
||||
Each character distinct voice. Show don't tell.
|
||||
```
|
||||
|
||||
## Scene Description
|
||||
```
|
||||
Describe [scene]:
|
||||
- POV: [character/omniscient]
|
||||
- Focus: [sensory details]
|
||||
- Mood: [atmosphere]
|
||||
- Pacing: [fast/slow/measured]
|
||||
|
||||
Use active verbs, concrete details.
|
||||
```
|
||||
|
||||
## Editing Pass
|
||||
```
|
||||
Edit this [content type]:
|
||||
Focus: [clarity/flow/voice/grammar]
|
||||
Preserve: [author's style]
|
||||
Flag: [major issues only]
|
||||
|
||||
Provide tracked changes with rationale.
|
||||
```
|
||||
|
||||
## Genre Adaptation
|
||||
```
|
||||
Rewrite [content] as [genre]:
|
||||
- Keep: core plot/message
|
||||
- Add: genre conventions
|
||||
- Tone: [genre-appropriate]
|
||||
- Tropes: [use/subvert specific tropes]
|
||||
```
|
||||
141
.opencode/skills/ai-artist/references/image-prompting.md
Normal file
141
.opencode/skills/ai-artist/references/image-prompting.md
Normal file
@@ -0,0 +1,141 @@
|
||||
# Image Generation Prompting
|
||||
|
||||
## Universal Structure
|
||||
```
|
||||
[Subject + Details] [Action/Pose] [Setting/Environment]
|
||||
[Style/Medium] [Artist/Movement Reference]
|
||||
[Lighting] [Camera/Lens] [Composition]
|
||||
[Quality Modifiers] [Aspect Ratio]
|
||||
```
|
||||
|
||||
## Platform Reference
|
||||
|
||||
### Midjourney v6.1
|
||||
```
|
||||
[prompt] --ar 16:9 --style raw --v 6.1
|
||||
```
|
||||
|
||||
| Parameter | Values | Effect |
|
||||
|-----------|--------|--------|
|
||||
| `--ar` | 1:1, 16:9, 9:16, 4:3, 3:2, 21:9 | Aspect ratio |
|
||||
| `--style` | raw, default | raw=photorealistic |
|
||||
| `--stylize` | 0-1000 | Artistic interpretation (0=literal) |
|
||||
| `--chaos` | 0-100 | Variation between outputs |
|
||||
| `--weird` | 0-3000 | Unusual/experimental elements |
|
||||
| `--quality` | .25, .5, 1, 2 | Detail level (cost) |
|
||||
| `--seed` | number | Reproducibility |
|
||||
| `--no` | [term] | Negative prompt inline |
|
||||
| `--tile` | - | Seamless patterns |
|
||||
|
||||
**Multi-prompt weighting**: `cat::2 dog::1` (cat 2x stronger)
|
||||
**Describe**: Upload image → get prompt suggestions
|
||||
**Blend**: `/blend` to merge 2-5 images
|
||||
|
||||
### DALL-E 3
|
||||
- Natural language only, no parameters
|
||||
- Be descriptive, not keyword-heavy
|
||||
- Specify: "HD quality" or "vivid style" in prompt
|
||||
- Text rendering: Describe font, placement, content explicitly
|
||||
- Avoid: Lists of keywords, technical jargon
|
||||
|
||||
### Stable Diffusion / SDXL / Flux
|
||||
```
|
||||
(important term:1.3), normal term, (less important:0.8)
|
||||
Negative prompt: ugly, blurry, deformed, watermark
|
||||
```
|
||||
|
||||
| Feature | Syntax |
|
||||
|---------|--------|
|
||||
| Weight up | `(word:1.2)` to `(word:1.5)` |
|
||||
| Weight down | `(word:0.5)` to `(word:0.8)` |
|
||||
| LoRA | `<lora:model_name:0.8>` |
|
||||
| Embedding | `embedding:name` |
|
||||
| Blend | `[cat|dog]` alternating |
|
||||
|
||||
**CFG Scale**: 7-12 typical (higher=more prompt adherence)
|
||||
**Samplers**: DPM++ 2M Karras (quality), Euler a (speed)
|
||||
|
||||
### Nano Banana (Gemini)
|
||||
```
|
||||
[Narrative description, not keywords]
|
||||
Captured with 85mm lens, soft bokeh, natural lighting
|
||||
```
|
||||
|
||||
**Key features**:
|
||||
- 32K token context (complex prompts OK)
|
||||
- Narrative paragraphs > keyword lists
|
||||
- Hex colors for precision: `#9F2B68`
|
||||
- Text rendering: Describe font, placement explicitly
|
||||
- Multi-image: Up to 14 reference images
|
||||
- Search grounding: Real-time data (weather, events)
|
||||
- Thinking mode: Complex composition reasoning
|
||||
|
||||
**Aspect ratios**: 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
|
||||
**Resolution**: 1K, 2K, 4K (use uppercase K)
|
||||
|
||||
**Best practices**:
|
||||
- ALL CAPS for critical requirements
|
||||
- Markdown lists for multiple rules
|
||||
- "NEVER include..." for negative constraints
|
||||
- Photography terms anchor quality
|
||||
|
||||
### Imagen 4 / Veo 3.1
|
||||
- Natural language, descriptive
|
||||
- Aspect ratio in text: "16:9 landscape format"
|
||||
- Veo: Cinematography keywords most powerful
|
||||
- Camera movements: pan, tilt, dolly, crane, tracking
|
||||
- Scene transitions: cut, fade, dissolve
|
||||
|
||||
## Style Keywords
|
||||
|
||||
### Art Movements
|
||||
photorealistic, hyperrealistic, impressionist, expressionist,
|
||||
surrealist, art nouveau, art deco, pop art, cyberpunk, steampunk,
|
||||
solarpunk, vaporwave, synthwave, brutalist, minimalist
|
||||
|
||||
### Media Types
|
||||
oil painting, watercolor, digital art, 3D render, vector art,
|
||||
pencil sketch, ink drawing, pastel, charcoal, gouache, fresco
|
||||
|
||||
### Photography Styles
|
||||
portrait, landscape, macro, street, documentary, fashion,
|
||||
editorial, product, architectural, aerial, underwater
|
||||
|
||||
## Lighting Vocabulary
|
||||
|
||||
| Term | Effect |
|
||||
|------|--------|
|
||||
| Golden hour | Warm, soft, directional |
|
||||
| Blue hour | Cool, moody, twilight |
|
||||
| Rembrandt | Triangle on cheek, dramatic |
|
||||
| Butterfly | Shadow under nose, glamorous |
|
||||
| Split | Half face lit, mysterious |
|
||||
| Rim/back | Edge highlight, separation |
|
||||
| Volumetric | Light rays visible |
|
||||
| Neon glow | Colorful, cyberpunk |
|
||||
|
||||
## Camera/Lens Terms
|
||||
- 50mm (standard), 85mm (portrait), 35mm (wide)
|
||||
- Telephoto (compressed), Macro (close-up), Fisheye (distorted)
|
||||
- Shallow DOF, Deep DOF, Bokeh
|
||||
- Low angle, High angle, Dutch angle, Bird's eye, Worm's eye
|
||||
|
||||
## Composition Keywords
|
||||
rule of thirds, golden ratio, centered, symmetrical,
|
||||
leading lines, framing, negative space, filling frame,
|
||||
foreground interest, layered depth
|
||||
|
||||
## Negative Prompts (SD/Flux)
|
||||
```
|
||||
ugly, deformed, blurry, low quality, bad anatomy,
|
||||
extra limbs, missing limbs, disfigured, watermark,
|
||||
text, signature, cropped, out of frame, duplicate,
|
||||
poorly drawn, bad proportions, gross proportions
|
||||
```
|
||||
|
||||
## Iterative Workflow
|
||||
1. Start: Subject + style + quality modifier
|
||||
2. Add: Lighting + composition + camera
|
||||
3. Test: Generate 4 variations
|
||||
4. Refine: Adjust weights, add negatives
|
||||
5. Upscale: Select winner, increase resolution
|
||||
165
.opencode/skills/ai-artist/references/llm-prompting.md
Normal file
165
.opencode/skills/ai-artist/references/llm-prompting.md
Normal file
@@ -0,0 +1,165 @@
|
||||
# LLM Prompting Reference
|
||||
|
||||
## Prompt Architecture
|
||||
|
||||
### System Prompt Structure
|
||||
```
|
||||
You are [ROLE] with expertise in [DOMAIN].
|
||||
|
||||
## Context
|
||||
[Background, constraints, tone]
|
||||
|
||||
## Instructions
|
||||
[Step-by-step task breakdown]
|
||||
|
||||
## Output Format
|
||||
[Exact structure with example]
|
||||
|
||||
## Constraints
|
||||
- [Hard limits]
|
||||
- [Guardrails]
|
||||
```
|
||||
|
||||
### User Prompt Structure
|
||||
```xml
|
||||
<context>[Background information]</context>
|
||||
<task>[Specific action required]</task>
|
||||
<format>[Output structure]</format>
|
||||
<constraints>[Additional limits]</constraints>
|
||||
```
|
||||
|
||||
## Reasoning Techniques
|
||||
|
||||
### Chain of Thought (CoT)
|
||||
| Variant | Trigger | Best For |
|
||||
|---------|---------|----------|
|
||||
| Zero-shot | "Think step by step" | Quick reasoning tasks |
|
||||
| Few-shot | 2-3 reasoning examples | Complex multi-step |
|
||||
| Auto-CoT | "Let's approach systematically" | General reasoning |
|
||||
|
||||
### Tree of Thoughts (ToT)
|
||||
```
|
||||
Explore 3 approaches to [problem]:
|
||||
For each: 1) Method 2) Pros/cons 3) Success probability
|
||||
Evaluate branches, select best path.
|
||||
```
|
||||
|
||||
### Self-Consistency
|
||||
Run same prompt 3-5x with temp=0.7, take majority answer. Best for: math, logic, factual.
|
||||
|
||||
### ReAct Pattern
|
||||
```
|
||||
Thought: [Current reasoning]
|
||||
Action: [Tool/step to take]
|
||||
Observation: [Result]
|
||||
...repeat...
|
||||
Final Answer: [Conclusion]
|
||||
```
|
||||
|
||||
### Least-to-Most
|
||||
```
|
||||
Break [complex task] into subproblems.
|
||||
Solve easiest first, build up.
|
||||
```
|
||||
|
||||
## Instruction Optimization
|
||||
|
||||
### Self-Refine Pattern
|
||||
```
|
||||
1. Generate initial response
|
||||
2. Critique: "What's wrong with this?"
|
||||
3. Refine: "Fix identified issues"
|
||||
4. Repeat until satisfactory
|
||||
```
|
||||
|
||||
### Role Optimization
|
||||
- **Expert persona**: "As a senior [role] with 20 years..."
|
||||
- **Constraint persona**: "You only respond with..."
|
||||
- **Teaching persona**: "Explain as if to a..."
|
||||
|
||||
### Task Decomposition
|
||||
```
|
||||
<subtasks>
|
||||
1. [First step - output X]
|
||||
2. [Second step - using X, output Y]
|
||||
3. [Final step - using Y, output Z]
|
||||
</subtasks>
|
||||
```
|
||||
|
||||
## Output Control
|
||||
|
||||
### JSON Enforcement
|
||||
```
|
||||
Respond in valid JSON only:
|
||||
{"field": "type", "required": true}
|
||||
No markdown, no explanation, just JSON.
|
||||
```
|
||||
|
||||
### Length Control
|
||||
| Goal | Phrase |
|
||||
|------|--------|
|
||||
| Brief | "In 2-3 sentences" |
|
||||
| Detailed | "Comprehensive analysis in 500 words" |
|
||||
| Structured | "5 bullet points, max 20 words each" |
|
||||
|
||||
### Hallucination Reduction
|
||||
- "Only use information from provided context"
|
||||
- "If unsure, say 'I don't know'"
|
||||
- "Cite sources for each claim"
|
||||
- "Confidence: high/medium/low for each point"
|
||||
|
||||
## Model-Specific Tips
|
||||
|
||||
### Claude
|
||||
- XML tags: `<thinking>`, `<answer>`, `<context>`
|
||||
- Extended thinking: "Think deeply before responding"
|
||||
- Prefill: Start assistant response to guide format
|
||||
|
||||
### GPT-4
|
||||
- JSON mode: `response_format: {"type": "json_object"}`
|
||||
- Function calling for structured output
|
||||
- System message for persistent instructions
|
||||
|
||||
### Gemini
|
||||
- Multimodal: Image + text in same prompt
|
||||
- Grounding: Enable Google Search for facts
|
||||
- Safety settings: Adjust thresholds
|
||||
|
||||
## Context Engineering
|
||||
|
||||
### RAG Prompt Pattern
|
||||
```
|
||||
<retrieved_context>
|
||||
[Document chunks with sources]
|
||||
</retrieved_context>
|
||||
|
||||
Answer based ONLY on context above.
|
||||
If not in context, say "Not found in documents."
|
||||
```
|
||||
|
||||
### Window Optimization
|
||||
- Front-load critical info (primacy effect)
|
||||
- Repeat key constraints at end (recency effect)
|
||||
- Chunk long documents with summaries
|
||||
|
||||
## Few-Shot Examples
|
||||
|
||||
### Structure
|
||||
```
|
||||
Example 1:
|
||||
Input: [representative input]
|
||||
Output: [ideal output]
|
||||
|
||||
Example 2:
|
||||
Input: [edge case]
|
||||
Output: [handling]
|
||||
|
||||
Now apply to:
|
||||
Input: [actual task]
|
||||
```
|
||||
|
||||
### Selection Criteria
|
||||
- Diverse examples > similar examples
|
||||
- Include edge cases
|
||||
- Match complexity of target task
|
||||
- 2-5 examples optimal (diminishing returns beyond)
|
||||
136
.opencode/skills/ai-artist/references/nano-banana.md
Normal file
136
.opencode/skills/ai-artist/references/nano-banana.md
Normal file
@@ -0,0 +1,136 @@
|
||||
# Nano Banana Pro (Gemini Image)
|
||||
|
||||
## Models
|
||||
|
||||
| Model ID | Type | Best For |
|
||||
|----------|------|----------|
|
||||
| `gemini-2.5-flash-image` | Flash | Speed, high-volume |
|
||||
| `gemini-3-pro-image-preview` | Pro | Text rendering, complex prompts |
|
||||
|
||||
## Core Principle
|
||||
|
||||
**Narrative paragraphs > keyword lists** (32K context). Write like briefing a photographer.
|
||||
|
||||
## Parameters
|
||||
|
||||
```python
|
||||
responseModalities=['TEXT', 'IMAGE']
|
||||
aspect_ratio="16:9" # 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 21:9
|
||||
image_size="2K" # 1K, 2K, 4K - MUST be uppercase K
|
||||
```
|
||||
|
||||
## Prompt Templates
|
||||
|
||||
**Photorealistic**: `A [subject] in [location], [lens] lens. [Lighting] creates [mood]. [Details]. [Camera angle]. Professional photography, natural lighting.`
|
||||
|
||||
**Illustration**: `[Art style] illustration of [subject]. [Color palette]. [Line style]. [Background]. [Mood].`
|
||||
|
||||
**Text in Image**: `Image with text "[EXACT]" in [font]. Font: [style]. Color: [hex/#FF5733]. Position: [top/center/bottom]. Background: [desc]. Context: [poster/sign].`
|
||||
|
||||
**Product**: `[Product] on [surface]. Materials: [finish]. Lighting: [setup]. Camera: [angle]. Background: [type]. Style: [commercial/lifestyle].`
|
||||
|
||||
**Infographic**: `Premium liquid glass Bento grid infographic with 8 modules. Product: [item]. Language: [lang]. Hero card: 28-30%. Background: [ethereal/macro/pattern/context].`
|
||||
|
||||
## Prompt Collection / Prompt Search
|
||||
|
||||
Read `references/awesome-prompts.csv` directly or search for relevant prompts using `python3 ../scripts/search.py "<query>"`.
|
||||
|
||||
## JSON Structured Prompts
|
||||
|
||||
For complex scenes, use JSON structure:
|
||||
|
||||
```json
|
||||
{
|
||||
"meta_data": { "prompt_version": "2.0", "use_case": "..." },
|
||||
"subject_layer": {
|
||||
"anatomy": { "demographics": {}, "face_detail": {}, "hair": {} },
|
||||
"attire_layer": { "garment_main": {}, "accessories": {} },
|
||||
"pose_dynamics": { "posture": "", "limb_placement": {} }
|
||||
},
|
||||
"environment_layer": { "setting_type": "", "spatial_layout": {} },
|
||||
"composition_and_tech": {
|
||||
"framing": { "type": "", "angle": "" },
|
||||
"lighting": { "source": "", "direction": "" },
|
||||
"aesthetic_style": { "visual_core": "", "vibe": "" }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Techniques
|
||||
|
||||
| Technique | Example |
|
||||
|-----------|---------|
|
||||
| Emphasis | `ALL CAPS` for critical requirements |
|
||||
| Precision colors | `#9F2B68` instead of "dark magenta" |
|
||||
| Negative constraints | `NEVER include text/watermarks. DO NOT add labels.` |
|
||||
| Realism trigger | `Natural lighting, DOF. Captured with Canon EOS 90D DSLR.` |
|
||||
| Structured edits | `Make ALL edits: - [1] - [2] - [3]` |
|
||||
| Complex logic | `Kittens MUST have heterochromatic eyes matching fur colors` |
|
||||
| Identity lock | `Use reference as EXACT facial reference. STRICT identity lock.` |
|
||||
|
||||
## Advanced Features
|
||||
|
||||
**Multi-Image Input** (up to 14): 6 object + 5 human refs. Tip: collage refs into single image.
|
||||
|
||||
**Search Grounding**: `tools=[{"google_search": {}}]` — real-time data (weather, charts, events).
|
||||
|
||||
**Thinking Mode** (Pro only): `part.thought` in response for complex reasoning.
|
||||
|
||||
## Popular Use Case Templates
|
||||
|
||||
### Quote Card
|
||||
```
|
||||
A wide quote card with {background} background, {font_style} font.
|
||||
Quote: "{quote_text}" — {author}
|
||||
Large subtle quotation mark before text. Portrait on left, text right.
|
||||
Text: 2/3 width, portrait: 1/3 width. Gradient transition on portrait.
|
||||
```
|
||||
|
||||
### Infographic (Bento Grid)
|
||||
```
|
||||
Premium liquid glass Bento grid product infographic with 8 modules.
|
||||
Product: [name]. Language: [lang].
|
||||
1) Hero card (28-30%): Product photo/3D glass
|
||||
2) Core Benefits: 4 benefits + icons
|
||||
3) How to Use: 4 methods + icons
|
||||
4) Key Metrics: 5 data points
|
||||
5) Who It's For: 4 recommended + 3 caution groups
|
||||
6) Important Notes: 4 precautions
|
||||
7) Quick Reference: Specs/certifications
|
||||
8) Did You Know: 3 facts
|
||||
Background: Apple liquid glass cards (85-90% transparent).
|
||||
```
|
||||
|
||||
### Mirror Selfie
|
||||
```
|
||||
Scene: Mirror selfie in [room type], [color] tone.
|
||||
Subject: [demographics], [body type], [hairstyle].
|
||||
Pose: [stance], holding smartphone.
|
||||
Clothing: [detailed outfit description].
|
||||
Environment: [room details, furnishings, lighting].
|
||||
Camera: Smartphone rear camera via mirror, [focal length]mm.
|
||||
Negative: [artifacts to avoid].
|
||||
```
|
||||
|
||||
### Style Transformation
|
||||
```
|
||||
A Japanese Edo-period Ukiyo-e woodblock print reimagining [modern scene].
|
||||
Characters: Edo-era kimono but modern actions.
|
||||
Tech transformation: Smartphones → glowing scrolls, trains → wooden carriages.
|
||||
Composition: Flattened perspective, bold ink outlines.
|
||||
Texture: Wood grain, paper fibers, pigment bleeding.
|
||||
Colors: Prussian blue, vermilion red, muted ochre.
|
||||
Include vertical Japanese calligraphy and red artist seal.
|
||||
```
|
||||
|
||||
## Workflow
|
||||
|
||||
1. Narrative description → 2. Photography terms → 3. ALL CAPS emphasis → 4. Multi-turn refine → 5. Negative constraints → 6. Set ratio/resolution
|
||||
|
||||
## Avoid
|
||||
|
||||
- Keyword spam ("4k, trending, masterpiece")
|
||||
- Vague text ("add some text" → specify exact text, font, position)
|
||||
- Lowercase resolution ("4k" rejected, use "4K")
|
||||
- Over-smoothed skin requests (leads to plastic look)
|
||||
- Generic prompts without specific details
|
||||
201
.opencode/skills/ai-artist/references/reasoning-techniques.md
Normal file
201
.opencode/skills/ai-artist/references/reasoning-techniques.md
Normal file
@@ -0,0 +1,201 @@
|
||||
# Reasoning Techniques Deep Dive
|
||||
|
||||
## Chain of Thought (CoT) Variants
|
||||
|
||||
### Zero-Shot CoT
|
||||
```
|
||||
[Task description]
|
||||
|
||||
Think step by step before answering.
|
||||
```
|
||||
**Use when**: Quick reasoning, no examples available
|
||||
**Effectiveness**: +40-60% on reasoning tasks
|
||||
|
||||
### Few-Shot CoT
|
||||
```
|
||||
Example 1:
|
||||
Q: [Question]
|
||||
A: Let me think through this...
|
||||
Step 1: [Reasoning]
|
||||
Step 2: [Reasoning]
|
||||
Therefore: [Answer]
|
||||
|
||||
Example 2:
|
||||
Q: [Question]
|
||||
A: Breaking this down...
|
||||
First: [Reasoning]
|
||||
Next: [Reasoning]
|
||||
So: [Answer]
|
||||
|
||||
Now solve:
|
||||
Q: [Your question]
|
||||
```
|
||||
**Use when**: Complex reasoning, pattern demonstration needed
|
||||
**Effectiveness**: +50-80% on complex tasks
|
||||
|
||||
### Auto-CoT
|
||||
```
|
||||
Let me approach this systematically:
|
||||
1. Identify the key elements
|
||||
2. Analyze relationships
|
||||
3. Apply relevant principles
|
||||
4. Draw conclusions
|
||||
5. Verify my reasoning
|
||||
```
|
||||
**Use when**: General problem-solving, exploratory reasoning
|
||||
|
||||
## Tree of Thoughts (ToT)
|
||||
|
||||
### Implementation Pattern
|
||||
```
|
||||
Problem: [Complex problem]
|
||||
|
||||
Generate 3 different approaches:
|
||||
|
||||
Approach A:
|
||||
- Method: [Description]
|
||||
- Reasoning: [Why this might work]
|
||||
- Potential issues: [Risks]
|
||||
- Confidence: [1-10]
|
||||
|
||||
Approach B:
|
||||
- Method: [Description]
|
||||
- Reasoning: [Why this might work]
|
||||
- Potential issues: [Risks]
|
||||
- Confidence: [1-10]
|
||||
|
||||
Approach C:
|
||||
- Method: [Description]
|
||||
- Reasoning: [Why this might work]
|
||||
- Potential issues: [Risks]
|
||||
- Confidence: [1-10]
|
||||
|
||||
Evaluate branches:
|
||||
- Which has highest success probability?
|
||||
- Which has fewest risks?
|
||||
- Which is most feasible?
|
||||
|
||||
Selected approach: [Best option with justification]
|
||||
Execution: [Step-by-step implementation]
|
||||
```
|
||||
|
||||
**Use when**: Strategic decisions, multiple valid paths, high-stakes problems
|
||||
|
||||
## Self-Consistency
|
||||
|
||||
### Process
|
||||
1. Generate 5 responses at temp=0.7
|
||||
2. Extract final answers from each
|
||||
3. Take majority vote
|
||||
4. Report confidence = agreement %
|
||||
|
||||
### Implementation
|
||||
```
|
||||
Run this prompt 5 times (or use n=5 parameter):
|
||||
[Your reasoning task]
|
||||
Think step by step and provide final answer.
|
||||
|
||||
Aggregate: If 4/5 agree = high confidence
|
||||
If 3/5 agree = medium confidence
|
||||
If split = low confidence, needs review
|
||||
```
|
||||
|
||||
**Use when**: Math, logic, factual questions with verifiable answers
|
||||
|
||||
## ReAct (Reasoning + Acting)
|
||||
|
||||
### Full Pattern
|
||||
```
|
||||
Task: [Goal to achieve]
|
||||
|
||||
Thought 1: I need to understand the current situation.
|
||||
Action 1: [Observation or tool use]
|
||||
Observation 1: [Result from action]
|
||||
|
||||
Thought 2: Based on this, I should [next logical step].
|
||||
Action 2: [Next action]
|
||||
Observation 2: [Result]
|
||||
|
||||
Thought 3: Now I can see that [insight].
|
||||
Action 3: [Verification or next step]
|
||||
Observation 3: [Result]
|
||||
|
||||
Thought 4: I have enough information to conclude.
|
||||
Final Answer: [Conclusion with reasoning]
|
||||
```
|
||||
|
||||
**Use when**: Tool-augmented reasoning, research tasks, multi-step analysis
|
||||
|
||||
## Least-to-Most Prompting
|
||||
|
||||
### Structure
|
||||
```
|
||||
Complex problem: [Full problem statement]
|
||||
|
||||
Step 1: Decomposition
|
||||
Break this into simpler subproblems, ordered from easiest to hardest:
|
||||
1. [Simplest subproblem]
|
||||
2. [Next subproblem, may depend on 1]
|
||||
3. [Harder subproblem, may depend on 1,2]
|
||||
4. [Final subproblem requiring all above]
|
||||
|
||||
Step 2: Sequential Solution
|
||||
Subproblem 1: [Solution]
|
||||
Using result from 1, Subproblem 2: [Solution]
|
||||
Using results from 1,2, Subproblem 3: [Solution]
|
||||
Using all results, Subproblem 4: [Solution]
|
||||
|
||||
Final integrated answer: [Complete solution]
|
||||
```
|
||||
|
||||
**Use when**: Mathematical word problems, multi-step procedures, compositional tasks
|
||||
|
||||
## Decomposed Prompting (DECOMP)
|
||||
|
||||
### Pattern
|
||||
```
|
||||
Task: [Complex task]
|
||||
|
||||
Required capabilities:
|
||||
- [Capability 1]: Use [specialized prompt/tool]
|
||||
- [Capability 2]: Use [specialized prompt/tool]
|
||||
- [Capability 3]: Use [specialized prompt/tool]
|
||||
|
||||
Orchestration:
|
||||
1. Call [Capability 1] with [input] → get [output1]
|
||||
2. Call [Capability 2] with [output1] → get [output2]
|
||||
3. Call [Capability 3] with [output2] → get [final output]
|
||||
|
||||
Integrate results: [Final response]
|
||||
```
|
||||
|
||||
**Use when**: Tasks requiring diverse expertise, specialized sub-tasks
|
||||
|
||||
## Constitutional AI Reasoning
|
||||
|
||||
### Self-Critique Pattern
|
||||
```
|
||||
Initial response: [Generated content]
|
||||
|
||||
Critique against principles:
|
||||
- Is it helpful? [Yes/No + reasoning]
|
||||
- Is it harmless? [Yes/No + reasoning]
|
||||
- Is it honest? [Yes/No + reasoning]
|
||||
|
||||
If any No:
|
||||
Revised response that addresses [specific issues]:
|
||||
[Improved content]
|
||||
```
|
||||
|
||||
## Choosing the Right Technique
|
||||
|
||||
| Task Type | Best Technique |
|
||||
|-----------|---------------|
|
||||
| Simple reasoning | Zero-shot CoT |
|
||||
| Complex multi-step | Few-shot CoT |
|
||||
| Strategic decisions | Tree of Thoughts |
|
||||
| Factual verification | Self-Consistency |
|
||||
| Tool-using tasks | ReAct |
|
||||
| Word problems | Least-to-Most |
|
||||
| Specialized sub-tasks | DECOMP |
|
||||
| Safety-critical | Constitutional AI |
|
||||
117
.opencode/skills/ai-artist/references/validation-workflow.md
Normal file
117
.opencode/skills/ai-artist/references/validation-workflow.md
Normal file
@@ -0,0 +1,117 @@
|
||||
# AI Artist Validation Workflow
|
||||
|
||||
Agent instructions for mandatory validation interview before image generation.
|
||||
|
||||
## Step 1: Parse Arguments
|
||||
|
||||
Extract from user input:
|
||||
- **concept**: The subject/description (required)
|
||||
- **--mode**: search (default), creative, or wild
|
||||
- **--skip**: If present, use defaults and skip to Step 4
|
||||
|
||||
**Defaults for --skip mode:** Style=Photorealistic, Mood=Professional, Colors=Auto, Aspect=16:9
|
||||
|
||||
## Step 2: Interview User
|
||||
|
||||
Use `AskUserQuestion` with these 4 questions in a single call:
|
||||
|
||||
```json
|
||||
{"questions": [
|
||||
{"question": "Visual style?", "header": "Style", "multiSelect": false, "options": [
|
||||
{"label": "Photorealistic (Recommended)", "description": "Professional photography, 8K"},
|
||||
{"label": "Cinematic", "description": "Film-like, dramatic lighting"},
|
||||
{"label": "Illustration", "description": "Digital art, stylized"},
|
||||
{"label": "Minimalist", "description": "Clean, white space"}
|
||||
]},
|
||||
{"question": "Mood?", "header": "Mood", "multiSelect": false, "options": [
|
||||
{"label": "Professional", "description": "Corporate, trustworthy"},
|
||||
{"label": "Energetic", "description": "Dynamic, bold"},
|
||||
{"label": "Calm", "description": "Peaceful, serene"},
|
||||
{"label": "Dramatic", "description": "High contrast, intense"}
|
||||
]},
|
||||
{"question": "Colors?", "header": "Colors", "multiSelect": false, "options": [
|
||||
{"label": "Auto-select (Recommended)", "description": "AI chooses"},
|
||||
{"label": "Warm tones", "description": "Oranges, reds"},
|
||||
{"label": "Cool tones", "description": "Blues, greens"},
|
||||
{"label": "High contrast", "description": "Blacks, neons"}
|
||||
]},
|
||||
{"question": "Aspect ratio?", "header": "Ratio", "multiSelect": false, "options": [
|
||||
{"label": "16:9 (Recommended)", "description": "Widescreen"},
|
||||
{"label": "1:1", "description": "Square"},
|
||||
{"label": "9:16", "description": "Vertical"},
|
||||
{"label": "4:3", "description": "Standard"}
|
||||
]}
|
||||
]}
|
||||
```
|
||||
|
||||
**Dynamic questions** (ask separately if concept matches):
|
||||
- "banner/poster/thumbnail" → Ask about text space
|
||||
- "product/showcase" → Ask about background preference
|
||||
|
||||
## Step 3: Build Prompt
|
||||
|
||||
Map answers to keywords:
|
||||
|
||||
| Style | Keywords |
|
||||
|-------|----------|
|
||||
| Photorealistic | photorealistic, professional photography, 8K, RAW |
|
||||
| Cinematic | cinematic, film still, anamorphic, dramatic lighting |
|
||||
| Illustration | digital illustration, artistic, stylized |
|
||||
| Minimalist | minimalist, clean design, white space |
|
||||
|
||||
| Mood | Keywords |
|
||||
|------|----------|
|
||||
| Professional | professional, clean, corporate, polished |
|
||||
| Energetic | dynamic, bold, vibrant, high energy |
|
||||
| Calm | serene, peaceful, soft, tranquil |
|
||||
| Dramatic | dramatic, high contrast, intense, moody |
|
||||
|
||||
| Colors | Keywords |
|
||||
|--------|----------|
|
||||
| Auto-select | (none) |
|
||||
| Warm tones | warm palette, golden tones, amber |
|
||||
| Cool tones | cool palette, blue tones, teal |
|
||||
| High contrast | high contrast, bold blacks, neon |
|
||||
|
||||
**Template:** `[concept], [style], [mood], [colors]. Professional quality. NEVER add watermarks.`
|
||||
|
||||
## Step 4: Confirm & Generate
|
||||
|
||||
Show preview, then ask confirmation:
|
||||
|
||||
```json
|
||||
{"questions": [{"question": "Generate?", "header": "Confirm", "multiSelect": false, "options": [
|
||||
{"label": "Yes, generate (Recommended)", "description": "Proceed"},
|
||||
{"label": "Edit prompt", "description": "Modify first"},
|
||||
{"label": "Start over", "description": "Re-answer"}
|
||||
]}]}
|
||||
```
|
||||
|
||||
**If "Edit prompt":** Ask user for edited text, use that instead.
|
||||
**If "Start over":** Return to Step 2.
|
||||
|
||||
Run generation:
|
||||
```bash
|
||||
cd .opencode/skills/ai-artist && .venv/bin/python3 scripts/generate.py "[concept]" \
|
||||
-o ./generated-$(date +%Y%m%d-%H%M%S).png \
|
||||
--mode [mode] \
|
||||
-ar [ratio] \
|
||||
-v
|
||||
```
|
||||
|
||||
## Error Handling
|
||||
|
||||
| Error | Action |
|
||||
|-------|--------|
|
||||
| API key missing | Tell user to set GEMINI_API_KEY |
|
||||
| Model error | Suggest `--model flash` |
|
||||
| No concept | Ask user for concept |
|
||||
|
||||
## Output
|
||||
|
||||
```
|
||||
[OK] Image generated: [path]
|
||||
Style: [style] | Mood: [mood] | Aspect: [ratio]
|
||||
|
||||
Tip: Use --skip to bypass interview next time.
|
||||
```
|
||||
197
.opencode/skills/ai-artist/scripts/core.py
Normal file
197
.opencode/skills/ai-artist/scripts/core.py
Normal file
@@ -0,0 +1,197 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
AI Artist Core - BM25 search engine for prompt engineering resources
|
||||
"""
|
||||
|
||||
import csv
|
||||
import re
|
||||
from pathlib import Path
|
||||
from math import log
|
||||
from collections import defaultdict
|
||||
|
||||
# ============ CONFIGURATION ============
|
||||
DATA_DIR = Path(__file__).parent.parent / "data"
|
||||
MAX_RESULTS = 3
|
||||
|
||||
CSV_CONFIG = {
|
||||
"use-case": {
|
||||
"file": "use-cases.csv",
|
||||
"search_cols": ["Use Case", "Category", "Keywords", "Best Platforms"],
|
||||
"output_cols": ["Use Case", "Category", "Keywords", "Prompt Template", "Key Elements", "Best Platforms", "Aspect Ratios", "Tips", "Example"]
|
||||
},
|
||||
"style": {
|
||||
"file": "styles.csv",
|
||||
"search_cols": ["Style Name", "Category", "Keywords", "Description", "Best For"],
|
||||
"output_cols": ["Style Name", "Category", "Description", "Key Characteristics", "Color Palette", "Best For", "Platforms", "Prompt Keywords"]
|
||||
},
|
||||
"platform": {
|
||||
"file": "platforms.csv",
|
||||
"search_cols": ["Platform", "Type", "Keywords", "Strengths"],
|
||||
"output_cols": ["Platform", "Type", "Prompt Style", "Key Parameters", "Strengths", "Limitations", "Aspect Ratios", "Best Practices"]
|
||||
},
|
||||
"technique": {
|
||||
"file": "techniques.csv",
|
||||
"search_cols": ["Technique", "Category", "Keywords", "Description", "When to Use"],
|
||||
"output_cols": ["Technique", "Category", "Description", "When to Use", "Syntax Example", "Platforms", "Tips"]
|
||||
},
|
||||
"lighting": {
|
||||
"file": "lighting.csv",
|
||||
"search_cols": ["Lighting Type", "Category", "Keywords", "Description", "Mood", "Best For"],
|
||||
"output_cols": ["Lighting Type", "Category", "Description", "Mood", "Best For", "Prompt Keywords", "Technical Notes"]
|
||||
},
|
||||
"template": {
|
||||
"file": "nano-banana-templates.csv",
|
||||
"search_cols": ["Category", "Template Name", "Keywords"],
|
||||
"output_cols": ["Category", "Template Name", "Keywords", "Prompt Template", "Aspect Ratio", "Tips"]
|
||||
},
|
||||
"awesome": {
|
||||
"file": "awesome-prompts.csv",
|
||||
"search_cols": ["title", "description", "prompt"],
|
||||
"output_cols": ["id", "title", "category", "description", "prompt", "author", "source"]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# ============ BM25 IMPLEMENTATION ============
|
||||
class BM25:
|
||||
"""BM25 ranking algorithm for text search"""
|
||||
|
||||
def __init__(self, k1=1.5, b=0.75):
|
||||
self.k1 = k1
|
||||
self.b = b
|
||||
self.corpus = []
|
||||
self.doc_lengths = []
|
||||
self.avgdl = 0
|
||||
self.idf = {}
|
||||
self.doc_freqs = defaultdict(int)
|
||||
self.N = 0
|
||||
|
||||
def tokenize(self, text):
|
||||
"""Lowercase, split, remove punctuation, filter short words"""
|
||||
text = re.sub(r'[^\w\s]', ' ', str(text).lower())
|
||||
return [w for w in text.split() if len(w) > 2]
|
||||
|
||||
def fit(self, documents):
|
||||
"""Build BM25 index from documents"""
|
||||
self.corpus = [self.tokenize(doc) for doc in documents]
|
||||
self.N = len(self.corpus)
|
||||
if self.N == 0:
|
||||
return
|
||||
self.doc_lengths = [len(doc) for doc in self.corpus]
|
||||
self.avgdl = sum(self.doc_lengths) / self.N
|
||||
|
||||
for doc in self.corpus:
|
||||
seen = set()
|
||||
for word in doc:
|
||||
if word not in seen:
|
||||
self.doc_freqs[word] += 1
|
||||
seen.add(word)
|
||||
|
||||
for word, freq in self.doc_freqs.items():
|
||||
self.idf[word] = log((self.N - freq + 0.5) / (freq + 0.5) + 1)
|
||||
|
||||
def score(self, query):
|
||||
"""Score all documents against query"""
|
||||
query_tokens = self.tokenize(query)
|
||||
scores = []
|
||||
|
||||
for idx, doc in enumerate(self.corpus):
|
||||
score = 0
|
||||
doc_len = self.doc_lengths[idx]
|
||||
term_freqs = defaultdict(int)
|
||||
for word in doc:
|
||||
term_freqs[word] += 1
|
||||
|
||||
for token in query_tokens:
|
||||
if token in self.idf:
|
||||
tf = term_freqs[token]
|
||||
idf = self.idf[token]
|
||||
numerator = tf * (self.k1 + 1)
|
||||
denominator = tf + self.k1 * (1 - self.b + self.b * doc_len / self.avgdl)
|
||||
score += idf * numerator / denominator
|
||||
|
||||
scores.append((idx, score))
|
||||
|
||||
return sorted(scores, key=lambda x: x[1], reverse=True)
|
||||
|
||||
|
||||
# ============ SEARCH FUNCTIONS ============
|
||||
def _load_csv(filepath):
|
||||
"""Load CSV and return list of dicts"""
|
||||
with open(filepath, 'r', encoding='utf-8') as f:
|
||||
return list(csv.DictReader(f))
|
||||
|
||||
|
||||
def _search_csv(filepath, search_cols, output_cols, query, max_results):
|
||||
"""Core search function using BM25"""
|
||||
if not filepath.exists():
|
||||
return []
|
||||
|
||||
data = _load_csv(filepath)
|
||||
|
||||
# Build documents from search columns
|
||||
documents = [" ".join(str(row.get(col, "")) for col in search_cols) for row in data]
|
||||
|
||||
# BM25 search
|
||||
bm25 = BM25()
|
||||
bm25.fit(documents)
|
||||
ranked = bm25.score(query)
|
||||
|
||||
# Get top results with score > 0
|
||||
results = []
|
||||
for idx, score in ranked[:max_results]:
|
||||
if score > 0:
|
||||
row = data[idx]
|
||||
results.append({col: row.get(col, "") for col in output_cols if col in row})
|
||||
|
||||
return results
|
||||
|
||||
|
||||
def detect_domain(query):
|
||||
"""Auto-detect the most relevant domain from query"""
|
||||
query_lower = query.lower()
|
||||
|
||||
domain_keywords = {
|
||||
"use-case": ["avatar", "profile", "thumbnail", "poster", "social", "youtube", "instagram", "marketing", "product", "e-commerce", "infographic", "comic", "game", "app", "web", "header", "banner"],
|
||||
"style": ["style", "aesthetic", "photorealistic", "anime", "manga", "3d", "render", "illustration", "pixel", "watercolor", "oil", "cyberpunk", "vaporwave", "minimalist", "vintage", "retro"],
|
||||
"platform": ["midjourney", "dalle", "dall-e", "stable diffusion", "flux", "nano banana", "gemini", "imagen", "ideogram", "leonardo", "firefly", "platform", "tool"],
|
||||
"technique": ["prompt", "technique", "weight", "emphasis", "negative", "json", "structured", "iteration", "reference", "identity", "multi-panel", "search grounding"],
|
||||
"lighting": ["lighting", "light", "shadow", "golden hour", "blue hour", "rembrandt", "butterfly", "neon", "volumetric", "softbox", "rim light", "studio"]
|
||||
}
|
||||
|
||||
scores = {domain: sum(1 for kw in keywords if kw in query_lower) for domain, keywords in domain_keywords.items()}
|
||||
best = max(scores, key=scores.get)
|
||||
return best if scores[best] > 0 else "style"
|
||||
|
||||
|
||||
def search(query, domain=None, max_results=MAX_RESULTS):
|
||||
"""Main search function with auto-domain detection"""
|
||||
if domain is None:
|
||||
domain = detect_domain(query)
|
||||
|
||||
config = CSV_CONFIG.get(domain, CSV_CONFIG["style"])
|
||||
filepath = DATA_DIR / config["file"]
|
||||
|
||||
if not filepath.exists():
|
||||
return {"error": f"File not found: {filepath}", "domain": domain}
|
||||
|
||||
results = _search_csv(filepath, config["search_cols"], config["output_cols"], query, max_results)
|
||||
|
||||
return {
|
||||
"domain": domain,
|
||||
"query": query,
|
||||
"file": config["file"],
|
||||
"count": len(results),
|
||||
"results": results
|
||||
}
|
||||
|
||||
|
||||
def search_all_domains(query, max_per_domain=2):
|
||||
"""Search across all domains for comprehensive results"""
|
||||
all_results = {}
|
||||
for domain in CSV_CONFIG.keys():
|
||||
result = search(query, domain, max_per_domain)
|
||||
if result.get("count", 0) > 0:
|
||||
all_results[domain] = result
|
||||
return all_results
|
||||
102
.opencode/skills/ai-artist/scripts/extract_prompts.py
Normal file
102
.opencode/skills/ai-artist/scripts/extract_prompts.py
Normal file
@@ -0,0 +1,102 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Extract all prompts from awesome-nano-banana-pro-prompts.md into CSV."""
|
||||
|
||||
import re
|
||||
import csv
|
||||
from pathlib import Path
|
||||
|
||||
def extract_prompts(md_content: str) -> list[dict]:
|
||||
"""Extract all prompts with their metadata."""
|
||||
prompts = []
|
||||
|
||||
# Split by prompt entries (### No. X:)
|
||||
entries = re.split(r'### No\. \d+:', md_content)
|
||||
|
||||
for i, entry in enumerate(entries[1:], 1): # Skip content before first entry
|
||||
prompt_data = {
|
||||
"id": i,
|
||||
"title": "",
|
||||
"category": "",
|
||||
"description": "",
|
||||
"prompt": "",
|
||||
"author": "",
|
||||
"source": "",
|
||||
}
|
||||
|
||||
# Extract title (first line after split)
|
||||
title_match = re.search(r'^([^\n]+)', entry.strip())
|
||||
if title_match:
|
||||
prompt_data["title"] = title_match.group(1).strip()
|
||||
|
||||
# Extract category from badges
|
||||
categories = re.findall(r'!\[([^\]]+)\]\([^)]+badge[^)]*\)', entry)
|
||||
if categories:
|
||||
# Filter out non-category badges
|
||||
cats = [c for c in categories if c not in ["Featured", "Raycast", "Language-ZH", "Language-EN", "Language-JA"]]
|
||||
prompt_data["category"] = ", ".join(cats[:3]) if cats else ""
|
||||
|
||||
# Extract description
|
||||
desc_match = re.search(r'#### 📖 Description\s*\n\n([^\n#]+)', entry)
|
||||
if desc_match:
|
||||
prompt_data["description"] = desc_match.group(1).strip()
|
||||
|
||||
# Extract prompt (between ``` markers after "#### 📝 Prompt")
|
||||
prompt_section = re.search(r'#### 📝 Prompt\s*\n\n```[^\n]*\n(.*?)```', entry, re.DOTALL)
|
||||
if prompt_section:
|
||||
prompt_data["prompt"] = prompt_section.group(1).strip()
|
||||
|
||||
# Extract author
|
||||
author_match = re.search(r'\*\*Author:\*\*\s*\[([^\]]+)\]', entry)
|
||||
if author_match:
|
||||
prompt_data["author"] = author_match.group(1).strip()
|
||||
|
||||
# Extract source URL
|
||||
source_match = re.search(r'\*\*Source:\*\*\s*\[([^\]]+)\]\(([^)]+)\)', entry)
|
||||
if source_match:
|
||||
prompt_data["source"] = source_match.group(2).strip()
|
||||
|
||||
if prompt_data["prompt"]: # Only add if we found a prompt
|
||||
prompts.append(prompt_data)
|
||||
|
||||
return prompts
|
||||
|
||||
|
||||
def save_to_csv(prompts: list[dict], output_path: Path):
|
||||
"""Save prompts to CSV file."""
|
||||
fieldnames = ["id", "title", "category", "description", "prompt", "author", "source"]
|
||||
|
||||
with open(output_path, 'w', newline='', encoding='utf-8') as f:
|
||||
writer = csv.DictWriter(f, fieldnames=fieldnames, quoting=csv.QUOTE_ALL)
|
||||
writer.writeheader()
|
||||
for p in prompts:
|
||||
writer.writerow(p)
|
||||
|
||||
print(f"Saved {len(prompts)} prompts to {output_path}")
|
||||
|
||||
|
||||
def main():
|
||||
script_dir = Path(__file__).parent
|
||||
md_path = script_dir.parent / "references" / "awesome-nano-banana-pro-prompts.md"
|
||||
csv_path = script_dir.parent / "data" / "awesome-prompts.csv"
|
||||
|
||||
print(f"Reading from: {md_path}")
|
||||
|
||||
with open(md_path, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
prompts = extract_prompts(content)
|
||||
print(f"Extracted {len(prompts)} prompts")
|
||||
|
||||
# Print sample
|
||||
if prompts:
|
||||
print("\nSample prompts:")
|
||||
for p in prompts[:3]:
|
||||
print(f"\n[{p['id']}] {p['title'][:50]}...")
|
||||
print(f" Category: {p['category']}")
|
||||
print(f" Prompt: {p['prompt'][:100]}...")
|
||||
|
||||
save_to_csv(prompts, csv_path)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
371
.opencode/skills/ai-artist/scripts/generate.py
Normal file
371
.opencode/skills/ai-artist/scripts/generate.py
Normal file
@@ -0,0 +1,371 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
AI Artist Generate - Nano Banana image generation with 3 creative modes
|
||||
|
||||
Uses 129 actual prompts from awesome-nano-banana-pro-prompts collection.
|
||||
|
||||
Usage:
|
||||
python generate.py "<concept>" --output <path.png> [options]
|
||||
|
||||
Modes:
|
||||
--mode search : Find best matching prompt (default)
|
||||
--mode creative : Remix elements from multiple prompts
|
||||
--mode wild : AI-enhanced out-of-the-box interpretation
|
||||
--mode all : Generate all 3 variations
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import random
|
||||
from pathlib import Path
|
||||
|
||||
# Add parent for core imports
|
||||
sys.path.insert(0, str(Path(__file__).parent))
|
||||
from core import search
|
||||
|
||||
# Gemini API setup
|
||||
CLAUDE_ROOT = Path.home() / '.claude'
|
||||
sys.path.insert(0, str(CLAUDE_ROOT / 'scripts'))
|
||||
PROJECT_CLAUDE = Path(__file__).parent.parent.parent.parent
|
||||
sys.path.insert(0, str(PROJECT_CLAUDE / 'scripts'))
|
||||
try:
|
||||
from resolve_env import resolve_env
|
||||
CENTRALIZED_RESOLVER = True
|
||||
except ImportError:
|
||||
CENTRALIZED_RESOLVER = False
|
||||
try:
|
||||
from dotenv import load_dotenv
|
||||
load_dotenv(Path.home() / '.claude' / '.env')
|
||||
load_dotenv(Path.home() / '.claude' / 'skills' / '.env')
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
try:
|
||||
from google import genai
|
||||
from google.genai import types
|
||||
GENAI_AVAILABLE = True
|
||||
except ImportError:
|
||||
GENAI_AVAILABLE = False
|
||||
|
||||
|
||||
# ============ CONFIGURATION ============
|
||||
NANO_BANANA_MODELS = {
|
||||
"flash2": "gemini-3.1-flash-image-preview", # Nano Banana 2 (new default)
|
||||
"flash": "gemini-2.5-flash-image",
|
||||
"pro": "gemini-3-pro-image-preview",
|
||||
}
|
||||
DEFAULT_MODEL = "flash2"
|
||||
ASPECT_RATIOS = ["1:1", "2:3", "3:2", "3:4", "4:3", "4:5", "5:4", "9:16", "16:9", "21:9"]
|
||||
|
||||
|
||||
def get_api_key() -> str:
|
||||
"""Get Gemini API key from environment."""
|
||||
if CENTRALIZED_RESOLVER:
|
||||
return resolve_env('GEMINI_API_KEY', skill='ai-multimodal')
|
||||
return os.getenv('GEMINI_API_KEY')
|
||||
|
||||
|
||||
def adapt_prompt(template_prompt: str, concept: str, **kwargs) -> str:
|
||||
"""Adapt a template prompt to the user's concept.
|
||||
|
||||
Intelligently replaces variables and adapts the prompt while keeping
|
||||
the original structure and Nano Banana narrative style.
|
||||
"""
|
||||
prompt = template_prompt
|
||||
|
||||
# Replace common variable patterns
|
||||
replacements = {
|
||||
# Raycast-style arguments
|
||||
r'\{argument name="[^"]*" default="[^"]*"\}': concept,
|
||||
r'\{argument name=[^}]+\}': concept,
|
||||
# Bracket variables
|
||||
r'\[insert [^\]]+\]': concept,
|
||||
r'\[subject\]': concept,
|
||||
r'\[concept\]': concept,
|
||||
r'\[topic\]': concept,
|
||||
r'\[product\]': concept,
|
||||
r'\[scene\]': concept,
|
||||
r'\[description\]': concept,
|
||||
# Generic placeholders
|
||||
r'\{[^}]+\}': lambda m: kwargs.get(m.group(0)[1:-1], concept),
|
||||
}
|
||||
|
||||
for pattern, replacement in replacements.items():
|
||||
if callable(replacement):
|
||||
prompt = re.sub(pattern, replacement, prompt, flags=re.IGNORECASE)
|
||||
else:
|
||||
prompt = re.sub(pattern, replacement, prompt, flags=re.IGNORECASE)
|
||||
|
||||
# Ensure negative constraints exist (Nano Banana style)
|
||||
if "NEVER" not in prompt and "DO NOT" not in prompt:
|
||||
prompt += " NEVER add watermarks or unwanted text. DO NOT include labels."
|
||||
|
||||
return prompt
|
||||
|
||||
|
||||
def mode_search(concept: str, verbose: bool = False) -> tuple[str, dict]:
|
||||
"""Mode 1: Find best matching prompt from awesome collection."""
|
||||
result = search(concept, "awesome", 1)
|
||||
|
||||
if result.get("count", 0) > 0:
|
||||
match = result["results"][0]
|
||||
prompt = adapt_prompt(match["prompt"], concept)
|
||||
|
||||
if verbose:
|
||||
print(f" [SEARCH] Matched: {match['title'][:60]}...")
|
||||
print(f" Author: {match.get('author', 'Unknown')}")
|
||||
|
||||
return prompt, {"mode": "search", "match": match}
|
||||
|
||||
# Fallback to basic prompt
|
||||
prompt = f"A professional image of {concept}. High quality, detailed. Professional photography. NEVER add watermarks."
|
||||
return prompt, {"mode": "search", "match": None}
|
||||
|
||||
|
||||
def mode_creative(concept: str, verbose: bool = False) -> tuple[str, dict]:
|
||||
"""Mode 2: Creative remix - combine elements from multiple prompts."""
|
||||
# Get top 3 matches
|
||||
result = search(concept, "awesome", 3)
|
||||
matches = result.get("results", [])
|
||||
|
||||
if len(matches) < 2:
|
||||
return mode_search(concept, verbose)
|
||||
|
||||
# Extract key elements from each prompt
|
||||
elements = []
|
||||
for m in matches:
|
||||
prompt = m.get("prompt", "")
|
||||
# Extract style descriptions, lighting, composition hints
|
||||
if "style" in prompt.lower() or "lighting" in prompt.lower():
|
||||
elements.append(prompt[:200])
|
||||
|
||||
if verbose:
|
||||
print(f" [CREATIVE] Remixing {len(matches)} prompts:")
|
||||
for m in matches:
|
||||
print(f" - {m['title'][:50]}...")
|
||||
|
||||
# Build creative remix
|
||||
base = matches[0]["prompt"]
|
||||
style_hints = []
|
||||
|
||||
# Extract style from second match
|
||||
if len(matches) > 1:
|
||||
m2 = matches[1]["prompt"]
|
||||
style_match = re.search(r'(style[^.]+\.)', m2, re.IGNORECASE)
|
||||
if style_match:
|
||||
style_hints.append(style_match.group(1))
|
||||
|
||||
# Extract lighting/mood from third match
|
||||
if len(matches) > 2:
|
||||
m3 = matches[2]["prompt"]
|
||||
light_match = re.search(r'(lighting[^.]+\.)', m3, re.IGNORECASE)
|
||||
if light_match:
|
||||
style_hints.append(light_match.group(1))
|
||||
|
||||
# Adapt and enhance
|
||||
prompt = adapt_prompt(base, concept)
|
||||
if style_hints:
|
||||
prompt += " " + " ".join(style_hints)
|
||||
|
||||
return prompt, {"mode": "creative", "matches": [m["title"] for m in matches]}
|
||||
|
||||
|
||||
def mode_wild(concept: str, verbose: bool = False) -> tuple[str, dict]:
|
||||
"""Mode 3: Wild/Out-of-the-box - AI-enhanced creative interpretation."""
|
||||
result = search(concept, "awesome", 5)
|
||||
matches = result.get("results", [])
|
||||
|
||||
# Creative transformations
|
||||
transformations = [
|
||||
"reimagined as a Japanese Ukiyo-e woodblock print with Prussian blue and vermilion",
|
||||
"transformed into a premium liquid glass Bento grid infographic",
|
||||
"captured as a vintage 1800s patent document with technical drawings",
|
||||
"rendered as a surreal dreamscape with volumetric god rays",
|
||||
"depicted in cyberpunk neon aesthetic with holographic elements",
|
||||
"illustrated as a hand-drawn chalkboard explanation",
|
||||
"visualized as an isometric 3D diorama with miniature figures",
|
||||
"presented as a cinematic movie poster with dramatic lighting",
|
||||
"created as a vaporwave aesthetic with glitch effects and Roman statues",
|
||||
"designed as a premium Apple-style product showcase",
|
||||
]
|
||||
|
||||
# Pick random transformation
|
||||
transform = random.choice(transformations)
|
||||
|
||||
if matches:
|
||||
# Use structure from a random match but apply wild transformation
|
||||
base = random.choice(matches)
|
||||
prompt = f"{concept}, {transform}. "
|
||||
|
||||
# Extract any technical camera/quality settings from matched prompt
|
||||
tech_match = re.search(r'(\d+mm lens|f/[\d.]+|Canon|Nikon|professional photography)', base["prompt"])
|
||||
if tech_match:
|
||||
prompt += f"Shot with {tech_match.group(1)}. "
|
||||
|
||||
if verbose:
|
||||
print(f" [WILD] Transform: {transform}")
|
||||
print(f" Based on: {base['title'][:50]}...")
|
||||
else:
|
||||
prompt = f"{concept}, {transform}. Professional quality."
|
||||
|
||||
prompt += " NEVER add watermarks. DO NOT include unwanted text."
|
||||
|
||||
return prompt, {"mode": "wild", "transformation": transform}
|
||||
|
||||
|
||||
def generate_image(
|
||||
prompt: str,
|
||||
output_path: str,
|
||||
model: str = DEFAULT_MODEL,
|
||||
aspect_ratio: str = "1:1",
|
||||
size: str = "2K",
|
||||
verbose: bool = False
|
||||
) -> dict:
|
||||
"""Generate image using Nano Banana (Gemini image models)."""
|
||||
|
||||
if not GENAI_AVAILABLE:
|
||||
return {"status": "error", "error": "google-genai not installed. Run: pip install google-genai"}
|
||||
|
||||
api_key = get_api_key()
|
||||
if not api_key:
|
||||
return {"status": "error", "error": "GEMINI_API_KEY not found"}
|
||||
|
||||
model_id = NANO_BANANA_MODELS.get(model, model)
|
||||
|
||||
if verbose:
|
||||
print(f"\n[Nano Banana Generation]")
|
||||
print(f" Model: {model_id}")
|
||||
print(f" Aspect: {aspect_ratio}")
|
||||
print(f" Prompt: {prompt[:100]}...")
|
||||
|
||||
try:
|
||||
client = genai.Client(api_key=api_key)
|
||||
|
||||
# Build config
|
||||
image_config_args = {'aspect_ratio': aspect_ratio}
|
||||
if 'pro' in model_id.lower() and size:
|
||||
image_config_args['image_size'] = size
|
||||
|
||||
config = types.GenerateContentConfig(
|
||||
response_modalities=['IMAGE'],
|
||||
image_config=types.ImageConfig(**image_config_args)
|
||||
)
|
||||
|
||||
response = client.models.generate_content(
|
||||
model=model_id,
|
||||
contents=[prompt],
|
||||
config=config
|
||||
)
|
||||
|
||||
output_file = Path(output_path)
|
||||
output_file.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
if hasattr(response, 'candidates') and response.candidates:
|
||||
for part in response.candidates[0].content.parts:
|
||||
if part.inline_data:
|
||||
with open(output_file, 'wb') as f:
|
||||
f.write(part.inline_data.data)
|
||||
|
||||
if verbose:
|
||||
print(f" Generated: {output_file}")
|
||||
|
||||
return {"status": "success", "output": str(output_file), "model": model_id}
|
||||
|
||||
return {"status": "error", "error": "No image in response"}
|
||||
|
||||
except Exception as e:
|
||||
return {"status": "error", "error": str(e)}
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="AI Artist Generate - Nano Banana with 3 creative modes",
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||
epilog="""
|
||||
Modes:
|
||||
search : Find best matching prompt from 129 curated prompts (default)
|
||||
creative : Remix elements from multiple matching prompts
|
||||
wild : AI-enhanced out-of-the-box creative interpretation
|
||||
all : Generate all 3 variations
|
||||
|
||||
Examples:
|
||||
# Search mode (default)
|
||||
python generate.py "tech conference banner" -o banner.png
|
||||
|
||||
# Creative remix
|
||||
python generate.py "AI workshop" -o workshop.png --mode creative
|
||||
|
||||
# Wild/experimental
|
||||
python generate.py "product showcase" -o product.png --mode wild
|
||||
|
||||
# Generate all 3 variations
|
||||
python generate.py "futuristic city" -o city.png --mode all
|
||||
"""
|
||||
)
|
||||
|
||||
parser.add_argument("concept", help="Core concept/subject to generate")
|
||||
parser.add_argument("--output", "-o", required=True, help="Output image path")
|
||||
parser.add_argument("--mode", "-m", choices=["search", "creative", "wild", "all"],
|
||||
default="search", help="Generation mode")
|
||||
parser.add_argument("--model", choices=list(NANO_BANANA_MODELS.keys()),
|
||||
default=DEFAULT_MODEL, help="Model: flash2 (default, Nano Banana 2), flash, or pro")
|
||||
parser.add_argument("--aspect-ratio", "-ar", choices=ASPECT_RATIOS, default="1:1")
|
||||
parser.add_argument("--size", choices=["1K", "2K", "4K"], default="2K")
|
||||
parser.add_argument("--verbose", "-v", action="store_true")
|
||||
parser.add_argument("--show-prompt", action="store_true", help="Print generated prompt")
|
||||
parser.add_argument("--dry-run", action="store_true", help="Build prompt without generating")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.verbose:
|
||||
print(f"[Concept: {args.concept}]")
|
||||
|
||||
# Determine modes to run
|
||||
modes = ["search", "creative", "wild"] if args.mode == "all" else [args.mode]
|
||||
|
||||
for mode in modes:
|
||||
if args.verbose or len(modes) > 1:
|
||||
print(f"\n{'='*50}")
|
||||
print(f"[Mode: {mode.upper()}]")
|
||||
|
||||
# Build prompt based on mode
|
||||
if mode == "search":
|
||||
prompt, meta = mode_search(args.concept, args.verbose)
|
||||
elif mode == "creative":
|
||||
prompt, meta = mode_creative(args.concept, args.verbose)
|
||||
elif mode == "wild":
|
||||
prompt, meta = mode_wild(args.concept, args.verbose)
|
||||
|
||||
if args.show_prompt or args.verbose:
|
||||
print(f"\n[Prompt]\n{prompt}\n")
|
||||
|
||||
if args.dry_run:
|
||||
print("[Dry run - no generation]")
|
||||
continue
|
||||
|
||||
# Generate output path for mode
|
||||
output_path = args.output
|
||||
if len(modes) > 1:
|
||||
base = Path(args.output)
|
||||
output_path = str(base.parent / f"{base.stem}-{mode}{base.suffix}")
|
||||
|
||||
result = generate_image(
|
||||
prompt=prompt,
|
||||
output_path=output_path,
|
||||
model=args.model,
|
||||
aspect_ratio=args.aspect_ratio,
|
||||
size=args.size,
|
||||
verbose=args.verbose
|
||||
)
|
||||
|
||||
if result["status"] == "success":
|
||||
print(f"✓ Generated: {result['output']}")
|
||||
else:
|
||||
print(f"✗ Error: {result['error']}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
147
.opencode/skills/ai-artist/scripts/search.py
Normal file
147
.opencode/skills/ai-artist/scripts/search.py
Normal file
@@ -0,0 +1,147 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
AI Artist Search - BM25 search engine for prompt engineering resources
|
||||
Usage: python search.py "<query>" [--domain <domain>] [--max-results 3]
|
||||
python search.py "<query>" --prompt-system [--platform <platform>]
|
||||
|
||||
Domains: use-case, style, platform, technique, lighting
|
||||
Platforms: midjourney, dalle, sd, flux, nano-banana
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
from core import CSV_CONFIG, MAX_RESULTS, search, search_all_domains
|
||||
|
||||
# Fix Windows cp1252 encoding: hardcoded emojis can't encode on Windows.
|
||||
# Reconfigure stdout to UTF-8 with replacement (Python 3.7+).
|
||||
if sys.stdout.encoding and sys.stdout.encoding.lower() != "utf-8":
|
||||
if hasattr(sys.stdout, 'reconfigure'):
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
|
||||
def format_output(result):
|
||||
"""Format results for Claude consumption (token-optimized)"""
|
||||
if "error" in result:
|
||||
return f"Error: {result['error']}"
|
||||
|
||||
output = []
|
||||
output.append(f"## AI Artist Search Results")
|
||||
output.append(f"**Domain:** {result['domain']} | **Query:** {result['query']}")
|
||||
output.append(f"**Source:** {result['file']} | **Found:** {result['count']} results\n")
|
||||
|
||||
for i, row in enumerate(result['results'], 1):
|
||||
output.append(f"### Result {i}")
|
||||
for key, value in row.items():
|
||||
value_str = str(value)
|
||||
if len(value_str) > 400:
|
||||
value_str = value_str[:400] + "..."
|
||||
output.append(f"- **{key}:** {value_str}")
|
||||
output.append("")
|
||||
|
||||
return "\n".join(output)
|
||||
|
||||
|
||||
def generate_prompt_system(query, platform=None):
|
||||
"""Generate a comprehensive prompt system for a given concept"""
|
||||
output = []
|
||||
output.append(f"## 🎨 AI Artist Prompt System")
|
||||
output.append(f"**Concept:** {query}")
|
||||
if platform:
|
||||
output.append(f"**Target Platform:** {platform}")
|
||||
output.append("")
|
||||
|
||||
# Search relevant domains
|
||||
use_case = search(query, "use-case", 1)
|
||||
style = search(query, "style", 2)
|
||||
lighting = search(query, "lighting", 1)
|
||||
technique = search(query, "technique", 2)
|
||||
|
||||
# Use case / Template
|
||||
if use_case.get("count", 0) > 0:
|
||||
uc = use_case["results"][0]
|
||||
output.append("### 📋 Use Case Match")
|
||||
output.append(f"**{uc.get('Use Case', 'N/A')}** ({uc.get('Category', '')})")
|
||||
if uc.get("Prompt Template"):
|
||||
output.append(f"**Template:** `{uc.get('Prompt Template')}`")
|
||||
if uc.get("Key Elements"):
|
||||
output.append(f"**Key Elements:** {uc.get('Key Elements')}")
|
||||
if uc.get("Tips"):
|
||||
output.append(f"**Tips:** {uc.get('Tips')}")
|
||||
output.append("")
|
||||
|
||||
# Styles
|
||||
if style.get("count", 0) > 0:
|
||||
output.append("### 🎭 Recommended Styles")
|
||||
for s in style["results"]:
|
||||
output.append(f"**{s.get('Style Name', 'N/A')}** - {s.get('Description', '')}")
|
||||
if s.get("Prompt Keywords"):
|
||||
output.append(f" Keywords: `{s.get('Prompt Keywords')}`")
|
||||
output.append("")
|
||||
|
||||
# Lighting
|
||||
if lighting.get("count", 0) > 0:
|
||||
lt = lighting["results"][0]
|
||||
output.append("### 💡 Lighting Suggestion")
|
||||
output.append(f"**{lt.get('Lighting Type', 'N/A')}** - {lt.get('Description', '')}")
|
||||
output.append(f" Mood: {lt.get('Mood', '')} | Keywords: `{lt.get('Prompt Keywords', '')}`")
|
||||
output.append("")
|
||||
|
||||
# Techniques
|
||||
if technique.get("count", 0) > 0:
|
||||
output.append("### 🔧 Relevant Techniques")
|
||||
for t in technique["results"]:
|
||||
output.append(f"**{t.get('Technique', 'N/A')}**: {t.get('Description', '')}")
|
||||
if t.get("Syntax Example"):
|
||||
output.append(f" Example: `{t.get('Syntax Example')}`")
|
||||
output.append("")
|
||||
|
||||
# Platform-specific tips
|
||||
if platform:
|
||||
plat = search(platform, "platform", 1)
|
||||
if plat.get("count", 0) > 0:
|
||||
p = plat["results"][0]
|
||||
output.append(f"### 🖥️ {p.get('Platform', '')} Tips")
|
||||
output.append(f"**Prompt Style:** {p.get('Prompt Style', '')}")
|
||||
output.append(f"**Key Parameters:** {p.get('Key Parameters', '')}")
|
||||
output.append(f"**Best Practices:** {p.get('Best Practices', '')}")
|
||||
output.append("")
|
||||
|
||||
return "\n".join(output)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="AI Artist Search")
|
||||
parser.add_argument("query", help="Search query")
|
||||
parser.add_argument("--domain", "-d", choices=list(CSV_CONFIG.keys()), help="Search domain")
|
||||
parser.add_argument("--max-results", "-n", type=int, default=MAX_RESULTS, help="Max results (default: 3)")
|
||||
parser.add_argument("--json", action="store_true", help="Output as JSON")
|
||||
# Prompt system generation
|
||||
parser.add_argument("--prompt-system", "-ps", action="store_true", help="Generate comprehensive prompt system")
|
||||
parser.add_argument("--platform", "-p", type=str, default=None, help="Target platform for prompt system")
|
||||
parser.add_argument("--all", "-a", action="store_true", help="Search all domains")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Prompt system generation
|
||||
if args.prompt_system:
|
||||
result = generate_prompt_system(args.query, args.platform)
|
||||
print(result)
|
||||
# Search all domains
|
||||
elif args.all:
|
||||
results = search_all_domains(args.query, args.max_results)
|
||||
if args.json:
|
||||
import json
|
||||
print(json.dumps(results, indent=2, ensure_ascii=False))
|
||||
else:
|
||||
for domain, result in results.items():
|
||||
print(format_output(result))
|
||||
print("---\n")
|
||||
# Domain search
|
||||
else:
|
||||
result = search(args.query, args.domain, args.max_results)
|
||||
if args.json:
|
||||
import json
|
||||
print(json.dumps(result, indent=2, ensure_ascii=False))
|
||||
else:
|
||||
print(format_output(result))
|
||||
Reference in New Issue
Block a user