f2s-kb-build

A project-knowledge builder that creates topics, indexes, and routing files from documents in a .Knowledge/stock-docs folder. It organizes project context so tasks can be directed to the relevant documentation.

In plain words
What is it for?
Use it to generate project context, build knowledge indexes and topic routes, and run the f2s-kb-build or final-context workflow.
Why use it?
It removes the need to maintain these topic and routing files by hand. It also defines which files the main agent and helper agents may change during larger updates.

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-build
Any agent
npx skills add double-coding-lab/Flow2Spec --skill f2s-kb-build
Clone the repo
git clone --depth 1 https://github.com/double-coding-lab/Flow2Spec

Made for: Claude Code, Codex.

Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,346 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.00045 $0.02346
Opus 5 $0.00023 $0.01173
Sonnet 5 $0.00009 $0.00469
Haiku 4.5 $0.00005 $0.00235

Measured 2d ago against content hash 46d8e16ecef1, 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-build 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-build/SKILL.md · 114 lines

How it starts

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

执行口径:本技能只维护 .Knowledgetopics/index/manifest-routing/matchers 分片),不改配置根 rules/skills。不再维护 .Knowledge/manifest-matchers.json(已废弃聚合文件;flow2spec init 会删除遗留副本)。

根据文档生成项目上下文(topics/index/路由清单)

编排(主 / 子 agent)

  • 两字段(subAgent / switchAgentVerification)语义以统一入口为唯一事实源:Cursor/Claude 读配置根 rules/f2s-flow2spec-unified-entry.*Codex.codex/topics/f2s-flow2spec-unified-entry.md(与上同源,flow2spec init 镜像)。本 SKILL 不复述。
  • 首选分支(小变更 → 主全流程):当本次改动 ≤ 2 个新 / 改主题且 ≤ 1 个新 matcher且无跨主题批量引用调整 时,全流程在主 agent 完成,不拆子。
  • 中大变更分支subAgent=true 且超出上述阈值):
    • 主 agent 在主会话中列出文件级契约:子 A 只写 .Knowledge/topics/<foo>.md,子 B 只写 .Knowledge/matchers/<m-foo>.json,路径互不重叠;
    • 子 agent 仅落盘契约内文件,不跨边界;
    • 主 agent 单点编辑 .Knowledge/manifest-routing.json / .Knowledge/index.md(补 taskToTopicRulestopicPathsmatcherPathtopicDependenciestopicMetadata);
    • 主 agent 做整体验收。
  • 不推荐:单个子 agent 同时改 manifest / index / 多份 topics / matchers;以及「子 A 写、子 B 验」。
  • 「一子写、主验」:仅在交付边界极窄(例如只产出 1 个新 matcher 分片草稿,manifest 引用仍由主写)时可接受。
  • 写权硬约束.Knowledge/manifest-routing.json(含 topicMetadata)/ .Knowledge/index.md 恒由主 agent 落盘,子 agent 不得触碰。
  • 默认落盘侧 agent 自验;本 SKILL 不绑定交叉校验。

输入

  • 接收一个参数:URL 或本地路径。
  • 本地路径必须位于 .Knowledge/stock-docs/
  • 须为终稿:推荐文件名含 _终稿.md,或已由 f2s-doc-final 规范化;禁止f2s-doc-arch 产出的 *_初稿.md 作为入参直接执行本技能。
  • 若入参路径含 _初稿、或用户刚完成架构初稿尚未执行 f2s-doc-final停止,回复须先执行 f2s-doc-final <初稿路径>,待终稿落盘后再以终稿路径调用本技能。
  • 若传入 .Knowledge/req-docs/,提示用户先整理为 stock-docs 终稿后再执行。

生成原则

  1. 拆解:文档较长或包含多块独立能力时,拆分为多个 topic;避免把无关能力塞到同一主题。
  2. 分工
  • topics/:规则与流程正文(可执行知识)
  • index.md:主题索引与语义说明(人读入口)
  • manifest-routing.json + taskToTopicRules[].matcherPath 指向的 matchers/*.json:任务路由与关键词词表(机读入口)

步骤 1:获取文档内容

  • URL:抓取正文;无法访问时提示用户先落地到 .Knowledge/stock-docs/*.md
  • 本地路径:读取 Markdown 文档,提炼主题与能力边界。

步骤 2:语义分析(必须)

从文档中提炼:

  • 主题名与主题意图(可形成 topic id)
  • 核心概念与关键流程
  • 业务规则与边界条件
  • 任务触发词(写入对应 matchers/<matcherId>.jsonincludeAny
  • 与现有主题的依赖关系(用于 topicDependencies

Read the full file on GitHub · 114 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 · 114 lines · 45 tokens per session scan A 46d8e16ecef1

Subscribe to this mod's changes

f2s-kb-build is a skill published in the GitHub repository double-coding-lab/Flow2Spec (47 stars, last pushed 5d ago), licensed MIT. It adds 45 tokens to every session and 2,346 once invoked, about $0.0002 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

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

agent-host-chat-contributions

Build and review cross-cutting agent-host chat behavior through lifecycle contributions. Use when adding turn lifecycle side effects, prompt or context injection, restored-history transformation, protocol-action observation, or when reviewing changes that add code to AgentSideEffects or AgentService.

microsoft/vscode · 56 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