Blog audio

From gabrielmoreira/agent-skills-mirror · View interactive version

Blog audio is an AI agent skill from the GitHub repository gabrielmoreira/agent-skills-mirror. Paid Gemini TTS audio for a finished blog post: summary, full read-aloud, or two-speaker dialogue, with an MP3 and an HTML5 embed. Asks for explicit consent before the first paid call. Runs only on an explicit request: /blog audio, "generate audio for this blog post", "narrate this blog post", "audi

How to use this skill

Skill file

Blog Audio: Gemini TTS Narration for Blog Posts

Bundled paths below use host Markdown substitution of ${CLAUDE_SKILL_DIR};

it is not an exported shell variable. Resolve them before execution, quote

paths, and refuse nonabsolute overrides. Pass blog_reference_root resolved

from ${CLAUDE_SKILL_DIR}/../blog/references, blog_template_root from

${CLAUDE_SKILL_DIR}/../blog/templates, and needed sibling roots to agents.

Read the main reference orchestration-details.md before loading project

context; pass only its helper-fenced output to downstream agents.

Generate professional audio narration of blog content using Google's Gemini TTS.

Three modes: summary (200-300 word spoken overview), full article read-aloud,

or two-speaker podcast dialogue. 30 prebuilt voices, over 130 languages on

Gemini 3.8 Flash TTS (over 100 on Flash-Lite), HTML5 embed output. Dated model,

pricing and language facts live in ${CLAUDE_SKILL_DIR}/references/models.md.

Cost and consent gate (mandatory, read first)

This skill spends the user's Google AI credit and writes audio files.

split into chunks, so a full read-aloud costs several calls. The script's

--max-chunks flag caps the chunks per run (default 12); never raise it

without telling the user the new worst-case cost.

per model (rates and their checked date are in references/models.md;

re-read https://ai.google.dev/gemini-api/docs/pricing before quoting a

number). Run --dry-run --json first for the script's estimate.

setup only, the managed .venv.

chunk count, and estimated cost, then wait for an explicit yes. The yes

covers only that run. Writing a blog post does not consent to audio.

one retry on a transient error, then report.

skip and return ONE line for the orchestrator's "Fallbacks and skips"

summary, such as "Audio: no API key set, skipped".

Quick Reference

| Command | What it does |

|---------|-------------|

| /blog audio generate <file> | Generate audio narration of a blog post |

| /blog audio voices | Show available voices with characteristics |

| /blog audio setup | Check/configure API key for Gemini TTS |

Prerequisites

Persistent runtime directory

CLAUDE_BLOG_RUNTIME_DIR optionally selects one trusted absolute persistent

root. This integration uses <root>/blog-audio/.venv; NotebookLM also

uses <root>/blog-notebooklm/data for its library, authentication and browser

state. Without this override, the existing skill-local defaults stay in use.

Google's shared credential config/token paths stay unchanged. No state is

copied or migrated automatically, and ordinary runs never perform setup.

Preserve an existing validated operator override. For a plugin without one,

explicitly pass the host-substituted ${CLAUDE_PLUGIN_DATA}/claude-blog-runtime

path on both setup and every later runner call. This is Markdown substitution,

not an exported shell variable. Execute only once it is an absolute resolved

path. Single quotes keep an unresolved placeholder literal so validation

rejects it instead of expanding it to a different shell path:

CLAUDE_BLOG_RUNTIME_DIR='${CLAUDE_PLUGIN_DATA}/claude-blog-runtime' python3 "${CLAUDE_SKILL_DIR}/scripts/setup_environment.py" --check --json
CLAUDE_BLOG_RUNTIME_DIR='${CLAUDE_PLUGIN_DATA}/claude-blog-runtime' python3 "${CLAUDE_SKILL_DIR}/scripts/run.py" generate_audio.py --help

Only explicit setup without --check installs dependencies. Standalone users

keep the default unless they explicitly choose an absolute runtime root.

Relative, unresolved, or linked managed subdirectories fail closed. Changing

the root selects separate state; it never authorizes a migration or cleanup of

the old root. Plugin persistent data follows the host's uninstall retention

rules; preserve it explicitly when uninstalling if it is still needed.

Use the Installed run.py Wrapper

BLOG_SKILLS_DIR="${CLAUDE_BLOG_SKILLS_DIR:-${CLAUDE_SKILL_DIR}/..}"
case "$BLOG_SKILLS_DIR" in /*) ;; *) echo "ERROR: skills dir must be absolute" >&2; exit 1 ;; esac
AUDIO_RUN="$BLOG_SKILLS_DIR/blog-audio/scripts/run.py"
python3 "$AUDIO_RUN" generate_audio.py --text-file blog_audio_prepared.txt --voice Charon --model flash38 --json

Put prepared narration in a file and pass --text-file. If you must use

--text, follow the shell argument rule in ${CLAUDE_SKILL_DIR}/../blog/SKILL.md

(single quotes, embedded ' written as '\'').

Ordinary generate and voices commands perform a nonmutating capability check.

If the managed environment is absent, return a setup-required result. Only

/blog audio setup may create .venv or install dependencies. Never resolve

the wrapper from the current project's scripts/ directory.

API Key Check (Gate Pattern)

Before generating audio, check for the API key (the script reads

GOOGLE_AI_API_KEY first, then GEMINI_API_KEY):

if [ -n "${GOOGLE_AI_API_KEY:-}" ] || [ -n "${GEMINI_API_KEY:-}" ]; then echo "API key is set"; else echo "API key is not set"; fi

"Audio generation requires a Google AI API key. Get one at https://aistudio.google.com/apikey

Then export it in the shell: export GOOGLE_AI_API_KEY=your-key (or GEMINI_API_KEY).

This can be the same key used by /blog image."

the key is missing, for the final summary. Never block the writing workflow.

Setup

For /blog audio setup:

  1. Check that GOOGLE_AI_API_KEY or GEMINI_API_KEY is set in the environment
  2. If blog-image uses project .mcp.json, confirm the referenced env var is exported
  3. If not, guide user to https://aistudio.google.com/apikey
  4. With the user's yes, create or refresh the managed environment. This is the

only step that installs dependencies:

python3 "$BLOG_SKILLS_DIR/blog-audio/scripts/setup_environment.py"

(add --check --json to inspect without installing)

  1. Verify with a dry run (no API call):

python3 "$AUDIO_RUN" generate_audio.py --text 'Test' --dry-run --json

Voice Selection

For /blog audio voices:

Load ${CLAUDE_SKILL_DIR}/references/voices.md and present the voice catalog to the user.

Ask the user which voice they prefer, or recommend based on content type:

Generation Workflow

For /blog audio generate <file>:

Step 1: Read the Blog Post

Read the file and extract:

Step 2: Choose Mode

Ask the user (or auto-select if they specified --mode):

| Mode | When to use | Output |

|------|-------------|--------|

| Summary | Quick audio overview (1-2 min) | 200-300 word spoken summary |

| Full | Complete read-aloud (5-15 min) | Full article as natural speech |

| Dialogue | Podcast-style (3-8 min) | Two-person conversation about the article |

Step 3: Prepare Text

Claude prepares the text; the script does TTS only.

Summary mode:

Write a 200-300 word spoken summary of the article. Rules:

Full mode:

Strip the markdown content to clean spoken text:

Dialogue mode:

Write a 2-person conversation script about the article:

Step 4: Select Voice

If the user chose a voice, use it. Otherwise, recommend based on mode:

Step 5: Generate Audio

Write the prepared text to a file under the working directory, then call:

# Single voice (summary or full mode)
python3 "$AUDIO_RUN" generate_audio.py \
  --text-file blog_audio_prepared.txt \
  --voice Charon \
  --model flash38 \
  --output audio/post-slug.mp3 \
  --json

# Two voices (dialogue mode)
python3 "$AUDIO_RUN" generate_audio.py \
  --text-file blog_audio_dialogue.txt \
  --voice Puck \
  --voice2 Kore \
  --model flash38 \
  --output audio/post-slug-dialogue.mp3 \
  --json

Model selection (use the explicit 3.8 IDs):

one used in the examples above. Over 130 languages.

100 languages; a few (for example Finnish and Thai) are Flash-only.

shut down 2026-11-17 at the earliest (details in references/models.md), so

do not use them for new work. Confirm the resolved model ID in the

--dry-run --json output before spending.

The 3.8 aliases have offline SDK schema and WAV parsing checks; authenticated

availability and voice quality still require provider testing. For 3.8, pass a

verbatim transcript, not embedded narration directions. Dialogue must use

explicit Speaker1: and Speaker2: lines; the helper does not infer

speakers. Cost estimates are not a billing quote.

Step 6: Deliver

Present the result to the user:

  1. File path: where the audio was saved
  2. Duration: human-readable (e.g., "3:42")
  3. Embed code: ready-to-paste HTML5 audio tag
  4. Cost: estimated API cost
  5. Placement suggestion: where to insert the embed in the blog post

Embedding Guide

Standard HTML (Hugo, Jekyll, static sites)

<audio controls preload="metadata">
  <source src="audio/post-slug.mp3" type="audio/mpeg">
  Your browser does not support the audio element.
</audio>

MDX (Next.js, Gatsby)

<audio controls preload="metadata">
  <source src="/audio/post-slug.mp3" type="audio/mpeg" />
</audio>

WordPress

[audio src="audio/post-slug.mp3"]

Placement

Insert the audio player after the introduction (below the first H2) or at the

very top of the article with a label: "Listen to this article" or "Audio version".

Use from blog-write

blog-write does not call this skill. The orchestrator may offer audio after

delivery, and never runs it without the consent gate above. If the key is

missing or the user declines, return one skip line for "Fallbacks and skips"

and carry on without audio.

Error Handling

| Error | Resolution |

|-------|-----------|

| API key not set (GOOGLE_AI_API_KEY or GEMINI_API_KEY) | Get key at https://aistudio.google.com/apikey |

| FFmpeg not found | Falls back to WAV output. Tell the user; do not install it for them. |

| Rate limited | Wait and retry. Check limits at https://aistudio.google.com/rate-limit |

| Text too long (>8,192 input tokens) | Split into sections around 7,800 tokens; the script chunks and stitches prepared text, up to --max-chunks (default 12) per run. Over the cap, stop and ask the user before raising it |

| Unknown voice name | Run /blog audio voices to see valid options |

| API error | Check key validity and model availability |

| API key missing (internal call) | Return a one-line skip note: writing workflow continues and reports it |

Reference Documentation

Load on-demand: do NOT load all at startup:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.