Skip to content

zjs105910/workbuddy-market / bundled/novel-writing-suite/skills/story-long-write

story-long-write

Verified

长篇网文规划与写作。支持只讨论结构、只写大纲或指定细纲,明确要求正文后再写章节。触发方式:/story-long-write、/写长篇、「帮我开书」「定设定」「出卷纲」「规划剧情」「写大纲」「补细纲」「日更」「续写」「继续写」「修改第X章」「回炉」「重写第X章」。

FileKindSize
SKILL.mdskill md14.2 KB
references/agent-calls.mdmarkdown7.3 KB
references/anti-ai-writing.mdmarkdown36.3 KB
references/artifact-protocols.mdmarkdown14.5 KB
references/author-memory-maintenance.mdmarkdown8.6 KB
references/author-memory.mdmarkdown11.3 KB
references/banned-words.mdmarkdown10.2 KB
references/benchmark-recall.mdmarkdown5.5 KB
references/character-basics.mdmarkdown16.5 KB
references/character-design-methods.mdmarkdown15.9 KB
references/character-relations.mdmarkdown17.4 KB
references/commercial-core-methods.mdmarkdown20.2 KB
references/cross-book-recall.mdmarkdown7.1 KB
references/deslop-gates.mdmarkdown14.1 KB
references/dialogue-mastery.mdmarkdown11.5 KB
references/emotion-on-page.mdmarkdown4.6 KB
references/emotional-arc-design.mdmarkdown12.0 KB
references/emotional-methods.mdmarkdown9.9 KB
references/female-audience-writing.mdmarkdown11.2 KB
references/genre-prose-cards.mdmarkdown7.0 KB
references/genre-prose-cards/东方仙侠.mdmarkdown2.7 KB
references/genre-prose-cards/传统玄幻.mdmarkdown2.7 KB
references/genre-prose-cards/历史古代.mdmarkdown2.6 KB
references/genre-prose-cards/历史脑洞.mdmarkdown2.9 KB
references/genre-prose-cards/双男主.mdmarkdown3.2 KB
references/genre-prose-cards/古言脑洞.mdmarkdown2.6 KB
references/genre-prose-cards/古风世情.mdmarkdown2.6 KB
references/genre-prose-cards/女频悬疑.mdmarkdown2.6 KB
references/genre-prose-cards/女频种田.mdmarkdown2.6 KB
references/genre-prose-cards/宫斗宅斗.mdmarkdown2.5 KB
references/genre-prose-cards/年代.mdmarkdown3.0 KB
references/genre-prose-cards/快穿.mdmarkdown2.8 KB
references/genre-prose-cards/悬疑灵异.mdmarkdown2.6 KB
references/genre-prose-cards/悬疑脑洞.mdmarkdown2.7 KB
references/genre-prose-cards/战神赘婿.mdmarkdown2.7 KB
references/genre-prose-cards/抗战谍战.mdmarkdown2.7 KB
references/genre-prose-cards/星光璀璨.mdmarkdown2.7 KB
references/genre-prose-cards/民国言情.mdmarkdown2.8 KB
references/genre-prose-cards/游戏体育.mdmarkdown2.8 KB
references/genre-prose-cards/玄幻脑洞.mdmarkdown2.9 KB
references/genre-prose-cards/玄幻言情.mdmarkdown2.5 KB
references/genre-prose-cards/现言脑洞.mdmarkdown2.7 KB
references/genre-prose-cards/科幻末世.mdmarkdown2.6 KB
references/genre-prose-cards/职场婚恋.mdmarkdown2.6 KB
references/genre-prose-cards/西方奇幻.mdmarkdown2.8 KB
references/genre-prose-cards/豪门总裁.mdmarkdown3.3 KB
references/genre-prose-cards/都市修真.mdmarkdown2.5 KB
references/genre-prose-cards/都市日常.mdmarkdown3.7 KB
references/genre-prose-cards/都市种田.mdmarkdown2.5 KB
references/genre-prose-cards/都市脑洞.mdmarkdown3.4 KB
references/genre-prose-cards/都市高武.mdmarkdown2.9 KB
references/genre-prose-cards/青春甜宠.mdmarkdown2.7 KB
references/genre-readers.mdmarkdown10.7 KB
references/long-chapter-hooks.mdmarkdown8.6 KB
references/long-chapter-quality.mdmarkdown8.6 KB
references/long-format.mdmarkdown2.5 KB
references/long-genre-catalog.mdmarkdown17.0 KB
references/long-genre-mechanics.mdmarkdown17.0 KB
references/long-reversal.mdmarkdown15.2 KB
references/long-suspense.mdmarkdown15.2 KB
references/opening-design.mdmarkdown12.5 KB
references/outline-conflict.mdmarkdown17.2 KB
references/outline-methods.mdmarkdown10.6 KB
references/outline-rhythm.mdmarkdown12.6 KB
references/outline-structure-theory.mdmarkdown12.4 KB
references/plot-core-methods.mdmarkdown19.8 KB
references/plot-emotion-system.mdmarkdown15.5 KB
references/plot-frameworks.mdmarkdown27.1 KB
references/plot-special-topics.mdmarkdown25.0 KB
references/project-files.mdmarkdown11.6 KB
references/reader-contract-and-progression.mdmarkdown11.3 KB
references/reference-index.mdmarkdown6.0 KB
references/stop-and-fix.mdmarkdown940 B
references/style-combat-face.mdmarkdown16.9 KB
references/style-craft.mdmarkdown13.1 KB
references/style-genre-modules.mdmarkdown24.2 KB
references/style-resolution.mdmarkdown3.9 KB
references/tracking-initialization.mdmarkdown1.3 KB
references/tracking-transaction.mdmarkdown14.9 KB
references/workflow-chapter.mdmarkdown14.4 KB
references/workflow-daily.mdmarkdown7.5 KB
references/workflow-outline.mdmarkdown20.7 KB
references/workflow-revision.mdmarkdown6.6 KB
references/workflow-setup.mdmarkdown13.4 KB
references/workflow-volume.mdmarkdown17.1 KB
references/writer-prompt-fallback.mdmarkdown3.5 KB
references/writing-craft.mdmarkdown28.1 KB
scripts/author_memory_commit.pyscript77.9 KB
scripts/build_architect_brief.pyscript15.8 KB
scripts/build_writer_prompt.pyscript31.8 KB
scripts/check-ai-patterns.jsscript73.5 KB
scripts/check-degeneration.jsscript14.8 KB
scripts/check-outline-contract.jsscript23.4 KB
scripts/check-outline-copy.jsscript13.0 KB
scripts/normalize-punctuation.jsscript13.2 KB
scripts/outline_view.pyscript11.8 KB
scripts/storyctl.pyscript25.0 KB
scripts/style-whitelist.jsscript1.1 KB
scripts/tracking_commit.pyscript81.8 KB
scripts/wordcount_core.pyscript17.9 KB

scripts/outline_view.py

View on GitHub
#!/usr/bin/env python3
"""卷纲取段器 —— 让「不整读卷纲」成立。

按声明作用域选取卷级、单元级和批次材料;未声明的旧段保守纳入并告警。

段头约定(每个 ## / ### / #### 标题的**下一行非空行**):

    > 作用域:卷级常任
    > 作用域:单元级 D1-03
    > 作用域:批次底稿 D1-03|状态:在用
    > 作用域:批次底稿 D1-02|状态:已退役

退役行(行内覆盖):以 `⊘` 起头的列表行 / 表格行,默认过滤。

用法:
    outline_view.py --toc   卷纲.md
    outline_view.py --unit D1-03 卷纲.md
    outline_view.py --contract 卷纲.md
    outline_view.py --check 卷纲.md
    任意子命令加 --history 连退役行一起输出
"""
import argparse
import io
import re
import sys

HEADING = re.compile(r"^(#{2,4})\s+(.*\S)\s*$")
SCOPE = re.compile(r"^>\s*作用域[::]\s*(.+?)\s*$")
RETIRED_LINE = re.compile(r"^\s*(?:[-*]\s*)?⊘|^\s*\|\s*⊘")
# 单元块内不该出现的全卷字样——出现即说明这条常任规则放错了地方
LEAK = re.compile(r"全卷常任|全程生效|全卷生效|本单元起常任|自 ?[LD]\d+-\d+ ?起生效")
# 指向卷级的指针行不算泄漏:单元块可以引用常任规则,不可以复述它
POINTER = re.compile(r"全卷常任裁定|已提为卷级|不复读|规则本身见|见「全卷")
UNIT_IN_TITLE = re.compile(r"(?<![\w-])([LD]\d+-\d+|U\d+)(?![\w-])")
# 批次底稿里出现跨章祈使=这条约束在写作期还有效,而写作档不给底稿 → 必须下沉
IMPERATIVE = re.compile(r"全程不许|一律不许|往后任何章|此后不再|往后每|从此不|终局前不")
CH_RANGE = re.compile(r"章节范围[::]\s*第\s*(\d+)\s*[-–—~至]\s*(\d+)\s*章")
# 情绪弧线逐章行:首列写「12」或模板里的「第12章」都认
ARC_ROW = re.compile(r"^\|\s*第?\s*(\d+)\s*章?\s*\|")


def read(path):
    with io.open(path, encoding="utf-8-sig") as handle:
        return handle.read()


class Section:
    __slots__ = ("level", "title", "start", "end", "scope", "kind",
                 "unit", "status", "lines")

    def __init__(self, level, title, start):
        self.level = level
        self.title = title
        self.start = start          # 标题行号(0 基)
        self.end = None
        self.scope = None           # 原始作用域串,None = 未声明
        self.kind = None            # 卷级常任 / 单元级 / 批次底稿
        self.unit = None
        self.status = "在用"
        self.lines = []


def parse(text):
    lines = text.split("\n")
    sections = []
    fence = None
    for index, line in enumerate(lines):
        marker = re.match(r"^\s{0,3}(`{3,}|~{3,})", line)
        if marker:
            value = marker.group(1)
            if fence is None:
                fence = value
            elif value[0] == fence[0] and len(value) >= len(fence):
                fence = None
            continue
        if fence:
            continue
        match = HEADING.match(line)
        if match:
            if sections:
                sections[-1].end = index
            sections.append(Section(len(match.group(1)), match.group(2), index))
    if sections:
        sections[-1].end = len(lines)
    for section in sections:
        section.lines = lines[section.start:section.end]
        for candidate in section.lines[1:]:
            if not candidate.strip():
                continue
            scope_match = SCOPE.match(candidate)
            if scope_match:
                section.scope = scope_match.group(1)
            break
        if section.scope:
            head = section.scope.split("|")[0].strip()
            if head == "卷级常任":
                section.kind = "卷级常任"
            elif re.fullmatch(r"单元级(?:\s+[A-Za-z][\w-]*)?", head):
                section.kind = "单元级"
            elif re.fullmatch(r"批次底稿(?:\s+[A-Za-z][\w-]*)?", head):
                section.kind = "批次底稿"
            found = re.search(r"^(?:单元级|批次底稿)\s+([A-Za-z][\w-]*)$", head)
            if found:
                section.unit = found.group(1)
            if "已退役" in section.scope:
                section.status = "已退役"
        if section.unit is None:
            found = re.search(r"剧情单元\s+([A-Za-z][\w-]*)", section.title) or UNIT_IN_TITLE.search(section.title)
            if found:
                section.unit = found.group(1)
        if section.unit is None and section.scope is None:
            for line in section.lines[1:]:
                field = re.match(r"^\s*[-*+]\s*单元ID\s*[::]\s*([A-Za-z][\w-]*)\s*$", line.replace("**", ""))
                if field:
                    section.unit = field.group(1)
                    break
    return lines, sections


def strip_retired(block_lines, keep_history):
    if keep_history:
        return block_lines
    return [line for line in block_lines if not RETIRED_LINE.match(line)]


def unit_chapter_range(sections, unit):
    for section in sections:
        if section.unit == unit and section.kind == "单元级" and "剧情单元" in section.title:
            for line in section.lines:
                found = CH_RANGE.search(line)
                if found:
                    return int(found.group(1)), int(found.group(2))
    return None


def slice_arc(section, span):
    """情绪弧线这类逐章表:只留本单元章区间的行,表头与说明照留。"""
    if span is None:
        return section.lines
    low, high = span
    kept = []
    for line in section.lines:
        row = ARC_ROW.match(line)
        if row and not (low <= int(row.group(1)) <= high):
            continue
        kept.append(line)
    return kept


def emit(sections, chosen, span, keep_history, note, preamble):
    out = ["\n".join(strip_retired(preamble, keep_history)).rstrip()] if preamble else []
    for section in sections:
        if section not in chosen:
            continue
        body = section.lines
        if "情绪弧线" in section.title or "排班" in section.title:
            body = slice_arc(section, span)
        body = strip_retired(body, keep_history)
        out.append("\n".join(body).rstrip())
    text = "\n\n".join(out)
    sys.stdout.write(text + "\n")
    if note:
        sys.stderr.write(note + "\n")


def cmd_toc(sections):
    print("%-3s %-6s %-9s %-8s %-46s %s" %
          ("#", "行", "作用域", "单元", "段", "字符"))
    for number, section in enumerate(sections, 1):
        size = sum(len(line) + 1 for line in section.lines)
        print("%-3d %-6d %-9s %-8s %-46s %d" %
              (number, section.start + 1, section.kind or "**未声明**",
               (section.unit or "-") + ("(退)" if section.status == "已退役" else ""),
               section.title[:44], size))


def cmd_check(sections, strict=False):
    problems = []
    warnings = []
    for section in sections:
        if section.kind == "批次底稿":
            for offset, line in enumerate(section.lines):
                if IMPERATIVE.search(line):
                    warnings.append(
                        ("W1", "第%d行" % (section.start + offset + 1),
                         "批次底稿里有跨章祈使,写作档不给底稿——确认已下沉到单元级段或细纲:%s"
                         % line.strip()[:52]))
    for section in sections:
        where = "第%d行「%s」" % (section.start + 1, section.title[:36])
        if section.scope is None:
            (problems if strict else warnings).append(("E1" if strict else "W2", where, "缺「> 作用域:」声明行;旧段保守纳入"))
            continue
        if section.kind is None:
            problems.append(("E2", where, "作用域值不认识:%s" % section.scope))
        if section.kind in ("单元级", "批次底稿") and section.unit is None:
            problems.append(("E3", where, "单元级/批次底稿段未标单元ID"))
        if section.kind in ("单元级", "批次底稿"):
            for offset, line in enumerate(section.lines):
                if LEAK.search(line) and not POINTER.search(line):
                    problems.append(
                        ("E4", "第%d行" % (section.start + offset + 1),
                         "单元块内出现全卷字样,常任规则放错了位置:%s"
                         % line.strip()[:56]))
    for code, where, message in problems + warnings:
        print("%s %s %s" % (code, where, message))
    print("---")
    print("段 %d / 问题 %d / 告警 %d(告警不阻断,逐条人工判断)"
          % (len(sections), len(problems), len(warnings)))
    return 1 if problems else 0


def main():
    parser = argparse.ArgumentParser(add_help=True)
    parser.add_argument("path")
    parser.add_argument("--toc", action="store_true")
    parser.add_argument("--unit")
    parser.add_argument("--contract", action="store_true")
    parser.add_argument("--check", action="store_true")
    parser.add_argument("--history", action="store_true")
    parser.add_argument("--strict", action="store_true", help="新建卷纲校验:缺作用域也视为错误")
    # 排纲底稿现在放在卷纲外的 大纲/排纲底稿_{单元ID}.md,默认输出就是写作要的闭包。
    # --stage outline 只为老卷纲保留:它们的供给自查等底稿还写在卷纲里(作用域:批次底稿)。
    parser.add_argument("--stage", choices=["outline", "write"], default="write",
                        help="write(默认)=卷级常任+单元级;"
                             "outline=另带老卷纲里仍在用的批次底稿段")
    args = parser.parse_args()

    if hasattr(sys.stdout, "reconfigure"):
        sys.stdout.reconfigure(encoding="utf-8")
        sys.stderr.reconfigure(encoding="utf-8")

    try:
        lines, sections = parse(read(args.path))
    except (OSError, UnicodeError) as error:
        sys.stderr.write(f"无法读取卷纲:{error}\n")
        return 2
    if not sections:
        sys.stderr.write("卷纲里没有 ## 段,路径对不对?\n")
        return 2

    if args.toc:
        cmd_toc(sections)
        return 0
    if args.check:
        return cmd_check(sections, args.strict)

    invalid = [s for s in sections if s.scope and
               (s.kind is None or (s.kind != "卷级常任" and s.unit is None))]
    if invalid:
        sys.stderr.write("作用域声明无效,先运行 --check 修正\n")
        return 1
    active = [s for s in sections if args.history or s.status != "已退役"]
    permanent = [s for s in active if s.kind == "卷级常任"]
    undeclared = [s for s in active if s.scope is None]
    note = ("%d 段未声明作用域,已保守纳入;用 --check 查看" % len(undeclared)) if undeclared else None
    preamble = lines[:sections[0].start]
    if args.contract:
        emit(sections, set(permanent + undeclared), None, args.history, note, preamble)
        return 0

    if args.unit:
        unit = args.unit
        owned = [s for s in active if s.unit == unit]
        if not owned:
            sys.stderr.write(
                "找不到单元 %s —— 不静默降级。核对单元ID,或先补卷纲。\n" % unit)
            return 1
        if args.stage == "write":
            # 写作档不给批次底稿:它是排纲期的工作底稿,其中有写作期约束力的条目
            # 必须已经下沉到单元级段或细纲(见 artifact-protocols.md 段位契约纪律④)
            live = [s for s in owned if s.kind == "单元级"]
        else:
            live = [s for s in owned
                    if s.kind == "单元级"
                    or s.kind == "批次底稿"]
        chosen = set(permanent + live + undeclared)
        span = unit_chapter_range(active, unit)
        emit(sections, chosen, span, args.history, note, preamble)
        return 0

    parser.print_help()
    return 2


if __name__ == "__main__":
    sys.exit(main())
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 196kUpdated Claude CodeCodexVerifiedInstall