# How to Implement the wechat-article Skill for Generating Research Content

> Learn how to implement the wechat-article skill to transform topic descriptions into research-ready WeChat articles using AI agents. Automate content generation with ai-berkshire.

- Repository: [Xbt Lin/ai-berkshire](https://github.com/xbtlin/ai-berkshire)
- Tags: how-to-guide
- Published: 2026-07-11

---

**The wechat-article skill is a multi-agent workflow in the ai-berkshire repository that transforms raw topic descriptions into polished, research-ready WeChat articles through four automated stages orchestrated by Author, Editor, and Reader agents.**

The **ai-berkshire** repository provides a structured framework for automating research content creation. When you implement the **wechat-article skill**, you enable a pipeline that conducts parallel research, drafts technical content in Chinese, performs multi-perspective editing, and finalizes assets—all triggered by a single CLI command.

## Architecture Overview

The skill executes a four-stage pipeline defined in [`skills/wechat-article.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/wechat-article.md). Each stage leverages specialized sub-agents to handle distinct aspects of content creation, from initial research to final publication formatting.

### Stage 1: Research & Material Collection

This stage begins with parameter clarification—defining target audience, depth, length, and style requirements. The workflow then spawns **2-3 parallel research agents** using the repository's generic **Agent** toolset (which includes web search, PDF download, and data extraction capabilities).

Each agent focuses on a specific domain:
- **Core content** agent extracts technical thesis and key data points
- **Industry background** agent gathers contextual market information
- **Optional competitor analysis** agent benchmarks against related work

Outputs consolidate into a structured framework containing the core thesis, key datasets, figure inventory, and article outline.

### Stage 2: Author Agent Drafting

The **Author Agent** receives the research framework and a detailed prompt template (lines 84-106 in [`skills/wechat-article.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/wechat-article.md)). This agent generates a full-draft article in Chinese following strict formatting rules:
- Maximum 4 lines per paragraph (optimized for mobile reading)
- LaTeX formula support with plain-language explanations
- Image placeholders using `![描述](相对路径)` syntax
- Specific structural requirements: strong hook in first 3 paragraphs, technical depth with "plain language translation," and screenshot-worthy conclusion

### Stage 3: Editor and Reader Review

Two agents run in parallel to evaluate the draft:

**Editor Agent** (prompt defined at lines 119-146) evaluates:
- Title clickability and length (must not exceed 30 characters)
- Hook strength in opening paragraphs
- Logical flow and structural coherence
- Balance between technical depth and readability
- Figure placement and accessibility

**Reader Agent** (prompt defined at lines 144-162) adopts the target persona to identify comprehension gaps, weak engagement points, and overall readability issues.

### Stage 4: Finalization and Asset Integration

The workflow merges feedback streams, prioritizes high-frequency revision issues, and rewrites accordingly (steps 71-78). The **image extraction pipeline** executes `pdftoppm → PIL` operations to embed high-resolution figures (≥ 500 KB) directly into the document. Final output saves to the `reports/` directory following the naming convention defined in the **File Naming & Storage** table (lines 113-117).

## Core Source Files and Their Roles

The skill implementation spans three synchronized files:

| Component | File Path | Purpose |
|-----------|-----------|---------|
| **Skill Definition** | [`skills/wechat-article.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/wechat-article.md) | Human-readable workflow containing all prompts, stage logic, and execution steps |
| **Codex Adapter** | [`codex-skills/wechat-article/SKILL.md`](https://github.com/xbtlin/ai-berkshire/blob/main/codex-skills/wechat-article/SKILL.md) | Auto-generated machine-readable artifact that wraps the markdown workflow for Codex invocation |
| **Slash-Prompt Entry** | [`codex-prompts/wechat-article.md`](https://github.com/xbtlin/ai-berkshire/blob/main/codex-prompts/wechat-article.md) | CLI shortcut interface used by end-users to trigger the skill |

## Setting Up and Syncing the Skill

After modifying [`skills/wechat-article.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/wechat-article.md), you must regenerate the Codex-compatible artifacts using the repository's sync script:

```bash
python3 scripts/sync-codex-skills.py

```

This script parses the human-readable skill definition and updates [`codex-skills/wechat-article/SKILL.md`](https://github.com/xbtlin/ai-berkshire/blob/main/codex-skills/wechat-article/SKILL.md) with the machine-readable version, ensuring the `$ARGUMENTS` placeholders remain correctly mapped.

## Invoking the Skill

Once synced, trigger the skill via the CLI wrapper:

```bash
ai-berkshire wechat-article "大模型 OPD 技术解读"

```

This command reads [`codex-prompts/wechat-article.md`](https://github.com/xbtlin/ai-berkshire/blob/main/codex-prompts/wechat-article.md), loads the Codex skill, injects the topic argument, and streams the multi-agent execution. The skill writes the final markdown to a path like `reports/AI产业研究/公众号-OPD技术解读-20260711.md`, containing the article body, embedded figures, and citation blocks.

### Programmatic Invocation

You can also trigger the skill from Python scripts:

```python
from subprocess import run, PIPE

def generate_wechat_article(topic: str) -> str:
    """Runs the wechat-article skill and returns the path of the generated markdown."""
    cmd = ["ai-berkshire", "wechat-article", topic]
    result = run(cmd, stdout=PIPE, stderr=PIPE, text=True)

    if result.returncode != 0:
        raise RuntimeError(f"Skill failed: {result.stderr}")

    # The skill prints the output file path on success

    return result.stdout.strip()

# Usage

article_path = generate_wechat_article("大模型 OPD 技术解读")
print(f"Article generated at: {article_path}")

```

## Customizing the Agent Prompts

All prompts use plain Chinese with explicit `$ARGUMENTS` placeholders, enabling reuse across any topic. The **Author Agent** receives this template (lines 84-106):

```markdown
你是一位深度技术写作者（Author Agent），需要写一篇微信公众号文章。

## 目标读者

{根据第一步确认的读者画像}

## 写作风格要求

- 纯中文表达，避免中英文夹杂（技术术语首次出现时给英文，后续用中文）
- 像写给聪明的朋友看的技术科普，不是学术论文翻译
- 用类比帮助理解，但类比要贴切、不俗套
- 关键公式/数据要有，但每个都要用大白话解释
- 不用emoji
- 段落不超过4行（公众号阅读环境）

## 核心内容

{整理好的素材、数据、论点}

## 文章结构要求

1. **开头（前3段）**：必须有强钩子——用数据冲击力或反直觉的结论开场，不要用温和的类比开场
2. **背景**：为什么这件事重要？解决什么问题？
3. **核心内容（2-3节）**：技术深度在这里体现，但每个技术点都要有"大白话翻译"
4. **实证/案例**：用数据和案例说话，不要空谈
5. **行业影响/展望**：这件事对行业意味着什么
6. **结尾**：一句有传播力的判断收束，适合被截图转发

## 配图要求

- 论文解读类文章：必须从论文PDF中提取原图，直接用 `![描述](相对路径)` 插入文章，不要用 [图X：描述] 占位符

请写出完整的文章初稿，约{目标字数}字。

```

The **Editor Agent** uses this review checklist (lines 119-146):

```markdown
你是一位资深公众号编辑（Editor Agent）。请对以下文章进行精修审阅。

## 审阅标准

1. **标题**：是否在朋友圈能吸引点击？是否会被截断（超过30字）？
2. **开头**：前3段能否留住读者？钩子是否足够强？
3. **结构**：逻辑链是否流畅？有无跳跃或断层？
4. **深度与可读性平衡**：公式/技术部分是否真的通俗？有无"假装通俗但没解释清楚"的地方？
5. **节奏**：有无太长的段落？每节长度是否合适？
6. **配图**：图片是否已实际插入（非占位符）？位置是否在读者最需要视觉辅助时出现？
7. **结尾**：有无传播力？读者看完会想转发吗？

## 文章全文

{完整初稿}

```

## Summary

- The **wechat-article skill** implements a four-stage multi-agent workflow (Research → Author → Editor/Reader → Finalization) defined in [`skills/wechat-article.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/wechat-article.md).
- Three synchronized files handle the implementation: the human-readable skill definition, the auto-generated Codex adapter at [`codex-skills/wechat-article/SKILL.md`](https://github.com/xbtlin/ai-berkshire/blob/main/codex-skills/wechat-article/SKILL.md), and the CLI entry point at [`codex-prompts/wechat-article.md`](https://github.com/xbtlin/ai-berkshire/blob/main/codex-prompts/wechat-article.md).
- Run `python3 scripts/sync-codex-skills.py` after editing the skill definition to regenerate machine-readable artifacts.
- Execute the skill via `ai-berkshire wechat-article "topic"` to generate research-ready articles with embedded figures and citations.
- Customize agent behavior by modifying the Chinese prompt templates in the skill definition file, which support variable injection through `$ARGUMENTS` placeholders.

## Frequently Asked Questions

### What makes the wechat-article skill different from a standard LLM prompt?

The **wechat-article skill** implements a structured multi-agent architecture where distinct AI agents (Research, Author, Editor, Reader) operate sequentially and in parallel to enforce quality controls. Unlike single-prompt approaches, this workflow extracts source PDF figures automatically, validates content against mobile-reading constraints (such as the 4-line paragraph limit), and performs adversarial review through the Editor and Reader agents before finalizing output.

### How do I modify the research parameters for a specific article?

Edit the **Skill Definition** file at [`skills/wechat-article.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/wechat-article.md) to adjust the Stage 1 parameters—specifically the target audience profile, desired word count, and research depth indicators. After modification, run `python3 scripts/sync-codex-skills.py` to propagate changes to the Codex adapter. The `$ARGUMENTS` placeholder system allows runtime topic injection without hardcoding subject matter into the prompts.

### Can I use the wechat-article skill without the Codex environment?

Yes. While the repository provides Codex integration through [`codex-skills/wechat-article/SKILL.md`](https://github.com/xbtlin/ai-berkshire/blob/main/codex-skills/wechat-article/SKILL.md), the core workflow in [`skills/wechat-article.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/wechat-article.md) contains human-readable prompts that can be executed manually or integrated into other agent frameworks. The Python subprocess example demonstrates how to invoke the skill through any environment that supports the `ai-berkshire` CLI wrapper.

### Where are the generated articles stored and how are they named?

The skill automatically saves finalized articles to the `reports/` directory following the naming convention specified in lines 113-117 of the skill definition. File paths typically follow the pattern `reports/{category}/公众号-{topic}-{date}.md` (for example: `reports/AI产业研究/公众号-OPD技术解读-20260711.md`), including the article body, embedded high-resolution figures, and source citation blocks.