f2s-kb-add

A workflow for adding an implemented capability to a project knowledge base. It combines information from several source files, creates a draft, and produces final topic, index, and manifest files.

In plain words
What is it for?
Use it to document existing capabilities from multiple files, coordinate parallel source review, merge findings, remove duplicates, and write the resulting knowledge-base files.
Why use it?
It gives large or scattered source material a consistent path into the knowledge base. It also sets rules for when to split reading among helper agents and how to check overlaps or contradictions.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/double-coding-lab/flow2spec/f2s-kb-add
Any agent
npx skills add double-coding-lab/Flow2Spec --skill f2s-kb-add
Clone the repo
git clone --depth 1 https://github.com/double-coding-lab/Flow2Spec

Made for: Claude Code, Codex.

Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,691 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00055 $0.02691
Opus 5 $0.00028 $0.01345
Sonnet 5 $0.00011 $0.00538
Haiku 4.5 $0.00006 $0.00269

Measured 2d ago against content hash b03d7051cbf0, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

f2s-kb-add scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/f2s-kb-add/SKILL.md · 133 lines

How it starts

The opening of the file, as written. The whole thing — 133 lines — stays where its author put it; the contents beside it link to each section on GitHub.

执行口径:本技能只维护 .Knowledge,不改配置根 rules/skills

编排(主 / 子 agent)

  • subAgent / switchAgentVerification 两字段语义以统一入口为唯一事实源:Cursor/Claude 读配置根 rules/f2s-flow2spec-unified-entry.*Codex.codex/topics/f2s-flow2spec-unified-entry.md(与上同源,flow2spec init 镜像)。
  • 默认不拆子:主会话全流程完成;低于阈值时拆子收益低于 context 切换成本。
  • 拆子阈值(仅当 subAgent=true 且任一满足):① 输入路径 ≥ 5;② 单源文件 > ~3000 行;③ 多路径总量 > ~10000 行。
  • 拆子策略(仅在达到拆子阈值且 subAgent=true 时启用)
    • B 模式(默认,单轮并行):主先产出「inventory(待解析源文档路径清单 + 核心能力名,主手写,禁止子 agent 自行增删)」+「扫描契约(每个源读哪些章节 / 行号范围、禁扫目录、统一产出字段与表头)」→ 子 agent 并行只读按表填写 → 主一轮合并 + 去重 → 写 .Knowledge/stock-docs/<方案名>_初稿.md → 主做用户确认与验收。适合源边界较清晰、中等规模、希望尽快出一版。
    • C 模式(大仓 / 高风险,多轮纠偏):在 B 之前或替代 B 首轮 —— 主先做 inventory → 子并行交表 → 主专做一轮对表(标重合 / 矛盾 / 缺依赖 / 跨源边界)→ 必要时对矛盾点补派小任务或主自读关键点 → 最后主写 / 改定稿。适合多 workspace / monorepo、目录极深、源路径 > 20 条、首轮子表矛盾或空洞明显、多源叙述重合或矛盾严重的场景。
    • 切换判据(任一成立即切到 C):多 workspace / monorepo;目录极深或源路径 > 20 条;首轮子表矛盾 / 空洞明显;多源叙述重合 / 矛盾严重。
  • 子交付硬约束:子 agent 不得自行裁剪源路径范围,必须按主手写 inventory 执行;交付按「子交付 YAML schema」(字段:source / scope / capabilities / cross_refs / pending),禁止散文式回传;子不得写 manifest-routing.json / .Knowledge/index.md;子不得单独宣布「已进知识库」。
  • 主必控:重合判定、终稿定稿、f2s-kb-build 调度、整体验收。
  • 写权硬约束:manifest-routing.json.Knowledge/index.md 恒由主 agent 落盘。
  • 落盘侧自验。

f2s-kb-add:多文件聚合 -> 初稿 -> 终稿 -> 知识路由同步

使用时机

  • 某能力已在代码中落地,但信息分散在多个文件,需沉淀为可检索知识。
  • f2s-doc-arch 区分:doc-arch 产出架构初稿;doc-add 产出“已落地能力”知识沉淀链路。

输入

参数 必填 说明
文件路径列表 一个或多个路径(空格/换行/@);支持源码、配置、文档
方案名 用于生成 <方案名>_初稿.md<方案名>_终稿.md
初稿/终稿路径 默认放 .Knowledge/stock-docs/

无有效路径时中止并要求用户补充。

步骤 0:重合判定(重要)

执行前先对照:

  • .Knowledge/index.md
  • .Knowledge/topics/*.md
  • .Knowledge/stock-docs/*.md

若已有同主题沉淀,优先原位更新,避免重复主题和重复索引行。

步骤 0.5:多模块检测(输入路径 ≥ 2 时必须执行)

  1. 目录聚合:按路径中的功能层目录(如 src/<模块名>/、顶层目录名)对文件分组。
  2. 判定规则(满足任一即判定为「多模块」):
    • 文件分属 ≥ 2 个不同顶层功能目录(如 auth/payment/);
    • 用户在输入中明确提及「多个功能 / 不同模块 / 分别处理」等;
    • 文件名前缀明显不同且无共同父目录。
  3. 单模块(未触发判定):不中断,继续步骤 1,按现有单输出逻辑生成 <方案名>_初稿.md
  4. 多模块(触发判定)暂停,向用户展示分组结果,并询问:
    • 方案 A(推荐):按模块分别生成知识文件 → 每组独立走步骤 1→2→3→4,各自产出 <模块名>_初稿.md / <模块名>_终稿.md
    • 方案 B(合并):忽略模块边界,合并生成一份 <方案名>_初稿.md(原有行为)。
    • 禁止在未获用户明确选择前默认走方案 B 继续执行。
  5. 单模块但 stock-doc 体量大:若单份输入文档或聚合后的源码超过 300–500 行,或涵盖 3 个以上不相干职责域,建议向用户提示"可拆成多份 focused stock-doc,各自对应独立 topic";用户确认继续则不阻断,但在输出摘要中记录"建议后续拆分"。

Read the full file on GitHub · 133 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 133 lines · 55 tokens per session scan A b03d7051cbf0

Subscribe to this mod's changes

f2s-kb-add is a skill published in the GitHub repository double-coding-lab/Flow2Spec (47 stars, last pushed 5d ago), licensed MIT. It adds 55 tokens to every session and 2,691 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens