Install
openclaw skills install zhihu-draft-writer自动从知乎热榜选题、调用 AI 生成原创回答并保存为草稿,支持自定义话题关键词、写作风格和批量生成。 Draft Zhihu answers automatically: picks hot questions, generates original answers via AI, and saves them...
openclaw skills install zhihu-draft-writerUse the host browser session that is already logged into Zhihu. Do not attempt automated login, do not ask for passwords, and do not use the publish action.
Before the first run, read {baseDir}/references/setup.md.
Before each run, resolve user options with {baseDir}/references/runtime-options.md.
curl to call the zhihuiapi inference endpoint directly for answer generation. Do not use llm-task, do not spawn a subagent for generation, and do not use the current session model to generate answer text.draft_count > 1 and a single draft fails (generation or save), skip that question, record the failure reason, and continue with the next eligible question. Report a summary of successes and failures at the end.Skip or reject any content that falls into these categories:
When in doubt, treat the content as risky and skip.
Resolve these options from the user's request before opening Zhihu:
topic_modecustom_topic_keywordsdraft_countcomment_countwriting_styleIf the user does not specify them, use the defaults from {baseDir}/references/runtime-options.md.
Do not ask follow-up questions just to collect optional parameters.
When the user gives no parameter at all, use this default run mode:
topic_mode = general_hotdraft_count = 1comment_count = 3writing_style.mode = defaultProcess up to draft_count eligible questions in one run. Create one draft answer per selected question. Never exceed 5 drafts in a single run even if the user asks for more; cap at 5 and note the cap in the result.
The skill maintains a local deduplication log at {baseDir}/data/history.json.
Format:
{
"answered": [
{
"question_url": "https://www.zhihu.com/question/xxxxxxx",
"question_title": "string",
"saved_at": "2026-03-16T10:00:00Z"
}
]
}
Rules:
{baseDir}/data/history.json. If the file does not exist, treat answered as an empty array.question_url already appears in answered.answered and write the file back immediately. Do not wait until the end of the run.Open https://www.zhihu.com/hot in the host browser.
Read the visible hot-question cards before clicking anything.
Load {baseDir}/data/history.json and extract the set of already-answered question_url values.
Determine the active topic filter based on topic_mode:
general_hot (default)
custom
custom_topic_keywords.Tie-breaking rule (applies to all modes): when two candidates are equally eligible, prefer the one with a higher visible heat indicator (answer count, comment count, or heat score shown on the card). If still tied, prefer the one whose title suggests a more open-ended question that allows varied perspectives.
Skip any candidate question that:
question_url that already exists in answered (already handled in a previous run)Continue selecting until draft_count eligible questions have been found or no more eligible visible hot questions remain. If the visible list is exhausted before reaching draft_count, report how many drafts were completed and why the run ended early.
question_titlequestion_urlquestion_excerptselected_reason (why this question was chosen)comment_count usable comments, clamped to the range 3–5. If fewer than 3 usable comments remain after one expand or load-more attempt, continue with however many are available (including 1 or 2).rankauthor_name (use "[已删除]" if the author name is missing or shows a deletion marker)like_counttext{baseDir}/references/answer-generation.md to get the system prompt text.<user_message_json> with the escaped JSON string, and read the API key from the ZHIHUIAPI_KEY environment variable:curl https://cc.zhihuiapi.top/v1/chat/completions \
-s \
-X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${ZHIHUIAPI_KEY}" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 2400,
"response_format": {"type": "json_object"},
"messages": [
{
"role": "system",
"content": "<contents of {baseDir}/references/answer-generation.md>"
},
{
"role": "user",
"content": <user_message_json>
}
]
}'
{
"topic_mode": "general_hot | custom",
"custom_topic_keywords": ["string"],
"draft_index": 1,
"draft_count": 1,
"question_title": "string",
"question_excerpt": "string",
"question_url": "string",
"selected_reason": "string",
"writing_style": {
"mode": "default | user_defined",
"summary": "string"
},
"top_comments": [
{
"rank": 1,
"author_name": "string",
"like_count": 123,
"text": "string"
}
],
"writing_rules": [
"模仿评论语气和论述节奏,但不要抄袭;连续18个及以上汉字不得与任何评论重合",
"必须有自己的判断和补充,加入至少1个评论中没有出现的观点或角度",
"中文自然表达,像真实知乎答主,不要出现元叙述",
"禁止任何政治相关言论、敏感表达、违法内容或法律风险内容",
"如果用户提供了写作风格,则优先遵循用户风格;风格冲突时以话题适配为准",
"如果无法安全表达,返回 {\"status\": \"failed\", \"error\": \"unsafe_content\"} 而非空字符串"
]
}
choices[0].message.content and parse it as JSON.Read the expected schema from {baseDir}/references/answer-schema.json before validating.
Validate the model output before writing to Zhihu:
"status": "failed" — record error field as the failure reason and do not retry.answer_text is absent or shorter than 200 characters.answer_text exceeds 800 characters.answer_text contains any of these meta-wording tokens: AI、人工智能、模型、生成、ChatGPT、Claude、根据评论、根据以上、作为助手、作为AI.answer_text contains political advocacy, political commentary, sensitive expression, illegal instructions, or other legally risky content.answer_text are identical to the same span in any single source comment.answer_text is a near-verbatim rewrite of a comment sentence (same meaning, minimal word substitution).On the first rejection (except status: failed responses), retry generation once with a strengthened anti-copy instruction appended to writing_rules. If the retry still fails validation, stop and report the specific rejection reason. Do not attempt a third generation.
answer_text into the main answer field.{baseDir}/data/history.json:
question_url: the URL of the answered questionquestion_title: the title of the answered questionsaved_at: current UTC timestamp in ISO 8601 formatdraft_count is greater than 1, return to the hot list and repeat the full flow for the next eligible question until the target count is reached or no eligible question remains.After completing all drafts (or stopping early), output a brief summary:
完成草稿:X / Y
成功:[问题标题列表]
跳过/失败:[问题标题 + 原因]
已跳过(历史重复):[问题标题列表]
历史记录:已写入 {baseDir}/data/history.json(当前共 N 条)
Use {baseDir}/references/manual-test-checklist.md after changes to the workflow or prompt contract.