Skip to content
Writing
Skill

/webnovel-learn

从当前会话提取成功写作模式并写入 project_memory.json

From plugin
webnovel-writer
6.4k8 skills4 agents
Install
$ npx -y skills add lingfengqaq/webnovel-writer --skill webnovel-learn --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/webnovel-learn

Context preview

The summary Claude sees to decide when to auto-load this skill.

从当前会话提取成功写作模式并写入 project_memory.json

SKILL.md

webnovel-learn.SKILL.md
name: webnovel-learn
description: 从当前会话提取成功写作模式并写入 project_memory.json
allowed-tools: Read Bash
argument-hint: "[要记住的写作经验]"

/webnovel-learn

Project Root Guard(必须先确认)

  • 必须在项目根目录执行(需存在 `.webnovel/state.json`)
  • 用统一入口解析项目根,避免写错目录:
export WORKSPACE_ROOT="${CLAUDE_PROJECT_DIR:-$PWD}"
export SCRIPTS_DIR="${CLAUDE_PLUGIN_ROOT:?}/scripts"
export PROJECT_ROOT="$(python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "${WORKSPACE_ROOT}" where)"

目标

提取可复用的写作模式(钩子/节奏/对话/微兑现等),追加到 `.webnovel/project_memory.json`。

执行流程

1. 读取 `"$PROJECT_ROOT/.webnovel/state.json"` 的 `progress.current_chapter` 作为当前章节号;缺失则用 `source_chapter: null`,不阻断。 2. 解析用户输入(`/webnovel-learn` 后的经验文本;为空则取本次对话中用户认可的写法),归类 `pattern_type`(hook/pacing/dialogue/payoff/emotion/format/other,无法归类用 `other`)。 3. 调用 `project-memory add-pattern` 写入,不得手写或拼接 JSON:

python -X utf8 "${SCRIPTS_DIR}/webnovel.py" --project-root "${PROJECT_ROOT}" project-memory add-pattern \
  --pattern-type "{pattern_type}" \
  --description "{用户输入或提炼后的完整描述}" \
  --category "{分类,可空}" \
  --importance "{high|medium|low}"

约束

  • 不删除旧记录,仅追加。
  • 追加前扫描已有 `patterns`;`pattern_type` + `description` 完全相同则跳过并告知用户,部分相似不去重。
  • 禁止使用 `Write` 或手工编辑 `.webnovel/project_memory.json`。

成功标准

  • `project_memory.json` 存在且格式合法,新 pattern 已追加到 `patterns` 数组。
  • 输出包含 `status: success` 和完整 `learned` 对象。

失败恢复

| 故障 | 恢复方式 | |------|---------| | `project_memory.json` 不存在 | 脚本自动初始化 `{"patterns": []}` 后继续 | | JSON 解析失败 | 不写入脏数据,告知用户文件损坏并建议手动修复 | | `state.json` 缺失无法取章节号 | 用 `source_chapter: null`,不阻断 |

Read more
Ships withwebnovel-writer

一个跑在 Claude Code 上的长篇网文创作插件。从初始化设定、规划卷纲,到写章、审查、沉淀记忆、查询状态,再到一个只读的可视化面板——整条创作流程都给你串好了。 它想解决的其实就一件事:让 AI 写到几百章,依然记得住设定、接得住伏笔、守得住大纲。 一句话定位:这是一套面向长篇连载的一致性系统,不是写完就忘的一次性生成器。 下一代 v7 设计已经进入公开意见征集期,欢迎阅读 Discussions #118:v7 设计公示 并留下反馈。只看 Issue 区的用户也可以从 Issue #119:v7

Get the whole plugin