From webnovel-writer
Writes webnovel chapters (2000-2500 words) via workflow: context, draft, style adapt, review, polish, data extraction. Use /webnovel-write or auto-activates on requests.
npx claudepluginhub lingfengqaq/webnovel-writer --plugin webnovel-writerThis skill is limited to using the following tools:
- 以稳定流程产出可发布章节:优先使用 `正文/第{NNNN}章-{title_safe}.md`,无标题时回退 `正文/第{NNNN}章.md`。
references/core-constraints.mdreferences/polish-guide.mdreferences/step-1.5-contract.mdreferences/step-3-review-gate.mdreferences/step-5-debt-switch.mdreferences/style-adapter.mdreferences/style-variants.mdreferences/workflow-details.mdreferences/writing/combat-scenes.mdreferences/writing/desire-description.mdreferences/writing/dialogue-writing.mdreferences/writing/emotion-psychology.mdreferences/writing/genre-hook-payoff-library.mdreferences/writing/scene-description.mdreferences/writing/typesetting.mdConducts multi-round deep research on GitHub repos via API and web searches, generating markdown reports with executive summaries, timelines, metrics, and Mermaid diagrams.
Dynamically discovers and combines enabled skills into cohesive, unexpected delightful experiences like interactive HTML or themed artifacts. Activates on 'surprise me', inspiration, or boredom cues.
Generates images from structured JSON prompts via Python script execution. Supports reference images and aspect ratios for characters, scenes, products, visuals.
正文/第{NNNN}章-{title_safe}.md,无标题时回退 正文/第{NNNN}章.md。review_metrics、summaries、chapter_meta。--fast/--minimal 只允许降级可选环节。/webnovel-write:Step 1 → 2A → 2B → 3 → 4 → 5 → 6/webnovel-write --fast:Step 1 → 2A → 3 → 4 → 5 → 6(跳过 2B)/webnovel-write --minimal:Step 1 → 2A → 3(仅3个基础审查)→ 4 → 5 → 6最小产物(所有模式):
正文/第{NNNN}章-{title_safe}.md 或 正文/第{NNNN}章.mdindex.db.review_metrics 新纪录(含 overall_score).webnovel/summaries/ch{NNNN}.md.webnovel/state.json 的进度与 chapter_meta 更新--fast / --minimal 只允许按上方定义裁剪步骤,不允许自创混合模式、"半步"或"简化版"。路径约定:
references/... 相对当前 skill 目录。../../references/... 指向全局共享参考。references/step-3-review-gate.md
references/step-5-debt-switch.md
../../references/shared/core-constraints.md
references/polish-guide.md
references/writing/typesetting.md
references/style-adapter.md
--fast/--minimal 跳过)。references/style-variants.md
../../references/reading-power-taxonomy.md
../../references/genre-profiles.md
state.project.genre 已知时加载。references/writing/genre-hook-payoff-library.md
esports/livestream/cosmic-horror 时必读。references/writing/combat-scenes.md
references/writing/dialogue-writing.md
references/writing/emotion-psychology.md
references/writing/scene-description.md
references/writing/desire-description.md
Read/Grep:读取 state.json、大纲、章节正文与参考文件。Bash:运行 extract_chapter_context.py、index_manager、workflow_manager。Task:调用 context-agent、审查 subagent、data-agent 并行执行。必须做:
.webnovel/state.json。大纲/总纲.md、${CLAUDE_PLUGIN_ROOT}/scripts/extract_chapter_context.py 存在。WORKSPACE_ROOT:Claude Code 打开的工作区根目录(可能是书项目的父目录,例如 D:\wk\xiaoshuo)PROJECT_ROOT:真实书项目根目录(必须包含 .webnovel/state.json,例如 D:\wk\xiaoshuo\凡人资本论)SKILL_ROOT:skill 所在目录(固定 ${CLAUDE_PLUGIN_ROOT}/skills/webnovel-write)SCRIPTS_DIR:脚本目录(固定 ${CLAUDE_PLUGIN_ROOT}/scripts)chapter_num:当前章号(整数)chapter_padded:四位章号(如 0007)环境设置(bash 命令执行前):
export WORKSPACE_ROOT="${CLAUDE_PROJECT_DIR:-$PWD}"
export SCRIPTS_DIR="${CLAUDE_PLUGIN_ROOT:?CLAUDE_PLUGIN_ROOT is required}/scripts"
export SKILL_ROOT="${CLAUDE_PLUGIN_ROOT:?CLAUDE_PLUGIN_ROOT is required}/skills/webnovel-write"
python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "${WORKSPACE_ROOT}" preflight
export PROJECT_ROOT="$(python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "${WORKSPACE_ROOT}" where)"
硬门槛:preflight 必须成功。它统一校验 CLAUDE_PLUGIN_ROOT 派生出的 SKILL_ROOT / SCRIPTS_DIR、webnovel.py、extract_chapter_context.py 和解析出的 PROJECT_ROOT。任一失败都立即阻断。
输出:
python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "${PROJECT_ROOT}" workflow start-task --command webnovel-write --chapter {chapter_num} || true
python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "${PROJECT_ROOT}" workflow start-step --step-id "Step 1" --step-name "Context Agent" || true
python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "${PROJECT_ROOT}" workflow complete-step --step-id "Step 1" --artifacts '{"ok":true}' || true
python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "${PROJECT_ROOT}" workflow complete-task --artifacts '{"ok":true}' || true
要求:
--step-id 仅允许:Step 1 / Step 2A / Step 2B / Step 3 / Step 4 / Step 5 / Step 6。complete-step(失败不阻断)。使用 Task 调用 context-agent,参数:
chapterproject_rootstorage_path=.webnovel/state_file=.webnovel/state.json硬要求:
state 或大纲不可用,立即阻断并返回缺失项。输出:
执行前必须加载:
cat "${SKILL_ROOT}/../../references/shared/core-constraints.md"
硬要求:
正文/第{chapter_padded}章-{title_safe}.md,否则回退为 正文/第{chapter_padded}章.md。[TODO]、[待补充])。中文思维写作约束(硬规则):
--fast)、checker id(consistency-checker)、DB 字段名(anti_ai_force_check)、JSON 键名等不可改的接口名保持英文,其余一律使用简体中文。输出:
--fast / --minimal 跳过)执行前加载:
cat "${SKILL_ROOT}/references/style-adapter.md"
硬要求:
输出:
执行前加载:
cat "${SKILL_ROOT}/references/step-3-review-gate.md"
调用约束:
Task 调用审查 subagent,禁止主流程伪造审查结论。issues/severity/overall_score。auto 路由:根据“本章执行合同 + 正文信号 + 大纲标签”动态选择审查器。核心审查器(始终执行):
consistency-checkercontinuity-checkerooc-checker条件审查器(auto 命中时执行):
reader-pull-checkerhigh-point-checkerpacing-checker模式说明:
--fast:核心 3 个 + auto 命中的条件审查器--minimal:只跑核心 3 个(忽略条件审查器)审查指标落库(必做):
python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "${PROJECT_ROOT}" index save-review-metrics --data "@${PROJECT_ROOT}/.webnovel/tmp/review_metrics.json"
review_metrics 字段约束(当前工作流约定只传以下字段):
{
"start_chapter": 100,
"end_chapter": 100,
"overall_score": 85.0,
"dimension_scores": {"爽点密度": 8.5, "设定一致性": 8.0, "节奏控制": 7.8, "人物塑造": 8.2, "连贯性": 9.0, "追读力": 8.7},
"severity_counts": {"critical": 0, "high": 1, "medium": 2, "low": 0},
"critical_issues": ["问题描述"],
"report_file": "审查报告/第100-100章审查报告.md",
"notes": "单个字符串;selected_checkers / timeline_gate / anti_ai_force_check 等扩展信息压成单行文本写入此字段"
}
notes 在当前执行契约中必须是单个字符串,不得传入对象或数组。硬要求:
--minimal 也必须产出 overall_score。review_metrics 不得进入 Step 5。执行前必须加载:
cat "${SKILL_ROOT}/references/polish-guide.md"
cat "${SKILL_ROOT}/references/writing/typesetting.md"
执行顺序:
critical(必须)high(不能修复则记录 deviation)medium/low(按收益择优)anti_ai_force_check: pass/fail)输出:
anti_ai_force_check)使用 Task 调用 data-agent,参数:
chapterchapter_file 必须传入实际章节文件路径;若详细大纲已有章节名,优先传 正文/第{chapter_padded}章-{title_safe}.md,否则传 正文/第{chapter_padded}章.mdreview_score=Step 3 overall_scoreproject_rootstorage_path=.webnovel/state_file=.webnovel/state.jsonData Agent 默认子步骤(全部执行):
rag index-chapter --scenes ...)style extract --scenes ...,仅 review_score >= 80 时)--scenes 来源优先级(G/H 步骤共用):
index.db 的 scenes 记录获取(Step F 写入的结果)start_line / end_line 从正文切片构造Step 5 失败隔离规则:
--scenes 缺失、scene 为空、scene JSON 格式错误:只补跑 G/H 子步骤,不回滚或重跑 Step 1-4。执行后检查(最小白名单):
.webnovel/state.json.webnovel/index.db.webnovel/summaries/ch{chapter_padded}.md.webnovel/observability/data_agent_timing.jsonl(观测日志)性能要求:
TOTAL > 30000ms 时,输出最慢 2-3 个环节与原因说明。观测日志说明:
call_trace.jsonl:外层流程调用链(agent 启动、排队、环境探测等系统开销)。data_agent_timing.jsonl:Data Agent 内部各子步骤耗时。债务利息:
step-5-debt-switch.md)。git add .
git -c i18n.commitEncoding=UTF-8 commit -m "第{chapter_num}章: {title}"
规则:
第{chapter_num}章: {title}。未满足以下条件前,不得结束流程:
正文/第{chapter_padded}章-{title_safe}.md 或 正文/第{chapter_padded}章.mdoverall_score 且 review_metrics 成功落库critical,high 未修项有 deviation 记录anti_ai_force_check=pass(基于全文检查;fail 时不得进入 Step 5)state.json、index.db、summaries/ch{chapter_padded}.md执行检查:
test -f "${PROJECT_ROOT}/.webnovel/state.json"
test -f "${PROJECT_ROOT}/正文/第${chapter_padded}章.md"
test -f "${PROJECT_ROOT}/.webnovel/summaries/ch${chapter_padded}.md"
python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "${PROJECT_ROOT}" index get-recent-review-metrics --limit 1
tail -n 1 "${PROJECT_ROOT}/.webnovel/observability/data_agent_timing.jsonl" || true
成功标准:
overall_score 与 Step 5 输入一致。触发条件:
恢复流程: