agentleFS
LuisHiluyLuisHiluy/claude-code-pipeline-skills/nb2-batch/SKILL.md

nb2-batch

Skill0 starsChanged 7 months agoMITView on GitHub

Batch-generate 2x2 contact sheet grids via the Nanobanana MCP (Nano Banana / NB2 / Gemini Image) for AI media pipelines. Handles prompt cleaning, up to 3 reference images per call, parallel batch orchestration, and generation logging so prior runs inform new ones. Use whenever the user asks to "generate frames", "run NB2 batch", "regen scenes", "generate contact sheets", "make grid variants", "batch generate with nano banana", or needs parallel image generation for AI film or media production. Trigger this skill after prompt edits when new frames are needed, even if the user only says "regenerate those".

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After prompt block edits when new frames are needed

    line 16
  2. Very specific:

    Use output_path parameter pointing to the variant directory

    line 46
  3. Very specific:

    Run 3 concurrent mcp__nanobanana__generate_image calls per batch to balance API load.

    line 68
  4. Distinctive:

    Every batch run should be logged.

    line 107

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

NB2 Batch Generation — 2x2 Contact Sheet Grids

Description

Generate 2x2 contact sheet grids for AI media projects using the Nanobanana MCP (mcp__nanobanana__generate_image). Each call produces a single image with 4 panels for hero frame selection.

When to Use

  • User asks to generate or regenerate 2x2 grids, variant frames, or scene images
  • User says "generate frames", "run NB2 batch", "regen scenes"
  • After prompt block edits when new frames are needed

Generation Settings (recommended defaults)

ParameterValueWhy
aspect_ratio"16:9"Cinematic frame ratio
model_tier"nb2"Nano Banana 2 (may auto-escalate to pro)
resolution"4k"Highest resolution available
n1 (coverage) or 4 (variants)1 for coverage pass, 4 for hero selection
negative_prompt"text, watermark, logo, title card, UI elements, split screen borders, white borders"Prevent unwanted artifacts
enable_groundingfalseGrounding adds noise for fictional content

Prompt Rules

  • No character names — use descriptors ("the son", "the soldier", "the mother")
  • Strip external tag references — MCP-specific tags from other tools are ignored
  • Include grid directive — add "2x2 contact sheet grid, four equal panels, thin borders" in the prompt
  • Front-load character descriptions in the first 200 chars
  • Camera specs — include lens and film stock for cinematic tone

Reference Images

  • Pass up to 3 reference images via input_image_path_1/2/3
  • Priority order: character turnaround > location > prop
  • Source from your references/approved/ directory

Output

  • Save to: runs/grids/variants/{ITEM_ID}/
  • Use output_path parameter pointing to the variant directory
  • Files are auto-named by the MCP tool

Batch Workflow

1. Load prompts

import json
with open("runs/prompts.json") as f:
    prompts = json.load(f)

2. Build manifest

For each item, extract:

  • prompt_text (strip references and external tag refs)
  • ref_images (up to 3 resolved absolute paths)
  • output_dir (e.g., runs/grids/variants/{item_id}/)

3. Generate in parallel batches of 3

Run 3 concurrent mcp__nanobanana__generate_image calls per batch to balance API load. More may hit rate limits.

4. Example MCP call

{
  "prompt": "2x2 contact sheet grid, four equal panels, thin borders, no text. [scene prompt here]",
  "aspect_ratio": "16:9",
  "model_tier": "nb2",
  "resolution": "4k",
  "negative_prompt": "text, watermark, logo, title card, UI elements, split screen borders, white borders",
  "enable_grounding": false,
  "n": 1,
  "input_image_path_1": "/abs/path/to/turnaround.png",
  "input_image_path_2": "/abs/path/to/location.png",
  "output_path": "/abs/path/to/runs/grids/variants/shot-01/"
}

Cost Reference

  • Pro tier: ~$0.04 per image
  • 27 scenes × 1 image = ~$1.08 per full pass
  • 27 scenes × 4 images = ~$4.32 per variant pass

World / Palette Anchoring (example)

Include a palette hint in each prompt for consistent world identity:

WorldColors
ColdSteel blue, black, cold grey — no warm tones
DiffusedTeal, cyan, soft light
WarmRed, terracotta, rust
LiminalCold moonlight plus distant warm glow in tension
NeutralDawn light, warm and cool coexisting

Generation Memory

Every batch run should be logged. This lets future sessions know what was generated, what prompts worked, and what scores were achieved.

Log a generation

python3 "${CLAUDE_SKILL_DIR}/scripts/log-generation.py" log \
  --scene shot-06 \
  --prompt "2x2 contact sheet grid..." \
  --model nb2 \
  --refs "references/approved/characters/hero/front.jpg" \
  --output-path "runs/grids/variants/shot-06/" \
  --notes "Round 2 — strengthened character descriptors"

Attach quality scores after verification

python3 "${CLAUDE_SKILL_DIR}/scripts/log-generation.py" add-scores --scene shot-06

Check what was previously generated

python3 "${CLAUDE_SKILL_DIR}/scripts/log-generation.py" history --scene shot-06

Before generating: always read history first

At the start of any batch run, read the generation history for target items. This tells you:

  • Which prompts were already tried
  • What worked (GOOD verdict) and what did not (FAIL)
  • Whether to iterate on the best prompt or try something new

For log format details, see reference/generation-format.md.

Gotchas

  • Model tier escalation — nb2 may auto-escalate to pro tier. Changes cost slightly.
  • 2x2 grid splitting — the MCP generates a single 4-panel image. Crop with a separate tool if you need individual frames.
  • Reference image limit — NB2 MCP accepts max 3 reference images. Priority: character > location > prop.
  • Prompt length — NB2 handles long prompts well, but front-load key descriptors in the first 200 chars.
  • Output directory — must exist before generation. Create with mkdir -p if needed.
  • Parallel batch size — 3 concurrent calls is the safe limit. More may hit rate limits.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.