SuperAPI AI Directory

webnovel-learn

Writing & research

View repository

Updated 10-15 18:03

About this skill

/webnovel-learn

Project Root Guard (must be confirmed first)

  • Must be executed in the project root directory (requires the existence of .webnovel/state.json)
  • Use the unified entry point to resolve the project root to avoid writing to the wrong directory:
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)"

Goal

Extract reusable writing patterns (hooks/pacing/dialogue/micro-payoffs, etc.) and append them to .webnovel/project_memory.json。

Execution Flow

  1. Read "$PROJECT_ROOT/.webnovel/state.json" 's progress.current_chapter as the current chapter number; if missing, use source_chapter: null, without blocking.
  2. Parse the user input (the experience text after/webnovel-learn ; if empty, take the writing approach approved by the user in this conversation), and categorize it as pattern_type(hook/pacing/dialogue/payoff/emotion/format/other; if it cannot be categorized, use other)。
  3. Call project-memory add-pattern to write; do not hand-write or concatenate 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}"

Constraints

  • Do not delete old records; only append.
  • Before appending, scan existing patterns;pattern_type + description ; if completely identical, skip and inform the user; partially similar entries are not deduplicated.
  • Do not use Write or manually edit .webnovel/project_memory.json。

Success Criteria

  • project_memory.json exists and is in a valid format, and the new pattern has been appended to the patterns array.
  • The output includes status: success and the complete learned object.

Failure Recovery

Failure Recovery Method
project_memory.json does not exist The script automatically initializes {"patterns": []} and then continues
JSON parsing fails Do not write dirty data; inform the user that the file is corrupted and suggest manual repair
state.json is missing, so the chapter number cannot be obtained Use source_chapter: null, without blocking