Skip to content

AgriciDaniel/banana-claude / skills/banana

banana

Verified

Plan, generate, edit, compare, and review images with Google Gemini (Nano Banana) image models, with an exact plan and explicit approval before every paid call. Use when the user asks to create or edit an image, picture, photo, illustration, logo, thumbnail, poster, banner, product shot, mockup, character sheet, infographic, or diagram; keep a character or product consistent across images; add exact text to an image; or compare image models.

FileKindSize
SKILL.mdskill md17.4 KB
references/cost-tracking.mdmarkdown13.2 KB
references/gemini-models.mdmarkdown18.5 KB
references/mcp-tools.mdmarkdown22.3 KB
references/models.jsonconfig29.2 KB
references/post-processing.mdmarkdown18.7 KB
references/presets.mdmarkdown8.9 KB
references/prompt-engineering.mdmarkdown20.2 KB
references/review-and-recovery.mdmarkdown8.4 KB
scripts/approval_store.pyexecutablescript22.6 KB
scripts/banana_core.pyexecutablescript183.8 KB
scripts/batch.pyexecutablescript5.5 KB
scripts/cost_tracker.pyexecutablescript117.7 KB
scripts/doctor.pyexecutablescript5.5 KB
scripts/edit.pyexecutablescript4.7 KB
scripts/generate.pyexecutablescript5.7 KB
scripts/legacy_cleanup.pyexecutablescript93.4 KB
scripts/mcp_server.pyexecutablescript42.9 KB
scripts/portfolio.pyexecutablescript20.9 KB
scripts/presets.pyexecutablescript128.1 KB
scripts/typeset.pyexecutablescript23.9 KB

scripts/generate.py

View on GitHub
#!/usr/bin/env python3
"""Plan or execute one Gemini image generation interaction.

Planning is the default and performs no Google request. It issues a short-lived
single-use approval ID. Execution requires both --execute and that exact ID.
Credentials are read only from the environment.
"""

from __future__ import annotations

import argparse
import json
import sys

from banana_core import (
    BananaError,
    SecretSafeArgumentParser,
    build_plan,
    build_reference_specs,
    execute_image,
    issue_public_plan,
    load_visual_brief_file,
)


def build_parser() -> argparse.ArgumentParser:
    parser = SecretSafeArgumentParser(
        description="Plan or execute a Gemini image generation"
    )
    parser.add_argument("--prompt", required=True)
    parser.add_argument("--model", default="gemini-nano-banana-2.1")
    parser.add_argument("--aspect-ratio", default="1:1")
    parser.add_argument("--resolution", default="auto")
    parser.add_argument(
        "--reference",
        action="append",
        default=[],
        help="Reference image path, repeatable",
    )
    parser.add_argument(
        "--reference-name",
        action="append",
        default=[],
        help="Non-sensitive disclosure alias aligned by reference order",
    )
    parser.add_argument(
        "--reference-role",
        action="append",
        choices=["object", "character", "style"],
        default=[],
    )
    parser.add_argument(
        "--reference-purpose",
        action="append",
        default=[],
        help="Purpose aligned by reference order",
    )
    parser.add_argument(
        "--reference-subject-id",
        action="append",
        default=[],
        help="Subject label aligned by reference order",
    )
    parser.add_argument(
        "--video-url",
        help=(
            "HTTPS YouTube watch or short URL syntax, Nano Banana 2.1 or Flash Image; "
            "existence, public status, and Google accessibility are user-asserted, "
            "not preflighted; an inaccessible URL can consume the one paid attempt"
        ),
    )
    parser.add_argument("--previous-interaction-id")
    parser.add_argument("--thinking", choices=["minimal", "medium", "high"])
    parser.add_argument("--web-search", action="store_true")
    parser.add_argument("--image-search", action="store_true")
    parser.add_argument(
        "--store",
        action="store_true",
        help="Allow provider-side storage for continuation",
    )
    parser.add_argument("--mime-type", choices=["image/jpeg"], default="image/jpeg")
    parser.add_argument("--output-dir")
    parser.add_argument("--brief-file", help="UTF-8 JSON banana.visual-brief.v1 file")
    parser.add_argument("--label", default="generation")
    parser.add_argument(
        "--record-prompt",
        action="store_true",
        help="Store raw prompt in the local metadata sidecar",
    )
    parser.add_argument(
        "--execute", action="store_true", help="Make the paid provider request"
    )
    parser.add_argument("--confirm", help="Single-use approval ID approved by the user")
    return parser


def main() -> int:
    args = build_parser().parse_args()
    operation = "continue" if args.previous_interaction_id else "generate"
    try:
        references = build_reference_specs(
            args.reference,
            names=args.reference_name,
            roles=args.reference_role,
            purposes=args.reference_purpose,
            subject_ids=args.reference_subject_id,
        )
        visual_brief = (
            load_visual_brief_file(args.brief_file) if args.brief_file else None
        )
        plan = build_plan(
            operation=operation,
            prompt=args.prompt,
            model=args.model,
            aspect_ratio=args.aspect_ratio,
            image_size=args.resolution,
            reference_paths=references,
            video_url=args.video_url,
            previous_interaction_id=args.previous_interaction_id,
            thinking_level=args.thinking,
            web_search=args.web_search,
            image_search=args.image_search,
            store=args.store,
            mime_type=args.mime_type,
            destination=args.output_dir,
            label=args.label,
            record_prompt=args.record_prompt,
            visual_brief=visual_brief,
        )
        if not args.execute:
            print(
                json.dumps(
                    {"network_called": False, "plan": issue_public_plan(plan)}, indent=2
                )
            )
            return 0
        if not args.confirm:
            raise BananaError(
                "confirmation_required",
                "Execution requires --confirm with the single-use approval ID.",
            )

        result = execute_image(
            operation=operation,
            prompt=args.prompt,
            approval_id=args.confirm,
            model=args.model,
            aspect_ratio=args.aspect_ratio,
            image_size=args.resolution,
            reference_paths=references,
            video_url=args.video_url,
            previous_interaction_id=args.previous_interaction_id,
            thinking_level=args.thinking,
            web_search=args.web_search,
            image_search=args.image_search,
            store=args.store,
            mime_type=args.mime_type,
            destination=args.output_dir,
            label=args.label,
            record_prompt=args.record_prompt,
            visual_brief=visual_brief,
        )
        result.pop("image_contents", None)
        print(json.dumps(result, indent=2, ensure_ascii=False))
        return 0
    except BananaError as exc:
        print(json.dumps(exc.as_dict()), file=sys.stderr)
        return 1


if __name__ == "__main__":
    raise SystemExit(main())
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall