Skip to content

AINoSleep/book-distiller-skill

book-distiller

Verified

炼金书:输入书名或电子书,自动深度调研→方法论提炼→生成该书的可运行框架Skill。 两种入口:(1)明确书名→直接蒸馏 (2)模糊学习需求→诊断荐书→再蒸馏。 触发词:「蒸馏这本书」「炼金XX」「把XX这本书做成skill」「XX的方法论skill」「更新XX的书skill」。 模糊需求也触发:「我想系统学谈判」「有没有一本书能帮我提升XX」。 English triggers: "distill [book]", "turn [book] into a skill", "book to framework skill". 不在用户只要书摘、读书笔记、买书推荐或查某个概念时触发——只在需要生成「可运行的方法论Skill」时激活。

FileKindSize
SKILL.mdskill md17.9 KB
references/methodology.mdmarkdown3.4 KB
references/template.mdmarkdown3.9 KB
scripts/quality_check.pyscript4.1 KB

scripts/quality_check.py

View on GitHub
#!/usr/bin/env python3
"""
炼金书 · 产物结构自检
对照 Phase 4 通过标准,对生成的 [book]-framework SKILL.md 做确定性检查。
主观项(框架运行 vs 书摘复读)仍需独立agent验证,本脚本只查结构。

用法:
    python quality_check.py <SKILL.md路径>
"""

import sys
import re
from pathlib import Path

def section(content: str, title_pattern: str) -> str:
    """提取某个 ## section 的内容(到下一个 ## 为止)"""
    m = re.search(rf'^##\s+.*(?:{title_pattern}).*$', content, re.MULTILINE)
    if not m:
        return ""
    start = m.end()
    nxt = re.search(r'^##\s+', content[start:], re.MULTILINE)
    return content[start:start + nxt.start()] if nxt else content[start:]

def check(skill_path: Path) -> int:
    content = skill_path.read_text(encoding="utf-8")
    results = []  # (name, passed, detail)

    # 1. 核心方法数量 3-7
    methods_sec = section(content, r'核心方法')
    methods = re.findall(r'^###\s+(?:方法|M)\d', methods_sec, re.MULTILINE)
    n = len(methods)
    results.append(("核心方法数量 3-7", 3 <= n <= 7, f"{n} 个"))

    # 2. 每个方法有 if-then / 证据强度 / 失效条件
    for field in ("if-then", "证据强度", "失效条件"):
        cnt = len(re.findall(re.escape(field), methods_sec))
        results.append((f"每个方法含「{field}」", cnt >= n and n > 0, f"{cnt}/{n}"))

    # 3. 适用边界 ≥3 条
    bounds = section(content, r'适用边界')
    bullets = re.findall(r'^\s*[-*]\s+', bounds, re.MULTILINE)
    results.append(("适用边界 ≥3 条", len(bullets) >= 3, f"{len(bullets)} 条"))

    # 4. 引语 ≤5 且带出处
    quotes_sec = section(content, r'关键引语|调研来源')
    quotes = [q for q in re.findall(r'^>\s+(.+)$', quotes_sec, re.MULTILINE)
              if q.strip() and "本Skill由" not in q and "创建者" not in q]
    quotes_with_src = [q for q in quotes if ('——' in q or '—' in q or '章' in q)]
    results.append(("直接引语 ≤5 句", len(quotes) <= 5, f"{len(quotes)} 句"))
    if quotes:
        results.append(("每句引语带出处", len(quotes_with_src) == len(quotes),
                        f"{len(quotes_with_src)}/{len(quotes)}"))

    # 5. description 含负向触发
    fm = re.search(r'^---\n(.*?)\n---', content, re.DOTALL)
    desc = fm.group(1) if fm else ""
    results.append(("description 含负向触发", "不触发" in desc or "不在" in desc, ""))

    # 6. 必备 section
    for sec_name in ("案例索引", "回答工作流|Agentic Protocol", "调研来源"):
        ok = bool(re.search(rf'^##.*(?:{sec_name})', content, re.MULTILINE))
        results.append((f"含「{sec_name.split('|')[0]}」section", ok, ""))

    # 7. 模型记忆标注一致性(警告级)
    research_dir = skill_path.parent / "references" / "research"
    warn = None
    if research_dir.exists():
        research_text = "".join(p.read_text(encoding="utf-8")
                                for p in research_dir.glob("*.md"))
        if "凭记忆" in research_text and "凭记忆" not in content:
            warn = "⚠️ 底稿含「凭记忆未核」标注但SKILL.md正文未传递——违反模型记忆规则"
        missing = [f"{i:02d}" for i in range(1, 7)
                   if not list(research_dir.glob(f"{i:02d}-*.md"))]
        if missing and "快速档" not in content and "信息不足" not in content:
            warn = (warn or "") + f" ⚠️ 底稿缺 {','.join(missing)} 但正文未声明覆盖缺口"

    # 输出
    print(f"检查对象: {skill_path}\n")
    failed = 0
    for name, ok, detail in results:
        mark = "PASS" if ok else "FAIL"
        if not ok:
            failed += 1
        print(f"  [{mark}] {name}" + (f"  ({detail})" if detail else ""))
    if warn:
        print(f"\n{warn.strip()}")
    print(f"\n结果: {len(results) - failed}/{len(results)} 项通过" +
          ("" if failed == 0 else f",{failed} 项需修复"))
    return 1 if failed else 0

if __name__ == "__main__":
    if len(sys.argv) != 2:
        print(__doc__)
        sys.exit(2)
    sys.exit(check(Path(sys.argv[1])))
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall