XHS Article Writer
Overview
Use this skill to collect Xiaohongshu reference notes, combine them with local .txt article libraries, and write natural Chinese short-form posts. The model used for analysis and writing is the current Codex or WorkBuddy model; do not ask the user to configure a separate AI provider.
Live XHS fetching uses the bundled Spider_XHS API runtime under scripts/runtime and scripts/xhs_api_tool.py. The user only needs to install this skill. To satisfy SkillHub upload limits, the package does not include node_modules; scripts/xhs_api_tool.py runs npm install --omit=dev on first use when crypto-js or jsdom is missing. If the bundled runtime is moved, the fetch script can also use --xhs-api-tool or the XHS_API_TOOL environment variable.
Inputs
Collect these inputs from the user or infer sensible defaults:
cookies: Required when fetching live XHS notes. Treat cookies as sensitive and never print them back.keyword: Required when fetching live notes.count: Number of XHS notes to fetch. Default to 20 when unspecified.text_library: Optional local.txtfile or folder path, or uploaded text files.topic: Optional writing topic. If missing, infer it from the keyword and samples.category: Optional disease, subject, or content category.target_length: Default to about 300 Chinese characters, with natural variation.
If the user provides only local .txt files and no cookies, skip live fetching and write from the local library.
Determine the mode from the user's wording:
- Fetch-only mode: if the user only asks to "拉取文章", "抓取数据", "整理文章", or "采集笔记", fetch notes, refetch note details, fetch comments, and output structured files. Do not write an article.
- Writing mode: if the user asks to "写文章", "生成文章", "创作", "仿写", or provides a writing topic, analyze the fetched notes and local
.txtlibrary before writing.
Workflow
- Fetch XHS references when cookies and keyword are available. This command calls the bundled API runtime, then refetches each note detail and comments:
python scripts/fetch_xhs_notes.py --cookies "<cookies>" --keyword "<keyword>" --count 20 --output work/xhs_notes.json
- Load local text library when files are provided:
python scripts/load_text_library.py --input "<txt-file-or-folder>" --output work/local_articles.json
- Build the analysis pack:
python scripts/prepare_article_context.py --xhs work/xhs_notes.json --local work/local_articles.json --output work/article_context.md
-
In fetch-only mode, stop after
work/xhs_notes.jsonandwork/article_context.md; summarize how many notes, details, and comments were collected. -
In writing mode, read
work/article_context.md, analyze the material, then generate the article in Chinese. -
If live fetching fails because cookies are invalid, login expired, or XHS blocks requests, explain the cause briefly and continue with any available local text material. If no material remains, ask for fresh cookies, exported XHS data, or
.txtfiles.
Fetching Notes
Use scripts/fetch_xhs_notes.py for XHS fetching. The script calls:
pc.search_some_notefor search resultspc.get_note_infoto refetch every note's full detailpc.get_note_all_commentto fetch comments when possible
The script saves JSON with:
- keyword and fetch count
- note id, title, body, author, url
- engagement fields when available
- comments when available
- warnings and failed requests
XHS requires browser-like signatures (x-s, x-t, x-s-common). The bundled runtime supplies these; do not replace it with unsigned direct HTTP requests.
Local Text Library
Use scripts/load_text_library.py for .txt files. Support:
- a single
.txtfile - a folder containing multiple
.txtfiles - recursive folder loading with
--recursive - category inferred from the parent folder unless
--categoryis provided
Do not copy local articles verbatim into the generated post.
Analysis Guidance
Analyze both fetched XHS notes and local articles for:
- real-person viewpoint and relationship to the topic
- opening style, sentence rhythm, and paragraph length
- concrete scenes, parent concerns, emotions, and turning points
- common spoken phrases and details that reduce AI tone
- facts or claims that need caution
- marketing or institution-like expressions to avoid
For comments, look for everyday user language, doubts, objections, and pain points. Do not copy comments directly.
Writing Rules
Write as a real parent or ordinary user unless the user asks for another viewpoint.
Default output:
标题:
...
正文:
...
标签:
#... #...
素材分析:
...
Content requirements:
- Keep the post natural, restrained, and specific.
- Prefer lived details over encyclopedic explanation.
- Avoid obvious AI phrasing, numbered lectures, rigid summaries, and slogans.
- Avoid marketing intent: no consultation, private message, organization promotion, course signup, promises, or conversion language.
- Avoid absolute medical conclusions; use observation and personal experience.
- Do not fabricate professional credentials or clinical outcomes.
- Keep around 300 Chinese characters by default, but let the text breathe when the samples call for it.
Output Files
When useful, save intermediate files under the current task workspace:
work/xhs_notes.jsonwork/local_articles.jsonwork/article_context.mdoutputs/xhs_article.md
Never save cookies into output files unless the user explicitly asks for a local debug artifact.