content-forge/.claude/skills/write-article/SKILL.md
lizikk 29bcbb89db feat: add claude-md-guardian, thinking commands, and security fixes
- Add claude-md-guardian agent with SessionStart hook for auto CLAUDE.md maintenance
- Add 6 thinking commands: /my-world, /emerge, /challenge, /connect, /today, /close
- Add my-world skill for one-shot vault context loading
- Fix command injection vulnerability in init-vault.sh (use env vars)
- Add error handling and logging to vault-sync.sh
- Update write-article skill with complete frontmatter fields
- Upgrade CLAUDE.md to v1.3.0 with cycle time tracking and exit criteria

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 16:58:43 +08:00

142 lines
5.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: write-article
description: >
Generate articles from topics and outlines stored in an Obsidian vault.
This skill should be used when creating long-form content such as tech blogs,
opinion pieces, tutorials, or social posts from structured topic briefs.
Depends on obsidian:obsidian-cli for all vault read/write operations.
Trigger words: 写文章、写作、生成草稿、技术博客、观点文、教程、社交短文、
article、blog post、draft。
---
# Write-ArticleObsidian 文章写作技能
## 目标
用统一流程产出可发布草稿,避免无来源、无结构、无 frontmatter 的半成品。
## 输入要求
必须提供:
- `topic`文章主题1 句话)
- `style``tech_blog` | `opinion` | `tutorial` | `social_short`
- `audience`:目标读者
- `source_notes`:至少 1 个 Obsidian note 路径vault 相对路径)
- `tags`1-5 个标签
可选但建议提供:
- `title`:文章标题
- `slug`:文件 slug英文短横线
- `length_target`:目标字数或段落数
- `cta`:结尾行动建议
- `publish_channel`:发布渠道
## 强制工作流(不得跳步)
### Step 1读取素材
逐个读取 `source_notes` 中的笔记,确认事实边界。
```bash
obsidian read path="<source_note_path_1>"
obsidian read path="<source_note_path_2>"
```
执行要求:
- `source_notes` 中每个路径都要读取。
- 未读完素材前,禁止进入写作。
- 素材不足以支撑结论时,输出 `[?]` 标记并向用户索要补充信息。
### Step 2生成文章草稿
`references/writing-styles.md` 选择对应风格模板生成正文。
执行要求:
- 只使用已读取素材中的事实。
- 观点必须有论证链,不得堆砌口号。
- 内容结构必须匹配所选风格的"结构"要求。
### Step 3创建草稿文件
将生成的 Markdown 写入 `02-drafts/` 目录。
```bash
obsidian create path="02-drafts/<YYYY-MM-DD>-<slug>.md" content="<ARTICLE_MARKDOWN>"
```
执行要求:
- 目标目录必须是 `02-drafts/`
- 文件名必须包含日期前缀与 slug。
- 正文必须是 Markdown可直接发布或二次编辑。
### Step 4设置 frontmatter
对 Step 3 产物逐项设置元数据。
```bash
# 先 cd 到 vault 目录
cd /home/kang/apps/content-forge/content-forge
# CLAUDE.md 必填字段
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="id" value="<YYYY-MM-DD>-<slug>"
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="title" value="<title>"
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="slug" value="<slug>"
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="status" value="draft"
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="content_type" value="article"
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="channels" value="[\"wechat\",\"x\"]" type=list
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="language" value="zh-CN"
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="source_urls" value="[]" type=list
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="assets" value="[]" type=list
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="cover_image" value=""
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="template" value="article"
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="owner" value="content-forge"
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="created_at" value="<YYYY-MM-DD>T00:00:00+08:00"
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="updated_at" value="<YYYY-MM-DD>T00:00:00+08:00"
# 技能扩展字段(可选)
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="style" value="<style>"
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="audience" value="<audience>"
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="tags" value="[\"tag1\",\"tag2\"]" type=list
obsidian property:set path="02-drafts/<YYYY-MM-DD>-<slug>.md" name="source_notes" value="[\"note1.md\"]" type=list
```
最小 frontmatter 字段集合(对齐 CLAUDE.md §4.2
- `id`, `title`, `slug`, `status`, `content_type`, `channels`, `language`
- `source_urls`, `assets`, `cover_image`, `template`, `owner`
- `created_at`, `updated_at`
技能扩展字段(可选):
- `style` — 写作风格tech_blog/opinion/tutorial/social_short
- `audience` — 目标读者
- `tags` — 标签列表
- `source_notes` — 来源笔记路径
## 输出约束
- 输出仅包含文章草稿及必要元数据,不输出无关解释。
- 文章语言默认中文,除非用户显式要求其他语言。
- 禁止编造数据、案例、引文、实验结果。
- 未确认的事实必须标记 `[?]`,并明确缺失项。
- 结构必须符合所选风格规范(见 `references/writing-styles.md`)。
- 段落应可读,避免空泛套话与重复表达。
## 质量检查(交付前必须全部通过)
- [ ] 所有 `source_notes` 已执行 `obsidian read`
- [ ] 文章结构与目标风格一致
- [ ] 关键结论可追溯到输入素材
- [ ] 草稿已通过 `obsidian create` 写入 `02-drafts/`
- [ ] frontmatter 必填字段已通过 `obsidian property:set` 完整设置
- [ ] 标题、slug、标签与内容主题一致
- [ ] 不存在事实捏造与无依据断言
## 失败处理
- 缺少必要输入时,返回:`[?] 缺失输入:<字段名>`,并停止写入。
- `obsidian` 命令失败时,返回:`[✗] <命令> 失败:<错误信息>`,并停止后续步骤。
- 如果无法确定风格,默认使用 `tech_blog`,同时显式告知用户。
## 风格参考
- `references/writing-styles.md`