@prismer/runtime 2.0.8 → 2.2.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3430 -0
- package/README.md +34 -12
- package/apc/skills/FIELD-DICTIONARY.md +111 -0
- package/apc/skills/bug-reproduce/SKILL.md +150 -0
- package/apc/skills/bug-reproduce/skill.json +96 -0
- package/apc/skills/code-review/SKILL.md +198 -0
- package/apc/skills/code-review/skill.json +124 -0
- package/apc/skills/design-review/SKILL.md +122 -0
- package/apc/skills/design-review/skill.json +88 -0
- package/apc/skills/doc-sync/SKILL.md +168 -0
- package/apc/skills/doc-sync/skill.json +81 -0
- package/apc/skills/env-doctor/SKILL.md +194 -0
- package/apc/skills/env-doctor/skill.json +209 -0
- package/apc/skills/git-ops/SKILL.md +189 -0
- package/apc/skills/git-ops/skill.json +94 -0
- package/apc/skills/impact-trace/SKILL.md +168 -0
- package/apc/skills/impact-trace/skill.json +104 -0
- package/apc/skills/observability/SKILL.md +195 -0
- package/apc/skills/observability/skill.json +116 -0
- package/apc/skills/release-db-config-sync/SKILL.md +186 -0
- package/apc/skills/release-db-config-sync/skill.json +109 -0
- package/apc/skills/release-ota-promote/SKILL.md +195 -0
- package/apc/skills/release-ota-promote/skill.json +176 -0
- package/apc/skills/release-preflight/SKILL.md +174 -0
- package/apc/skills/release-preflight/skill.json +175 -0
- package/apc/skills/release-rollback/SKILL.md +214 -0
- package/apc/skills/release-rollback/skill.json +230 -0
- package/apc/skills/release-tag/SKILL.md +194 -0
- package/apc/skills/release-tag/skill.json +94 -0
- package/apc/skills/releasing-prod/SKILL.md +49 -0
- package/apc/skills/releasing-test/SKILL.md +135 -0
- package/apc/skills/sdk-release/SKILL.md +200 -0
- package/apc/skills/spec-intake/SKILL.md +169 -0
- package/apc/skills/spec-intake/skill.json +93 -0
- package/apc/skills/test-result-feedback/SKILL.md +239 -0
- package/apc/skills/test-result-feedback/skill.json +193 -0
- package/apc/skills/test-runner/SKILL.md +169 -0
- package/apc/skills/test-runner/skill.json +103 -0
- package/apc/skills/ui-align/SKILL.md +209 -0
- package/apc/skills/ui-align/skill.json +114 -0
- package/apc/skills/ui-canvas/SKILL.md +148 -0
- package/apc/skills/ui-canvas/skill.json +127 -0
- package/built-in-skills/agent-coordination/SKILL.md +59 -37
- package/built-in-skills/agent-meta/SKILL.md +1 -0
- package/built-in-skills/assets/SKILL.md +8 -6
- package/built-in-skills/browser-use/SKILL.md +93 -0
- package/built-in-skills/canvas-design/SKILL.md +1 -0
- package/built-in-skills/claim-agent-ownership/SKILL.md +3 -2
- package/built-in-skills/claude-api/SKILL.md +1 -0
- package/built-in-skills/codebase-design/DEEPENING.md +37 -0
- package/built-in-skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
- package/built-in-skills/codebase-design/LICENSE +21 -0
- package/built-in-skills/codebase-design/SKILL.md +116 -0
- package/built-in-skills/conversation-compaction/SKILL.md +114 -0
- package/built-in-skills/council-creator/SKILL.md +426 -0
- package/built-in-skills/diagnosing-bugs/LICENSE +21 -0
- package/built-in-skills/diagnosing-bugs/SKILL.md +136 -0
- package/built-in-skills/diagnosing-bugs/scripts/hitl-loop.template.sh +41 -0
- package/built-in-skills/doc-coauthoring/SKILL.md +1 -0
- package/built-in-skills/document-generation/SKILL.md +105 -0
- package/built-in-skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/built-in-skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/built-in-skills/domain-modeling/LICENSE +21 -0
- package/built-in-skills/domain-modeling/SKILL.md +76 -0
- package/built-in-skills/frontend-design/SKILL.md +1 -0
- package/built-in-skills/human-approval/SKILL.md +17 -2
- package/built-in-skills/image-generate/SKILL.md +103 -302
- package/built-in-skills/image-generate/scripts/generate-and-deliver.mjs +289 -0
- package/built-in-skills/ingest/SKILL.md +13 -45
- package/built-in-skills/internal-comms/SKILL.md +1 -0
- package/built-in-skills/liteparse/SKILL.md +130 -110
- package/built-in-skills/mcp-builder/SKILL.md +1 -0
- package/built-in-skills/memory/SKILL.md +420 -55
- package/built-in-skills/memory-dream/SKILL.md +339 -0
- package/built-in-skills/office-artifacts/SKILL.md +17 -4
- package/built-in-skills/okr/SKILL.md +154 -0
- package/built-in-skills/persona/SKILL.md +81 -0
- package/built-in-skills/persona-generator/SKILL.md +296 -0
- package/built-in-skills/pkf-svg/SKILL.md +253 -0
- package/built-in-skills/pkf-writing/SKILL.md +236 -0
- package/built-in-skills/prismer-im-collab/SKILL.md +26 -6
- package/built-in-skills/proactivity/SKILL.md +84 -0
- package/built-in-skills/remotion/SKILL.md +431 -0
- package/built-in-skills/role-builder/SKILL.md +203 -0
- package/built-in-skills/role-builder/scripts/author-role.mjs +334 -0
- package/built-in-skills/role-builder/scripts/ingest-role.mjs +223 -0
- package/built-in-skills/role-builder/scripts/instantiate-and-run.mjs +290 -0
- package/built-in-skills/role-builder/scripts/operation-harness.mjs +267 -0
- package/built-in-skills/skill-authoring/SKILL.md +110 -100
- package/built-in-skills/skill-authoring/skill.json +3 -3
- package/built-in-skills/skill-builder/SKILL.md +171 -0
- package/built-in-skills/skill-builder/scripts/ingest.mjs +265 -0
- package/built-in-skills/skill-creator/SKILL.md +165 -423
- package/built-in-skills/skill-creator/references/external-library-import.md +110 -0
- package/built-in-skills/skill-creator/scripts/import-library.mjs +475 -0
- package/built-in-skills/slack-gif-creator/SKILL.md +20 -0
- package/built-in-skills/tasks/SKILL.md +38 -23
- package/built-in-skills/tdd/LICENSE +21 -0
- package/built-in-skills/tdd/SKILL.md +110 -0
- package/built-in-skills/tdd/mocking.md +59 -0
- package/built-in-skills/tdd/refactoring.md +10 -0
- package/built-in-skills/tdd/tests.md +61 -0
- package/built-in-skills/team/SKILL.md +2 -1
- package/built-in-skills/web-artifacts-builder/SKILL.md +1 -0
- package/built-in-skills/webapp-testing/SKILL.md +1 -0
- package/built-in-skills/wechat-pay/SKILL.md +59 -0
- package/dist/cli.cjs +71872 -19960
- package/dist/cli.js +71803 -19846
- package/dist/index.cjs +72010 -19966
- package/dist/index.d.cts +4258 -712
- package/dist/index.d.ts +4258 -712
- package/dist/index.js +72156 -20118
- package/package.json +37 -6
- package/plugins/memory/prismer/__init__.py +1211 -0
- package/plugins/memory/prismer/plugin.yaml +8 -0
- package/plugins/memory/prismer/tool-schemas.generated.json +249 -0
- package/plugins/tools/prismer-recall/__init__.py +282 -0
- package/plugins/tools/prismer-recall/plugin.yaml +15 -0
- package/built-in-skills/memory-curation/SKILL.md +0 -135
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: tasks
|
|
3
|
+
scope: common
|
|
3
4
|
description: Manage Prismer workspace tasks across the full Kanban lifecycle — create, list, inspect, update, complete, approve, reject, cancel. Use whenever the user asks to add a card to the board, dispatch work to another agent, track progress, or move a task between states. Executes via the `cloud task` CLI.
|
|
4
5
|
---
|
|
5
6
|
|
|
@@ -11,13 +12,22 @@ Use this skill to drive the **workspace Kanban** end-to-end. Tasks are durable b
|
|
|
11
12
|
|
|
12
13
|
When the user asks you to **assign / delegate / hand off** work to ANOTHER agent (e.g. "create kanban tasks and assign to @research-agent", "give this to Bob"):
|
|
13
14
|
|
|
14
|
-
1. **Call `cloud task create --assignee-name <agent>` (or `--assignee-id`).** That is the ONLY legitimate delegation path.
|
|
15
|
+
1. **Call `cloud task create --assignee-name <agent>` (or `--assignee-id`).** That is the ONLY legitimate delegation path. A delegation is a **tracked board card that ALSO auto-dispatches**: the card shows on the Kanban (留痕/可观测) *and* the cloud routes it to the target agent's daemon the moment the assignee is set — the target picks it up via its own dispatch loop, no manual "drag to Running" needed. (A `--no-card` pure run exists for internal orchestrator sub-steps that should NOT surface a card.)
|
|
15
16
|
2. **STOP** as soon as `cloud task create` returns task IDs. Reply to the user with the IDs / titles. **Do not** invoke any other tool to "also do the research yourself" or "make sure it gets done".
|
|
16
17
|
3. **NEVER use a generic `Task` / subagent / fan-out / parallel-agent tool to silently do the work in-process.** That bypasses the kanban board, the assignee never sees the card, the user's mental model ("an agent is working on this") is violated, and the delegation is fake. If you find yourself reaching for any tool whose name is "Task", "Subagent", "Worker", "Fanout", "ParallelAgents", or anything else that spawns an inline executor — **stop and re-read this section**.
|
|
17
18
|
4. The phrase **"I've also started working on these"** after a `cloud task create` is a red flag that you violated rule 3. The correct phrase is **"Tasks created and assigned. @research-agent will pick up the cards."**
|
|
18
19
|
|
|
19
20
|
This is non-negotiable. Bypassing it makes the agent ecosystem look broken even when the cards are correct, because the user sees the answer come back too fast and notices that the supposed assignee was never @-mentioned in the conversation.
|
|
20
21
|
|
|
22
|
+
## ↩️ 结果回流 — 委派后怎么拿到结果(HARD)
|
|
23
|
+
|
|
24
|
+
委派出去之后,**结果不会自动回流**到你的对话或 run —— 没有回调、没有自动推送。被派的 agent 在它**自己的独立 context** 里执行(不进你当前这条会话、也不会在这里发言),产物落在 **task 卡 + 看板**上。所以:
|
|
25
|
+
|
|
26
|
+
- **要看结果,你必须主动拉**:`cloud task get <taskId>` 读 `status` / `result` / 附件。`status=completed` 才算交付;`review` 等你 approve/reject。
|
|
27
|
+
- **编排节奏**:`cloud task create --assignee-name <peer>` → 拿到 taskId → 反复 `cloud task get <taskId>` 直到 `status` 进终态 → 读产物 → 决定下一步。(有 `cloud task wait <id>` 时优先用它,省手搓轮询。)
|
|
28
|
+
- **「看不到对方回复 ≠ 它没在干」**。被派 agent 沉默是正常的——它在独立 context 里跑,结果只在卡上。**绝不要**因为对话里没动静就自己把活重做一遍(那就是影子执行,违反上面的 Hard rules)。
|
|
29
|
+
- 派完先停、把 taskId 报给用户;之后用 `cloud task get` 跟进,而不是把委派和自办混在一条回复里。
|
|
30
|
+
|
|
21
31
|
## When to use
|
|
22
32
|
|
|
23
33
|
- The user asks to **create**, **assign**, **schedule**, or **track** work ("add to kanban", "give Bob this task", "remind me to ship X by Friday").
|
|
@@ -33,11 +43,17 @@ This is non-negotiable. Bypassing it makes the agent ecosystem look broken even
|
|
|
33
43
|
|
|
34
44
|
```
|
|
35
45
|
pending → assigned → running → review → completed | failed | cancelled
|
|
36
|
-
|
|
37
|
-
|
|
46
|
+
↑ ↓
|
|
47
|
+
└──── blocked ────────┤ (unblock returns to assigned)
|
|
48
|
+
↓
|
|
49
|
+
awaiting_approval
|
|
50
|
+
↓
|
|
51
|
+
approved / rejected (back to review)
|
|
38
52
|
```
|
|
39
53
|
|
|
40
|
-
|
|
54
|
+
Nine-state lifecycle: `pending / assigned / running / review / blocked / awaiting_approval / completed / failed / cancelled`. `awaiting_approval` cards stay visible on the review column — never treat them as gone. `blocked` has its own column.
|
|
55
|
+
|
|
56
|
+
A `work_item` shows on the Kanban; a `goal` shows on the Goals lane. Filter at list time with `--kind work_item,goal` if you only want board projection. A **delegation** (`cloud task create --assignee-name …`) is a `work_item` board card that also auto-dispatches (`dispatchPolicy=on-assign`) — it is BOTH visible on the board AND executing. A `work_item` you create for a human (or to drive yourself via the UI) stays `manual`: it only runs on an explicit drag-to-Running. **Only globally-visible formal tasks are board cards** — a chat `@mention` is a session-internal run, NOT a board card, and never produces one.
|
|
41
57
|
|
|
42
58
|
## Permission model (v2.0 — `release 200` state machine)
|
|
43
59
|
|
|
@@ -267,7 +283,7 @@ You MUST also confirm:
|
|
|
267
283
|
|
|
268
284
|
### As a verifier agent (when you receive task.verify.requested)
|
|
269
285
|
|
|
270
|
-
You will receive
|
|
286
|
+
You will receive a task dispatch message:
|
|
271
287
|
|
|
272
288
|
type: task.verify.requested
|
|
273
289
|
taskId: ...
|
|
@@ -332,7 +348,7 @@ cloud task apply-template <taskId> --template <id> # adopt a template
|
|
|
332
348
|
|
|
333
349
|
## 产物输出(user-deliverable)
|
|
334
350
|
|
|
335
|
-
|
|
351
|
+
**文件交付是显式的**(release202/09 P2 起)。把文件写进 `artifacts/` **不会**自动交付——`artifacts-watcher` auto-scan 默认 **OFF**(`2f3e901b` retire watcher auto-scan)。仅当 carrier 决策是文件时,才使用 `cloud deliver` / `cloud task attach` 显式交付该文件。
|
|
336
352
|
|
|
337
353
|
```bash
|
|
338
354
|
# 1) 把最终产物写到 artifacts/(draft / 中间文件走 scratch,不会被交付)
|
|
@@ -345,39 +361,38 @@ cloud task attach "${PRISMER_ARTIFACTS_DIR}/my-report.md" # 动作 ③:挂
|
|
|
345
361
|
|
|
346
362
|
> ⚠️ **写进 `artifacts/` ≠ 交付**。没有 auto-scan。每个文件都要显式 `cloud deliver`(聊天回复产物)或 `cloud task attach`(任务卡产物),否则用户收不到。`artifacts/` 放最终交付物,draft / 中间文件走 `scratch/`。
|
|
347
363
|
|
|
348
|
-
>
|
|
364
|
+
> **常态(含 hermes):直接 `cloud deliver <abs-path>` 即可**——hermes 虽没有 per-dispatch env id(`PRISMER_RUN_ID` / `PRISMER_CONVERSATION_ID` unset),但 daemon(release203/15c)会按你的 agent 身份自动关联你**当前**的 dispatch,补全 run/conversation。spawn 适配器(claude-code / codex)env 已注入,同样无需 flag。
|
|
365
|
+
> **仅以下情形才手传 flag**:(a) 你要对**另一个**(非当前)dispatch 交付;(b) daemon 返回 **409 歧义**(同 agent 多个并发 dispatch 无法区分)。这时才从 `<execution_context>` 抄 `<run_id>` / `<conversation_id>`:
|
|
349
366
|
> ```bash
|
|
350
367
|
> cloud deliver "<abs-path>" --run-id "<run_id>" --conversation-id "<conversation_id>"
|
|
351
368
|
> ```
|
|
352
|
-
>
|
|
369
|
+
> 详见 `office-artifacts` SKILL(唯一交付契约)。
|
|
353
370
|
|
|
354
371
|
**Workflow**:
|
|
355
372
|
|
|
356
|
-
1. 中间脚本 / draft 写到 `${PRISMER_SCRATCH_DIR}/`(scratch,不进
|
|
373
|
+
1. 中间脚本 / draft 写到 `${PRISMER_SCRATCH_DIR}/`(scratch,不进 Asset、不交付)
|
|
357
374
|
2. 最终产物写到 `${PRISMER_ARTIFACTS_DIR}/`(agent process env; physically `${TASK_WORKDIR}/artifacts/`)
|
|
358
375
|
3. **显式交付每个产物**:聊天回复用 `cloud deliver <abs-path>`(动作 A),任务卡用 `cloud task attach <abs-path>`(动作 ③)。命令成功会打印 `assetId`
|
|
359
376
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
- 不要在对话里贴大段 markdown 充当 "产物"——实际产物必须落文件
|
|
363
|
-
- 不要把 draft / 中间产物丢进 `artifacts/`——那里只放最终交付物(draft 走 `scratch/`)
|
|
364
|
-
- 不要以为写进 `artifacts/` 就交付了——没有 auto-scan,必须显式 `cloud deliver` / `cloud task attach`
|
|
377
|
+
### Carrier 选择与显式交付
|
|
365
378
|
|
|
366
|
-
|
|
379
|
+
carrier 优先级是:**用户明确要求 > Runtime carrier directive > 已选内容 skill > task 默认**。`tasks` skill 只管任务与回执,不擅自把内容改成 Markdown 文件、Asset 或 Memory Page。
|
|
367
380
|
|
|
368
|
-
**
|
|
381
|
+
1. **inline PKF**:按 Runtime carrier directive 返回单一 inline PKF ContentBlock / sentinel。不写文件,不调 `cloud deliver` / `cloud task attach`,不并行产出 `.md` / `.html` / `.css` / `.js`。
|
|
382
|
+
2. **用户明确要求文件**:按用户指定格式或内容 skill 决定的格式写入 `${PRISMER_ARTIFACTS_DIR}/`,再显式调 `cloud deliver` / `cloud task attach`。不要另造 Markdown 投影。
|
|
383
|
+
3. **Asset / Memory**:只有用户要求或 Runtime carrier directive 明确选中时才 materialize;必须以服务端返回的 id / path / version / hash 以及读回结果作为权威证据。
|
|
384
|
+
4. **任务 evidence**:截图、benchmark JSON、日志等原始证据可作为明确文件附件显式 `cloud task attach`;它们不会改变主交付物的 carrier。
|
|
369
385
|
|
|
370
|
-
|
|
371
|
-
2. chat 里的文字回复是 **summary / teaser**(一两句话点出产了什么、关键结论),**不是交付物本身**。交付物在产物资产里,用户在 task 详情的 Artifacts 看完整内容;下游 task 可经 Library 复用同一份 markdown 资产。
|
|
372
|
-
3. **文件名 / 结构由 skill 按目的自定**——别套死 schema。一般约定:用有意义的文件名(如 `research-summary.md` / `design-review.md` / `q3-plan.md`),需要时拆多个文件。一个 task 可产多个 markdown。
|
|
373
|
-
|
|
374
|
-
**为什么**:贴在对话里的长 markdown 是一次性的、不可复用、污染时间线、跨设备 / 刷新易丢;写成文件后它是有 hash、可预览、可 promote 到 Library Root、可被下游 task 引用的**资产**。chat 时间线的完成卡只 surface「N 个产物 →」,点进 task drawer 看正文。
|
|
386
|
+
**禁止**:
|
|
375
387
|
|
|
376
|
-
|
|
388
|
+
- inline 选中后并行生成 Markdown/HTML/CSS/JS 或附件;
|
|
389
|
+
- 把 draft / 中间产物放进 `artifacts/`(draft 走 `scratch/`);
|
|
390
|
+
- 把“写进 `artifacts/`”当成已交付——auto-scan 是 OFF,文件 carrier 必须有显式 receipt;
|
|
391
|
+
- 用 role 模板或 task 流程覆盖 Runtime carrier directive。
|
|
377
392
|
|
|
378
393
|
**Self-check checkpoint**:
|
|
379
394
|
|
|
380
|
-
`cloud task update --status review` 内嵌调用本地 daemon `/v1/checkpoints/pre_status_change`。该 hook 比较 `artifacts/` 内文件 sha256 与已 attach
|
|
395
|
+
`cloud task update --status review` 内嵌调用本地 daemon `/v1/checkpoints/pre_status_change`。该 hook 比较 `artifacts/` 内文件 sha256 与已 attach Asset.contentHash,若 diff 非空:
|
|
381
396
|
|
|
382
397
|
- exit code = 12
|
|
383
398
|
- stderr 列出未 attach 的文件路径 + hash + size
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Matt Pocock
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd
|
|
3
|
+
scope: coding
|
|
4
|
+
source: https://github.com/mattpocock/skills (MIT, © 2026 Matt Pocock)
|
|
5
|
+
description: Test-driven development. Use when the user wants to build features or fix bugs test-first, mentions "red-green-refactor", or wants integration tests.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Test-Driven Development
|
|
9
|
+
|
|
10
|
+
## Philosophy
|
|
11
|
+
|
|
12
|
+
**Core principle**: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.
|
|
13
|
+
|
|
14
|
+
**Good tests** are integration-style: they exercise real code paths through public APIs. They describe _what_ the system does, not _how_ it does it. A good test reads like a specification - "user can checkout with valid cart" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.
|
|
15
|
+
|
|
16
|
+
**Bad tests** are coupled to implementation. They mock internal collaborators, test private methods, or verify through external means (like querying a database directly instead of using the interface). The warning sign: your test breaks when you refactor, but behavior hasn't changed. If you rename an internal function and tests fail, those tests were testing implementation, not behavior.
|
|
17
|
+
|
|
18
|
+
See [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.
|
|
19
|
+
|
|
20
|
+
## Anti-Pattern: Horizontal Slices
|
|
21
|
+
|
|
22
|
+
**DO NOT write all tests first, then all implementation.** This is "horizontal slicing" - treating RED as "write all tests" and GREEN as "write all code."
|
|
23
|
+
|
|
24
|
+
This produces **crap tests**:
|
|
25
|
+
|
|
26
|
+
- Tests written in bulk test _imagined_ behavior, not _actual_ behavior
|
|
27
|
+
- You end up testing the _shape_ of things (data structures, function signatures) rather than user-facing behavior
|
|
28
|
+
- Tests become insensitive to real changes - they pass when behavior breaks, fail when behavior is fine
|
|
29
|
+
- You outrun your headlights, committing to test structure before understanding the implementation
|
|
30
|
+
|
|
31
|
+
**Correct approach**: Vertical slices via tracer bullets. One test → one implementation → repeat. Each test responds to what you learned from the previous cycle. Because you just wrote the code, you know exactly what behavior matters and how to verify it.
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
WRONG (horizontal):
|
|
35
|
+
RED: test1, test2, test3, test4, test5
|
|
36
|
+
GREEN: impl1, impl2, impl3, impl4, impl5
|
|
37
|
+
|
|
38
|
+
RIGHT (vertical):
|
|
39
|
+
RED→GREEN: test1→impl1
|
|
40
|
+
RED→GREEN: test2→impl2
|
|
41
|
+
RED→GREEN: test3→impl3
|
|
42
|
+
...
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Workflow
|
|
46
|
+
|
|
47
|
+
### 1. Planning
|
|
48
|
+
|
|
49
|
+
When exploring the codebase, read `CONTEXT.md` (if it exists) so that test names and interface vocabulary match the project's domain language, and respect ADRs in the area you're touching.
|
|
50
|
+
|
|
51
|
+
Before writing any code:
|
|
52
|
+
|
|
53
|
+
- [ ] Confirm with user what interface changes are needed
|
|
54
|
+
- [ ] Confirm with user which behaviors to test (prioritize)
|
|
55
|
+
- [ ] Identify opportunities for deep modules (small interface, deep implementation) — run the `/codebase-design` skill for the vocabulary and the testability checks
|
|
56
|
+
- [ ] List the behaviors to test (not implementation steps)
|
|
57
|
+
- [ ] Get user approval on the plan
|
|
58
|
+
|
|
59
|
+
Ask: "What should the public interface look like? Which behaviors are most important to test?"
|
|
60
|
+
|
|
61
|
+
**You can't test everything.** Confirm with the user exactly which behaviors matter most. Focus testing effort on critical paths and complex logic, not every possible edge case.
|
|
62
|
+
|
|
63
|
+
### 2. Tracer Bullet
|
|
64
|
+
|
|
65
|
+
Write ONE test that confirms ONE thing about the system:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
RED: Write test for first behavior → test fails
|
|
69
|
+
GREEN: Write minimal code to pass → test passes
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
This is your tracer bullet - proves the path works end-to-end.
|
|
73
|
+
|
|
74
|
+
### 3. Incremental Loop
|
|
75
|
+
|
|
76
|
+
For each remaining behavior:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
RED: Write next test → fails
|
|
80
|
+
GREEN: Minimal code to pass → passes
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Rules:
|
|
84
|
+
|
|
85
|
+
- One test at a time
|
|
86
|
+
- Only enough code to pass current test
|
|
87
|
+
- Don't anticipate future tests
|
|
88
|
+
- Keep tests focused on observable behavior
|
|
89
|
+
|
|
90
|
+
### 4. Refactor
|
|
91
|
+
|
|
92
|
+
After all tests pass, look for [refactor candidates](refactoring.md):
|
|
93
|
+
|
|
94
|
+
- [ ] Extract duplication
|
|
95
|
+
- [ ] Deepen modules (move complexity behind simple interfaces)
|
|
96
|
+
- [ ] Apply SOLID principles where natural
|
|
97
|
+
- [ ] Consider what new code reveals about existing code
|
|
98
|
+
- [ ] Run tests after each refactor step
|
|
99
|
+
|
|
100
|
+
**Never refactor while RED.** Get to GREEN first.
|
|
101
|
+
|
|
102
|
+
## Checklist Per Cycle
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
[ ] Test describes behavior, not implementation
|
|
106
|
+
[ ] Test uses public interface only
|
|
107
|
+
[ ] Test would survive internal refactor
|
|
108
|
+
[ ] Code is minimal for this test
|
|
109
|
+
[ ] No speculative features added
|
|
110
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# When to Mock
|
|
2
|
+
|
|
3
|
+
Mock at **system boundaries** only:
|
|
4
|
+
|
|
5
|
+
- External APIs (payment, email, etc.)
|
|
6
|
+
- Databases (sometimes - prefer test DB)
|
|
7
|
+
- Time/randomness
|
|
8
|
+
- File system (sometimes)
|
|
9
|
+
|
|
10
|
+
Don't mock:
|
|
11
|
+
|
|
12
|
+
- Your own classes/modules
|
|
13
|
+
- Internal collaborators
|
|
14
|
+
- Anything you control
|
|
15
|
+
|
|
16
|
+
## Designing for Mockability
|
|
17
|
+
|
|
18
|
+
At system boundaries, design interfaces that are easy to mock:
|
|
19
|
+
|
|
20
|
+
**1. Use dependency injection**
|
|
21
|
+
|
|
22
|
+
Pass external dependencies in rather than creating them internally:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// Easy to mock
|
|
26
|
+
function processPayment(order, paymentClient) {
|
|
27
|
+
return paymentClient.charge(order.total);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Hard to mock
|
|
31
|
+
function processPayment(order) {
|
|
32
|
+
const client = new StripeClient(process.env.STRIPE_KEY);
|
|
33
|
+
return client.charge(order.total);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**2. Prefer SDK-style interfaces over generic fetchers**
|
|
38
|
+
|
|
39
|
+
Create specific functions for each external operation instead of one generic function with conditional logic:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
// GOOD: Each function is independently mockable
|
|
43
|
+
const api = {
|
|
44
|
+
getUser: (id) => fetch(`/users/${id}`),
|
|
45
|
+
getOrders: (userId) => fetch(`/users/${userId}/orders`),
|
|
46
|
+
createOrder: (data) => fetch('/orders', { method: 'POST', body: data }),
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// BAD: Mocking requires conditional logic inside the mock
|
|
50
|
+
const api = {
|
|
51
|
+
fetch: (endpoint, options) => fetch(endpoint, options),
|
|
52
|
+
};
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The SDK approach means:
|
|
56
|
+
- Each mock returns one specific shape
|
|
57
|
+
- No conditional logic in test setup
|
|
58
|
+
- Easier to see which endpoints a test exercises
|
|
59
|
+
- Type safety per endpoint
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Refactor Candidates
|
|
2
|
+
|
|
3
|
+
After TDD cycle, look for:
|
|
4
|
+
|
|
5
|
+
- **Duplication** → Extract function/class
|
|
6
|
+
- **Long methods** → Break into private helpers (keep tests on public interface)
|
|
7
|
+
- **Shallow modules** → Combine or deepen
|
|
8
|
+
- **Feature envy** → Move logic to where data lives
|
|
9
|
+
- **Primitive obsession** → Introduce value objects
|
|
10
|
+
- **Existing code** the new code reveals as problematic
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Good and Bad Tests
|
|
2
|
+
|
|
3
|
+
## Good Tests
|
|
4
|
+
|
|
5
|
+
**Integration-style**: Test through real interfaces, not mocks of internal parts.
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
// GOOD: Tests observable behavior
|
|
9
|
+
test("user can checkout with valid cart", async () => {
|
|
10
|
+
const cart = createCart();
|
|
11
|
+
cart.add(product);
|
|
12
|
+
const result = await checkout(cart, paymentMethod);
|
|
13
|
+
expect(result.status).toBe("confirmed");
|
|
14
|
+
});
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Characteristics:
|
|
18
|
+
|
|
19
|
+
- Tests behavior users/callers care about
|
|
20
|
+
- Uses public API only
|
|
21
|
+
- Survives internal refactors
|
|
22
|
+
- Describes WHAT, not HOW
|
|
23
|
+
- One logical assertion per test
|
|
24
|
+
|
|
25
|
+
## Bad Tests
|
|
26
|
+
|
|
27
|
+
**Implementation-detail tests**: Coupled to internal structure.
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
// BAD: Tests implementation details
|
|
31
|
+
test("checkout calls paymentService.process", async () => {
|
|
32
|
+
const mockPayment = jest.mock(paymentService);
|
|
33
|
+
await checkout(cart, payment);
|
|
34
|
+
expect(mockPayment.process).toHaveBeenCalledWith(cart.total);
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Red flags:
|
|
39
|
+
|
|
40
|
+
- Mocking internal collaborators
|
|
41
|
+
- Testing private methods
|
|
42
|
+
- Asserting on call counts/order
|
|
43
|
+
- Test breaks when refactoring without behavior change
|
|
44
|
+
- Test name describes HOW not WHAT
|
|
45
|
+
- Verifying through external means instead of interface
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
// BAD: Bypasses interface to verify
|
|
49
|
+
test("createUser saves to database", async () => {
|
|
50
|
+
await createUser({ name: "Alice" });
|
|
51
|
+
const row = await db.query("SELECT * FROM users WHERE name = ?", ["Alice"]);
|
|
52
|
+
expect(row).toBeDefined();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// GOOD: Verifies through interface
|
|
56
|
+
test("createUser makes user retrievable", async () => {
|
|
57
|
+
const user = await createUser({ name: "Alice" });
|
|
58
|
+
const retrieved = await getUser(user.id);
|
|
59
|
+
expect(retrieved.name).toBe("Alice");
|
|
60
|
+
});
|
|
61
|
+
```
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: team
|
|
3
|
+
scope: persistence
|
|
3
4
|
description: Invite humans into a workspace, propose collaborators for a project, and inspect the current human team. Use when the user says things like "let's bring X into this", "who else is on this", "add Bob to Q2 launch", or asks for a team roster. NEVER mints invites silently — the human must press a button.
|
|
4
5
|
---
|
|
5
6
|
|
|
@@ -19,7 +20,7 @@ Use this skill when work needs another human in the loop. The workspace + projec
|
|
|
19
20
|
- The user names someone who isn't already on the workspace: *"Have Maya look at this"*, *"Loop Bob in on Q2 launch"*.
|
|
20
21
|
- The user asks who's on the team or what the roster looks like: *"who has access to this workspace"*, *"who's working on Q2 launch"*.
|
|
21
22
|
- The user asks to remove someone, change someone's role, or move someone between projects.
|
|
22
|
-
- An agent (e.g.
|
|
23
|
+
- An agent (e.g. Team Manager role) is reasoning about staffing in onboarding and needs to *propose* additions without taking action.
|
|
23
24
|
|
|
24
25
|
## What the platform exposes
|
|
25
26
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: web-artifacts-builder
|
|
3
|
+
scope: coding
|
|
3
4
|
description: Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.
|
|
4
5
|
license: Complete terms in LICENSE.txt
|
|
5
6
|
---
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: webapp-testing
|
|
3
|
+
scope: coding
|
|
3
4
|
description: Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
|
|
4
5
|
license: Complete terms in LICENSE.txt
|
|
5
6
|
---
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wechat-pay
|
|
3
|
+
scope: persistence
|
|
4
|
+
description: Collect a real WeChat Pay (微信支付) payment from inside an IM session. Use when a user in the conversation explicitly asks to pay / 下单 / 付款 / 收款 and has stated (or confirmed) an amount. Posts a Native 扫码 QR card into the session (which the bridge forwards to bound WeChat users), then confirms when the payment lands. Executes via `cloud pay create` / `cloud pay status`. This is the RUNTIME收款 capability — distinct from the wechatpay-skills coding-assistant skill, which only helps developers write integration code.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# WeChat Pay (收款) in a session
|
|
8
|
+
|
|
9
|
+
This skill lets you collect a **real** WeChat Pay payment from a participant of the
|
|
10
|
+
current conversation. The platform is a **platform-direct merchant** using **Native
|
|
11
|
+
(扫码) payment**: you create an order, the cloud renders a QR card into the session,
|
|
12
|
+
the bridge fans that QR out to the session's bound WeChat users, they scan & pay, and
|
|
13
|
+
the cloud posts a settlement message + flips the card to 已支付.
|
|
14
|
+
|
|
15
|
+
## ⛔ Guardrails — real money
|
|
16
|
+
|
|
17
|
+
1. **Only on explicit user request with an explicit amount.** Never invent a price,
|
|
18
|
+
never round, never "helpfully" collect more. If the amount is unclear, ASK in the
|
|
19
|
+
conversation first.
|
|
20
|
+
2. **Never alter the amount** the user agreed to.
|
|
21
|
+
3. **One order per intent.** Don't re-issue a QR for the same charge — poll the
|
|
22
|
+
existing order with `cloud pay status` instead.
|
|
23
|
+
4. This is **online-only**. If the cloud is unreachable the command fails — surface
|
|
24
|
+
that to the user, do NOT fake a confirmation.
|
|
25
|
+
|
|
26
|
+
## When to use
|
|
27
|
+
|
|
28
|
+
- A user says "帮我下单 / 付款 / 收款 ¥X" or agrees to a quoted price.
|
|
29
|
+
- You're a 客服 / 销售 / 咨询 agent closing a paid action.
|
|
30
|
+
|
|
31
|
+
## CLI
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Create an order + post the QR card (amount in YUAN on the CLI)
|
|
35
|
+
cloud pay create --conversation <conversationId> --amount 9.9 --desc "咨询费"
|
|
36
|
+
# → prints orderId + status=pending; the QR is now visible in the session.
|
|
37
|
+
|
|
38
|
+
# Poll until paid (the cloud also posts a "✅ 已收款" message when it lands)
|
|
39
|
+
cloud pay status <orderId>
|
|
40
|
+
# → status: pending | succeeded | expired | closed
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`--conversation` is the current session id. Get it from your dispatch context; if you
|
|
44
|
+
don't have it, you are not in a session that can collect payment.
|
|
45
|
+
|
|
46
|
+
## Flow
|
|
47
|
+
|
|
48
|
+
1. Confirm the amount + purpose with the user (in YUAN).
|
|
49
|
+
2. `cloud pay create --conversation <id> --amount <yuan> --desc "<purpose>"`.
|
|
50
|
+
3. Tell the user the QR is posted and to scan it in WeChat.
|
|
51
|
+
4. Poll `cloud pay status <orderId>` (or wait for the settlement message). On
|
|
52
|
+
`succeeded`, confirm to the user and continue your task.
|
|
53
|
+
5. The Native QR expires in ~2h. If it expires before payment, create a new order.
|
|
54
|
+
|
|
55
|
+
## Notes
|
|
56
|
+
|
|
57
|
+
- Amounts: CLI takes **yuan** (`9.9`); the API stores **分**. ¥9.9 → 990 分.
|
|
58
|
+
- Errors surface the WeChat `code` + `Request-Id` — if a user reports a failure, that
|
|
59
|
+
`Request-Id` is exactly what the wechatpay-skills troubleshooting flow consumes.
|