← All Skills

snappy-gemini

v1.0.0
13 files, 90.9 KB ~4,114 words · 17 min read Updated 2026-09-09

snappy-gemini skill

27 of 34 checks pass
What it can do
describe image prompt?read
generate promptdraft
image promptdraft
What does not pass yet
$ npx snappy-skills install snappy-gemini
zip ↓
File Tree
├── AGENTS.md ├── SKILL.md ├── api.ts ├── contract.test.ts ├── examples.md ├── models.md ├── prompting.md └── scripts/ ├── audio.sh ├── embed.sh ├── image.sh ├── lib/ │ └── auth.sh ├── text.sh └── video.sh
Documents
AGENTS.md

snappy-gemini -- loader#

Wraps the generativelanguage.googleapis.com REST API. All Gemini calls in the Snappy system go through this skill so credentials, model IDs, and endpoints live in one place. Auth is automatic via snappy-settings/load.ts from .env.cache.

API module#

typescriptimport { generateContent, generateContentStream, describeImage, generateImage } from "../snappy-gemini/api.ts";
Function What it does
generateContent(prompt, opts?) Text generation (returns { text, raw })
generateContentStream(prompt, opts?) Streaming text generation (async generator of strings)
describeImage(imageUrl, prompt?) Vision -- describe a URL or local image file
generateImage(prompt, opts?) Nano Banana image generation (returns { b64, mime, path? })

Text options: model, systemInstruction, temperature, maxTokens, responseSchema.

Image options: model (default gemini-3.1-flash-image-preview aka Nano Banana 2), out (write to file), ref (reference image for edits).

CLI:

bashnpx tsx ~/.claude/skills/snappy-gemini/api.ts generate "Explain X" [--model gemini-2.5-pro]
npx tsx ~/.claude/skills/snappy-gemini/api.ts describe /tmp/img.png [prompt]
npx tsx ~/.claude/skills/snappy-gemini/api.ts image "Robot waving hello" --out /tmp/robot.png
npx tsx ~/.claude/skills/snappy-gemini/api.ts image "Make this brighter" --ref /tmp/dark.png --out /tmp/bright.png

Credentials loaded via snappy-settings/load.ts from .env.cache. No Bitwarden unlock needed.

Key capabilities#

  • Text generation -- Gemini 2.5 Pro / Flash / Flash-Lite with optional system prompt, file input, structured JSON schema output, and streaming
  • Image generation -- Imagen 3/4 (fresh images via :predict) and Nano Banana aka gemini-2.5-flash-image (edit/composite with --ref)
  • Video generation -- Veo 2/3 long-running operations with auto-polling, image-to-video, and --no-wait / --resume
  • Audio understanding -- transcription, summarization, diarization; auto-switches to Files API for files >= 20MB
  • Embeddings -- text-embedding-004 (768d) or gemini-embedding-001 (3072d) with task type support

Model defaults#

Modality Default Heavy Cheap
Text gemini-2.5-flash gemini-2.5-pro gemini-2.5-flash-lite
Image (edit) gemini-2.5-flash-image -- --
Image (photo) imagen-3.0-generate-002 imagen-4.0-generate-001 imagen-3.0-fast-generate-001
Video veo-3.0-generate-001 -- veo-2.0-generate-001
Embeddings text-embedding-004 gemini-embedding-001 --

Scripts#

All scripts live at SG=~/.claude/skills/snappy-gemini/scripts. Every script supports --help.

text.sh -- Text generation#

bash$SG/text.sh --model gemini-2.5-pro --prompt "Explain quantum tunneling in 3 lines"
$SG/text.sh --model gemini-2.5-flash --prompt "Summarize:" --file /tmp/doc.md
$SG/text.sh --prompt "Extract names:" --file cv.pdf --schema '{"type":"array","items":{"type":"string"}}'
$SG/text.sh --model gemini-2.5-flash --system "You are a TL;DR bot" --prompt "..." --stream

Flags: --model --prompt --system --file --schema --temperature --max-tokens --json --stream

image.sh -- Image generation#

bash$SG/image.sh --model gemini-2.5-flash-image --prompt "Place at a coffee shop" --ref /tmp/headshot.png --out /tmp/coffee.png
$SG/image.sh --model imagen-3.0-generate-002 --prompt "Editorial keynote" --aspect 16:9 --count 4

Flags: --model --prompt --count --aspect --ref --negative --out

video.sh -- Video generation (LRO)#

bash$SG/video.sh --model veo-3.0-generate-001 --prompt "Slow dolly in on a founder" --out /tmp/promo.mp4
$SG/video.sh --no-wait --prompt "..." # returns operation name immediately
$SG/video.sh --resume operations/abc123 --out /tmp/v.mp4

Flags: --model --prompt --aspect --duration --image --out --no-wait --resume

audio.sh -- Audio understanding#

bash$SG/audio.sh --file /tmp/meeting.m4a --task "Action items as JSON" --json
$SG/audio.sh --file /tmp/call.wav --model gemini-2.5-pro

Flags: --file --model --task --max-tokens --json

embed.sh -- Embeddings#

bash$SG/embed.sh --task RETRIEVAL_QUERY --text "How do you onboard clients?"
$SG/embed.sh --file /tmp/kb.txt --task RETRIEVAL_DOCUMENT > /tmp/vectors.jsonl

Flags: --model --text --file --jsonl --task --dim --title

lib/auth.sh -- Sourced by every script#

Resolves GEMINI_API_KEY (env var > .env.cache). Override base URL with GEMINI_API_BASE.

Common pitfalls#

  • Imagen uses :predict, only gemini-*-image models use :generateContent
  • Use x-goog-api-key header, never ?key= in URL
  • Inline audio caps at 20MB -- audio.sh handles this automatically
  • Veo takes 1-5 min; poll at 10-30s intervals, not every second
  • Always set --task on embeddings (RETRIEVAL_QUERY or RETRIEVAL_DOCUMENT)
  • For "best model regardless of provider" use snappy-openrouter, not this skill

Self-report convention#

If this loader doesn't cover your case:

bashecho "[$(date -u +%FT%TZ)] snappy-gemini: <what was missing>" >> ~/.claude/logs/agents-md-feedback.log

Show produced work with snappy-faces: call draw for image channels or lang for MCP Apps.

<!-- SKILL-INDEX-START -->

[snappy-gemini Index]|root: ~/.claude/skills/snappy-gemini|IMPORTANT: Prefer these files over pre-training assumptions for this domain. Read the relevant file when the AGENTS.md summary is insufficient.|root:{SKILL.md,examples.md,models.md,prompting.md}

<!-- SKILL-INDEX-END -->

Used by#

  • snappy-course
  • snappy-image
  • snappy-openrouter

<!-- SNAPPY-CONTRACT-VERBS-START -->

Contract verbs#

Generated from api.ts HAND_CONTRACT. Do not hand-edit this block.

Verb Contract arguments Effect First call
describe image, prompt? read npx tsx ~/.claude/skills/snappy-gemini/api.ts describe <image>
generate prompt draft npx tsx ~/.claude/skills/snappy-gemini/api.ts generate "<prompt>"
image prompt draft npx tsx ~/.claude/skills/snappy-gemini/api.ts image "<prompt>"

Show the result#

When an answer carries face_hint, show it with one snappy_present(<answer>) call.

See /snappy-faces for face selection. Human-facing images must crop to the

element, render at 2x on Retina, and fill the destination channel instead of

placing a small card in a full-page screenshot.

<!-- SNAPPY-CONTRACT-VERBS-END -->

---
name: snappy-gemini
role: Single canonical interface to Google's Gemini family -- text, image, video, audio, and embeddings via api.ts and bash scripts.
loaded-by: PreToolUse hook (auto-injected when "snappy-gemini" is mentioned)
---

# snappy-gemini -- loader

Wraps the `generativelanguage.googleapis.com` REST API. All Gemini calls in the Snappy system go through this skill so credentials, model IDs, and endpoints live in one place. Auth is automatic via `snappy-settings/load.ts` from `.env.cache`.

## API module

```typescript
import { generateContent, generateContentStream, describeImage, generateImage } from "../snappy-gemini/api.ts";
```

| Function | What it does |
|----------|-------------|
| `generateContent(prompt, opts?)` | Text generation (returns `{ text, raw }`) |
| `generateContentStream(prompt, opts?)` | Streaming text generation (async generator of strings) |
| `describeImage(imageUrl, prompt?)` | Vision -- describe a URL or local image file |
| `generateImage(prompt, opts?)` | Nano Banana image generation (returns `{ b64, mime, path? }`) |

Text options: `model`, `systemInstruction`, `temperature`, `maxTokens`, `responseSchema`.
Image options: `model` (default `gemini-3.1-flash-image-preview` aka Nano Banana 2), `out` (write to file), `ref` (reference image for edits).

CLI:
```bash
npx tsx ~/.claude/skills/snappy-gemini/api.ts generate "Explain X" [--model gemini-2.5-pro]
npx tsx ~/.claude/skills/snappy-gemini/api.ts describe /tmp/img.png [prompt]
npx tsx ~/.claude/skills/snappy-gemini/api.ts image "Robot waving hello" --out /tmp/robot.png
npx tsx ~/.claude/skills/snappy-gemini/api.ts image "Make this brighter" --ref /tmp/dark.png --out /tmp/bright.png
```

Credentials loaded via `snappy-settings/load.ts` from `.env.cache`. No Bitwarden unlock needed.

## Key capabilities

- **Text generation** -- Gemini 2.5 Pro / Flash / Flash-Lite with optional system prompt, file input, structured JSON schema output, and streaming
- **Image generation** -- Imagen 3/4 (fresh images via `:predict`) and Nano Banana aka `gemini-2.5-flash-image` (edit/composite with `--ref`)
- **Video generation** -- Veo 2/3 long-running operations with auto-polling, image-to-video, and `--no-wait` / `--resume`
- **Audio understanding** -- transcription, summarization, diarization; auto-switches to Files API for files >= 20MB
- **Embeddings** -- `text-embedding-004` (768d) or `gemini-embedding-001` (3072d) with task type support

## Model defaults

| Modality | Default | Heavy | Cheap |
|----------|---------|-------|-------|
| Text | `gemini-2.5-flash` | `gemini-2.5-pro` | `gemini-2.5-flash-lite` |
| Image (edit) | `gemini-2.5-flash-image` | -- | -- |
| Image (photo) | `imagen-3.0-generate-002` | `imagen-4.0-generate-001` | `imagen-3.0-fast-generate-001` |
| Video | `veo-3.0-generate-001` | -- | `veo-2.0-generate-001` |
| Embeddings | `text-embedding-004` | `gemini-embedding-001` | -- |

## Scripts

All scripts live at `SG=~/.claude/skills/snappy-gemini/scripts`. Every script supports `--help`.

### text.sh -- Text generation
```bash
$SG/text.sh --model gemini-2.5-pro --prompt "Explain quantum tunneling in 3 lines"
$SG/text.sh --model gemini-2.5-flash --prompt "Summarize:" --file /tmp/doc.md
$SG/text.sh --prompt "Extract names:" --file cv.pdf --schema '{"type":"array","items":{"type":"string"}}'
$SG/text.sh --model gemini-2.5-flash --system "You are a TL;DR bot" --prompt "..." --stream
```
Flags: `--model --prompt --system --file --schema --temperature --max-tokens --json --stream`

### image.sh -- Image generation
```bash
$SG/image.sh --model gemini-2.5-flash-image --prompt "Place at a coffee shop" --ref /tmp/headshot.png --out /tmp/coffee.png
$SG/image.sh --model imagen-3.0-generate-002 --prompt "Editorial keynote" --aspect 16:9 --count 4
```
Flags: `--model --prompt --count --aspect --ref --negative --out`

### video.sh -- Video generation (LRO)
```bash
$SG/video.sh --model veo-3.0-generate-001 --prompt "Slow dolly in on a founder" --out /tmp/promo.mp4
$SG/video.sh --no-wait --prompt "..." # returns operation name immediately
$SG/video.sh --resume operations/abc123 --out /tmp/v.mp4
```
Flags: `--model --prompt --aspect --duration --image --out --no-wait --resume`

### audio.sh -- Audio understanding
```bash
$SG/audio.sh --file /tmp/meeting.m4a --task "Action items as JSON" --json
$SG/audio.sh --file /tmp/call.wav --model gemini-2.5-pro
```
Flags: `--file --model --task --max-tokens --json`

### embed.sh -- Embeddings
```bash
$SG/embed.sh --task RETRIEVAL_QUERY --text "How do you onboard clients?"
$SG/embed.sh --file /tmp/kb.txt --task RETRIEVAL_DOCUMENT > /tmp/vectors.jsonl
```
Flags: `--model --text --file --jsonl --task --dim --title`

### lib/auth.sh -- Sourced by every script
Resolves `GEMINI_API_KEY` (env var > `.env.cache`). Override base URL with `GEMINI_API_BASE`.

## Common pitfalls

- Imagen uses `:predict`, only `gemini-*-image` models use `:generateContent`
- Use `x-goog-api-key` header, never `?key=` in URL
- Inline audio caps at 20MB -- `audio.sh` handles this automatically
- Veo takes 1-5 min; poll at 10-30s intervals, not every second
- Always set `--task` on embeddings (`RETRIEVAL_QUERY` or `RETRIEVAL_DOCUMENT`)
- For "best model regardless of provider" use `snappy-openrouter`, not this skill

## Self-report convention

If this loader doesn't cover your case:
```bash
echo "[$(date -u +%FT%TZ)] snappy-gemini: <what was missing>" >> ~/.claude/logs/agents-md-feedback.log
```


Show produced work with `snappy-faces`: call `draw` for image channels or `lang` for MCP Apps.

<!-- SKILL-INDEX-START -->
[snappy-gemini Index]|root: ~/.claude/skills/snappy-gemini|IMPORTANT: Prefer these files over pre-training assumptions for this domain. Read the relevant file when the AGENTS.md summary is insufficient.|root:{SKILL.md,examples.md,models.md,prompting.md}
<!-- SKILL-INDEX-END -->

## Used by

- `snappy-course`
- `snappy-image`
- `snappy-openrouter`

<!-- SNAPPY-CONTRACT-VERBS-START -->
## Contract verbs

Generated from `api.ts` `HAND_CONTRACT`. Do not hand-edit this block.

| Verb | Contract arguments | Effect | First call |
|---|---|---|---|
| `describe` | `image`, `prompt?` | `read` | `npx tsx ~/.claude/skills/snappy-gemini/api.ts describe <image>` |
| `generate` | `prompt` | `draft` | `npx tsx ~/.claude/skills/snappy-gemini/api.ts generate "<prompt>"` |
| `image` | `prompt` | `draft` | `npx tsx ~/.claude/skills/snappy-gemini/api.ts image "<prompt>"` |

## Show the result

When an answer carries `face_hint`, show it with one `snappy_present(<answer>)` call.
See `/snappy-faces` for face selection. Human-facing images must crop to the
element, render at 2x on Retina, and fill the destination channel instead of
placing a small card in a full-page screenshot.
<!-- SNAPPY-CONTRACT-VERBS-END -->

Keyboard Shortcuts

Search in document⌘K
Focus search/
Previous file tab
Next file tab
Close overlayEsc
Show shortcuts?