我做了一个自定义的 Claude Code Skill,把写博客从 30 分钟的苦差事变成了 30 秒的一条命令
问题所在
每次我想写写项目的时候,都要走一遍同样繁琐的步骤:
- 去项目文件夹找截图
- 复制到博客的素材目录
- 创建一个新的 MDX 文件并写好正确的 frontmatter
- 写正文内容
- 记住正确的分类和标签格式
- 提交所有改动
- 启动开发服务器预览
不难,但有摩擦。而摩擦会扼杀动力
Claude Code Skills 入门
Skill 文件放在 ~/.claude/skills/ 目录下,是 markdown 格式。每个文件定义一个 Claude Code 可以执行的斜杠命令。结构很简单:
~/.claude/├── CLAUDE.md # 全局指令└── skills/├── blog.md # /blog 命令├── rewrite.md # /rewrite 命令├── tweet.md # /tweet 命令└── commit.md # /commit 命令
在 Claude Code 里输入 /blog,它就会加载对应的 Skill 文件并按照指令执行
Skill 的结构解析
来看看我的博客 Skill 的结构:
# Blog Post SkillCreate a new blog post for jovweb.dev about a project or topic.## Usage/blog [project-folder-or-topic]## Arguments- $ARGUMENTS: path to a project folder or a topic to write about## Instructions### 1. Determine the Subject- Parse $ARGUMENTS to get the project folder or topic- If a folder path is provided, explore it to understand:- What the project does (check README, package.json, main source files)- Key features and technologies used- Any screenshots or images in the repo### 2. Find Images- Search the project folder for potential cover images:- Look in: `/public`, `/assets`, `/images`, `/screenshots`- File types: `.png`, `.jpg`, `.jpeg`, `.webp`, `.gif`- Copy the best image to `/path/to/blog/public/assets/blog/`### 3. Write the Blog Post Content- Create an outline based on:- What problem does this project solve?- How does it work?- Key features or interesting technical decisions- Use the `/rewrite` skill to convert to personal style### 4. Create the MDX File- Location: `/path/to/blog/content/blog/`- Filename: kebab-case based on topic- Include frontmatter with title, description, date, category, tags
这里的关键是 $ARGUMENTS。这就是你给 Skill 传参数的方式。/blog 后面跟的内容都会注入到这里
链式调用 Skill
博客 Skill 会调用另一个 Skill:/rewrite。它负责把我的草稿转成我的写作风格
# Rewrite Skill## Instructions1. Parse the text from $ARGUMENTS2. Rewrite using the style guide below3. Show the rewritten version## Style Guide- start with lowercase- use "I" not "I"- no ending punctuation- short, direct sentences- stream of consciousness flow
Skill 调用 Skill——这就是可组合的自动化
执行流程
当我运行 /blog ~/Sites/hyperscalper 的时候:
1. Claude Code 加载 ~/.claude/skills/blog.md2. $ARGUMENTS = "~/Sites/hyperscalper"3. Claude 探索文件夹:- 读取 README.md- 检查 package.json 查看依赖- 扫描 src/ 了解核心功能4. 在 ~/Sites/hyperscalper/public/ 找到图片5. 把最合适的图片复制到博客素材目录6. 起草文章内容7. 调用 /rewrite 应用我的写作风格8. 创建 content/blog/building-hyperscalper.mdx9. 执行:git add . && git commit -m "add hyperscalper blog post"10. 执行:npm run dev(如果没在运行的话)11. 打开 http://localhost:3000/blog/building-hyperscalper
一条命令搞定所有
MDX 输出
Skill 精确知道我的博客需要什么 frontmatter:
---Title: "Building Hyperscalper"Description: "a real-time trading dashboard for crypto markets"PublishedAt: "2026-01-13"Author: "Jo Vinkenroye"Category: "Development"Tags: ["Trading", "Crypto", "Real-time", "Next.js"]CoverImage: "/assets/blog/hyperscalper-cover.png"Featured: false---
分类、标签、图片路径,全部在 Skill 里定义好了,不用我去记
最 Meta 的部分
这篇文章就是用我正在介绍的这个 Skill 写的。用 /blog 写关于 blog Skill 的文章 :D
自己动手做一个
从简单的开始。创建 ~/.claude/skills/your-skill.md,内容:
# Your Skill NameDescription of what it does.## Usage/your-skill [arguments]## Instructions1. First step2. Second step3. ...
想想你重复做的那些事:
- 审代码 →
/reviewSkill,附上你的检查清单 - 初始化项目 →
/initSkill,用你喜欢的技术栈 - 写文档 →
/docsSkill,按你的格式 - 发动态 →
/tweetSkill,用你的风格
技术栈
我的博客跑在 Next.js 14 上,用的 MDX。文章就是文件:
Content/blog/├── automating-blog-posts.mdx├── building-hyperscalper.mdx└── ...
没有数据库,没有 CMS。就是 Markdown 加 Git。Skill 直接往仓库里写
接下来
我在考虑加上:
/imagen集成,自动生成封面图- 自动提取相关代码片段
- 用
/crosspost同步发到 dev.to
但目前来说,它已经在帮我省时间了。更重要的是——它消除了那个阻止我写东西的摩擦
Stay Updated
Get notified about new posts on automation, productivity tips, indie hacking, and web3.
No spam, ever. Unsubscribe anytime.

