SuperAPI AI Directory

soia-pkm-clip-wechat-article

Office & productivity

View repository

Updated 10-16 08:52

About this skill

soia-pkm-clip-wechat-article

clip family'sOfficial Account member: deposit Official Account articles into the vault.

Customer-readable description

What this skill can do

Archive a single WeChat Official Account article to an Obsidian vault: fetch the static HTML, extract the title, author, body, publish time, and images, and store it according to the clip family conventions; when a PDF is needed, prefer exporting via Obsidian

What the customer wants What the skill will do What the customer can see
Complete the work covered by this skill Read the user request, necessary context, and this skill's main workflow, and execute the minimal reliable steps The customer will see Obsidian/vault file changes, terminal logs, generated artifact paths, and the final receipt.
Missing dependencies, permissions, configuration, or keys Stop actions that require external state and clearly state what is missing Install commands, application addresses, configuration paths, or questions that need customer confirmation
Execution complete Summarize successes, skips, failures, file changes, and verification results A completion receipt that can be copied into a ticket/log

How the customer uses it

  1. State the goal in natural language and provide the necessary inputs: files, URLs, repos, workspaces, proposals, vaults, or platform account status.
  2. The Agent first determines whether this skill is triggered, then checks dependencies, configuration, permissions, and risky actions.
  3. For actions that can be dry-run or previewed, provide a preview first; for actions involving deletion, overwriting, sending, publishing, or writing remote state, ask the customer for confirmation first.
  4. After execution, verify the real output; do not substitute "looks successful" for evidence.
  5. The final reply must give the customer a visible summary: what was done, a log summary, file changes, issues, and next steps.

Dependencies and installation

Install this skill (single skill):

npx skills add soia-team/soia-open-skills -g -a '*' -s soia-pkm-clip-wechat-article -y

The current script's configuration entry point:

OBSIDIAN_VAULT=<vault-path>
OBSIDIAN_ARTICLES=<vault-relative-articles-dir>
  • CLI --vault / --articles-dir takes precedence over environment variables; when neither is provided, only search upward from the current directory for a real .obsidian/ flag.
  • If --articles-dir、OBSIDIAN_ARTICLES are both missing, the script still retains the Articles/ fallback for compatibility with existing workflows, but prints a clear warning to stderr; the receipt must include the actual directory written to, and when the fallback is used, it should recommend configuring a formal articles directory and then relocating.
  • The current stdlib script does not parse YAML config.yml, and does not require an API key, cookie, or other credentials; do not create a configuration file that will not take effect.
  • Strong dependencies, optional dependencies, and third-party skill relationships must be based on the "dependencies / prerequisites / resources / boundaries" explanations that follow in this SKILL.md ; if they are not clearly written, first supplement the explanation or ask the customer, and do not guess.
  • Third-party skills may only declare dependencies and installation methods; do not directly modify third-party skill files.

Logs and completion receipt

Every execution must let the customer see the process and results. Minimum receipt format:

完成:<一句话说明本次完成了什么>。

日志摘要:
- started: <检查到的输入/配置/依赖,不打印秘密值>
- processed: <数量或范围>
- created/updated: <数量或路径>
- skipped/failed: <数量和原因>

文件变化:
- <绝对路径或“未改动文件”>

验证:
- <运行过的检查、命令或人工核对点>

问题与下一步:
- <缺 key / 缺依赖 / 需要客户确认 / 建议下一条命令;没有则写“无”>

Fetch

  • Input:https://mp.weixin.qq.com/s/...
  • The Official Account article isstatic HTML(Easier to scrape than X, no API needed): stdlib urllib.request fetch page → parse #js_content(body),#activity-name / og:title(title), author meta (byline author),#js_name(official account name),createTime / oriCreateTime(publish time fallback).
  • Images: extract data-src and keep as remote links; the current script does not download images, offline conversion is handled by a later process.
  • Script:scripts/archive_wechat.py <url> --vault <path>(pure Python standard library; supports --dry-run、--json, URL deduplication, body quality gate, and atomic write).
python3 scripts/archive_wechat.py <url> \
  --vault <vault-path> \
  --articles-dir <vault-relative-articles-dir> \
  --dry-run --json

First dry-run to verify title, author, publish time,body_chars, image count, and content_complete, then remove --dry-run and write. When #js_contentcannot be found, the body is abnormally short, or interception page keywords are hit, writing is refused by default; only use --allow-incomplete。

to land when the client explicitly accepts an incomplete archive (unified spec for the clip family)

  • Path:<vault-articles-dir>/<年>/<月>/YYYY-MM-DD-公众号-<作者>-<标题>.md
  • frontmatter:tags:[文章摘抄]、source: 公众号、url、author、publisher、published_at、captured_at、topics:[]、content_complete
  • Body paragraphs:## 摘要(AI fills in),## 原文、## 我的看法(leave blank),## 关联
  • After archiving, AI fills in summary + topics; the script has already placed it by publish month.
  • The receipt must include the actual directory written to; if --articles-dir or OBSIDIAN_ARTICLES is not configured and the Articles/ fallback is used, a warning must be explicitly noted, and it is recommended to configure a formal articles directory and then relocate.

Verification

python3 -m unittest discover -s tests -p 'test_*.py'
python3 -m py_compile scripts/archive_wechat.py

When the repository maintainer runs from the repo root, replace the paths with skills/soia-pkm-clip-wechat-article/tests and skills/soia-pkm-clip-wechat-article/scripts/archive_wechat.py. These two checks specifically prevent SKILL from again declaring a script that is not delivered with the installation package.

Export PDF after archiving

When the user also requests "convert to PDF / export PDF", first complete the Markdown archiving, summary, topics, and month placement, then read and execute references/obsidian-pdf-export.md. As long as the target file is inside the Obsidian vault, prefer calling Obsidian's built-in "Export PDF"; external PDF engines can only be used as an explicit fallback.

Closed-loop location

★clip-wechat(收) → organize → distill → compose → publish. Shares the landing spec with clip-x/web/drive, only the source differs.


Receipt after completion

Delivery order: first write the file to disk, then output the receipt below; do not reverse the order; uncertain metadata (such as author or publish time parsing failure) must be explicitly marked "unverified" in the receipt, do not fabricate.

After executionmustoutput to the user (do not silently finish):

  1. What was done — a one-sentence summary of the completed work.
  2. File changes — list newly created / modified / moved files (full paths); if no files were changed, state "no files changed".
  3. Next steps — optional follow-up suggestions (such as the next skill to connect to).