Motivation
I write blog posts infrequently. Not because I lack things to write about, but because the process of going from a conversation or idea to a published post has too much friction. I often have great discussions with Claude Code while working on projects, and those conversations contain insights worth sharing. The problem is that by the time I finish the work, I don’t want to spend another hour writing up what I just learned.
So I decided to automate the process using Claude Code itself.
The Idea
Claude Code supports custom slash commands. These are markdown files stored in ~/.claude/commands/ that act as reusable prompts. When you type /blog in a conversation, Claude follows the instructions in that file.
I wanted a command that does the following:
- Reads my existing blog posts to learn how I write
- Turns the current conversation into a blog post draft in my style
- Shows me the draft for review before saving
- Publishes to my Quartz blog with a single confirmation
The key insight is that the conversation context is already there. Claude has seen everything we discussed. Rather than starting a blog post from scratch, I can just tell it to distill what we talked about into something publishable.
The Setup
My blog runs on Quartz, a static site generator built for digital gardens. Posts are markdown files in a content/ directory with minimal frontmatter:
draft: "false"That’s it. The title comes from the filename, and dates are pulled from git history. Publishing is a single command: npx quartz sync.
The Command
The slash command lives at ~/.claude/commands/blog.md. Here is what it does:
Step 1: Study my writing style. Before drafting anything, it reads 3-5 of my existing posts. This matters because without it, the output sounds like generic AI writing. By reading my actual posts, it picks up on how I structure things, my tone, and the kind of formatting I use.
Step 2: Draft the post. It takes the conversation and distills it into a blog post that matches my voice. Not a transcript of the conversation, but an actual post.
Step 3: Editorial review. It shows me the draft and asks for feedback. I can request rewrites, add sections, or change the angle. This loops until I am satisfied.
Step 4: Save. It writes the final markdown to my blog’s content directory.
Step 5: Publish. It asks for confirmation, then runs npx quartz sync from the blog directory to push it live.
Why This Works
The friction of blogging was never the writing itself. It was the context switching. Going from a productive coding session to “now write about what you just did” requires a mental shift that kills momentum.
With this setup, the context is already loaded. Claude was there for the entire conversation. It knows what we discussed, what problems we solved, and what the takeaways were. All I have to do is type /blog, review the draft, and confirm.
Takeaway
Custom slash commands in Claude Code are more powerful than they first appear. They are not just prompt shortcuts. They are workflows that can read files, write files, and run shell commands. By combining a style-matching step with an editorial review loop and a publish step, a single command turns any conversation into a blog post with minimal effort on my part.