[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79SM78DRVE2019WFP9N2PZ7":3,"skill-same:01M79SM78DRVE2019WFP9N2PZ7":58},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M79SM78DRVE2019WFP9N2PZ7","rpi-create-tdd",null,"Only use when the user explicitly invokes this skill by name.","TiagoJacinto\u002Flocal-agent-factory","TiagoJacinto","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99197066?v=4","01M79SKJF80XZ2N03BAMTPC445","Tiago Jacinto","01M79SKJGAJW7VGWQK6M4S6SE6",0,"MIT","https:\u002F\u002Fgithub.com\u002FTiagoJacinto\u002Flocal-agent-factory\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Frpi-create-tdd\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: rpi-create-tdd\ndescription: Only use when the user explicitly invokes this skill by name.\n---\n\n# TDD Phase\n\nYou are creating a Technical Design Document (TDD): the artifact that turns whatever product context exists into a technical design the team can build from. It answers HOW we build something - not WHAT or WHY. Leave product requirements and UX to the upstream product context.\n\nYou run the design as a guided conversation in **two ordered phases**:\n\n1. **System Design** - how the pieces fit together across components.\n2. **Program Design** - how the code inside those pieces is shaped.\n\nYou fully settle and get the user's sign-off on the System Design before you open the Program Design. Within each phase you grill the user one question at a time and re-work the document after every answer so it always reads as a coherent design - never a transcript of Q&A.\n\n\u003C!-- @if target=workflow -->\n\n## RPI problem folder\n\nUse `{{problemFolder}}` as the task artifact directory for this workflow run. Do not infer a different task directory.\n\u003C!-- @endif -->\n\n## How the conversation works (read this before you start)\n\n**Exactly one question per message.** End every message with a single question - never a second question, a stacked follow-up, or an \"and also...\". Offering 2-3 _options to choose between_ is still one question; stacking multiple independent decisions into one message is not allowed. Walk down the decision tree one decision at a time: present the decision with its options, tradeoffs, and your recommendation, then stop and wait. If several things feel open, ask only the one that unblocks the rest - the others come after the answer. Never ask for a vague \"any feedback?\".\n\n**Run each decision as an interview loop; patch the doc only once the decision is resolved.** Ask your one question, then work back and forth until it's settled. The user won't always answer outright - they may push back, think out loud, or ask a clarifying question of their own. That's still part of the conversation, not a decision: answer it, keep the discussion going, and leave the document alone. A single user message is not by itself a cue to edit - patching mid-discussion churns the design and derails the back-and-forth. Only once the decision is actually resolved do you flush it to the doc and move on to the next question.\n\n**When you flush a resolved decision, re-work the relevant section rather than appending to it.** Fold the decision in: rewrite prose, redraw a diagram, reorder or remove earlier content as needed. A single decision often revises parts of the section that have already started to emerge - four questions into the program design, the right move may be to restructure two paragraphs you wrote earlier. Capture each decision in whatever form conveys it best - a diagram, signature, or sketch - reaching for one when the decision calls for it, regardless of whether the question itself used one.\n\n**The doc is always a cohesive description of what's known - never a log.** At any point in the conversation, the System Design and Program Design sections should read like a design someone wrote on purpose: high-level, coherent, and current - not a list of answers, and not a changelog of decisions. Treat each answer as a reason to re-paint: restructure, reorder, rebuild, and reorient the section so it stays a clean, unified description of everything decided so far. **Rewriting entire sections as you go is expected, not exceptional.** Favor a smaller, sharper section over an accreting pile of bullet points.\n\n**Show, don't tell.** Reach for a diagram, type signature, or code-shape sketch instead of paragraphs of prose. A quick diagram communicates more than a wall of text. Keep artifacts up to date as decisions evolve.\n\n**Make it read like a document a human designed for other humans.** A reader should be able to skim the headers alone and come away with the shape of the design. Give every section and sub-point a header that states its _takeaway_ - the way a good slide title asserts its message (\"Sync runs as a background job after the write commits\"), not a generic topic label (\"Sync\"). Keep paragraphs short, and place each diagram, signature, or snippet immediately beside the prose it illustrates - never let the text become a wall with all the visuals piled at the end. Lead with the point, then support it.\n\n**Leverage, not exhaustiveness.** The TDD should let the user decide, align, and re-steer the implementation without loading every detail into their head. Prefer the smallest set of diagrams, signatures, and sketches that reveal the important decisions and tradeoffs.\n\n**Get more context when you need it.** When a decision depends on how the codebase actually works, spawn Agent() calls (codebase-analyzer, codebase-pattern-finder, web-search-researcher, or the library researcher) before presenting options. Fold any new findings back into the research artifact.\n\n---\n\n\u003Cstep index=\"1\" name=\"understand-the-context\">\n\n\u003Cinstructions>\n- Find the task directory: `ls -La .rpi\u002Fproblems\u002FTASKNAME` (use Bash `ls -La` - not Grep\u002FGlob - the directory may be a symlink).\n- Read every relevant file in the task directory **fully** (Read with no limit\u002Foffset), excluding research-questions docs.\n- Read the TDD template: `Read({SKILLBASE}\u002Freferences\u002Ftdd_template.md)`.\n\u003C\u002Finstructions>\n\n\u003Cguidance>\n## Working from whatever inputs exist\n\nThere is no required upstream artifact. The product context might be a full PRD, or just a ticket plus a research doc, or only a couple of sentences describing what the user wants inside an existing research document. Work from whatever is present - **a PRD is not required.**\n\n- Ground the design in the inputs you _do_ have, and cite them as you write: \"Per the ticket...\", \"The research doc notes...\", \"As described in the PRD...\".\n- Don't duplicate upstream content into the TDD - reference it.\n- If the product context is thin, don't invent requirements. Surface the gaps as questions during the interview and let the user fill them in.\n- The TDD answers HOW to build what those inputs describe. If a technical decision changes product scope or UX, call it out for the user (and update the PRD\u002Fmockups if a PRD exists).\n\u003C\u002Fguidance>\n\n\u003C\u002Fstep>\n\n\u003Cstep index=\"2\" name=\"write-the-skeleton\">\n\n\u003Cinstructions>\nWrite the doc to `.rpi\u002Fproblems\u002FENG-XXXX-description\u002FNN-tdd-DESCRIPTION.md` (next zero-padded `NN-` index in the task dir; `DESCRIPTION` is a 2-4 word kebab-case slug).\n\n**Keep the skeleton as minimal as possible. No preamble, no setup, no summaries.** The faster you reach the first question, the more the user stays engaged in building the TDD. Write only:\n\n- Frontmatter with `type: design-tdd`, plus the top-level title\n- Empty **System Design** and **Program Design** headers - built out through the two phases\n- **Patterns to Follow** header\n\nToday's reality and the target both get expressed inside the System Design and Program Design during the interview (Steps 3 and 5), so the skeleton itself stays empty.\n\nThen respond immediately by opening the System Design phase with the **first system-design question** - at most one short orienting line, then the question. For example:\n\n> I've started the TDD. First question: should the new sync run inline in the request, or as a background job after the write commits?\n>\n> - **Inline** - simplest, but the client waits on the upload...\n> - **Background job** - returns fast, but needs a queue and a retry path...\n>\n> I'd lean background job because the upload shouldn't block the response - which way do you want to go?\n> \u003C\u002Finstructions>\n\n\u003Cguidance>\n## Markdown formatting\n\nWhen you write markdown that itself contains a code block showing other markdown (for example a fenced block that contains its own fence), use 4 backticks for the outer fence so the inner 3-backtick block doesn't close it early:\n\n````markdown\n# Example heading\n\n```bash\nnpm install example\n```\n````\n\n\u003C\u002Fguidance>\n\n\u003C\u002Fstep>\n\n\u003Cstep index=\"3\" name=\"system-design\">\n\n\u003Cinstructions>\nDesign the cross-component architecture. System Design is about behavior *between* components - how services, endpoints, schemas, queues, stores, and external systems interact - not the code inside any one of them.\n\nConvey **how the system changes**: what exists today and what's new or different. Express the delta so the reader understands the change at a glance.\n\n**Ask exactly one question per message, walking down each branch of the design tree.** Resolve one decision, let it inform the next, and only then ask the next. Presenting 2-3 options to choose between is still one question - don't stack multiple decisions into one message, and don't append a second question or an \"any feedback?\".\n\nFor each decision: present a single decision with options (as diagrams \u002F signatures \u002F endpoint shapes when that's the clearest form) and your recommendation -> work back and forth until the decision is resolved (clarifying questions and pushback are part of this, not a cue to patch) -> only then re-work the **System Design** section so it absorbs the decision, keeping it one coherent architecture. Reach for a diagram, signature, or sketch whenever it captures the decision best.\n\nUse the representations in the guidance below; pick the form that makes each decision clearest.\n\u003C\u002Finstructions>\n\n\u003Cguidance>\n## System Design representations\n\n**Mermaid diagrams** for control flow, data flow, and component interactions:\n\n```mermaid\nsequenceDiagram\n    participant Client\n    participant Service\n    participant Store\n    Client->>Service: request\n    Service->>Store: read\u002Fwrite\n    Store-->>Service: result\n    Service-->>Client: response\n```\n\n**High-level type signatures** for the contracts that define the boundary (use the codebase's language):\n\n```\ncreateResource(input: CreateResourceInput) -> Resource\n```\n\n**Endpoint \u002F message shapes** for the interfaces between components - routes, message definitions, or request\u002Fresponse schemas in whatever transport the codebase uses (REST, RPC such as gRPC, GraphQL, queue events, etc.):\n\n```text\nPUT \u002Fapi\u002Fresources\u002F:slug\n  request:  { destination: string }\n  response: { resource: Resource }\n```\n\n**Data contracts** when a schema is part of the cross-component agreement:\n\n```sql\nCREATE TABLE artifact_sync_status (\n  artifact_id   UUID PRIMARY KEY REFERENCES artifacts(id),\n  content_hash  TEXT NOT NULL,\n  cloud_permalink TEXT\n);\n```\n\nIf the codebase uses an ORM or a schema-definition library, the equivalent ORM-specific definition may be clearer than raw SQL - use whatever form matches the project.\n\n## HTML artifacts for complex concepts\n\nWhen a concept is too complex for Mermaid or plain text - combining data flow, structure, annotations, or side-by-side comparisons - write a focused HTML artifact and display it inline:\n\n- Write to `.rpi\u002Fproblems\u002F{task-slug}\u002Fdiagram-{description}.html`\n- Keep each artifact focused on the decision at hand; use realistic labels, not lorem ipsum\n\n```task-artifact\n.rpi\u002Fproblems\u002F{task-slug}\u002Fdiagram-{description}.html\n```\n\n**If you are writing an HTML artifact, read `{SKILLBASE}\u002Freferences\u002Fartifact_template.html` and follow it.** Copy its `\u003Cstyle>` block and build your content in the body using its prose elements and utility classes (`.card`, `.badge*`, `.stat*`, `.ba`). The artifact must follow the template so it matches the RPI artifact viewer, not the codebase the TDD is about.\n\u003C\u002Fguidance>\n\n\u003C\u002Fstep>\n\n\u003Cstep index=\"4\" name=\"system-design-review-gate\">\n\n\u003Cinstructions>\nWhen the cross-component architecture is settled, stop and hand it back for review. Because you've been fleshing it out section-by-section, the user hasn't read it as a whole yet. Say something like:\n\n> I think the system design is complete. Since we've been building it up decision by decision, can you read the **System Design** section top to bottom and confirm it hangs together before we move on to program design?\n\nWait for the user's approval. Incorporate any fixes they raise. **Do not open the Program Design phase until the user signs off on the System Design.**\n\u003C\u002Finstructions>\n\n\u003C\u002Fstep>\n\n\u003Cstep index=\"5\" name=\"program-design\">\n\n\u003Cinstructions>\nNow design the in-code shape under the **Program Design** header.\n\n**Ask exactly one question per message, walking down each branch of the design tree.** Same rhythm as system design: resolve one decision, let it inform the next, re-work the section after each answer. Presenting 2-3 options to choose between is still one question - don't stack multiple decisions into one message, and don't append a second question or an \"any feedback?\".\n\n**Almost every message should carry a code block.** Program design is a discussion about the shape of code, so visualize it richly rather than describing it in prose: show each option as a concrete code-shape sketch - a `diff`, a call-stack tree, a file-tree diff, a component tree, a type signature, or pseudocode (use the views in the guidance below). When you present 2-3 options, render each one as its own code block so the user compares the actual shapes side by side, not your description of them. A message that asks a program-design question with no code block should be the rare exception - if you catch yourself explaining a code change in words alone, convert it into one of the views before sending.\n\nFor each decision: present a single decision with options as concrete code-shape sketches and your recommendation -> work back and forth until the decision is resolved (clarifying questions and pushback are part of this, not a cue to patch) -> only then re-work the **Program Design** section so it absorbs the decision, keeping it one coherent description of the code shape. A resolved decision often updates the call tree or file shape you already started, so restructure and redraw those in place.\n\nUse the views in the guidance below that fit the change.\n\u003C\u002Finstructions>\n\n\u003Cguidance>\n## Program Design views\n\nBe concrete but selective - include the views that clarify the design.\n\n**Call-stack tree** - for services, CLIs, workers, or any orchestration \u002F control-flow change. Show the important calls, not every frame.\n\n```text\nentrypoint\n  runCommand\n    handleCreateResource\n      ResourceClient.create(input)\n        POST \u002Fresources\n      renderResult\n```\n\nUse `diff` syntax only when it highlights changed\u002Fadded\u002Fremoved calls; if most of the snippet is net-new, plain `text` is clearer.\n\n```diff\n entrypoint\n   runCommand\n+    handleCreateResource\n-    legacyCreateFlow\n```\n\n**Frontend component tree** - UI changes. Show production components, their state\u002Flocal data, and module\u002Fpackage boundaries (the example below is React\u002FTSX - adapt to whatever UI framework the codebase uses).\n\n```tsx\n\u003CResourcePage> (apps\u002Fexample\u002Fsrc\u002Froutes\u002Fresource.tsx)\n  useResourceActions()\n  \u003CResourceToolbar>\n    \u003CCreateResourceDialog> (packages\u002Fui)\n      useFormState()\n```\n\nUse `diff` syntax only when it highlights changed\u002Fadded\u002Fremoved components, props, or state.\n\n```diff\n \u003CResourcePage> (apps\u002Fexample\u002Fsrc\u002Froutes\u002Fresource.tsx)\n   useResourceActions()\n+  useOptimisticResourceState()\n   \u003CResourceToolbar>\n+    \u003CCreateResourceDialog> (packages\u002Fui)\n```\n\n**File-tree diff** - broad refactors or when file responsibility is a design decision. Format like `tree` output so depth is easy to scan; keep it high-level.\n\n```diff\n src\n └── resource\n+    ├── resource-client.ext      # NEW - wraps API contract calls\n~    └── resource-route.ext       # MODIFIED - wires create action into UI\n```\n\n**Dependency-injection map** - the seams and injected dependencies that matter, grouped by the object\u002Fworkflow that receives them. Explain what each dependency lets the code do; avoid raw constructor dumps.\n\n```text\ncreateResourceWorkflow\n  receives resourceStore    -> persists resources\n  receives eventPublisher   -> emits resource-created events after commit\n  receives clock            -> makes timestamps deterministic\n\nResourcePage\n  receives createResource   -> UI does not know transport details\n  receives queryClient      -> updates cached resource list after success\n```\n\n**Internal method signatures** for key new functions not captured in system design (use the codebase's language):\n\n```\nresolveTarget(items: Item[], cursor: Cursor) -> ItemId | null\n```\n\n**Pseudocode** for complex algorithms or logic - english-y, not a programming language:\n\n```text\non(artifactSave)\n  if artifact.unchanged(oldHash)\n    return cached permalink\n  else\n    objectStore.upload(artifact.content)\n    update local cache with new hash and permalink\n    return fresh permalink\n```\n\n## Required close-out views\n\nEnd every Program Design with both views below.\n\n**Test assertions** - state the important behavior each test proves and identify its test level or boundary. Specify assertions, not test implementation.\n\n```text\nintegration: create resource\n  boundary: API -> service -> store\n  asserts: persists the resource and returns its generated ID\n```\n\n**Low-confidence decisions** - name the design choices the agent is least confident about and explain why they need human attention. Write `None` when there are no low-confidence decisions.\n\n```text\n- Queue retry policy - production traffic and failure-rate evidence are incomplete.\n```\n\n## HTML artifacts for complex concepts\n\nThe same HTML-artifact escape hatch from the System Design step applies here - use a focused inline HTML artifact when code shape, data flow, and annotations are clearer together than in plain text. Base any HTML artifact on `{SKILLBASE}\u002Freferences\u002Fartifact_template.html` so it matches the RPI artifact viewer's visual language.\n\u003C\u002Fguidance>\n\n\u003C\u002Fstep>\n\n\u003Cstep index=\"6\" name=\"program-design-review-gate\">\n\n\u003Cinstructions>\nWhen the program design is settled, hand it back for review the same way:\n\n> I think the program design is complete too. Can you review the **Program Design** section and confirm the code shape looks right?\n\nWait for the user's approval and incorporate any fixes.\n\u003C\u002Finstructions>\n\n\u003C\u002Fstep>\n\n\u003Cstep index=\"7\" name=\"wrap-up\">\n\n\u003Cinstructions>\nWhen both phases are approved, read the final answer template and follow it exactly (it points to the next step - the structure outline): `Read({SKILLBASE}\u002Freferences\u002Ftdd_final_answer_resolved.md)`. Include RPI artifact permalinks if available.\n\u003C\u002Finstructions>\n\n\u003C\u002Fstep>\n","# TDD Phase\n\nYou are creating a Technical Design Document (TDD): the artifact that turns whatever product context exists into a technical design the team can build from. It answers HOW we build something - not WHAT or WHY. Leave product requirements and UX to the upstream product context.\n\nYou run the design as a guided conversation in **two ordered phases**:\n\n1. **System Design** - how the pieces fit together across components.\n2. **Program Design** - how the code inside those pieces is shaped.\n\nYou fully settle and get the user's sign-off on the System Design before you open the Program Design. Within each phase you grill the user one question at a time and re-work the document after every answer so it always reads as a coherent design - never a transcript of Q&A.\n\n\u003C!-- @if target=workflow -->\n\n## RPI problem folder\n\nUse `{{problemFolder}}` as the task artifact directory for this workflow run. Do not infer a different task directory.\n\u003C!-- @endif -->\n\n## How the conversation works (read this before you start)\n\n**Exactly one question per message.** End every message with a single question - never a second question, a stacked follow-up, or an \"and also...\". Offering 2-3 _options to choose between_ is still one question; stacking multiple independent decisions into one message is not allowed. Walk down the decision tree one decision at a time: present the decision with its options, tradeoffs, and your recommendation, then stop and wait. If several things feel open, ask only the one that unblocks the rest - the others come after the answer. Never ask for a vague \"any feedback?\".\n\n**Run each decision as an interview loop; patch the doc only once the decision is resolved.** Ask your one question, then work back and forth until it's settled. The user won't always answer outright - they may push back, think out loud, or ask a clarifying question of their own. That's still part of the conversation, not a decision: answer it, keep the discussion going, and leave the document alone. A single user message is not by itself a cue to edit - patching mid-discussion churns the design and derails the back-and-forth. Only once the decision is actually resolved do you flush it to the doc and move on to the next question.\n\n**When you flush a resolved decision, re-work the relevant section rather than appending to it.** Fold the decision in: rewrite prose, redraw a diagram, reorder or remove earlier content as needed. A single decision often revises parts of the section that have already started to emerge - four questions into the program design, the right move may be to restructure two paragraphs you wrote earlier. Capture each decision in whatever form conveys it best - a diagram, signature, or sketch - reaching for one when the decision calls for it, regardless of whether the question itself used one.\n\n**The doc is always a cohesive description of what's known - never a log.** At any point in the conversation, the System Design and Program Design sections should read like a design someone wrote on purpose: high-level, coherent, and current - not a list of answers, and not a changelog of decisions. Treat each answer as a reason to re-paint: restructure, reorder, rebuild, and reorient the section so it stays a clean, unified description of everything decided so far. **Rewriting entire sections as you go is expected, not exceptional.** Favor a smaller, sharper section over an accreting pile of bullet points.\n\n**Show, don't tell.** Reach for a diagram, type signature, or code-shape sketch instead of paragraphs of prose. A quick diagram communicates more than a wall of text. Keep artifacts up to date as decisions evolve.\n\n**Make it read like a document a human designed for other humans.** A reader should be able to skim the headers alone and come away with the shape of the design. Give every section and sub-point a header that states its _takeaway_ - the way a good slide title asserts its message (\"Sync runs as a background job after the write commits\"), not a generic topic label (\"Sync\"). Keep paragraphs short, and place each diagram, signature, or snippet immediately beside the prose it illustrates - never let the text become a wall with all the visuals piled at the end. Lead with the point, then support it.\n\n**Leverage, not exhaustiveness.** The TDD should let the user decide, align, and re-steer the implementation without loading every detail into their head. Prefer the smallest set of diagrams, signatures, and sketches that reveal the important decisions and tradeoffs.\n\n**Get more context when you need it.** When a decision depends on how the codebase actually works, spawn Agent() calls (codebase-analyzer, codebase-pattern-finder, web-search-researcher, or the library researcher) before presenting options. Fold any new findings back into the research artifact.\n\n---\n\n\u003Cstep index=\"1\" name=\"understand-the-context\">\n\n\u003Cinstructions>\n- Find the task directory: `ls -La .rpi\u002Fproblems\u002FTASKNAME` (use Bash `ls -La` - not Grep\u002FGlob - the directory may be a symlink).\n- Read every relevant file in the task directory **fully** (Read with no limit\u002Foffset), excluding research-questions docs.\n- Read the TDD template: `Read({SKILLBASE}\u002Freferences\u002Ftdd_template.md)`.\n\u003C\u002Finstructions>\n\n\u003Cguidance>\n## Working from whatever inputs exist\n\nThere is no required upstream artifact. The product context might be a full PRD, or just a ticket plus a research doc, or only a couple of sentences describing what the user wants inside an existing research document. Work from whatever is present - **a PRD is not required.**\n\n- Ground the design in the inputs you _do_ have, and cite them as you write: \"Per the ticket...\", \"The research doc notes...\", \"As described in the PRD...\".\n- Don't duplicate upstream content into the TDD - reference it.\n- If the product context is thin, don't invent requirements. Surface the gaps as questions during the interview and let the user fill them in.\n- The TDD answers HOW to build what those inputs describe. If a technical decision changes product scope or UX, call it out for the user (and update the PRD\u002Fmockups if a PRD exists).\n\u003C\u002Fguidance>\n\n\u003C\u002Fstep>\n\n\u003Cstep index=\"2\" name=\"write-the-skeleton\">\n\n\u003Cinstructions>\nWrite the doc to `.rpi\u002Fproblems\u002FENG-XXXX-description\u002FNN-tdd-DESCRIPTION.md` (next zero-padded `NN-` index in the task dir; `DESCRIPTION` is a 2-4 word kebab-case slug).\n\n**Keep the skeleton as minimal as possible. No preamble, no setup, no summaries.** The faster you reach the first question, the more the user stays engaged in building the TDD. Write only:\n\n- Frontmatter with `type: design-tdd`, plus the top-level title\n- Empty **System Design** and **Program Design** headers - built out through the two phases\n- **Patterns to Follow** header\n\nToday's reality and the target both get expressed inside the System Design and Program Design during the interview (Steps 3 and 5), so the skeleton itself stays empty.\n\nThen respond immediately by opening the System Design phase with the **first system-design question** - at most one short orienting line, then the question. For example:\n\n> I've started the TDD. First question: should the new sync run inline in the request, or as a background job after the write commits?\n>\n> - **Inline** - simplest, but the client waits on the upload...\n> - **Background job** - returns fast, but needs a queue and a retry path...\n>\n> I'd lean background job because the upload shouldn't block the response - which way do you want to go?\n> \u003C\u002Finstructions>\n\n\u003Cguidance>\n## Markdown formatting\n\nWhen you write markdown that itself contains a code block showing other markdown (for example a fenced block that contains its own fence), use 4 backticks for the outer fence so the inner 3-backtick block doesn't close it early:\n\n````markdown\n# Example heading\n\n```bash\nnpm install example\n```\n````\n\n\u003C\u002Fguidance>\n\n\u003C\u002Fstep>\n\n\u003Cstep index=\"3\" name=\"system-design\">\n\n\u003Cinstructions>\nDesign the cross-component architecture. System Design is about behavior *between* components - how services, endpoints, schemas, queues, stores, and external systems interact - not the code inside any one of them.\n\nConvey **how the system changes**: what exists today and what's new or different. Express the delta so the reader understands the change at a glance.\n\n**Ask exactly one question per message, walking down each branch of the design tree.** Resolve one decision, let it inform the next, and only then ask the next. Presenting 2-3 options to choose between is still one question - don't stack multiple decisions into one message, and don't append a second question or an \"any feedback?\".\n\nFor each decision: present a single decision with options (as diagrams \u002F signatures \u002F endpoint shapes when that's the clearest form) and your recommendation -> work back and forth until the decision is resolved (clarifying questions and pushback are part of this, not a cue to patch) -> only then re-work the **System Design** section so it absorbs the decision, keeping it one coherent architecture. Reach for a diagram, signature, or sketch whenever it captures the decision best.\n\nUse the representations in the guidance below; pick the form that makes each decision clearest.\n\u003C\u002Finstructions>\n\n\u003Cguidance>\n## System Design representations\n\n**Mermaid diagrams** for control flow, data flow, and component interactions:\n\n```mermaid\nsequenceDiagram\n    participant Client\n    participant Service\n    participant Store\n    Client->>Service: request\n    Service->>Store: read\u002Fwrite\n    Store-->>Service: result\n    Service-->>Client: response\n```\n\n**High-level type signatures** for the contracts that define the boundary (use the codebase's language):\n\n```\ncreateResource(input: CreateResourceInput) -> Resource\n```\n\n**Endpoint \u002F message shapes** for the interfaces between components - routes, message definitions, or request\u002Fresponse schemas in whatever transport the codebase uses (REST, RPC such as gRPC, GraphQL, queue events, etc.):\n\n```text\nPUT \u002Fapi\u002Fresources\u002F:slug\n  request:  { destination: string }\n  response: { resource: Resource }\n```\n\n**Data contracts** when a schema is part of the cross-component agreement:\n\n```sql\nCREATE TABLE artifact_sync_status (\n  artifact_id   UUID PRIMARY KEY REFERENCES artifacts(id),\n  content_hash  TEXT NOT NULL,\n  cloud_permalink TEXT\n);\n```\n\nIf the codebase uses an ORM or a schema-definition library, the equivalent ORM-specific definition may be clearer than raw SQL - use whatever form matches the project.\n\n## HTML artifacts for complex concepts\n\nWhen a concept is too complex for Mermaid or plain text - combining data flow, structure, annotations, or side-by-side comparisons - write a focused HTML artifact and display it inline:\n\n- Write to `.rpi\u002Fproblems\u002F{task-slug}\u002Fdiagram-{description}.html`\n- Keep each artifact focused on the decision at hand; use realistic labels, not lorem ipsum\n\n```task-artifact\n.rpi\u002Fproblems\u002F{task-slug}\u002Fdiagram-{description}.html\n```\n\n**If you are writing an HTML artifact, read `{SKILLBASE}\u002Freferences\u002Fartifact_template.html` and follow it.** Copy its `\u003Cstyle>` block and build your content in the body using its prose elements and utility classes (`.card`, `.badge*`, `.stat*`, `.ba`). The artifact must follow the template so it matches the RPI artifact viewer, not the codebase the TDD is about.\n\u003C\u002Fguidance>\n\n\u003C\u002Fstep>\n\n\u003Cstep index=\"4\" name=\"system-design-review-gate\">\n\n\u003Cinstructions>\nWhen the cross-component architecture is settled, stop and hand it back for review. Because you've been fleshing it out section-by-section, the user hasn't read it as a whole yet. Say something like:\n\n> I think the system design is complete. Since we've been building it up decision by decision, can you read the **System Design** section top to bottom and confirm it hangs together before we move on to program design?\n\nWait for the user's approval. Incorporate any fixes they raise. **Do not open the Program Design phase until the user signs off on the System Design.**\n\u003C\u002Finstructions>\n\n\u003C\u002Fstep>\n\n\u003Cstep index=\"5\" name=\"program-design\">\n\n\u003Cinstructions>\nNow design the in-code shape under the **Program Design** header.\n\n**Ask exactly one question per message, walking down each branch of the design tree.** Same rhythm as system design: resolve one decision, let it inform the next, re-work the section after each answer. Presenting 2-3 options to choose between is still one question - don't stack multiple decisions into one message, and don't append a second question or an \"any feedback?\".\n\n**Almost every message should carry a code block.** Program design is a discussion about the shape of code, so visualize it richly rather than describing it in prose: show each option as a concrete code-shape sketch - a `diff`, a call-stack tree, a file-tree diff, a component tree, a type signature, or pseudocode (use the views in the guidance below). When you present 2-3 options, render each one as its own code block so the user compares the actual shapes side by side, not your description of them. A message that asks a program-design question with no code block should be the rare exception - if you catch yourself explaining a code change in words alone, convert it into one of the views before sending.\n\nFor each decision: present a single decision with options as concrete code-shape sketches and your recommendation -> work back and forth until the decision is resolved (clarifying questions and pushback are part of this, not a cue to patch) -> only then re-work the **Program Design** section so it absorbs the decision, keeping it one coherent description of the code shape. A resolved decision often updates the call tree or file shape you already started, so restructure and redraw those in place.\n\nUse the views in the guidance below that fit the change.\n\u003C\u002Finstructions>\n\n\u003Cguidance>\n## Program Design views\n\nBe concrete but selective - include the views that clarify the design.\n\n**Call-stack tree** - for services, CLIs, workers, or any orchestration \u002F control-flow change. Show the important calls, not every frame.\n\n```text\nentrypoint\n  runCommand\n    handleCreateResource\n      ResourceClient.create(input)\n        POST \u002Fresources\n      renderResult\n```\n\nUse `diff` syntax only when it highlights changed\u002Fadded\u002Fremoved calls; if most of the snippet is net-new, plain `text` is clearer.\n\n```diff\n entrypoint\n   runCommand\n+    handleCreateResource\n-    legacyCreateFlow\n```\n\n**Frontend component tree** - UI changes. Show production components, their state\u002Flocal data, and module\u002Fpackage boundaries (the example below is React\u002FTSX - adapt to whatever UI framework the codebase uses).\n\n```tsx\n\u003CResourcePage> (apps\u002Fexample\u002Fsrc\u002Froutes\u002Fresource.tsx)\n  useResourceActions()\n  \u003CResourceToolbar>\n    \u003CCreateResourceDialog> (packages\u002Fui)\n      useFormState()\n```\n\nUse `diff` syntax only when it highlights changed\u002Fadded\u002Fremoved components, props, or state.\n\n```diff\n \u003CResourcePage> (apps\u002Fexample\u002Fsrc\u002Froutes\u002Fresource.tsx)\n   useResourceActions()\n+  useOptimisticResourceState()\n   \u003CResourceToolbar>\n+    \u003CCreateResourceDialog> (packages\u002Fui)\n```\n\n**File-tree diff** - broad refactors or when file responsibility is a design decision. Format like `tree` output so depth is easy to scan; keep it high-level.\n\n```diff\n src\n └── resource\n+    ├── resource-client.ext      # NEW - wraps API contract calls\n~    └── resource-route.ext       # MODIFIED - wires create action into UI\n```\n\n**Dependency-injection map** - the seams and injected dependencies that matter, grouped by the object\u002Fworkflow that receives them. Explain what each dependency lets the code do; avoid raw constructor dumps.\n\n```text\ncreateResourceWorkflow\n  receives resourceStore    -> persists resources\n  receives eventPublisher   -> emits resource-created events after commit\n  receives clock            -> makes timestamps deterministic\n\nResourcePage\n  receives createResource   -> UI does not know transport details\n  receives queryClient      -> updates cached resource list after success\n```\n\n**Internal method signatures** for key new functions not captured in system design (use the codebase's language):\n\n```\nresolveTarget(items: Item[], cursor: Cursor) -> ItemId | null\n```\n\n**Pseudocode** for complex algorithms or logic - english-y, not a programming language:\n\n```text\non(artifactSave)\n  if artifact.unchanged(oldHash)\n    return cached permalink\n  else\n    objectStore.upload(artifact.content)\n    update local cache with new hash and permalink\n    return fresh permalink\n```\n\n## Required close-out views\n\nEnd every Program Design with both views below.\n\n**Test assertions** - state the important behavior each test proves and identify its test level or boundary. Specify assertions, not test implementation.\n\n```text\nintegration: create resource\n  boundary: API -> service -> store\n  asserts: persists the resource and returns its generated ID\n```\n\n**Low-confidence decisions** - name the design choices the agent is least confident about and explain why they need human attention. Write `None` when there are no low-confidence decisions.\n\n```text\n- Queue retry policy - production traffic and failure-rate evidence are incomplete.\n```\n\n## HTML artifacts for complex concepts\n\nThe same HTML-artifact escape hatch from the System Design step applies here - use a focused inline HTML artifact when code shape, data flow, and annotations are clearer together than in plain text. Base any HTML artifact on `{SKILLBASE}\u002Freferences\u002Fartifact_template.html` so it matches the RPI artifact viewer's visual language.\n\u003C\u002Fguidance>\n\n\u003C\u002Fstep>\n\n\u003Cstep index=\"6\" name=\"program-design-review-gate\">\n\n\u003Cinstructions>\nWhen the program design is settled, hand it back for review the same way:\n\n> I think the program design is complete too. Can you review the **Program Design** section and confirm the code shape looks right?\n\nWait for the user's approval and incorporate any fixes.\n\u003C\u002Finstructions>\n\n\u003C\u002Fstep>\n\n\u003Cstep index=\"7\" name=\"wrap-up\">\n\n\u003Cinstructions>\nWhen both phases are approved, read the final answer template and follow it exactly (it points to the next step - the structure outline): `Read({SKILLBASE}\u002Freferences\u002Ftdd_final_answer_resolved.md)`. Include RPI artifact permalinks if available.\n\u003C\u002Finstructions>\n\n\u003C\u002Fstep>\n",{"name":5,"description":7},"main","0567c9d05ed24829c98f8f3efe7049acc1f4ea2b","src\u002Fskills\u002Frpi-create-tdd","https:\u002F\u002Fgithub.com\u002FTiagoJacinto\u002Flocal-agent-factory","https:\u002F\u002Fgithub.com\u002FTiagoJacinto","2026-09-11 17:28:26",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add TiagoJacinto\u002Flocal-agent-factory --skill rpi-create-tdd",{"tool":36,"command":37},"bunx","bunx skills add TiagoJacinto\u002Flocal-agent-factory --skill rpi-create-tdd",{"tool":39,"command":40},"pnpm","pnpm dlx skills add TiagoJacinto\u002Flocal-agent-factory --skill rpi-create-tdd","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FTiagoJacinto\u002Flocal-agent-factory\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Frpi-create-tdd\u002FSKILL.md",true,[44,50,54],{"path":45,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":48,"sourceHtmlUrl":49},"references\u002Fartifact_template.html","REFERENCE","参考文档",1779,"https:\u002F\u002Fgithub.com\u002FTiagoJacinto\u002Flocal-agent-factory\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Frpi-create-tdd\u002Freferences\u002Fartifact_template.html",{"path":51,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":52,"sourceHtmlUrl":53},"references\u002Ftdd_final_answer_resolved.md",226,"https:\u002F\u002Fgithub.com\u002FTiagoJacinto\u002Flocal-agent-factory\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Frpi-create-tdd\u002Freferences\u002Ftdd_final_answer_resolved.md",{"path":55,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":56,"sourceHtmlUrl":57},"references\u002Ftdd_template.md",575,"https:\u002F\u002Fgithub.com\u002FTiagoJacinto\u002Flocal-agent-factory\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Frpi-create-tdd\u002Freferences\u002Ftdd_template.md",[59,66,73,80,87,93],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M79SMPKA5DTKFP44KBBK32XE","sssf","Run and monitor registered change-delivery workflows through the local factory runtime.","https:\u002F\u002Fgithub.com\u002FTiagoJacinto\u002Flocal-agent-factory\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Fsssf\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M79SMJE5ATKJ0CP81HPEPDT3","rpi-problem","Create the local RPI problem record for an inline request or a Linear, Beads, or GitHub issue.","https:\u002F\u002Fgithub.com\u002FTiagoJacinto\u002Flocal-agent-factory\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Frpi-problem\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M79SMEDMZ3AE76FZDYACFN2T","rpi-implement-outline","Implement a HumanLayer structure outline through the registered implement-outline Workflow.","https:\u002F\u002Fgithub.com\u002FTiagoJacinto\u002Flocal-agent-factory\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Frpi-implement-outline\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M79SMAKKFVE7ANAK8YWMCY3G","rpi-describe-pr","Compose and publish the reviewed description for one stacked pull request.","https:\u002F\u002Fgithub.com\u002FTiagoJacinto\u002Flocal-agent-factory\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Frpi-describe-pr\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M79SM1S4CAS26HX7BVXZAPQW","rpi-create-research","https:\u002F\u002Fgithub.com\u002FTiagoJacinto\u002Flocal-agent-factory\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Frpi-create-research\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M79SKYJD0G2V95RASQ3EC43B","rpi-create-research-questions","https:\u002F\u002Fgithub.com\u002FTiagoJacinto\u002Flocal-agent-factory\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Frpi-create-research-questions\u002FSKILL.md",[],[]]