Free, open source blog writer for Claude Code. Researches current sources, writes answer-first posts for Google and AI answers, has an independent reviewer score each one out of 100 and ships only after five delivery gates. 32 skills, 30 /blog commands, 5 agents. Active development at AI-Marketing-Hub/claude-blog; public releases ship here.
Python agent-skillsaiai-citationsai-contentai-marketingai-marketing-hubblogblog-writingclaude-codeclaude-code-skillclaude-pluginclaude-skillcontent-creationcontent-optimizationcontent-strategyeeatgeomultilingualopen-sourceseo
docs(skills): describe the new hero, gate and repair rules
Agrici Daniel295b4b7d74bd
diff --git a/CLAUDE.md b/CLAUDE.mdindex c15dcc7..227f141 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -22,7 +22,7 @@ claude-blog/CLAUDE.md # Project instructions (this file)docs/CONTRIBUTORS.md # Pro Hub Challenge attribution and integration decisionsCHANGELOG.md # Keep a Changelog format- .claude-plugin/plugin.json # Plugin manifest (v2.3.1)+ .claude-plugin/plugin.json # Plugin manifest (v2.3.2).claude-plugin/marketplace.json # Marketplace catalog for distribution (claude-blog + optional blog-studio)plugins/blog-studio/ # Optional Claude Code mod companion (status band, pipeline panel); own README, tests, version 0.2.0.mcp.example.json # MCP config example (tracked; .mcp.json is gitignored)@@ -35,7 +35,7 @@ claude-blog/scripts/blog_hygiene.py # Optional deterministic hygiene: lazy-load imgs + auto-TOC (v1.11.0)scripts/cognitive_load.py # Per-section concept-density analyzer (v1.8.0)scripts/discourse_research.py # Discourse brief synthesis from SERP JSON (v1.8.0)- scripts/generate_hero.py # Hero image ladder: Banana -> Gemini -> stock -> Openverse (v1.9.0)+ scripts/generate_hero.py # Hero image ladder: Banana -> Gemini (--allow-paid) -> stock -> Openverse (v1.9.0)scripts/load_untrusted_root.py # Code-enforced fence helper for BRAND/VOICE/DISCOURSE (v1.8.3)scripts/lint_prose.py # Fence-aware prose-hygiene linter (v1.8.4; CI-enforced)scripts/sync_flow.py # Pulls FLOW references (stdlib, sandboxed)diff --git a/agents/blog-researcher.md b/agents/blog-researcher.mdindex 23646b2..72cb752 100644--- a/agents/blog-researcher.md+++ b/agents/blog-researcher.md@@ -220,8 +220,9 @@ Return structured findings:## Cover Image Search-The orchestrator generates or fetches the hero (`generate_hero.py`: image model,-then official stock APIs, then Openverse). When asked for cover ideas, return+The orchestrator generates or fetches the hero (`generate_hero.py`: a valid existing hero,+the paid image model only with consent and `--allow-paid`, then official stock+APIs, then Openverse). When asked for cover ideas, returnconcepts and Openverse candidates as described under "When Finding Images",note the aspect ratio wanted (at least 1200x630, wide), and write descriptive alttext: a full sentence, topic keywords naturally. Do not claim a candidate isdiff --git a/agents/blog-reviewer.md b/agents/blog-reviewer.mdindex 8816bd6..ac88959 100644--- a/agents/blog-reviewer.md+++ b/agents/blog-reviewer.md@@ -241,6 +241,7 @@ Gate 4 parses the score and P0 clearance independently, so these must appear:- `### Overall Score: [N]/100 - [Rating]`- A standalone affirmative `no P0` or `zero P0 issues found` statement when no P0 issue exists- Exactly one Overall Score field, one Nonce field and one final BLOCKING decision+- All five category scores, with the overall equal to their sum; a missing category or a mismatched overall fails Gate 4- A non-empty reason in the final decision; negated or qualified clearance is invalidSet `BLOCKING: true` if ANY of the following hold:diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex 5a4e916..cbfffb1 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -106,7 +106,7 @@ Each sub-skill is a standalone Claude Code skill with its own:| Sub-Skill | Responsibility | Introduced ||-----------|----------------|------------|-| blog-write | New article generation with full optimization (v1.9.0: iterates through 5-gate delivery contract until score >= 90 and zero P0, max 3 iterations) | v1.0.0 |+| blog-write | New article generation with full optimization (v1.9.0: iterates through 5-gate delivery contract until score >= 90 and zero P0, at most 3 failed gate runs per draft) | v1.0.0 || blog-rewrite | Existing post optimization preserving author voice (v1.9.0: same delivery contract) | v1.0.0 || blog-analyze | Quality audit with 5-category 100-point scoring | v1.0.0 || blog-brief | Content brief generation with research | v1.0.0 |@@ -215,7 +215,7 @@ dependencies are stdlib-only or narrowly pinned.| `content_decay.py` | GSC content-decay detector: 20%+ QoQ decline | v1.10.0 || `dependency_smoke.py` | Offline initialization smoke checks for the optional runtimes | Maintenance || `discourse_research.py` | Discourse-brief synthesis from SERP JSON; depth-bounded parsing; path-traversal guards | v1.8.0 |-| `generate_hero.py` | Hero image ladder: Banana MCP -> Gemini API -> Unsplash/Pexels/Pixabay -> Openverse | v1.9.0 |+| `generate_hero.py` | Hero image ladder: Banana MCP -> Gemini API (only with `--allow-paid`) -> Unsplash/Pexels/Pixabay -> Openverse; keeps a valid existing hero | v1.9.0 || `installer_ownership.py` | Shared Unix legacy/v2 ownership verification, migration and rollback | v2.3.0 || `lint_prose.py` | Fence-aware prose-hygiene linter (no em-dash, en-dash, ` -- `); CI-enforced | v1.8.4 || `load_untrusted_root.py` | Code-enforced BRAND/VOICE/DISCOURSE fencing with CSPRNG nonces; O_NOFOLLOW + size cap | v1.8.3 |diff --git a/docs/COMMANDS.md b/docs/COMMANDS.mdindex a0e2872..209415b 100644--- a/docs/COMMANDS.md+++ b/docs/COMMANDS.md@@ -18,11 +18,11 @@ Every command is invoked through the main orchestrator| Command | Sub-Skill | Description ||---------|-----------|-------------|-| `write <topic>` | blog-write | Write a new blog post from scratch (v1.9.0: iterates through the 5-gate delivery contract until score 90+ and zero P0, max 3 iterations) |+| `write <topic>` | blog-write | Write a new blog post from scratch (v1.9.0: iterates through the 5-gate delivery contract until score 90+ and zero P0, at most 3 failed gate runs per draft) || `rewrite <file>` | blog-rewrite | Optimize an existing blog post (v1.9.0: same delivery contract; rewrites must score at least as high as the original) || `analyze <file-or-url>` | blog-analyze | Audit blog quality with 0-100 score || `brief <topic>` | blog-brief | Generate a detailed content brief |-| `calendar [monthly\|quarterly]` | blog-calendar | Generate an editorial calendar |+| `calendar [monthly\|quarterly] [niche]` | blog-calendar | Generate an editorial calendar || `strategy <niche>` | blog-strategy | Blog strategy and topic ideation || `outline <topic>` | blog-outline | SERP-informed outline generation || `seo-check <file>` | blog-seo-check | Post-writing SEO validation |@@ -35,10 +35,10 @@ Every command is invoked through the main orchestrator| `factcheck <file>` | blog-factcheck | Verify statistics against cited sources || `persona [create\|list\|use\|show]` | blog-persona | Manage writing personas and voice profiles || `taxonomy [sync\|audit\|suggest]` | blog-taxonomy | Tag/category CMS management |-| `notebooklm <question>` | blog-notebooklm | Query NotebookLM for source-grounded research |+| `notebooklm [ask\|discover\|library\|setup\|status\|cleanup] [question-or-url]` | blog-notebooklm | Query NotebookLM for source-grounded research || `audio [generate\|voices\|setup]` | blog-audio | Generate audio narration via Gemini TTS || `google [command] [args]` | blog-google | Google API data: PSI, CrUX, GSC, GA4, NLP, YouTube, Keywords |-| `cluster [plan\|execute] <seed>` | blog-cluster | Semantic topic-cluster planning + execution (v1.7.0) |+| `cluster [plan\|execute] [seed-keyword\|cluster-plan.json]` | blog-cluster | Semantic topic-cluster planning + execution (v1.7.0) || `multilingual <topic> --languages <codes>` | blog-multilingual | Write + translate + localize + hreflang (v1.7.0) || `translate <file> --to <codes>` | blog-translate | SEO-optimized translation with format preservation (v1.7.0) || `localize <file> --locale <code>` | blog-localize | Cultural deep-adaptation per locale (v1.7.0) |@@ -148,10 +148,10 @@ platform engineers") and the skill asks for whatever it still needs.1. **Topic clarification**: Asks for audience, keyword, word count, platform2. **Research**: Spawns `blog-researcher` agent to find sourced statistics and images3. **Outline**: Generates structured outline, presents for approval-4. **Draft**: Spawns `blog-writer` agent for the full article; the agent may leave `[IMAGE]`, `[CHART]` and `[INTERNAL-LINK]` markers+4. **Draft**: Creates the draft folder and runs Gate 1 capability discovery before writing (with `--reset-iterations` first when a new write starts in a used folder), then spawns the `blog-writer` agent for the full article; the agent may leave `[IMAGE]`, `[CHART]` and `[INTERNAL-LINK]` markers5. **Visuals**: The orchestrator resolves every marker (hero image, `blog-chart` SVGs where a chart helps, real internal links); none may remain6. **Render and review**: Renders HTML and PDF, issues the review nonce, runs `blog-reviewer`, and saves its report to `review.md`-7. **Gates**: Runs the 5-gate delivery contract; any edit means re-render, new nonce and a new review, up to 3 iterations+7. **Gates**: Runs the 5-gate delivery contract; any edit means re-render, new nonce and a new review; after 3 failed gate runs it stops with the diagnostic8. **Delivery**: Presents the artifact folder and the scorecardThe exact order and every gate check are specified once, in@@ -717,7 +717,12 @@ can copy them to the project directory.accepted) for source-grounded research via patchright browser automation.```-/blog notebooklm <question>+/blog notebooklm ask <question>+/blog notebooklm discover <url>+/blog notebooklm library [list|add <url>|search <query>|remove <id>]+/blog notebooklm setup+/blog notebooklm status+/blog notebooklm cleanup```**Flow**: See `skills/blog-notebooklm/SKILL.md`. With `--json`, the notebook's@@ -773,7 +778,10 @@ ordinary blog posts are not eligible.architecture with shared cluster context.```-/blog cluster <seed-topic>+/blog cluster+/blog cluster plan <seed-keyword>+/blog cluster plan --from strategy [path]+/blog cluster execute [path-to-plan]```**Flow**: See `skills/blog-cluster/SKILL.md`. Adapted from@@ -903,8 +911,8 @@ User Input Routes To/blog rewrite <file> --> blog-rewrite/blog analyze <file-or-url> --> blog-analyze/blog brief <topic> --> blog-brief-/blog calendar [period] --> blog-calendar-/blog plan [period] --> blog-calendar+/blog calendar [monthly|quarterly] [niche] --> blog-calendar+/blog plan [monthly|quarterly] [niche] --> blog-calendar/blog strategy <niche> --> blog-strategy/blog ideation <niche> --> blog-strategy/blog outline <topic> --> blog-outline@@ -921,10 +929,10 @@ User Input Routes To/blog brand [init|show|update] --> blog-brand (v1.8.0)/blog discourse <topic> --> blog-discourse (v1.8.0)/blog taxonomy [suggest|sync|audit] --> blog-taxonomy-/blog notebooklm <question> --> blog-notebooklm+/blog notebooklm [ask|discover|...] <arg> --> blog-notebooklm/blog audio [generate|voices|setup] --> blog-audio/blog google [command] [args] --> blog-google-/blog cluster [plan|execute] <seed> --> blog-cluster+/blog cluster [plan|execute] [seed-or-plan] --> blog-cluster/blog multilingual <topic> --languages --> blog-multilingual/blog translate <file> --to --> blog-translate/blog localize <file> --locale --> blog-localizediff --git a/docs/DEMO.md b/docs/DEMO.mdindex 8d2cb64..5344caf 100644--- a/docs/DEMO.md+++ b/docs/DEMO.md@@ -1,4 +1,4 @@-# claude-blog v2.3.1: Demo Runbook+# claude-blog v2.3.2: Demo RunbookEnd-to-end demo flow that exercises every wired integration: YouTubeembedding (blog-google), keyword research (DataForSEO MCP), AI imagediff --git a/skills/blog-analyze/SKILL.md b/skills/blog-analyze/SKILL.mdindex 0e176e9..9b93671 100644--- a/skills/blog-analyze/SKILL.md+++ b/skills/blog-analyze/SKILL.md@@ -12,7 +12,7 @@ description: >(orphan pages, cannibalization, stale content, schema across all posts) useblog-audit instead.user-invocable: true-argument-hint: "<file-path>"+argument-hint: "<file-or-url>"license: MIT---diff --git a/skills/blog-audio/SKILL.md b/skills/blog-audio/SKILL.mdindex 3a9f204..71a9286 100644--- a/skills/blog-audio/SKILL.md+++ b/skills/blog-audio/SKILL.md@@ -12,7 +12,7 @@ argument-hint: "[generate|voices|setup] [file-or-text] [--mode summary|full|diallicense: MITmetadata:author: AgriciDaniel- version: "2.3.1"+ version: "2.3.2"---# Blog Audio: Gemini TTS Narration for Blog Postsdiff --git a/skills/blog-calendar/SKILL.md b/skills/blog-calendar/SKILL.mdindex e900267..8edd4bc 100644--- a/skills/blog-calendar/SKILL.md+++ b/skills/blog-calendar/SKILL.md@@ -9,7 +9,7 @@ description: >(blog-cluster), or detecting declining pages from Search Console exports(blog-decay). Publication frequency is not a ranking signal.user-invocable: true-argument-hint: "[<niche>]"+argument-hint: "[monthly|quarterly] [<niche>]"license: MIT---diff --git a/skills/blog-cluster/SKILL.md b/skills/blog-cluster/SKILL.mdindex 1aa6550..1dca0ce 100644--- a/skills/blog-cluster/SKILL.md+++ b/skills/blog-cluster/SKILL.md@@ -14,7 +14,7 @@ license: MITcompatibility: Requires Claude Code and claude-blog (provides blog-write, blog-chart, blog-image)metadata:author: AgriciDaniel- version: "2.3.1"+ version: "2.3.2"category: bloguser-invocable: trueargument-hint: "[plan|execute] [seed-keyword|cluster-plan.json]"@@ -240,12 +240,13 @@ Before reading a user-supplied plan path, canonicalize it relative to the curren**One-time cost question (before the first post).** Execution is bulk andpaid. Ask once, and wait for an explicit yes: "This plan has N posts. Eachpost runs a full `blog-write` pass, one `blog-reviewer` pass (more if a gate-blocks, up to 3 iterations), and one hero image. A Gemini hero is one paid+blocks, at most 3 failed gate runs per post), and one hero image. A Gemini hero is one paidimage call per post (about N times the current per-image price onhttps://ai.google.dev/gemini-api/docs/pricing). Proceed with Gemini heroes,use free stock heroes only, or stop?" Record the answer in the clustercontext as `HERO: gemini` or `HERO: stock-only`. For `stock-only`, run-`generate_hero.py` with the Gemini key unset (`env -u GOOGLE_AI_API_KEY`).+`generate_hero.py` without `--allow-paid` (its default), so a Gemini key is+ignored. Only `HERO: gemini` adds `--allow-paid`.The yes covers exactly N heroes; never regenerate in a loop. Report eachfallback or skip (a stock hero, a skipped post) as one line under"Fallbacks and skips" in the final report.@@ -307,8 +308,11 @@ case explicitly:(file, anchor text, the sentence to change, target filename) and show thelist in the final report. If the user explicitly opts in to apply a patch,edit the markdown and then repeat the canonical sequence for that post:- re-render, re-init the review nonce, re-review, re-run preflight `--strict`- (max 3 iterations). Tell the user the number of extra reviewer runs first.+ if the post's last full gate run passed (it was delivered, so this is a new+ edit pass), run `blog_preflight.py --draft <post folder> --reset-iterations`;+ never reset a post whose last run failed. Then re-render, re-init the review+ nonce, re-review, re-run preflight `--strict` (at most 3 failed gate runs).+ Tell the user the number of extra reviewer runs first.4. Cluster metadata (`cluster:`, `cluster_role:`, `cluster_group:`,`cluster_position:`) is written into each post's frontmatter during itsown draft (Step 3), never added afterward.diff --git a/skills/blog-cluster/references/execution-workflow.md b/skills/blog-cluster/references/execution-workflow.mdindex 33996f6..51cf2f7 100644--- a/skills/blog-cluster/references/execution-workflow.md+++ b/skills/blog-cluster/references/execution-workflow.md@@ -137,9 +137,12 @@ completes for a post:edit it. Append the proposed edit (file, anchor, sentence, target) to`cluster-<slug>/cluster-link-patches.md` for the user.4. Only with the user's explicit approval, apply a patch and rerun the- canonical sequence for that post: re-render, re-init the review nonce,- re-review, re-run `blog_preflight.py --strict` (max 3 iterations), using- the trusted absolute scripts path.+ canonical sequence for that post. Only if its last full gate run passed (a+ delivered post getting a new edit pass), run+ `blog_preflight.py --reset-iterations` on its draft folder first; never reset+ a post whose last run failed. Then re-render, re-init the review nonce,+ re-review, re-run `blog_preflight.py --strict` (at most 3 failed gate runs),+ using the trusted absolute scripts path.5. If no planned marker exists, do not edit automatically. Emit a proposeddiff for user approval instead.diff --git a/skills/blog-factcheck/SKILL.md b/skills/blog-factcheck/SKILL.mdindex 1574ac3..5ade65a 100644--- a/skills/blog-factcheck/SKILL.md+++ b/skills/blog-factcheck/SKILL.md@@ -12,7 +12,7 @@ description: >experience. Use when the user says "fact check", "verify statistics", "checksources", "factcheck". Report only; not for rewriting posts (blog-rewrite).user-invocable: true-argument-hint: "[file]"+argument-hint: "<file-path>"license: MIT---diff --git a/skills/blog-flow/SKILL.md b/skills/blog-flow/SKILL.mdindex cc8a53a..63db604 100644--- a/skills/blog-flow/SKILL.md+++ b/skills/blog-flow/SKILL.md@@ -8,12 +8,12 @@ description: >"evidence-led blogging", or "find optimize win", or asks for stage-specificblog prompts. Not for generic prompt writing.user-invocable: true-argument-hint: "[stage] [url|topic]"+argument-hint: "[find|optimize|win|prompts|sync] [topic-or-url]"license: MITcompatibility: Requires Claude Code and Python 3.11+ for the sync scriptmetadata:author: AgriciDaniel- version: "2.3.1"+ version: "2.3.2"category: blog---diff --git a/skills/blog-google/SKILL.md b/skills/blog-google/SKILL.mdindex 9e78776..c7cbd5e 100644--- a/skills/blog-google/SKILL.md+++ b/skills/blog-google/SKILL.md@@ -15,7 +15,7 @@ argument-hint: "[setup|pagespeed|crux|crux-history|gsc|inspect|index|ga4|nlp|youlicense: MITmetadata:author: AgriciDaniel- version: "2.3.1"+ version: "2.3.2"category: blog---diff --git a/skills/blog-image/SKILL.md b/skills/blog-image/SKILL.mdindex 0f3c761..dc618c3 100644--- a/skills/blog-image/SKILL.md+++ b/skills/blog-image/SKILL.md@@ -12,7 +12,7 @@ argument-hint: "[generate|edit|setup] [description-or-path]"license: MITmetadata:author: AgriciDaniel- version: "2.3.1"+ version: "2.3.2"optional-mcp-package: "@ycse/nanobanana-mcp"---@@ -48,8 +48,9 @@ This skill spends the user's Google AI credit and writes image files.- **No uncapped spend:** never loop on paid calls. Safety rephrases stop at 3attempts per image. Bulk work (for example a cluster) needs a stated totalcount and a cap, confirmed once before the first call.-- **Declined or unavailable:** skip the Gemini call (run the script with the- key unset, `env -u GOOGLE_AI_API_KEY`, to use the free stock rungs) and+- **Declined or unavailable:** skip the Gemini call (run the script without+ `--allow-paid`, its default, so a key is ignored and it uses the free rungs:+ existing hero, then stock keys, then Openverse) andreturn ONE line for the orchestrator's "Fallbacks and skips" summary, such as"Hero image: user declined paid generation, used a stock photo".@@ -86,7 +87,8 @@ Match the image type to blog use case:## Generation Routes1. **Direct API (default).** The repo's `generate_hero.py` calls the Gemini- API with `GOOGLE_AI_API_KEY` or `GEMINI_API_KEY` (the `google-genai` SDK+ API only when run with `--allow-paid` (after the consent gate) and+ `GOOGLE_AI_API_KEY` or `GEMINI_API_KEY` is set (the `google-genai` SDKmust be installed), then falls back to premium stock and Openverse. It needsno MCP server. `NANOBANANA_MODEL` sets its default model ID.2. **Optional MCP (at your own risk).** `@ycse/[email protected]` is the@@ -130,14 +132,18 @@ Pass the title and tags as single-quoted arguments (shell argument rule in```bashpython3 "$BLOG_SCRIPT_DIR/generate_hero.py" --topic '<post title>' \--tags 'tag1,tag2' --out "<draft-folder>" [--width 1200] [--height 630] \- [--model <image-model-id>] [--replace] --json+ [--model <image-model-id>] [--replace] --allow-paid --json```Flags: `--topic` (required), `--tags`, `--out` (required, receives`hero.<ext>` and `hero-credit.txt`), `--width`, `--height`, `--model`,-`--replace`, `--json`. A hero already in `--out` is kept and nothing is-generated (JSON `source` is `existing`) unless you pass `--replace`, which the-user must have asked for. Exit 0 means a hero is in place (the JSON `source`+`--replace`, `--allow-paid`, `--json`. `--allow-paid` enables the paid Gemini+rung; pass it only after the consent gate approved this call, and omit it+otherwise (a key is then ignored and only the free rungs run). A valid+image hero already in `--out` is kept and nothing is generated (JSON `source`+is `existing`) unless you pass `--replace`, which the user must have asked for+and which swaps the hero and `hero-credit.txt` together. An invalid existing+`hero.*` is not kept, and a symlinked `hero.*` makes the script stop. Exit 0 means a hero is in place (the JSON `source`field says `existing`, `gemini`, a stock provider, or `openverse`: report anystock or Openverse source as a fallback). Exit 1 means every rung failed.@@ -262,7 +268,8 @@ image capability configuration, and it needs the user's explicit yes first.1. Export `GOOGLE_AI_API_KEY` or `GEMINI_API_KEY` (free to create athttps://aistudio.google.com/apikey; a billing-enabled project may berequired for image models). `generate_hero.py` reads `GOOGLE_AI_API_KEY`- first, then `GEMINI_API_KEY`; `NANOBANANA_MODEL` sets its default model ID.+ first, then `GEMINI_API_KEY`, and uses the key only with `--allow-paid`;+ `NANOBANANA_MODEL` sets its default model ID.2. Install the SDK with the project's explicit setup (`google-genai` isdeclared in the repo `pyproject.toml` dependencies); neverinstall implicitly during a run.diff --git a/skills/blog-image/references/mcp-tools.md b/skills/blog-image/references/mcp-tools.mdindex 2046637..0c3307d 100644--- a/skills/blog-image/references/mcp-tools.md+++ b/skills/blog-image/references/mcp-tools.md@@ -112,7 +112,7 @@ Reset session context and conversation history.| Variable | Required | Description ||----------|----------|-------------|-| `GOOGLE_AI_API_KEY` | Yes | API key from https://aistudio.google.com/apikey (also the only key variable `generate_hero.py` reads) |+| `GOOGLE_AI_API_KEY` | Yes | API key from https://aistudio.google.com/apikey (for the MCP server; `generate_hero.py` reads `GOOGLE_AI_API_KEY` or `GEMINI_API_KEY`, and only with `--allow-paid`) || `NANOBANANA_MODEL` | No | Pinned package accepts only `gemini-3.1-flash-image-preview` or `gemini-3-pro-image-preview`; both are shut down |## Output Directorydiff --git a/skills/blog-locale-audit/SKILL.md b/skills/blog-locale-audit/SKILL.mdindex a9d0609..fe94c1b 100644--- a/skills/blog-locale-audit/SKILL.md+++ b/skills/blog-locale-audit/SKILL.md@@ -14,7 +14,7 @@ license: MITcompatibility: Standalone within claude-blog. Optional richer hreflang validation via claude-seo seo-hreflang.metadata:author: AgriciDaniel- version: "2.3.1"+ version: "2.3.2"category: blog---diff --git a/skills/blog-localize/SKILL.md b/skills/blog-localize/SKILL.mdindex e743046..9a6954e 100644--- a/skills/blog-localize/SKILL.md+++ b/skills/blog-localize/SKILL.md@@ -15,7 +15,7 @@ license: MITcompatibility: Standalone within claude-blog. Invoked by blog-multilingual.metadata:author: AgriciDaniel- version: "2.3.1"+ version: "2.3.2"category: blog---@@ -222,7 +222,10 @@ This skill does not give legal advice.`blog_preflight.py --draft <locale-delivery-dir> --strict --slug <localized-slug>`.- Require 90+/100, zero P0, matching nonce, final `BLOCKING: false`, and allother gates. After ANY later change to the file, hero, HTML, or PDF,- re-render, re-init the nonce, and re-review (max 3 iterations). On failure,+ re-render, re-init the nonce, and re-review (at most 3 failed gate runs;+ run `blog_preflight.py --draft <locale-delivery-dir> --reset-iterations`+ first only when a new localization starts in a used directory or a+ delivered locale gets a new edit pass, never after a failed run). On failure,retain the file as `draft-blocked` and report the diagnostic instead ofcalling localization complete.diff --git a/skills/blog-multilingual/SKILL.md b/skills/blog-multilingual/SKILL.mdindex d96f999..f503e60 100644--- a/skills/blog-multilingual/SKILL.md+++ b/skills/blog-multilingual/SKILL.md@@ -15,7 +15,7 @@ license: MITcompatibility: Requires claude-blog (blog-write). Optional integration with claude-seo (seo-hreflang) for richer hreflang validation.metadata:author: AgriciDaniel- version: "2.3.1"+ version: "2.3.2"category: blog---@@ -334,7 +334,10 @@ independently. Multilingual-specific rules:`<locale-delivery-dir>/review.md`.- Gates: `blog_preflight.py --draft <locale-delivery-dir> --strict --slug <localized-slug>`.- Loop: after ANY change to the locale file, hero, HTML, or PDF, re-render,- re-init the nonce, and re-review. Maximum 3 iterations per locale.+ re-init the nonce, and re-review. At most 3 failed gate runs per locale. Run+ `blog_preflight.py --draft <locale-delivery-dir> --reset-iterations` first only+ when a new locale write starts in a used directory or a delivered locale gets+ a new edit pass; never reset a locale whose last run failed.Mark the locale passed only at 90+/100, zero P0, matching nonce, final`BLOCKING: false`, and all other gates. A failed locale remainsdiff --git a/skills/blog-notebooklm/SKILL.md b/skills/blog-notebooklm/SKILL.mdindex 0d3f54c..514caaf 100644--- a/skills/blog-notebooklm/SKILL.md+++ b/skills/blog-notebooklm/SKILL.md@@ -13,7 +13,7 @@ argument-hint: "[ask|discover|library|setup|status|cleanup] [question-or-url]"license: MITmetadata:author: AgriciDaniel- version: "2.3.1"+ version: "2.3.2"source: "https://github.com/PleasePrompto/notebooklm-skill"---diff --git a/skills/blog-rewrite/SKILL.md b/skills/blog-rewrite/SKILL.mdindex 5765abc..1e75fb9 100644--- a/skills/blog-rewrite/SKILL.md+++ b/skills/blog-rewrite/SKILL.md@@ -137,6 +137,22 @@ See `${CLAUDE_SKILL_DIR}/../blog/references/visual-media.md` for chart type sele### Phase 4: Content Rewrite+Before rewriting, set up the draft folder `D` (rules in Phase 5.5) and run+capability discovery on it; the script needs `D` to exist. Copy the existing+hero into `D` as lowercase `hero.<ext>` and every locally referenced image+(for example `images/`) with its relative path BEFORE Gate 1, so Gate 1 sees+the hero you plan to keep. If `D` was used before and this is a new rewrite or+a new edit pass on a delivered post (its last full run passed), clear its+repair counter first so this rewrite gets its own 3 failed runs; never reset+inside a failing repair loop (`BLOG_SCRIPT_DIR` resolved as in Phase 5.5):++```bash+mkdir -p "$D"+cp '<existing hero>' "$D/hero.<ext>" # plus local images, keeping relative paths+python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --draft "$D" --reset-iterations # reused D only+python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --draft "$D" --gate 1+```+Apply changes in this order:#### 4a. Preserve What Works@@ -302,7 +318,7 @@ After rewriting, verify all quality gates pass:Before presenting the rewritten draft, run the delivery contract. Theauthoritative sequence is the "Canonical delivery sequence" in`${CLAUDE_SKILL_DIR}/../blog/references/blog-delivery-contract.md` (capability-discovery with `blog_preflight.py --gate 1` first). The user is never the first+discovery with `blog_preflight.py --gate 1` already ran before Phase 4). The user is never the firstreviewer. Resolve the scripts root once, reject it unless absolute, and neveruse the current project's `scripts/`:@@ -314,18 +330,20 @@ case "$BLOG_SCRIPT_DIR" in /*) ;; *) echo "ERROR: script dir must be absolute" >Rewrite-specific rules on top of the contract:- **Draft folder.** Work in `D` holding the rewritten post as `D/S.md` (a copy,- so the original stays untouched until the gates pass). Copy the existing hero- and every locally referenced image (for example `images/`) into `D`, keeping- the relative paths, so each image reference resolves inside `D`. Make sure the+ so the original stays untouched until the gates pass). The existing hero and+ every locally referenced image were copied into `D` in Phase 4, before Gate+ 1, keeping the relative paths, so each image reference resolves inside `D`. Make sure thefrontmatter has `canonical` (from the post, or the project's site URL in`BRAND.md`, otherwise ask the user once). The markdown file stem is theartifact stem unless `slug` is set.-- **Hero.** Keep an existing hero that is still on disk. If the topic changed- substantially or the hero is missing, run the command below (`--replace`- generates a new hero even though the copied one is in `D`; without it the- script keeps the existing file). A paid image call- needs the `blog-image` cost and consent gate first; without that consent the- `env -u` prefix keeps `generate_hero.py` on its free rungs. If the hero's+- **Hero.** Keep an existing hero that is still on disk: the default command+ below keeps a valid hero in `D` (a real image of at least 1200x630, the size Gate 2 enforces, named lowercase `hero.<ext>`) and+ replaces a missing, too-small or broken one. Add+ `--replace` only when the topic changed substantially; it generates a new+ hero and swaps `hero-credit.txt` with it. Run it without `--allow-paid` by+ default, so a Gemini key is ignored and the script stays on its free rungs;+ add `--allow-paid` only after the `blog-image` cost and consent gate approved+ the paid call. If the hero's`hero-credit.txt` names a license that needs visible credit (CC BY, BY-SA, ora stock license that asks for it), add that credit line to the Sources sectionor hero caption in `S.md`.@@ -336,21 +354,24 @@ Rewrite-specific rules on top of the contract:Threshold: 90/100 or higher and zero P0 (see `quality-scoring.md`).```bash-env -u GOOGLE_AI_API_KEY -u GEMINI_API_KEY \- python3 "$BLOG_SCRIPT_DIR/generate_hero.py" --topic '<new title>' --tags '<tags>' --out "$D" --replace+# hero: keeps a valid existing hero; add --replace only for a substantial topic change,+# and --allow-paid only after the blog-image consent gate+python3 "$BLOG_SCRIPT_DIR/generate_hero.py" --topic '<new title>' --tags '<tags>' --out "$D"# renderpython3 "$BLOG_SCRIPT_DIR/blog_render.py" --md "$D/S.md" --out-dir "$D"# nonceNONCE=$(python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --init-review-nonce --draft "$D")# review: dispatch blog-reviewer with the draft path, reference roots, $NONCE and both scores;# it returns text and you save it verbatim to "$D/review.md"-# gates (add --repair-attempt inside the repair loop); exit 0 = ship, exit 1 = block+# gates (each failed full run counts toward the cap of 3); exit 0 = ship, exit 1 = blockpython3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --draft "$D" --strict```-Loop: maximum 3 iterations. After ANY change to `S.md`, `S.html`, `S.pdf` or-the hero, re-render, re-init the nonce and re-review. After the 3rd failure,-STOP and present the diagnostic from `D/preflight-report.json`.+Loop: at most 3 failed full gate runs per draft (after the third failure the+next full run exits 2). After+ANY change to `S.md`, `S.html`, `S.pdf` or the hero, re-render, re-init the+nonce and re-review. After the 3rd failure, STOP and present the diagnostic+from `D/preflight-report.json`, not the draft.Rewrites keep the additional compatibility rule documented for this command:the new score must be no lower than the original score. Pass both scores to thediff --git a/skills/blog-strategy/SKILL.md b/skills/blog-strategy/SKILL.mdindex 7fad7d2..41a4e23 100644--- a/skills/blog-strategy/SKILL.md+++ b/skills/blog-strategy/SKILL.md@@ -227,7 +227,7 @@ Set quality standards that all blog content must meet:### Content Quality Standards| Metric | Target | Measured By ||--------|--------|-------------|-| Blog quality score | 90+ to deliver a new post (`blog-write` gate); 80+ floor for existing posts | `/blog analyze` |+| Blog quality score | 90+ to deliver a new post (`blog-write` gate); 80+ as a planning goal for existing posts | `/blog analyze` || Editorial trust | Named author and sufficient claim-level support | Manual review || AI citation readiness | Evidence-backed claims + purpose fit + entity clarity | `/blog analyze` || Visual support | Charts and images where they add information gain | Asset count and editorial review |@@ -237,8 +237,10 @@ Set quality standards that all blog content must meet:```Every post should be scored before publishing. New posts from `blog-write`-must reach 90 to be delivered; for a site audit of existing posts, 80 is the-floor and posts below it should be revised (thresholds table in+must reach 90 to be delivered. For existing posts, 80 or higher is a planning+goal for the back catalog, not a delivery rule or audit floor: use it to rank+which posts to revise first. The audit buckets stay as defined (70-89 is Good;+thresholds table in`${CLAUDE_SKILL_DIR}/../blog/references/quality-scoring.md`).### Step 5.7: Multi-Surface Readiness Strategy@@ -300,7 +302,7 @@ Reference: `${CLAUDE_SKILL_DIR}/../blog/references/distribution-playbook.md` for- Brand mention volume (branded search + web mentions)#### Content Quality-- Blog quality score via `/blog analyze` (new posts 90+, existing posts 80+ floor)+- Blog quality score via `/blog analyze` (new posts 90+, existing posts 80+ as a planning goal)- Content freshness (% of posts updated within 30 days)- Visual element coverage where assets add information gain- Citation tier quality (% tier 1-3 sources)@@ -364,7 +366,7 @@ Output format:- [ ] Launch off-site presence on review platforms### Month 3: Optimization-- [ ] Audit all posts with `/blog analyze` (80+ floor for existing posts)+- [ ] Audit all posts with `/blog analyze` (80+ as the planning goal for existing posts)- [ ] Optimize lowest-scoring posts- [ ] Publish [Pillar 3] guide- [ ] Review AI citation metrics across all platformsdiff --git a/skills/blog-translate/SKILL.md b/skills/blog-translate/SKILL.mdindex 717c591..db6c433 100644--- a/skills/blog-translate/SKILL.md+++ b/skills/blog-translate/SKILL.md@@ -18,7 +18,7 @@ license: MITcompatibility: Standalone within claude-blog. Invoked by blog-multilingual.metadata:author: AgriciDaniel- version: "2.3.1"+ version: "2.3.2"category: blog---@@ -224,7 +224,10 @@ Translation-specific rules:`<locale-delivery-dir>/review.md`.- Gates: `blog_preflight.py --draft <locale-delivery-dir> --strict --slug <localized-slug>`.- Loop: after ANY change to the file, hero, HTML, or PDF, re-render, re-init the- nonce, and re-review (maximum 3 iterations).+ nonce, and re-review (at most 3 failed gate runs per locale draft; run+ `blog_preflight.py --draft <locale-delivery-dir> --reset-iterations` before+ the first gate run only when a new translation starts in a used directory or a+ delivered locale gets a new edit pass, never after a failed run).Require 90+/100, zero P0, the matching nonce, final `BLOCKING: false`, and allother gates. A failed locale remains `draft-blocked`; report its diagnostic anddiff --git a/skills/blog-write/SKILL.md b/skills/blog-write/SKILL.mdindex 81aaea7..4359c12 100644--- a/skills/blog-write/SKILL.md+++ b/skills/blog-write/SKILL.md@@ -200,6 +200,18 @@ See `${CLAUDE_SKILL_DIR}/../blog/references/visual-media.md` for chart type sele### Phase 5: Content Writing+Before writing, create the draft folder `D` and run capability discovery+(Gate 1) on it; the script needs `D` to exist. Resolve `BLOG_SCRIPT_DIR` as in+Phase 6.5 first. If `D` was used before and this is a new write, a new rewrite, or a new edit pass on a delivered post (its last full run passed),+clear its repair counter so this draft gets its own 3 failed runs (never reset+inside a failing repair loop):++```bash+mkdir -p "$D"+python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --draft "$D" --reset-iterations # reused D only+python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --draft "$D" --gate 1+```+Write the full article to `D/S.md` (spawn `blog-writer` with the research packet andoutline, or write inline) following these rules. The agent has Write and Editaccess, so tell it the exact draft folder: it may create or edit files only@@ -380,7 +392,7 @@ Before delivering, verify:3. All statistics have named tier 1-3 sources4. Every chart present clarifies chart-worthy evidence and uses an appropriate type5. Every inline image present materially helps the reader and has descriptive alt text-6. A valid local hero (`hero.<ext>`) sits in the draft folder, with `og_image_alt` set in frontmatter+6. A valid local hero (a real image of at least 1200x630, the size Gate 2 enforces, named lowercase `hero.<ext>`) sits in the draft folder, with `og_image_alt` set in frontmatter7. FAQ section present with 3-5 items when warranted by user questions8. Heading hierarchy is clean (H1 -> H2 -> H3)9. Meta description accurately and specifically summarizes the visible content@@ -419,9 +431,9 @@ BLOG_SCRIPT_DIR="${CLAUDE_BLOG_SCRIPTS_DIR:-${CLAUDE_SKILL_DIR}/../../scripts}"case "$BLOG_SCRIPT_DIR" in /*) ;; *) echo "ERROR: script dir must be absolute" >&2; exit 1 ;; esac```-With draft folder `D` and slug `S` (the draft from Phase 5 is `D/S.md`), run-capability discovery once (`blog_preflight.py --draft "$D" --gate 1`), then the-contract's steps in order. This skill's own rules:+With draft folder `D` and slug `S` (the draft from Phase 5 is `D/S.md`; Gate 1+already ran before Phase 5), run the contract's steps in order. This skill's+own rules:- **Visuals** (you, not the agent): resolve every `[CHART]` through `blog-chart`as inline SVG, every `[INTERNAL-LINK]` with a real link or remove it, every@@ -429,32 +441,32 @@ contract's steps in order. This skill's own rules:that needs visible credit (CC BY, BY-SA, or a stock license that asks for it),add that credit line to the Sources section or hero caption, because therenderer does not publish it. No marker may remain.-- **Hero (one step, owned here)**: keep a valid local `hero.<ext>`, otherwise- generate it once with the command below. A paid image call needs the- `blog-image` cost and consent gate first; without that consent run the hero- step with the Gemini key variables unset (`env -u GOOGLE_AI_API_KEY -u- GEMINI_API_KEY ...`) so `generate_hero.py` falls to the free rungs. Phase 2- only chooses the route; it does not produce a second hero.+- **Hero (one step, owned here)**: keep a valid local hero (a real image of at least 1200x630, the size Gate 2 enforces, named lowercase `hero.<ext>`;+ `generate_hero.py` keeps the first valid one, removes invalid siblings and+ replaces a too-small or broken one), otherwise generate it once with the command below. By default run it without+ `--allow-paid`, so a Gemini key is ignored and `generate_hero.py` uses the+ free rungs. Add `--allow-paid` only after the `blog-image` cost and consent+ gate approved the paid call. Phase 2 only chooses the route; it does not+ produce a second hero.```bash-# hero without paid-image consent; drop the env -u prefix only after the consent gate-env -u GOOGLE_AI_API_KEY -u GEMINI_API_KEY \- python3 "$BLOG_SCRIPT_DIR/generate_hero.py" --topic '<title>' --tags '<tags>' --out "$D"+# hero on the free rungs; add --allow-paid only after the consent gate+python3 "$BLOG_SCRIPT_DIR/generate_hero.py" --topic '<title>' --tags '<tags>' --out "$D"# renderpython3 "$BLOG_SCRIPT_DIR/blog_render.py" --md "$D/S.md" --out-dir "$D"# nonceNONCE=$(python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --init-review-nonce --draft "$D")# review: dispatch blog-reviewer with the draft path, reference roots and $NONCE;# it returns text and you save it verbatim to "$D/review.md"-# gates (add --repair-attempt inside the repair loop)+# gates (each failed full run counts toward the cap of 3)python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --draft "$D" --strict```- **Loop**: on a block, capture `D/preflight-report.json`, fix, and repeat fromthe visuals or render step. Any edit to `S.md`, `S.html`, `S.pdf` or the heroafter the nonce needs a re-render, a new nonce and a new review (re-init and- re-review). Maximum 3 iterations; on the third failure stop and present the- diagnostic instead of the draft.+ re-review). At most 3 failed full gate runs per draft (after the third failure+ the next full run exits 2); on the third failure stop and present the diagnostic instead of the draft.The user is never the first reviewer; the gates are.diff --git a/skills/blog-write/references/delivery.md b/skills/blog-write/references/delivery.mdindex 9bacdb3..7210084 100644--- a/skills/blog-write/references/delivery.md+++ b/skills/blog-write/references/delivery.md@@ -17,12 +17,17 @@ are not expanded by the host, so the owning skill passes the resolved path.)## Gate Steps-Draft folder `D`, slug `S`. Run capability discovery once first:-`python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --draft "$D" --gate 1`.+Draft folder `D`, slug `S`. Create `D` first (`mkdir -p "$D"`), then run+capability discovery once before writing:+`python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --draft "$D" --gate 1`. If `D` was+used before and this is a new write, a new rewrite, or a new edit pass on a delivered post (its last full run passed), run+`python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --draft "$D" --reset-iterations`+before Gate 1 so the new draft gets its own 3 failed runs. Never reset inside a+failing repair loop.1. Draft: `D/S.md` exists. Draft markers `[INTERNAL-LINK: ...]`, `[IMAGE: ...]`, `[CHART: ...]` are allowed here only.2. Visuals, done by the orchestrator (the `blog-writer` agent cannot call skills):- - Hero: keep a valid local `hero.<ext>`; otherwise run `python3 "$BLOG_SCRIPT_DIR/generate_hero.py" --topic '<title>' --tags '<tags>' --out "$D"` or use `blog-image`. A paid image call needs the `blog-image` cost and consent gate first; without that consent, prefix the command with `env -u GOOGLE_AI_API_KEY -u GEMINI_API_KEY` so the script uses its free rungs. `blog-write` produces one hero, in this step. Record provider, model ID, prompt, license and attribution.+ - Hero: keep a valid local hero (a real image of at least 1200x630, the size Gate 2 enforces, named lowercase `hero.<ext>`); otherwise run `python3 "$BLOG_SCRIPT_DIR/generate_hero.py" --topic '<title>' --tags '<tags>' --out "$D"` or use `blog-image`. Run it without `--allow-paid` by default: a Gemini key is then ignored and the script uses its free rungs. Add `--allow-paid` only after the `blog-image` cost and consent gate approved the paid call. `blog-write` produces one hero, in this step. Record provider, model ID, prompt, license and attribution.- Quote model or user text as in the shell argument rule of `skills/blog/SKILL.md` (single quotes, embedded `'` as `'\''`).- Charts: run `blog-chart` for each `[CHART]` marker and embed the SVG in a `<figure>`.- Internal links: replace each `[INTERNAL-LINK]` with a real link to a page that exists, or remove the marker and keep the plain text.@@ -36,7 +41,7 @@ Draft folder `D`, slug `S`. Run capability discovery once first:- It returns the report as text. Save that text verbatim to `D/review.md` (no edits).- Required: score 90/100 or higher (see the threshold table in `quality-scoring.md`; unpublished drafts follow its draft-stage rule), zero P0 issues, a matching `Nonce:` line, and a last line `BLOCKING: true|false (reason)`.6. Gates: `python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --draft "$D" --strict`. Strict delivery requires renderer support for the visual checks; if the renderer is unavailable, mark the output non-shippable instead of treating it as passed.-7. Loop: use `D/preflight-report.json` as the diagnostic input and add `--repair-attempt` on gate runs inside the loop. After ANY change to `S.md`, `S.html`, `S.pdf` or the hero, re-render, re-init the nonce and re-review; the gate fails if they were not. Stop after 3 failed iterations and present the diagnostic.+7. Loop: use `D/preflight-report.json` as the diagnostic input; each failed full gate run counts toward the cap of 3 (passing runs, `--gate N` without `--repair-attempt` and `--manual-check` runs do not). After ANY change to `S.md`, `S.html`, `S.pdf` or the hero, re-render, re-init the nonce and re-review; the gate fails if they were not. After the third failed full run the next one exits 2: after the third failure stop and present the diagnostic, not the draft.## URL And Asset Safetydiff --git a/skills/blog/SKILL.md b/skills/blog/SKILL.mdindex 1204650..49483b2 100644--- a/skills/blog/SKILL.md+++ b/skills/blog/SKILL.md@@ -14,7 +14,7 @@ license: MITcompatibility: Requires Claude Code and Python 3.11+ for quality scoringmetadata:author: AgriciDaniel- version: "2.3.1"+ version: "2.3.2"user-invocable: trueargument-hint: "[write|rewrite|analyze|brief|calendar|cannibalization|strategy|outline|seo-check|schema|repurpose|geo|image|audit|factcheck|persona|brand|discourse|taxonomy|notebooklm|audio|google|update|cluster|multilingual|translate|localize|locale-audit|flow|style|decay] [topic-or-file]"---@@ -52,7 +52,7 @@ citation outcomes.| `/blog rewrite <file>` | Rewrite/optimize an existing blog post || `/blog analyze <file-or-url>` | Score one post (or a folder of posts) 0-100 with prioritized fixes || `/blog brief <topic>` | Generate a detailed content brief |-| `/blog calendar [monthly\|quarterly]` | Generate an editorial calendar |+| `/blog calendar [monthly\|quarterly] [niche]` | Generate an editorial calendar || `/blog strategy <niche>` | Blog strategy and topic ideation || `/blog outline <topic>` | Generate SERP-informed content outline || `/blog seo-check <file>` | Post-writing SEO validation checklist |@@ -67,7 +67,7 @@ citation outcomes.| `/blog brand [init\|show\|update]` | Generate BRAND.md + VOICE.md context files auto-loaded by all sub-skills || `/blog discourse <topic>` | Research what people are actually saying about a topic in last 30 days; produces DISCOURSE.md (v1.8.0, API-free) || `/blog taxonomy [suggest\|sync\|audit]` | Tag/category management across CMS platforms |-| `/blog notebooklm <question>` | Query NotebookLM for source-grounded research |+| `/blog notebooklm [ask\|discover\|library\|setup\|status\|cleanup]` | Query NotebookLM for source-grounded research || `/blog audio [generate\|voices\|setup]` | Generate audio narration of blog posts || `/blog google [command] [args]` | Google API data: PSI, CrUX, GSC, GA4, NLP, YouTube, Keywords || `/blog update <file>` | Update existing post with fresh stats (routes to rewrite) |@@ -258,7 +258,7 @@ reference roots when needed. Agent `tools` is the actual allowlist; agentsnever run Bash helpers and cannot call skills. The orchestrator runs helpers,resolves skills such as `blog-chart`, and passes their output to agents.-Preparation for `/blog write` (no files in the draft folder yet):+Preparation for `/blog write` (nothing written to the draft folder yet):- **Parse**: identify topic, detect platform, select template.- **Research**: spawn `blog-researcher` for statistics, sources, SERP data.@@ -269,30 +269,38 @@ Then run the **canonical delivery sequence** inthe single source of truth (capability discovery with `blog_preflight.py--gate 1`, draft, visuals with the optional hygiene helper, render, nonce,review, gates, loop) and wins on any disagreement. Draft folder `D`, slug `S`.-The orchestrator's part of it, in order:+Create `D` first, then run Gate 1 before writing. The orchestrator's part of+it, in order:```bashBLOG_SCRIPT_DIR="${CLAUDE_BLOG_SCRIPTS_DIR:-${CLAUDE_SKILL_DIR}/../../scripts}"case "$BLOG_SCRIPT_DIR" in /*) ;; *) echo "ERROR: script dir must be absolute" >&2; exit 1 ;; esac+# draft folder first; Gate 1 needs it to exist and runs before writing+mkdir -p "$D"+# reused folder, new write/rewrite or new edit pass on a delivered post only;+# never inside a failing repair loop (clears the counter, runs no gates)+python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --draft "$D" --reset-iterations+python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --draft "$D" --gate 1# visuals: hero (resolve every marker, then optional blog-seo and blog_hygiene.py);-# drop the env -u prefix only after the blog-image cost and consent gate-env -u GOOGLE_AI_API_KEY -u GEMINI_API_KEY \- python3 "$BLOG_SCRIPT_DIR/generate_hero.py" --topic '<title>' --tags '<tags>' --out "$D"+# free rungs only; add --allow-paid only after the blog-image cost and consent gate+python3 "$BLOG_SCRIPT_DIR/generate_hero.py" --topic '<title>' --tags '<tags>' --out "$D"# renderpython3 "$BLOG_SCRIPT_DIR/blog_render.py" --md "$D/S.md" --out-dir "$D"# nonceNONCE=$(python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --init-review-nonce --draft "$D")# review: spawn blog-reviewer with the draft path, reference roots and $NONCE;# it returns text and you save it verbatim to "$D/review.md"-# gates (add --repair-attempt inside the repair loop)+# gates (each full run counts toward the cap of 3)python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --draft "$D" --strict```Never run a helper through a path relative to the current project. Spawn`blog-writer` for the draft. After any change to `S.md`, `S.html`, `S.pdf` or the-hero, re-render, re-init the nonce and re-review; maximum 3 iterations. A paid-image call needs the `blog-image` cost and consent gate first; otherwise run-the hero step with the Gemini key variables unset (see `blog-write`).+hero, re-render, re-init the nonce and re-review; at most 3 failed full gate+runs per draft (passing runs, `--gate N` without `--repair-attempt` and+`--manual-check` runs never count), then stop and present the diagnostic, not the draft. A paid+image call needs the `blog-image` cost and consent gate first, and only then+`--allow-paid` on `generate_hero.py`; without the flag a Gemini key is ignored.Deliver the content, scorecard, `preview/*.png` and improvement notes ONLY when all gates pass. The gates review first, not the user. The nonce stops accidents and casual forgery; it does not stop a process running as the same user that can read the verifier state file.diff --git a/skills/blog/references/blog-delivery-contract.md b/skills/blog/references/blog-delivery-contract.mdindex cebacff..9ec0d85 100644--- a/skills/blog/references/blog-delivery-contract.md+++ b/skills/blog/references/blog-delivery-contract.md@@ -1,6 +1,6 @@# Blog Delivery Contract-The contract every blog must pass before being presented to the user. Five gates that fire automatically between content generation and delivery, plus an iteration loop that retries failures up to three times before escalating.+The contract every blog must pass before being presented to the user. Five gates that fire automatically between content generation and delivery, plus a repair loop that allows at most three failed full gate runs per draft before escalating.Resolve every executable core helper through the trusted absolute installedscripts root described in `orchestration-details.md`:@@ -19,7 +19,7 @@ This contract is the v1.9.0 answer to a failure pattern from the v1.8.x cycle: s| Gate | What it enforces | Failure mode | Implementation ||---|---|---|---|-| 1. Capability Discovery | Required tools + agents are available before write begins | Block if no valid local hero and no permitted image path; block if reviewer agent missing | `scripts/blog_preflight.py --gate 1` |+| 1. Capability Discovery | Required tools + agents are available before write begins (run after creating the draft folder, before writing) | Pass if a free hero path exists (valid local hero, stock key, or reachable Openverse); pass with a warning if only paid paths exist (Banana MCP tool, Gemini key; both need cost consent); block only if there is no hero path, or if the reviewer agent is missing | `scripts/blog_preflight.py --gate 1` || 2. Format Completeness | `.md` + `.html` + `.pdf` + `hero.(png\|jpg\|jpeg\|webp)` present and valid; no draft placeholders; HTML source hash matches the `.md` | Block on any missing or invalid artifact | `scripts/blog_render.py` renders `.html` and `.pdf`; `scripts/generate_hero.py` emits `hero.<ext>` || 3. Visual Verification | Rendered HTML has no SVG overflow, no console errors, valid JSON-LD | Block on any defect; preserve screenshots | `scripts/blog_preflight.py --gate 3` via `patchright` || 4. Content Review | `blog-reviewer` scores ≥ 90/100 AND zero P0 issues, with a matching nonce and no edits to the draft after the nonce was issued | Block + iterate | `agents/blog-reviewer.md` (now blocking) |@@ -35,9 +35,15 @@ orchestrator and `blog-write/references/delivery.md` carry short versions thatlink here. If any of them disagrees with this section, this section wins.Draft folder `D`, slug `S`. Helpers always run from the trusted absolute scripts-root set at the top of this file, never from a path relative to the current project. Run-capability discovery once before step 1:+root set at the top of this file, never from a path relative to the current project.+Create the draft folder `D` first (`mkdir -p "$D"`; the script needs it to+exist), then run capability discovery once before step 1:`python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --draft "$D" --gate 1`.+If `D` was used before and this is a new write, a new rewrite, or a new edit+pass on a delivered post (its last full run passed), clear its repair counter+first: `python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --draft "$D" --reset-iterations`.+Never reset in the middle of a failing repair loop.+That command only clears the counter; it runs no gates.1. **Draft.** Write `D/S.md` (frontmatter, answer-first). Draft-only markers`[INTERNAL-LINK: ...]`, `[IMAGE: ...]` and `[CHART: ...]` are allowed here and@@ -47,10 +53,16 @@ capability discovery once before step 1:`python3 "$BLOG_SCRIPT_DIR/generate_hero.py" --topic '<title>' --tags '<tags>' --out "$D"`writes `D/hero.<ext>`, or keeps a hero already in `D` (`--replace` generatesa new one instead). Quote model-written text as in the Shell argument rule- in `skills/blog/SKILL.md`. With `GOOGLE_AI_API_KEY` or `GEMINI_API_KEY` set the- script tries the paid Gemini rung first, so get consent through the- `blog-image` cost gate first, or run it with both variables unset- (`env -u GOOGLE_AI_API_KEY -u GEMINI_API_KEY`). Charts: the `blog-chart` skill, embedded as inline SVG.+ in `skills/blog/SKILL.md`. By default run it without `--allow-paid`: a+ Gemini key is then ignored and the script uses the free rungs (a valid hero+ already in `D`, then stock keys, then Openverse). A hero is valid only if it+ is a real image of at least 1200×630, the size Gate 2 enforces, named lowercase `hero.<ext>`. Add `--allow-paid` only+ after the `blog-image` cost and consent gate approved the paid Gemini call;+ that route also needs `GOOGLE_AI_API_KEY` or `GEMINI_API_KEY`. The script+ keeps the first valid `hero.*`, removes invalid siblings, and replaces a+ too-small or broken one; a symlinked `hero.*` stops the script, and+ `--replace` swaps the hero and `hero-credit.txt` together.+ Charts: the `blog-chart` skill, embedded as inline SVG.Internal links: replaced with real links, or the marker removed. Images:replaced with local files in `D`, or removed. No marker may remain after thisstep. An optional `blog-seo` pass runs here, on the resolved `S.md`, and its@@ -70,12 +82,12 @@ capability discovery once before step 1:`Nonce: <hex>`, five category scores, the overall score, the P0 list and`BLOCKING: true|false (reason)`.6. **Gates.** `python3 "$BLOG_SCRIPT_DIR/blog_preflight.py" --draft "$D" --strict`- (add `--repair-attempt` on every run inside the repair loop).+ (each failed full run counts toward the cap of 3; passing runs do not).7. **Loop.** If a gate blocks, fix the cause, then repeat from step 2 or 3 asneeded, and ALWAYS re-render, re-init the nonce and re-review after ANY change- to `S.md`, `S.html`, `S.pdf` or the hero. Maximum 3 iterations, then stop and- present the diagnostic. On a pass, deliver with the scorecard and- `preview/*.png`.+ to `S.md`, `S.html`, `S.pdf` or the hero. At most 3 failed full gate runs+ per draft; after the third failure the next full run exits 2. Then stop and+ present the diagnostic, not the draft. On a pass, deliver with the scorecard and `preview/*.png`.Why the order matters: the reviewer judges the rendered artifacts, so it runsafter render (steps 3 to 5), and the nonce is issued after the files are final@@ -118,20 +130,23 @@ the gates compare that with the local hero file.## Gate 1: Capability Discovery-Runs once at the start of `/blog write` or `/blog rewrite`. Enumerates the project's available capabilities and writes `<draft-folder>/capabilities.json`. Every later gate consumes this artifact rather than re-detecting.+Runs once at the start of `/blog write` or `/blog rewrite`, after the draft folder exists and before any writing. Enumerates the project's available capabilities and writes `<draft-folder>/capabilities.json`. Every later gate consumes this artifact rather than re-detecting.### What gets enumerated- **MCP servers loaded**: `nanobanana-mcp`, `dataforseo-mcp`, others. Detected via tool availability, not by reading `.mcp.json` (the file may declare servers that failed to start).- **Env vars present**: `GOOGLE_AI_API_KEY` or `GEMINI_API_KEY`, `UNSPLASH_ACCESS_KEY`, `PEXELS_API_KEY`, `PIXABAY_API_KEY`. Key names only; values never read or logged.- **Optional Python deps**: `patchright`, `weasyprint`, `google-genai`, `requests`. Probed via `importlib.util.find_spec()`.-- **Project-root context files**: `BRAND.md`, `VOICE.md`, `DISCOURSE.md`. Loaded only via the trusted installed `load_untrusted_root.py` helper.+- **Project-root context files**: `BRAND.md`, `VOICE.md`, `DISCOURSE.md`, looked up in the user's project root. Loaded only via the trusted installed `load_untrusted_root.py` helper.- **Agents available**: `blog-reviewer` is mandatory; `blog-researcher`, `blog-writer`, `blog-seo`, `blog-translator` are optional.-- **Helper scripts present**: `scripts/lint_prose.py`, `scripts/analyze_blog.py`, the new `scripts/blog_preflight.py` itself.+- **Helper scripts present**: `scripts/lint_prose.py`, `scripts/load_untrusted_root.py`, `scripts/analyze_blog.py` (presence only; Gate 1 does not run them).### Failure modes-- **No hero path at all** (no valid local `hero.png`, `.jpg`, `.jpeg` or `.webp`, no Banana MCP, no Gemini key, no stock API key, and Openverse unreachable): BLOCK with explicit setup instructions.+- **Hero paths**: Gate 1 reports every path it finds in `capabilities.json` under `hero_paths`. Free paths: a valid local hero (a real image of at least 1200×630, the size Gate 2 enforces, named lowercase `hero.<ext>`; `png`, `jpg`, `jpeg` or `webp`), a stock API key, or a reachable Openverse (probed whenever no other free path exists). Paid paths: the Banana MCP tool and a Gemini key; both need consent through the `blog-image` cost gate (and `--allow-paid` for `generate_hero.py`).+- **Free path available**: PASS.+- **Only paid paths available**: PASS with a warning; the hero step needs the user's cost consent.+- **No hero path at all** (neither free nor paid): BLOCK with explicit setup instructions.- **Reviewer agent missing**: BLOCK. Cannot enforce Gate 4 without it.- **Capability declared but unused**: WARN (informational, not blocking). Example: `dataforseo-mcp` is loaded but the post topic doesn't need keyword research.@@ -194,7 +209,7 @@ Strict delivery requires `patchright` or an equivalent renderer. If no rendererThe `blog-reviewer` agent (`agents/blog-reviewer.md`) runs against the rendered `.html` (not the raw `.md`), after the nonce is issued (steps 4 and 5 of the canonical sequence). Reviewer output is **blocking**, not advisory.-Scoring rules live in `quality-scoring.md`: the threshold table, the draft-stage rule for items a draft cannot evidence, and the rule that the overall equals the sum of the five category scores. Gate 4 also fails when `S.md`, `S.html`, `S.pdf` or the hero changed after the nonce was issued; the message reads "draft changed after the review nonce was issued: <file>; re-render, re-init the nonce and re-review". State files written before digests existed keep the old behavior (no digest check, a warning).+Scoring rules live in `quality-scoring.md`: the threshold table, the draft-stage rule for items a draft cannot evidence, and the rule that the overall equals the sum of the five category scores. Gate 4 requires all five category scores in the report and an overall equal to their sum; a missing category or a mismatched overall blocks. Gate 4 also fails when `S.md`, `S.html`, `S.pdf` or the hero changed after the nonce was issued; the message reads "draft changed after the review nonce was issued: <file>; re-render, re-init the nonce and re-review". State files written before digests existed keep the old behavior (no digest check, a warning).### Blocking decision rules@@ -221,7 +236,7 @@ BLOCKING: false (cleared review gate)Machine-readable by `scripts/blog_preflight.py` so the orchestrator does not have to parse the human-readable scorecard.-The reviewer has no Write tool and returns its report as text. The orchestrator saves that text verbatim to `<draft-folder>/review.md` (step 5). Shown to the user on success ("here is why this passed") and on final failure ("here is why this is still blocked after 3 iterations").+The reviewer has no Write tool and returns its report as text. The orchestrator saves that text verbatim to `<draft-folder>/review.md` (step 5). Shown to the user on success ("here is why this passed") and on final failure ("here is why this is still blocked after 3 failed gate runs").Gate 4 may report sentence-length variation, configured phrase-list matches,or vocabulary sampling for editorial review. These diagnostics do not affect@@ -244,20 +259,26 @@ the numeric score and are never machine-enforced as evidence of AI authorship.Tried in order. First success wins. Skip steps for capabilities not available per Gate 1's `capabilities.json`.-1. **Banana MCP** (`nanobanana-mcp` loaded as a tool, not just declared in `.mcp.json`): call its `gemini_generate_image` tool with an optimized six-component prompt (Subject + Action + Context + Composition + Lighting + Style) targeting 1200×630.-2. **Direct Gemini API** (`GOOGLE_AI_API_KEY` present, MCP not loaded): call the `google-genai` SDK with the default image model and fallback order that `generate_hero.py --help` and the `blog-image` skill's Gemini model reference currently document; this contract does not pin a model ID. See `https://ai.google.dev/gemini-api/docs/image-generation`.+1. **Banana MCP** (`nanobanana-mcp` loaded as a tool, not just declared in `.mcp.json`; paid, so only after the `blog-image` cost consent): call its `gemini_generate_image` tool with an optimized six-component prompt (Subject + Action + Context + Composition + Lighting + Style) targeting 1200×630.+2. **Direct Gemini API** (`GOOGLE_AI_API_KEY` or `GEMINI_API_KEY` present, MCP not loaded, and `generate_hero.py` run with `--allow-paid` after the `blog-image` consent gate): call the `google-genai` SDK with the default image model and fallback order that `generate_hero.py --help` and the `blog-image` skill's Gemini model reference currently document; this contract does not pin a model ID. See `https://ai.google.dev/gemini-api/docs/image-generation`.3. **Premium stock APIs** (`UNSPLASH_ACCESS_KEY`, `PEXELS_API_KEY`, or `PIXABAY_API_KEY` present): search via the official API using post title + top tags as query. Do not scrape or construct raw CDN URLs. Capture each source's license metadata and attribution requirements, download the asset locally, and write `hero-credit.txt`. Unsplash, Pexels, and Pixabay use their own licenses; do not treat them as CC sources.4. **Openverse public API** (no key required): `GET https://api.openverse.org/v1/images/?q=<query>&aspect_ratio=wide&license=cc0,by,by-sa` (the licenses `generate_hero.py` sends, with `size=large` and `page_size=10`). Pick the top relevance match with complete attribution. Always download to `hero.<ext>` plus `hero-credit.txt` for CC attribution. CC BY and BY-SA images require visible attribution, and the renderer does not publish it: the orchestrator must add the credit line from `hero-credit.txt` to the article's Sources section or the hero caption in `S.md` (step 2) before the render. The same applies to any stock image whose license asks for credit.-5. **Block with clear error**: "Hero image required but no generation path available. Configure Banana MCP, set GOOGLE_AI_API_KEY, set UNSPLASH/PEXELS/PIXABAY key, or place a 1200×630 hero.png in the draft folder manually."+5. **Block with clear error**: "Hero image required but no generation path available. Configure Banana MCP, set GOOGLE_AI_API_KEY or GEMINI_API_KEY and pass --allow-paid once the user approves the cost, set an UNSPLASH/PEXELS/PIXABAY key, or place a 1200×630 hero.png in the draft folder manually." A symlinked `hero.*` in the draft folder also stops `generate_hero.py` before it writes, deletes or spends anything.Implementation: `scripts/generate_hero.py`. Always writes `hero-credit.txt` next to `hero.<ext>` for attribution compliance, even when generation paths 1-2 (AI-generated, no attribution needed) are used. The file then contains "AI-generated; no attribution required."## Iteration Loop-Step 7 of the canonical sequence drives the retry loop. The orchestrator-(`skills/blog/SKILL.md`) holds the counter, and `--repair-attempt` on-`blog_preflight.py` enforces the cap of 3. Sub-skills never loop themselves;-that would risk infinite loops if two sub-skills disagree.+Step 7 of the canonical sequence drives the retry loop. `blog_preflight.py`+counts FAILED full gate runs per draft and allows max 3; after the third+failure the next full run exits 2. Passing runs, single-gate runs+(`--gate N` without `--repair-attempt`), `--init-review-nonce` and `--manual-check` runs never count. The+counter is stored with the review state outside the draft folder, so deleting+files in `D` does not reset it. `blog_preflight.py --draft "$D" --reset-iterations`+clears it and runs no gates. Reset only when a new write, a new rewrite, or a+new edit pass on a delivered post (its last full run passed) starts in a draft+folder that was used before; never to escape a failing repair loop. Sub-skills never loop+themselves; that would risk infinite loops if two sub-skills disagree.1. **Capture diagnostic**: which gate failed, which specific check, screenshot if visual, scorecard if content.2. **Fix, keyed to the failing gate:**@@ -268,12 +289,12 @@ that would risk infinite loops if two sub-skills disagree.- Gate 4 "draft changed after the review nonce was issued": no content fix is needed; re-render, re-init the nonce and re-review.- Gate 5 404: re-dispatch with instruction to remove or replace the broken URL.3. **Re-render, re-init the nonce and re-review after ANY change** to `S.md`, `S.html`, `S.pdf` or the hero, then run step 6 again. The review is bound to the exact files it saw; an old `review.md` never carries over to edited files.-4. **On pass**: present the draft with a one-line summary ("Delivered after N iteration(s)").-5. **On fail after 3 iterations**: STOP. Show the user the failure diagnostic for each remaining defect, the partial draft, the latest reviewer report, and an explicit "Manual fix required" message. Do not iterate further automatically.+4. **On pass**: present the draft with a one-line summary ("Delivered after N gate run(s)").+5. **On the third failed gate run**: STOP. Show the user the failure diagnostic for each remaining defect and the latest reviewer report, not the draft, and an explicit "Manual fix required" message. Do not iterate further automatically.## Bypass Mechanism-Strict mode is the default. Users can override only via an explicit operator-controlled `--no-strict` flag on `scripts/blog_preflight.py` or signed/trusted project config. Draft frontmatter is untrusted content and must never disable delivery gates. Any bypass logs loudly:+Strict mode is the default. Users can override only via an explicit operator-controlled `--no-strict` flag on `scripts/blog_preflight.py` or signed/trusted project config. Draft frontmatter is untrusted content and must never disable delivery gates. Any bypass logs loudly, printing this text to stderr in every output mode:```WARNING: Delivery contract bypassed. Failed gates: [Gate 3, Gate 5].@@ -305,7 +326,6 @@ https://github.com/AgriciDaniel/claude-blog/issues.- `<blog_reference_root>/schema-stack.md`: JSON-LD structure validated by Gate 3 step 5- `agents/blog-reviewer.md`: the reviewer agent that produces the Gate 4 scorecard- `scripts/load_untrusted_root.py`: the v1.8.3 helper used for project-root file loading in Gate 1-- `scripts/lint_prose.py`: the v1.8.4 prose linter run as part of Gate 4's editorial-heuristics scoring- `tests/test_blog_delivery_contract.py`: coherence test that asserts this contract and its implementation stay in sync## How this contract maps to the v1.8.x lesson@@ -333,6 +353,7 @@ Blog Studio reads the additive `evidence` object in `preflight-report.json`local fingerprints without executing gates. Missing, legacy, partial or staleevidence cannot establish full preflight success. Fingerprints describefreshness, not authenticated approval. The five gates and the reviewer remain-the delivery authority. Manual checks do not reset nonces or consume repair-iterations. Run `blog_preflight.py --project-root <dir>` to anchor a run inside+the delivery authority. Manual checks run the gates with+`blog_preflight.py --manual-check` (Blog Studio's Run checks uses it): they do+not reset nonces and never touch the repair counter. Run `blog_preflight.py --project-root <dir>` to anchor a run insidea project; stdout modes, other flags and exit codes are unchanged.