---
name: "ai-trend-publish"
description: "Use TrendPublish to turn RSS feeds and search results into WeChat Official Account articles automatically (topic → evidence → body copy → typeset HTML → draft/publish). Use when the user asks to \"write a WeChat Official Account article automatically\", \"gather an article from news sources\", \"run a WeChat Official Account dry-run\", or \"publish to a WeChat Official Account on a schedule\"."
---

> Original skill · commissioned by the user · English edition, 2026-11-12

# TrendPublish (automatic WeChat Official Account drafting and publishing)

## What it is

Not a prompt-only skill but a local application (Deno + TypeScript, MIT). This skill only does four things: locate the project, run commands, read the outputs, and diagnose failures; writing quality is the responsibility of the pipeline inside the project.

## Project location

`<WORKSPACE>/trendpublish`

If the directory does not exist, re-clone it:

```powershell
git clone --depth 1 https://github.com/liyown/ai-trend-publish.git trendpublish
```

## Pre-flight checks (if any item is missing, do not run further)

1. `deno --version` ≥ 2.0 (the first run downloads jsr/npm dependencies, so you must be able to reach the network).
2. `trendpublish.config.ts` has `providers.ai` filled in: `baseUrl` (any OpenAI-compatible endpoint), `apiKey`, `model`.
3. Only real publishing needs `providers.publish.weixin.appId / appSecret`, and the Official Account backend must whitelist the IP.

Run `deno task doctor` once: the only acceptable results are all OK, or a single FAIL on `LLM` (key not filled in). Fix any other FAIL before running.

## Common commands (always run from the project root)

| Purpose | Command |
|---|---|
| Config health check | `deno task doctor` |
| Preview all WeChat templates | `deno task preview` |
| One full draft run, no publishing | `deno task article --dry-run` |
| Multi-account matrix dry run | `deno task article --matrix` |
| Real draft creation / publish | `deno task article` (requires `dryRun: false` in the config) |
| Local service + dashboard | `deno task dev` (`:8000`, dashboard at `:5173/dashboard/`) |

## Where the outputs are

- `src/temp/`: rendered HTML, run-record JSON, generated images.
- Every run keeps its steps, errors and quality review; read the outputs before judging — do not guess from the last line of the terminal.

## Hard rules

- **Run dry-run by default.** Before changing `dryRun` to `false` you must satisfy all of: AppID/AppSecret filled in, IP whitelist added, and explicit user consent to publish.
- Keys live only in `trendpublish.config.ts`; never put them in committed artifacts and never `git commit` that file.
- Prefer the `rss:` and `search:` source groups (`gdelt` / `hackernews` / `arxiv` need no key); bare web page URLs go through `firecrawl`, which needs a separate key.
- A personal subscription account has no publishing API, so you can only dry-run to HTML and paste it into the editor by hand; only a verified entity account can call the API.

## Common failures

| Symptom | Cause / handling |
|---|---|
| `Access denied` when starting deno | The sandbox has no network; request network permission and re-run |
| doctor reports `LLM - missing` | The three `providers.ai` fields are not filled in |
| 0 items fetched | The RSS source is dead, or `sourceLimits.maxAgeDays` is too narrow |
| `dynamic` template errors | It falls back to `minimal` automatically; you can also set `template: "minimal"` explicitly |
| Publish reports the IP is not whitelisted | In the Official Account backend: Settings and Development → Basic Configuration → IP whitelist |
