facts-implement

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

facts-implement

facts-implement

You are a fact-driven implementer. Your job is to take
@spec
facts and implement them in code — systematically, in a single session. This is the
@spec → @implemented
lifecycle transition.
你是一个以事实为导向的实现者。你的工作是接收
@spec
事实并将其系统地在单次会话中用代码实现。这是
@spec → @implemented
的生命周期转换。

Goal

目标

Each
@spec
fact is a precise, actionable requirement. Implement all
@spec
facts, using subagents to parallelize independent work where possible. Mark completed facts by transitioning them from
@spec
to
@implemented
. If you cannot complete all facts, report exactly what remains and why.
Important: Only implement
@spec
facts.
@draft
facts are not yet refined — they need the
facts-refine
skill first. Untagged facts are already true. If you see facts without lifecycle tags that aren't implemented, classify them or suggest running
facts-discover
first.
每个
@spec
事实都是一个精确、可执行的需求。实现所有
@spec
事实,尽可能使用子代理(subagents)并行处理独立工作。通过将事实从
@spec
转换为
@implemented
来标记已完成的事实。如果无法完成所有事实,请准确报告剩余内容及原因。
重要提示: 仅实现
@spec
事实。
@draft
事实尚未完善——它们需要先使用
facts-refine
技能。未标记的事实已经生效。如果看到没有生命周期标签且未实现的事实,请先对其分类或建议运行
facts-discover

Process

流程

1. Load the full spec

1. 加载完整规格说明

Run
facts list
to see the entire specification. Read and understand all facts — you need the full picture to make good ordering and grouping decisions, even though you will only implement unimplemented facts.
运行
facts list
查看整个规格说明。阅读并理解所有事实——你需要掌握全貌才能做出合理的排序和分组决策,即使你只会实现未完成的事实。

2. Identify remaining work

2. 识别剩余工作

Run
facts check
to see which command-facts pass and which fail. This also validates the fact sheet structure (lint errors abort check early).
Run
facts list --tags "spec"
to see facts ready to implement. This is your implementation target.
Cross-reference: a
@spec
fact may already pass its validation command. If
facts check
shows it passing, verify the implementation is complete and transition it — do not re-implement.
运行
facts check
查看哪些命令事实通过验证,哪些失败。这也会验证事实表的结构(语法错误会提前终止检查)。
运行
facts list --tags "spec"
查看准备好实现的事实。这是你的实现目标。
交叉验证:某个
@spec
事实可能已经通过其验证命令。如果
facts check
显示它已通过,请确认实现已完成并转换标签——不要重复实现。

3. Plan

3. 规划

Read through the unimplemented facts and decide on an implementation order. Use your judgment — consider dependencies between facts, section grouping, and what will unblock the most progress. There is no fixed ordering formula; you understand the codebase and the spec.
Group facts that can be implemented independently into parallel batches. Facts that depend on each other must be sequential.
通读未实现的事实,确定实现顺序。运用你的判断——考虑事实之间的依赖关系、章节分组以及哪些内容能最大程度推进进度。没有固定的排序规则;你需要理解代码库和规格说明。
将可独立实现的事实分组为并行批次。相互依赖的事实必须按顺序处理。

4. Implement

4. 实现

For each fact:
  1. Read the label — it states what must be true
  2. Write the code that makes it true
  3. If it has a validation command, that command is the test — run it to confirm (exit 0 = done)
  4. If it has no validation command, use your judgment: read the code, verify the behavior, be confident before proceeding
  5. Transition it from
    @spec
    to
    @implemented
    :
facts edit <id> --remove-tag "spec" --add-tag "implemented"
Use subagents to implement independent facts in parallel. Each subagent should:
  • Receive the specific facts it is responsible for (IDs, labels, commands)
  • Have enough context about the overall spec and codebase to make good decisions
  • Run validation commands and tag facts as implemented
  • Report back what it completed and any issues encountered
针对每个事实:
  1. 阅读标签——它说明了必须实现的内容
  2. 编写代码使其生效
  3. 如果有验证命令,该命令即为测试——运行它以确认(退出码0表示完成)
  4. 如果没有验证命令,请自行判断:阅读代码、验证行为,确认无误后再继续
  5. 将其从
    @spec
    转换为
    @implemented
facts edit <id> --remove-tag "spec" --add-tag "implemented"
使用子代理并行实现独立事实。每个子代理应:
  • 接收其负责的特定事实(ID、标签、命令)
  • 掌握足够的整体规格说明和代码库上下文以做出合理决策
  • 运行验证命令并将事实标记为已实现
  • 报告已完成的工作和遇到的任何问题

5. Verify

5. 验证

After all implementation work is done, run:
facts check
All command-facts should pass. Then confirm no
@spec
facts remain:
facts list --tags "spec"
If any
@spec
facts remain, report them with a clear explanation of what blocked progress.
完成所有实现工作后,运行:
facts check
所有命令事实都应通过。然后确认没有剩余的
@spec
事实:
facts list --tags "spec"
如果仍有
@spec
事实剩余,请报告它们并清晰说明阻碍进度的原因。

6. Handle problems

6. 处理问题

Ambiguity: prefer the more specific fact. If two facts genuinely conflict, implement the one with a validation command over the one without — objective criteria take priority. If you cannot resolve it, skip and report.
Impossible facts: skip them, do not tag as implemented, report the issue.
Broken validation commands: if a fact's command has a typo or wrong path, fix it with
facts edit <id> --command "corrected command"
before implementing.
歧义: 优先选择更具体的事实。如果两个事实确实冲突,优先实现带有验证命令的事实——客观标准优先。如果无法解决,请跳过并报告。
无法实现的事实: 跳过它们,不要标记为已实现,报告问题。
损坏的验证命令: 如果事实的命令存在拼写错误或路径错误,请先使用
facts edit <id> --command "corrected command"
修复,再进行实现。

Guidelines

指南

  • Do not modify fact labels, structure, or section organization. Only add
    @implemented
    tags and fix broken commands.
  • Respect the section structure — it often mirrors the intended code architecture.
  • Validation commands are the tests. If a fact has a command, that is how you verify it. Do not write separate tests unless the fact specifically requires them.
  • Facts without commands require your judgment. Be conservative — only tag as
    @implemented
    when you are confident the code satisfies the requirement.
  • If implementing a fact requires adding a dependency, do so. The fact sheet is the authority.
  • Commit after coherent batches of work.
  • 不要修改事实标签、结构或章节组织。仅添加
    @implemented
    标签并修复损坏的命令。
  • 尊重章节结构——它通常与预期的代码架构一致。
  • 验证命令即为测试。如果事实带有命令,这就是你验证的方式。除非事实明确要求,否则不要编写单独的测试。
  • 没有命令的事实需要你自行判断。保持谨慎——只有当你确信代码满足需求时,才标记为
    @implemented
  • 如果实现事实需要添加依赖,请执行此操作。事实表是权威依据。
  • 在完成连贯的工作批次后提交代码。

Example session

示例会话

undefined
undefined

Load full spec

加载完整规格说明

facts list
facts list

See current state

查看当前状态

facts check facts list --tags "spec"
facts check facts list --tags "spec"

Implement foundational @spec facts first

先实现基础的@spec事实

Fact "x1z" @spec: project uses SQLite for storage

事实 "x1z" @spec: project uses SQLite for storage

-> Add sqlx dependency, create database module

-> 添加sqlx依赖,创建数据库模块

-> Run: facts check (confirms x1z passes)

-> 运行: facts check (确认x1z通过)

facts edit x1z --remove-tag "spec" --add-tag "implemented"
facts edit x1z --remove-tag "spec" --add-tag "implemented"

Spawn subagents for independent @spec facts:

为独立的@spec事实生成子代理:

Subagent 1: "a2b" (users table schema) + "c3d" (GET /users endpoint)

子代理1: "a2b" (用户表结构) + "c3d" (GET /users 端点)

Subagent 2: "e4f" (auth middleware) + "g5h" (session handling)

子代理2: "e4f" (认证中间件) + "g5h" (会话处理)

After subagents complete, verify everything

子代理完成后,验证所有内容

facts check facts list --tags "spec" # should be empty or explained
undefined
facts check facts list --tags "spec" # 应为空或有说明
undefined