“Write a post about Hooks”—I type that into my terminal, and 15 minutes later the article is live. Outline review, drafting, build verification, git push, and GitHub Actions deployment are all handled by Claude Code.

This blog has 30+ posts. I don’t create files by hand, I don’t run hexo generate manually, and I don’t push commits myself. Claude Code paired with a tight set of Skills and Hooks collapses the publishing loop to the bare minimum.

This post walks through my workflow across four layers: how I write a single post, how I enforce quality, how I batch-rewrote 20+ articles, and how the setup evolved over time. Every layer includes copy-pasteable configs you can adapt directly.


Stack Overview

Here is the full picture before we dig into each layer:

Layer Tool Role
Blog Framework Hexo 7.3.0 + Butterfly 5.5.4 Compiles Markdown into a static site
Deployment GitHub Actions Builds and publishes automatically on git push
Writing Rules CLAUDE.md Defines tone, tagging conventions, and publish steps
Automation 4 Skills New post, new series, publish, and batch rewrite
Safety Guardrails 4 Hook Groups Dangerous-command blocking, build checks, screenshot verification, completion alerts
Batch Processing Subagent Orchestration planner → executor → scorer automated iteration
Quality Evaluation Scoring Profile + Script 30% quantitative + 70% qualitative; auto-rewrites anything under 70

Daily Workflow: Writing a New Post

Scaffolding a Post: One Skill Handles the Boilerplate

Instead of running hexo new manually, I invoke a custom Skill: /blog-new-post. Its definition lives in .claude/commands/blog-new-post.md and follows four steps:

  1. Draft an outline from the title and wait for my approval before continuing
  2. Run yarn hexo new "<post title>" to create the file
  3. Write the body and Front Matter following the style rules in CLAUDE.md
  4. Verify locally with hexo server and wait for me to say “publish”

The Front Matter template is fixed—every post must include these fields:

1
2
3
4
5
6
7
8
9
10
11
---
title: Post Title
date: 2026-04-07 13:30:00
updated: 2026-04-07 13:30:00
tags:
- tag-1
categories:
- Category Name
description: A concise summary (under 100 chars) shown on homepage cards and SEO metadata
cover: /img/covers/your-cover-image.webp
---

Early on, I used picsum.photos for random cover images. To eliminate flaky external links, keep a consistent visual style, and speed up page loads, I migrated every cover to local /img/covers/*.webp assets (as in this post’s Front Matter). Because this template is pinned in CLAUDE.md, Claude follows it verbatim on every new article.

Drafting the Body: Outline First

I always ask Claude for an outline before letting it write the full post. It’s not about distrust—discovering a structural mismatch after 2,000 words is far more painful to fix than starting over. In practice, it takes two prompts:

1
Write a post about XXX. Give me an outline first so I can review it.

Once the outline looks right:

1
Draft the post from this outline, following the writing guidelines in CLAUDE.md.

Claude automatically pulls the conventions from CLAUDE.md: conversational tone, plain explanations for technical terms, explicit language tags on every code block, and <!-- more --> right after the intro. I never have to repeat those instructions.

Publishing: One Command to Ship

1
/blog-publish

This Skill runs a clean three-step sequence:

  1. Show the diff summary via git status and git diff --stat
  2. Verify the local build with yarn hexo clean && yarn hexo generate
  3. After my confirmation, run git add → git commit → git push

About a minute after the push, GitHub Actions finishes building and the post goes live.

From idea to live URL takes 15–30 minutes depending on length, with only two human checkpoints: approving the outline and confirming the publish.


Quality Assurance: A Safety Net of Hooks

The writing loop looks simple, yet a few failure modes can break production quickly. My Hooks catch most of them before they leave my machine. Here is the complete configuration from .claude/settings.json:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [{ "type": "command", "command": ".claude/hooks/block-dangerous.sh" }]
},
{
"matcher": "Bash",
"hooks": [{
"type": "command",
"if": "Bash(git commit *)",
"command": "hexo clean && hexo generate 2>&1 | tail -5 || { echo 'Build failed, commit blocked' >&2; exit 2; }"
}]
},
{
"matcher": "Edit|Write|MultiEdit",
"hooks": [{ "type": "command", "command": ".claude/hooks/protect-files.sh" }]
}
],
"PostToolUse": [
{
"matcher": "Write|Edit|MultiEdit",
"hooks": [{ "type": "command", "command": ".claude/hooks/screenshot-hook.sh" }]
}
],
"Stop": [
{
"matcher": "",
"hooks": [
{ "type": "command", "command": ".claude/hooks/notify.sh" },
{ "type": "command", "command": ".claude/hooks/feishu-notify.sh" }
]
}
]
}
}

Hook 1: Blocking Dangerous Commands

Once, Claude tried to run rm -rf node_modules to clear a cache. Harmless in that specific case, but I don’t want an AI executing recursive deletes unchecked in my repo. block-dangerous.sh enforces a simple denylist:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
DANGEROUS_LIST="
rm -rf|recursive force delete
git push --force|force push
git reset --hard|hard reset
git clean -fd|clean untracked files
DROP TABLE|drop database table
mkfs|format filesystem
"

while IFS='|' read -r pattern desc; do
if echo "$COMMAND" | grep -qE "(^|;|&&|\|\|)\s*${pattern}"; then
echo "Dangerous command blocked: $desc — run manually if intended"
exit 2 # exit 2 = block execution
fi
done <<< "$DANGEROUS_LIST"

When triggered, Claude sees the block message and automatically switches to a safer alternative. This single Hook has caught at least three rm -rf attempts and one git reset --hard.

Hook 2: Build Verification

Before every git commit, a Hook runs hexo generate. If the build fails, the commit is blocked.

Real incident that prompted this: a missing indentation space under tags in a post’s Front Matter looked fine in the editor, but pushing it broke the homepage with a 404. Adding this pre-commit build gate has prevented at least five live outages since.

Hook 3: Protected Files

protect-files.sh maintains a list of sensitive files—.env, settings.json, lockfiles, and similar configs—that Claude is not allowed to touch. It once stopped Claude from trying to “optimize” yarn.lock.

Hook 4: Screenshot Verification + Completion Alerts

After any post edit, a Puppeteer hook captures a rendered screenshot so I can inspect layout issues before committing. When a task wraps up, Stop hooks fire both a desktop notification and a Feishu alert—letting me run Claude in the background instead of babysitting the terminal.

Hooks Summary

Hook Trigger Blocked Scope Real-World Catches
block-dangerous.sh PreToolUse (Bash) rm -rf, git push --force, etc. 3+ times
hexo generate PreToolUse (git commit) Commits that break the build 5+ times
protect-files.sh PreToolUse (Edit/Write) .env, settings.json, lockfiles, etc. 2+ times
screenshot-hook.sh PostToolUse (Edit/Write) None (verification only) Every post edit
notify.sh Stop (task complete) None (notification only) Every task

Batch Operations: Rewriting 27 Posts with Subagents

At peak workload, I had 27 official-docs deep-dive articles that needed a full rewrite. Doing them by hand would have taken at least two full days; a Subagent pipeline finished the batch in two hours.

Orchestration Flow

The /doc-rewrite Skill coordinates a three-stage agent pipeline:

1
planner → executor → scorer
  1. Planner: Reads the existing post, fetches the latest upstream official docs URL, and produces a rewrite plan.
  2. Executor: Rewrites the article from the plan—one Subagent per post, completely isolated.
  3. Scorer: Combines quantitative checks (code block count, word count, config examples, etc.) with qualitative LLM grading (technical depth, practical code value, authentic experience).

Any post scoring below 70 automatically enters another iteration, up to three rounds. A progress file tracks each article’s status and score.

Scoring Profile

The rubric lives in .claude/scoring/profiles/official-doc.yaml:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
quantitative:
weight: 0.3
checks:
- id: codeBlocks # >= 2 code blocks, 20 pts
threshold: 2
score: 20
- id: configExamples # >= 1 config example, 15 pts
threshold: 1
score: 15
- id: tables # >= 1 table, 15 pts
threshold: 1
score: 15
- id: wordCount # >= 1000 Chinese characters, 20 pts
threshold: 1000
score: 20
- id: platitudes # 0 filler phrases, 15 pts
patterns: ['filler-pattern-A', 'filler-pattern-B'] # Example: replace with real filler patterns to flag
score: 15
qualitative:
weight: 0.7
dimensions:
- id: contentDepth # Content substance, 25 pts
- id: codeUsability # Practical code value, 25 pts
- id: personalExperience # Authentic hands-on experience, 20 pts
pass:
threshold: 70
maxIterations: 3

Quantitative checks make up 30% of the score and are evaluated by script; qualitative dimensions make up 70% and are graded by an LLM. If the weighted total falls under 70, the post is automatically queued for rewrite.

Actual Results

All 27 posts passed with an average score of 88.6:

Metric Result
Total posts 27
First-pass rate 100% (27/27)
Average score 88.6
Highest score 93 (cli-reference, common-workflows, claude-overview)
Lowest score 78.3 (claude-quickstart)
Average time per post ~4 minutes
Total wall time ~2 hours (vs. 2+ days manually)

How the Configuration Evolved

None of this was built upfront. Every piece was added in response to a concrete pain point:

Stage Trigger Config Added Problem Solved
Stage 1: Barebones Started the blog CLAUDE.md (10 lines) Claude didn’t know my writing style or repo layout
Stage 2: Automation Got tired after 4 posts 3 Skills Manual file creation, template boilerplate, and commit/push loops
Stage 3: Guardrails Pushed 2 broken builds 3 Hook groups Live 404s from build failures; Claude nearly ran rm -rf
Stage 4: Scale Needed to rewrite 20+ docs Subagent pipeline + scoring system Manual rewrites were too slow and inconsistent in quality

The rule of thumb: don’t over-engineer on day one. Start with a minimal CLAUDE.md and add automation only when a specific friction point hurts. The 10-line file from Stage 1 was already enough to write posts; everything after that earned its place through real pain.


Reusable Patterns You Can Adopt Today

Whether you use Hexo, Hugo, or Jekyll, the underlying patterns transfer directly.

Minimal Starting Point: CLAUDE.md

This is the only config file you actually need to start:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# CLAUDE.md

## Project Info
- Framework: Hexo/Hugo/Jekyll (pick yours)
- Deploy: git push → automated build

## Writing Guidelines
- Tone: direct and conversational, like explaining to a peer
- Every code block must specify a language
- Front Matter must include title/date/tags/description

## Publish Workflow
git add source/_posts/<post-file>
git commit -m "post: <post title>"
git push

Skill Structure

Turn any recurring workflow into a Skill under .claude/commands/, where the filename becomes the slash command. The core layout has three sections:

1
2
3
4
5
6
7
8
9
10
11
12
# Skill Name

## Usage
/blog-xxx

## Steps
1. First step
2. Second step
...

## Notes
- Edge cases

At its core, a Skill is just a structured prompt that tells Claude the exact procedure to follow whenever you invoke that command.

Minimal Hook Config

The highest-leverage Hook to add first is a pre-commit build check:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [{
"type": "command",
"if": "Bash(git commit *)",
"command": "cd \"$CLAUDE_PROJECT_DIR\" && your-build-command 2>&1 || { echo 'Build failed, commit blocked' >&2; exit 2; }"
}]
}
]
}
}

Swap your-build-command for your static site generator (hexo generate, hugo, or jekyll build), and you have a solid baseline safety net.


Series Navigation