Create Spec 标志

Create Spec

组织
bastani-inc
create-spec

Create a detailed execution plan/spec/PRD for implementing features or refactors in a codebase, designed around the program's entrypoints, the doors that carry domain intent, by leveraging existing research in the codebase.

概览

发布者bastani-inc
代码仓库atomic
技能名称create-spec
星标数
856
复刻数
115
附带文件
仅含指令
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 bastani-inc 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Create Spec AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/bastani-inc/atomic/tree/main/packages/workflows/skills/create-spec
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/bastani-inc/atomic.git /tmp/atomic
mkdir -p .claude/skills
cp -r /tmp/atomic/packages/workflows/skills/create-spec .claude/skills/create-spec
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Create Spec,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Create Spec。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Create Spec 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

You are tasked with creating a spec for implementing a new feature or system change in the codebase by leveraging existing research in the $ARGUMENTS path. If no research path is specified, use the entire research/ directory. IMPORTANT: Research documents are located in the research/ directory — do NOT look in the specs/ directory for research. Follow the template below to produce a comprehensive specification as output in the specs/ folder using the findings from RELEVANT research documents found in research/. The spec file MUST be named using the format YYYY-MM-DD-topic.md (e.g., specs/2026-03-26-my-feature.md), where the date is the current date and the topic is a kebab-case summary. Tip: It's good practice to use the codebase-research-locator and codebase-research-analyzer agents to help you find and analyze the research documents in the research/ directory. It is also HIGHLY recommended to cite relevant research throughout the spec for additional context.

Ask Clarifying Questions Before You Start

  • If the user's request is vague or lacks necessary details, ask clarifying questions to gather more information before starting the spec creation process. This will help ensure that the spec is comprehensive and aligned with the user's needs.

Determine the compatibility posture

  • Before decomposing the spec creation request, identify whether this project must preserve backward compatibility for real downstream users.
  • If the user explicitly allows breaking changes, public API changes, cleanup, or says there are no real users/downstream dependencies, allow breaking changes.
  • If the user mentions production users, published APIs, downstream consumers, migration safety, or compatibility requirements, disallow breaking changes.
  • If the posture is not inferable from the request, ask the user once before continuing, using the available structured question tool when possible.
  • Carry this posture into the spec creation plan, the final spec frontmatter, and a ## Backwards Compatibility section in the final spec.
  • When allowing breaking changes, document existing legacy behavior, compatibility shims, optional flags, and public APIs as current state, not as constraints future specs must preserve unless the user explicitly asks for preservation.
  • When not allowing breaking changes, document public APIs, compatibility-sensitive surfaces, downstream callers, migration constraints, and behavior that future work must preserve.

Choose a working path before drafting

First inspect the context already available: the conversation, the requested research path, the research/ documents, local docs, and the codebase. Choose the path that matches what is actually known:

  • Path A — Convert context to spec: use this when the available conversation, research, docs, or code contain enough background to describe the problem, constraints, affected code, and acceptance criteria.
  • Path B — Grill first: use this when the user wants a spec but the problem, constraints, design direction, affected code, or acceptance criteria are not yet clear. Do not invent architectural decisions.

If the codebase can answer a question, inspect it instead of asking the user. For Path B, do not write a full spec yet: state what context is missing, then use the existing ask_user_question and contrastive-clarification rules below (one question at a time or a logical group, with a recommended answer and concrete trade-offs). Once the answers and repository evidence provide enough context, run Path A.

Path A working method

When Path A is selected, work in this order and map the results into the numbered document headings below:

  1. Load standards and local context. Inspect local vocabulary, module layout, domain concepts, errors, adapters, observability, runtime patterns, and test style. Check precedent before introducing a pattern, library, adapter, schema style, or test strategy; ground the findings in §2.1 and the door names.
  2. Extract the design problem. Record current state, users and callers, pain point, goals, non-goals, constraints, invariants, affected systems, likely doors, operational concerns, risks, and open questions in §2, §3, and §9. Unknowns stay open questions.
  3. Explore materially different alternatives before locking the recommendation. Compare interface shape, seam placement, ownership, call stack, runtime topology, and module boundaries—not just names. Record the comparison in §6 even though §6 appears after the recommended design in the document.
  4. Specify typed contracts. Define the recommended doors, types, APIs, named failures, and refusals in §5.1–§5.3 while preserving the door rubric.
  5. Specify call stacks and data flow. Put current and proposed paths, failure behavior, retry, cancellation, and idempotency where reachable into §5.4 using the visual formats below.
  6. Map files and modules. List add/change/delete/test/config files and the responsibility each owns under §4 or §5.
  7. Plan vertical RGR TDD slices. In §8, take each important public door or seam through a red behavior test, the smallest green implementation, and a refactor that preserves the behavior; do not write a horizontal all-tests-first plan.
  8. Produce the design-only spec. Write specs/YYYY-MM-DD-topic.md; do not implement the change in this skill.

Design philosophy: a spec is a theory of its doors

The entrypoints of a program, read together, are the program's theory of its own purpose. Everything inside the boundary is mechanism — the how. Only at the boundary does the code speak in terms of meaning — the what and the why. So the single most important thing this spec defines is not the mechanism inside the system, but the set of doors the system keeps: the functions, routes, and RPC methods through which untrusted input arrives and irreversible effects happen.

Two acts hide inside that claim, and a good spec performs both. One is finding the doors — discovering where the domain is already jointed, using the research in research/ to learn what actually matters in the world the software serves. The other is crafting them — naming and shaping each door so it tells the truth about what lies behind it. Treat entrypoint design as the spine of the spec: a reviewer should be able to read the door set alone and reconstruct what the system is for before reading a single implementation detail.

Apply the five principles below to every entrypoint the spec introduces or changes, and run the rubric on each.

The five principles

  1. Name a joint, not a tool. A domain has seams — places reality is already divided into meaningful units (authenticate a user, settle a payment, revoke access, publish a draft). These exist before your code does. Name each door after such a joint, never after the mechanism behind it (run the query, call the service, update the row). A door named for a tool lets a reader learn how it works without ever learning what it is for — an ontological mismatch no clean mechanism repairs. Listen to the domain (and to the research), not to the code.

  2. Compress honestly, or not at all. A door's value is roughly the ratio of mechanism hidden to surface exposed — but only when the name promises exactly what the body delivers. No less (so it hides no danger or incompleteness), no more (so it implies no guarantee it does not keep). A save() that sometimes silently doesn't, a delete() that soft-deletes, a validate() that mutates, a getUser() that creates one — each is a lie at the boundary, and lies at the boundary compound across every caller who reasons from the name. Encode cost and risk in the vocabulary (cheap-borrow vs allocate vs consume; read vs read_exact; panic-risk in the name).

  3. Intent lives in what the door refuses. A boundary communicates as much by what it forbids as by what it allows. The shape of the door set — what it makes easy, what it makes impossible — is a direct statement of what the designers held sacred. Prefer making the illegal unrepresentable (in types and structure) over merely checked at runtime: a door that checks a rule trusts the caller; a door that makes the rule structurally necessary need trust no one. Use newtypes (AccountId, OrderId) over primitives, sum types over independent booleans, and capability-carrying types (an AdminSession, an AuthorizedCharge) that can only be produced by the door that earns them.

  4. Write for the stranger across time. You craft the door not for the machine but for a competent stranger who arrives years from now, never meets you, and must understand the system's purpose before they dare change it. The governing test: could they reconstruct the purpose of the system from the entrypoints alone, without reading a single body? If they would have to read implementations to learn what the system means, intent has leaked out of the doors into the mechanism.

  5. Keep the dangerous doors few and honest. The maturity of a system is visible in how few doors guard its irreversible effects — and how truthfully those doors are named. Every place money moves, access is granted, data is destroyed, a key is minted, a message is broadcast: funnel each effect through one honestly-named chokepoint, so the promise that guards it has exactly one home. Scatter danger across many small unnamed paths (every handler that can chargeCard, broad DB grants reaching DROP TABLE, ad-hoc os.system(...), default-public storage) and no one — not even the authors — can say where the weight is carried.

The rubric you run on every entrypoint in the spec

For each non-trivial entrypoint the spec introduces or changes, walk these in order. Stop at the first one you cannot answer cleanly — that is a finding, and it belongs in the spec (often in §5 as a constraint, or in §9 as an open question). Run it forward to audit a door you've drafted, and backward — asking what door each obligation deserves — to find the doors the system is still missing.

  1. Joint, not tool. Is the name a unit of domain intent a non-engineer would recognize — not a description of the mechanism? If you can only name it in implementation terms, it's a step, not a door.
  2. The sentence holds. Can you state its guarantee in one declarative sentence with no and? If not, it's fused (split it) or undefined (the most dangerous case — stop and find out what it actually promises).
  3. The name is honest. Does it promise exactly what the body will deliver — hiding no danger, implying no guarantee it won't keep? List the ways the name could be read as a lie.
  4. Obligations are discharged. Read the pre / invariant / post / never off the sentence. Does each obligation map to a real step in the design, and each step to an obligation?
  5. Every exit keeps the promise. Walk the error return, the retry, the timeout, the partial write, the concurrent caller, the second entry. The guarantee must survive all of them, not just the happy path.
  6. The refusals are real. What does this door make impossible? Are the illegal states unrepresentable, or merely checked and trusted?
  7. The trust transition is explicit and singular. If untrusted becomes trusted or authority increases, does it happen here — and only here?
  8. Irreversible effects pass one chokepoint. Is this the single dominating door for the effect it guards? If the effect can be reached another way, that other way is the bug.
  9. The airlock is at the boundary. Validation, authorization, conversion, and the error boundary live at the door, leaving the inside free to trust its own invariants. Defensive code deep within means the boundary is misplaced.
  10. A stranger could reconstruct intent. Could someone read this door alone — name and signature, not the body — and know what it is for and what it owes?

The joint is the same at every boundary

settle_payment in process, POST /v1/payment_intents/{id}/capture over REST, and Billing.SettlePayment over gRPC are one door, three transports, one name. When the function, the route, and the RPC method disagree about what the joints are, at least one of them is naming a tool — flag it. On the wire, the HTTP verb is honesty the protocol gives you for free (GET is safe, PUT/DELETE are idempotent, POST is neither — which is exactly why money doors carry an Idempotency-Key), and the status code is the door's honest exit (201 created, 204 done, 202 accepted; 409/412 are real refusals). The cardinal lie is 200 OK wrapping {"error": ...}. Authentication is one gate at the edge so every handler behind it may trust it speaks to a known caller.

<EXTREMELY_IMPORTANT>

  • Please use your ask_user_question tool to provide a rich interface to ask the user for their input on a question.
  • Please DO NOT implement anything in this stage, just create the comprehensive spec as described below.
  • When writing the spec, DO NOT include information about concrete dates/timelines (e.g. # minutes, hours, days, weeks, etc.) and favor explicit phases (e.g. Phase 1, Phase 2, etc.).
  • The spec MUST treat its entrypoint set as a first-class artifact. Section 5 is built around the doors (typed signatures, named failures, refusals expressed in types) and must pass the rubric above. Do not let intent leak into mechanism: a reviewer should reconstruct the system's purpose from §4.4 and §5.1 alone.
  • If the spec is for a workflow with reviewer gates plus final actions (for example PR/MR/review creation, release tagging, deployment, or publication), explicitly separate implementation/review acceptance from those post-approval final actions. The workflow design should tell reviewers/reducers to approve and stop the implementation loop when implementation and validation criteria are proven and only an explicitly authorized final action remains; carry that remainder as a next action/final-action field instead of another implementation iteration.
  • If the spec is for a workflow or workflow prompt refactor, require local, action-oriented stage/reviewer/reducer prompts. A model stage sees its prompt, artifacts, tools, and reads — not the workflow graph's name or surrounding implementation details unless explicitly provided — so prefer instructions like "review the current code delta" or "create/update the review request" over implementation-specific workflow nicknames unless a name is user-visible context or materially changes behavior.
  • Once the spec is generated ask questions one at a time OR in logical groups:
    • Refer to section "## 9. Open Questions / Unresolved Issues", go through each question one by one, and use contrastive clarification (presenting 2-3 specific options with concrete tradeoffs) rather than open-ended questions. This means presenting interpretations like "(A) Option X — tradeoff Y" and "(B) Option Z — tradeoff W" instead of asking "what do you think about X?". Update the spec with the user's answers as you walk through the questions.
    • Interview the user relentlessly about every aspect of this plan/spec until you reach a shared understanding with them. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one. For each question, provide your recommended answer (i.e., contrastive clarification). Pay special attention to the doors: every disagreement about what a joint is, what a door promises, what it refuses, or where a dangerous effect is funneled is a question worth resolving with the user.
    • If a question can be answered by exploring the codebase, explore the codebase instead and confirm with the user that this is their inferred intent.
  • Finally, once the spec is generated and after open questions are answered, provide an executive summary of the spec to the user including the path to the generated spec document in the specs/ directory.
    • In the summary, list the door set by name alone (the stranger-across-time view) and call out which doors guard irreversible effects.
    • Encourage the user to review the spec for best results and provide feedback or ask any follow-up questions they may have.

</EXTREMELY_IMPORTANT>

Shape-first visual language

Specs stay in Markdown, but their visuals should use the smallest view that makes the key point clear. Skip a preamble, keep prose brief, and place each visual next to the short text it supports. Use one or several of these as needed; do not use all of them every time:

  • Show logic or algorithms as indented text pseudocode, not prose alone.
  • Show runtime control flow as an indented call tree.
  • Show UI structure as a tsx component tree, including the state and module boundaries that matter.
  • Show file responsibility or a broad refactor as a shallow text file tree.
  • Show component interaction, control flow, or data flow with Mermaid.
  • Use diff when the surrounding shape already exists and the point is what changes. Match the diff to the topic: component tree, file tree, call tree, or state/control flow.
  • Show the whole block when most of it is new, omitted context would hide ownership or order, or the reader needs a copyable target shape.

For a visual UI, layout, state comparison, or concept too dense for Mermaid, allow one focused show-me-{description}.html artifact (diagram, infographic, or short slide deck). Match the product's colors, type, spacing, components, labels, and data; support desktop and mobile. Specs remain Markdown in specs/; HTML is an optional extra only when the page is the point. Open it with Atomic's bash tool and a portable opener:

bash
if [ "$(uname -s)" = "Darwin" ] && command -v open >/dev/null 2>&1; then
  open "path/to/show-me-{description}.html"
elif [ "$(uname -s)" = "Linux" ] && command -v xdg-open >/dev/null 2>&1; then
  xdg-open "path/to/show-me-{description}.html"
else
  printf 'Open this file: %s\n' "path/to/show-me-{description}.html"
fi

[Project Name] Technical Design Document / RFC

Document MetadataDetails
Author(s)!git config user.name
StatusDraft (WIP) / In Review (RFC) / Approved / Implemented / Deprecated / Rejected
Team / Owner
Created / Last Updated

1. Executive Summary

Instruction: A "TL;DR" of the document. Assume the reader is a VP or an engineer from another team who has 2 minutes. Summarize the Context (Problem), the Solution (Proposal), and the Impact (Value). Name the one or two doors at the heart of the change. Keep it under 200 words.

Example: This RFC proposes replacing our current nightly batch billing system with an event-driven architecture. Currently, billing delays cause a 5% increase in customer support tickets. The proposed solution introduces two money doors — authorize_charge (reversible hold) and settle_payment (irreversible capture) — as the single chokepoint for outbound money, reducing billing latency from 24 hours to <5 minutes while making double-charges structurally impossible.

2. Context and Motivation

Instruction: Why are we doing this? Why now? Link to the Product Requirement Document (PRD) and cite the relevant research/ documents.

2.1 Current State

Instruction: Describe the existing architecture and be honest about the flaws — including which existing doors leak (named for tools, dishonest compression, scattered danger). Pick the smallest view that makes the current state clear: a shallow file tree for ownership, a call tree for runtime flow, a component tree for UI structure, or Mermaid for interaction/data flow. Place the visual next to the short explanation and do not force a diagram when prose is clearer.

  • Architecture: Currently, Service A communicates with Service B via a shared SQL database.
  • Limitations: This creates a tight coupling; when Service A locks the table, Service B times out.
  • Leaking doors (today): e.g. chargeCard(token, cents) is reachable from checkout, the retry job, and the admin panel — no one owns "charge exactly once." processPayment(...) -> bool collapses a declined card, a network failure, and a duplicate submission into the same false.

2.2 The Problem

Instruction: What is the specific pain point?

  • User Impact: Customers cannot download receipts during the nightly batch window.
  • Business Impact: We are losing $X/month in churn due to billing errors.
  • Technical Debt: Danger is scattered; the boundary is misplaced, with defensive code deep inside the core instead of at the door.

3. Goals and Non-Goals

Instruction: This is the contract / Definition of Success. Be precise.

3.1 Functional Goals

  • Users must be able to export data in CSV format.
  • System must support multi-tenant data isolation.

3.2 Non-Goals (Out of Scope)

Instruction: Explicitly state what you are NOT doing. Remember: intent lives in what the door refuses — the doors you deliberately do not build are as much a statement of purpose as the ones you do. This prevents scope creep.

  • We will NOT support PDF export in this version (CSV only).
  • We will NOT migrate data older than 3 years.
  • We will NOT expose a second path to move money; settle_payment remains the only chokepoint.

4. Proposed Solution (High-Level Design)

Instruction: The "Big Picture." Choose the smallest fitting view from the shape-first visual language above; use one or several only when each answers a different question. Types, trees, diffs, or Mermaid should define the shape, while brief prose explains why. Do not use a heavy styled diagram when a simpler view communicates the boundary.

4.1 System Architecture Diagram

Instruction: Show the system boundary and mark the airlock (the single edge where untrusted input becomes a trusted request). Use Mermaid for component interaction or data flow, a shallow file tree for module responsibility, a call tree for runtime control flow, or a component tree for UI structure. Show the whole block when most of it is new or omitted context would hide ownership or order.

4.2 Architectural Pattern

Instruction: Name the pattern (e.g., "Event Sourcing", "BFF — Backend for Frontend", "Publisher-Subscriber").

  • We are adopting a Publisher-Subscriber pattern where the Order Service publishes OrderCreated events, and the Billing Service consumes them asynchronously.

4.3 Key Components

ComponentResponsibilityTechnology StackJustification
Ingestion ServiceValidates incoming webhooksGo, Gin FrameworkHigh concurrency performance needed.
Event BusDecouples servicesKafkaDurable log, replay capability.
Projections DBRead-optimized viewsMongoDBFlexible schema for diverse receipt formats.

Instruction: Map the files and modules that implement the design. List every add, change, delete, test, and configuration file, and state the responsibility each owns. Use a shallow file tree when layout is the key point; otherwise use this compact map.

PathActionOwns
src/feature/door.tschangePublic door and boundary contract
test/feature/door.test.tsaddVertical behavior slice through the door

4.4 The Door Set at a Glance (Stranger-Across-Time View)

Instruction: List the entrypoint names alone — no signatures, no bodies. A competent stranger should reconstruct the system's purpose from this list. If they cannot, intent has leaked into the mechanism; return to §5 and rename until they can. Mark every door that guards an irreversible effect with ⚠.

Example: register_account, authenticate, authorize_charge, settle_payment ⚠, grant_access ⚠, revoke_access, publish_draft. Reading these alone tells you who the system lets in, that money moves in exactly two steps and only those two, who may hand out access, and what it means for work to go live.

5. Detailed Design

Instruction: The "Meat" of the document. Sufficient detail for an engineer to start coding. Lead with the doors — they are the load-bearing part of the spec — then describe the mechanism behind them.

5.1 The Doors (Entrypoint Contracts)

Instruction: For each non-trivial entrypoint, give a typed signature (typed pseudocode is fine — read the types, not the syntax), the one-sentence guarantee (no "and"), the named failure set, and the refusals it enforces in the type system. Then record the rubric result. Make illegal states unrepresentable, not merely checked. Cite the research/ doc that establishes each joint. Use a whole block when the door is mostly new or the reader needs a copyable target shape; use a topic-matched diff when an existing door is changing. Show the runtime path to and from the door as a call tree, and include UI/module boundaries as a component tree when they matter.

// — Money. Two doors, and there is no third way to move a cent. —

authorize_charge(
  account: AccountId,            // newtype: cannot be confused with any other id
  amount: Money,                 // currency-typed: USD and JPY will not add
  idempotency_key: IdempotencyKey,
): Result<AuthorizedCharge, ChargeError>
// Guarantee: places a reversible hold and returns proof an authorization exists.
// ChargeError = InsufficientFunds | CardDeclined | NetworkError | DuplicateKey

settle_payment(
  authorized: AuthorizedCharge,  // ← can ONLY be produced by authorize_charge
  idempotency_key: IdempotencyKey,
): Result<Settlement, SettlementError>
// Guarantee: captures the held funds. IRREVERSIBLE. The single chokepoint for outbound money.
// You cannot settle a charge you did not authorize — not because a check forbids it,
// but because there is no way to CONSTRUCT an AuthorizedCharge except by calling
// authorize_charge. The illegal state is unrepresentable. The idempotency key makes
// the retry, the double-click, and the at-least-once queue converge on ONE settlement.

Per-door audit (run the rubric):

Door(1) Joint(2) One sentence, no "and"(3) Honest name(5) Every exit(6) Refusals real(7) Trust transition(8) One chokepoint
authorize_charge✅ business verb✅ "places a reversible hold"✅retry → DuplicateKey; timeout → NetworkErrorcurrency mismatch unrepresentablen/areversible, not the chokepoint
settle_payment ⚠✅ business verb✅ "captures held funds"✅ irreversibility in doc + typereplay converges via keycannot settle un-authorized charge (type)n/a✅ the sole outbound-money door

5.2 API Interfaces — The Same Doors on the Wire

Instruction: A web service's real boundary is its transport surface. The URL names the joint, the HTTP verb declares its safety class, the status code is the door's honest exit. Never 200 OK wrapping an error. The wire door MUST carry the same name as its in-process twin (§5.1).

# Identity — the one trust transition, at the edge
POST   /v1/sessions                       201 Created      # = authenticate; 401 on bad credentials
DELETE /v1/sessions/current               204 No Content   # = log out

# Money — two doors, one chokepoint, idempotent under retry
POST   /v1/payment_intents                201   Idempotency-Key: <key>   # = authorize_charge (reversible)
POST   /v1/payment_intents/{id}/capture   200   Idempotency-Key: <key>   # = settle_payment (IRREVERSIBLE)
#   409 Conflict if the key is replayed with a different body
#   422 Unprocessable if the intent was never authorized

# Access — authority demanded by the route, destructive door made idempotent
POST   /v1/accounts/{id}/grants           201   (admin scope required)            # = grant_access
DELETE /v1/grants/{id}                     204   (204 even if already revoked)     # = revoke_access

# Publishing — the domain's own verb, refusing to clobber a concurrent edit
POST   /v1/drafts/{id}/publish            200   If-Match: <etag>                   # = publish_draft
#   412 Precondition Failed if the draft moved under you — the wire's --force-with-lease

If using gRPC, define the same joints in the .proto; the typed request message is the airlock by construction. Use honest status codes (INVALID_ARGUMENT, PERMISSION_DENIED, NOT_FOUND, ALREADY_EXISTS, FAILED_PRECONDITION, retryable ABORTED/UNAVAILABLE) — never a lone OK carrying an error field.

5.3 Data Model / Schema

Instruction: Provide ERDs or JSON schemas. Discuss normalization vs. denormalization. Prefer schemas that make illegal states unrepresentable (sum-type status columns over independent boolean flags).

Table: invoices (PostgreSQL)

ColumnTypeConstraintsDescription
idUUIDPK
user_idUUIDFK -> UsersPartition Key
statusENUM'DRAFT','LOCKED','PROCESSING','PAID'A sum type, not three booleans

5.4 Algorithms and State Management

Instruction: Describe complex logic, state machines, or consistency models. Tie each state transition to the door that performs it and choose the smallest view that makes the behavior clear. Use indented text pseudocode for algorithms, a call tree for runtime control flow, Mermaid for interaction or data flow, and a topic-matched diff for changes to an existing state or control-flow shape. Include failure, retry, cancellation, idempotency, and concurrency behavior whenever reachable; keep unknowns for §9 rather than inventing them.

text
on(settle_payment)
  if request is a replay
    return the recorded settlement
  validate the authorized charge
  if provider call fails
    return named retryable error
  persist settlement
  return settlement
text
publishDraft
  authenticate
  loadDraft
  checkVersion
  persistPublication
  notifySubscribers
  • State Machine: An invoice moves DRAFT → LOCKED → PROCESSING → PAID; the PROCESSING → PAID transition happens only through settle_payment.
  • Concurrency: Optimistic locking on the version column; on the wire this surfaces as If-Match/412.
  • Data flow: Show boundary input, parsing, canonical domain input, service door, adapter call, typed result/error, projection, and serialized output in a Mermaid diagram or concise arrow chain when those stages are reachable.

6. Alternatives Considered

Instruction: Prove you thought about trade-offs — including alternative door sets (e.g., one god endpoint vs. distinct joints). Explore materially different alternatives before locking the recommendation, then record why the selected boundary is better. Compare interface shape, seam placement, ownership, call stack, runtime topology, and module boundaries — not just names.

OptionProsConsReason for Rejection
Option A: Single POST /execute {action}One route, flexibleGod door; intent hidden in payload; danger un-funneledFails "joint, not tool" and "few dangerous doors."
Option B: One-step chargeCard()Fewest callsNo reversible hold; retries double-chargeCannot make double-charge unrepresentable.
Option C: authorize + settle (Selected)Reversible hold; one chokepoint; idempotentTwo calls instead of oneSelected: the two real joints, with the irreversible effect funneled once.

7. Cross-Cutting Concerns

7.1 Security and Privacy

Instruction: This is where "keep the dangerous doors few and honest" and "the airlock at the boundary" become concrete.

  • The trust transition is singular: untrusted callers become trusted only at POST /v1/sessions / the gateway. No other door promotes an anonymous caller. (Rubric #7.)
  • Authority carried by type: destructive/privileged doors demand a capability (AdminSession) that only authenticate can mint — the permission check cannot be forgotten at a call site because there is no call site where it is absent. (Rubric #6.)
  • Irreversible effects pass one chokepoint: money via settle_payment, deletion via the single guarded door; the catastrophic version must be asked for explicitly. (Rubric #8.)
  • Data Protection: PII (names, emails) encrypted at rest (AES-256); Password is a newtype that cannot be logged, printed, or compared by accident.
  • Threat Model: Primary threat is a compromised API key; remediation is rapid rotation and rate limiting.

8. Test Plan

Instruction: Test the doors at their promises and their refusals — not just the happy path. Every exit in rubric #5 deserves a test. Plan vertical red-green-refactor (RGR) slices through public doors and seams: each slice starts with one failing behavior test, adds the smallest implementation that turns it green, then refactors without changing the behavior. Do not write all tests first as a horizontal batch. The interactive verification is what lets a human or another agent confirm the feature is correct without reading the bodies — the stranger-across-time test, made executable.

  • Unit Tests: each door's named failure variants; the refusals (e.g., a type/construction test proving settle_payment cannot accept anything but an AuthorizedCharge).
  • End-to-End Tests: full domain flows named by joint (register → authenticate → authorize → settle), driven through the real wire doors of §5.2.
  • Integration Tests: idempotency under replay (same key → one settlement); concurrent-edit 412; trust transition (no door promotes an anonymous caller except authenticate).
  • Fuzz / Property Tests: throw malformed and adversarial input at the doors (the airlock); the boundary must reject everything the types forbid and never crash the core. Assert invariants over random inputs (e.g., settle_payment converges on one settlement under any interleaving of retries; no input sequence reaches a money move except through the chokepoint).
  • Interactive Verification: a runnable checklist or script a human OR another agent can execute to confirm the feature was implemented correctly — each step names a door, supplies an input, and states the expected honest exit (status code / named error / resulting state), so correctness is observable from the boundary alone. Include the exact commands or requests to run and the pass/fail condition for each.

9. Open Questions / Unresolved Issues

Instruction: List known unknowns. These must be resolved before the doc is marked "Approved." Include any door whose rubric could not be answered cleanly — especially undefined guarantees (rubric #2, the most dangerous case) and any irreversible effect not yet funneled to a single chokepoint (rubric #8). Resolve these with the user via contrastive clarification.

  • Is publish_draft the only door that moves a draft to live, or can the admin panel also publish? (If the latter, the effect is not yet funneled — rubric #8.)
  • What exactly does authorize_charge promise on a partial provider outage — is the guarantee defined? (rubric #2.)
  • Will the Legal team approve the 3rd-party library for PDF generation?
  • Does the current VPC peering allow connection to the legacy mainframe?

常见问题

Create Spec AI 技能有什么作用?

Create a detailed execution plan/spec/PRD for implementing features or refactors in a codebase, designed around the program's entrypoints, the doors that carry domain intent, by leveraging existing research in the codebase.

为什么在 TypingMind 中使用 Create Spec?

因为您只需安装一次,就能搭配任何模型使用。Create Spec 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Create Spec?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/bastani-inc/atomic/tree/main/packages/workflows/skills/create-spec。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Create Spec?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Create Spec 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Create Spec 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Create Spec AI 技能免费吗?

是的。bastani-inc 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇