One of my biggest struggles with writing technical blog posts is that when I'm usually inspired to write a blog post, I'm right in the middle of solving a larger problem and I'm faced with three options:

  1. Stop and write it immediately. I break my coding flow state and lose coding momentum. The draft post easily takes 30 minutes, but now getting back to the solution is much harder.
  2. Make a quick note to write later. "Blog post: Mocking components with Vitest'' Two weeks later I come back to it and can't quite remember the context that made it interesting.
  3. Hope I'll remember it later on. I think we both know what happens... (nothing.)

Let's face it. The idea is most visceral and relevant in that very moment. So imagine the ideas I could capture if I had a personal assistant who could capture the idea and context properly so I could actually return back to the idea properly later?

The Ideal Workflow

I can't tell you how many insights I've lost to option two and three. Ideas that felt so clear in the moment and gone like the wind by the time I finished the task at hand. And the worst part? I can never quite remember what I forgot. I just know something was there. 😭

With the proliferation of AI tools, it dawned on me that this was the perfect way to leverage AI especially in a coding context where I work through problems with the agent. So, before getting lost in implementation details, I started by defining what success would look like:

Be able to quickly capture an insight with any relevant context during a coding session in under a minute.

After iterating on a few concepts, this is the workflow I came up with that could fit that criterion:

  1. I'm in the middle of coding / solving a problem and something worth blogging about strikes.
  2. I call a command like /draft <one line statement about the insight>.
  3. The AI agent generates a structured outline based on a template I define with the context of the conversation and my one line statement.
  4. I review the submission and approve it.
  5. The AI agent saves it inside my Obsidian vault (without having access to my vault itself).
  6. I resume coding and know confidently I can return to the blog post at a future date without losing any context.

And while it might sound like a lot, all of this should be able to happen within a span of a minute because any longer will break the flow state.

The Secret Sauce: Skill Command

You might have heard the term "agent skills" floating around, but don't overthink it. Skills are essentially a set of instructions written in markdown for your agent to follow. Or to use programming terms, it's defining a reusable function that the agent can invoke so it gets the same prompt every time.

The "command" part is just how you invoke the skill. With Claude Code, you create the command by adding commandName.md in a /.claude/commands directory.

So in my case, I wanted to tell Claude I wanted to draft a blog post by invoking the /draft command.

What It Looks Like in Practice

/draft Component mocks default explanation with Vitest

This is the beauty of the skill. It lets you quickly jot down a concise one liner and you're golden. Because here's the best part: the AI agent has full context. It can see the code you just wrote, the bug you just fixed, and most importantly, the conversation about why this insight matters to you.

After it "discombobulates" for a bit, it generates a structured outline with:

  • Core thesis
  • Author context (what you were building)
  • Content sections with code examples pulled from the real session
  • Potential titles

Just like that, the expensive context switching that is required to go from "I should write about this" to "I have a draft with enough context to write about in the future" shrinks to seconds. And most importantly, you can just jump right back into coding.

📄 /.claude/commands/draft.md

Below is more or less the exact skill command that I'm currently using. The only difference being that I removed some metadata from the template section that is unlikely to be relevant to others.

---
description: Draft a blog post based on a lesson or insight
---

# Draft Blog Post

Create a blog post draft in `/Users/bencodezen/digital-forest/blog/`.

## What to Write

Based on the current conversation context and the user's prompt, draft a post about the lesson, pattern, decision, or insight worth sharing.

**Good topics:**

- Design decisions and their rationale
- Patterns discovered or anti-patterns avoided
- Debugging stories
- Architecture insights
- Testing strategies

## Format

```markdown
---
uuid: <% tp.file.creation_date("YYYYMMDDHHmmss") %>
created-on: <% tp.file.creation_date("YYYY-MM-DDTHH:mm:ss") %>
updated-on: <% tp.file.last_modified_date("YYYY-MM-DDTHH:mm:ss") %>
aliases:
tags:
  - type/content
  - type/blog-post
status: 🗃️ Backlog
published-on:
description:
related:
---

# Draft: [Working Title]

## Status: Outline

## Core Thesis

[One sentence summary of the insight]

## Author Context

[Brief project context -- what we were building and why this came up]

## [Main content sections]

## Potential Titles

- [Option 1]
- [Option 2]
```

## Guidelines

- Focus on the **why**, not just the what
- Make it useful beyond the specific project
- Include code examples where they clarify the point
- Keep it concise -- outlines are fine, polish comes later

The Fourth Option

Remember those three options? Stop everything, jot a vague note, or hope you'll remember? The reality is that there's a fourth option now: let the agent help you capture the insight and get back to coding.

This workflow isn't about having AI generate a blog post for you. It's about the fact that the agent was there when the insight happened and can capture it for you to reflect on later. It's still up to you to figure out how to tell the story in your own tone, but you never have to worry that you forgot about something.