@kunolu/dsh-sbtd 0.1.0-rc.1

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.
Files changed (41) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +51 -0
  3. package/cordis.patch.yml +3 -0
  4. package/dist/hooks.d.ts +47 -0
  5. package/dist/hooks.d.ts.map +1 -0
  6. package/dist/hooks.js +275 -0
  7. package/dist/hooks.js.map +1 -0
  8. package/dist/index.d.ts +13 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +19 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/section.d.ts +14 -0
  13. package/dist/section.d.ts.map +1 -0
  14. package/dist/section.js +16 -0
  15. package/dist/section.js.map +1 -0
  16. package/dist/state.d.ts +38 -0
  17. package/dist/state.d.ts.map +1 -0
  18. package/dist/state.js +41 -0
  19. package/dist/state.js.map +1 -0
  20. package/dist/tools/plan.d.ts +53 -0
  21. package/dist/tools/plan.d.ts.map +1 -0
  22. package/dist/tools/plan.js +290 -0
  23. package/dist/tools/plan.js.map +1 -0
  24. package/dist/tools/review.d.ts +41 -0
  25. package/dist/tools/review.d.ts.map +1 -0
  26. package/dist/tools/review.js +161 -0
  27. package/dist/tools/review.js.map +1 -0
  28. package/manuals/MANIFEST.json +67 -0
  29. package/manuals/book-ddd-distilled-modeling/SKILL.md +66 -0
  30. package/manuals/book-ddia-data-design/SKILL.md +74 -0
  31. package/manuals/book-legacy-change-safety/SKILL.md +74 -0
  32. package/manuals/book-refactoring-pass/SKILL.md +70 -0
  33. package/manuals/book-release-readiness/SKILL.md +73 -0
  34. package/manuals/domain-modeling/SKILL.md +74 -0
  35. package/manuals/grill-me/SKILL.md +7 -0
  36. package/manuals/grill-with-docs/SKILL.md +7 -0
  37. package/manuals/grilling/SKILL.md +28 -0
  38. package/manuals/to-spec/SKILL.md +75 -0
  39. package/manuals/to-tickets/SKILL.md +105 -0
  40. package/manuals/trellis-workflow/SKILL.md +475 -0
  41. package/package.json +40 -0
@@ -0,0 +1,161 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { getSession } from "../state.js";
5
+ import { sessionIdFromExec, } from "./plan.js";
6
+ export const SBTD_REVIEW_TOOL_NAME = "sbtd_review";
7
+ export const REVIEW_KINDS = [
8
+ "legacy",
9
+ "refactor",
10
+ "ddd",
11
+ "ddia",
12
+ "release",
13
+ ];
14
+ export const REVIEW_TITLES = {
15
+ legacy: "Legacy Change Safety Review",
16
+ refactor: "Refactoring Review",
17
+ ddd: "DDD Boundary Review",
18
+ ddia: "DDIA Data Design Review",
19
+ release: "Release Readiness Review",
20
+ };
21
+ const MANUAL_ID = {
22
+ legacy: "book-legacy-change-safety",
23
+ refactor: "book-refactoring-pass",
24
+ ddd: "book-ddd-distilled-modeling",
25
+ ddia: "book-ddia-data-design",
26
+ release: "book-release-readiness",
27
+ };
28
+ const REVIEW_STATUSES = {
29
+ legacy: ["characterized", "needs-safety-net", "seam-required", "blocked"],
30
+ refactor: ["proceed", "refactor-first", "blocked"],
31
+ ddd: ["confirmed", "needs-clarification", "blocked"],
32
+ ddia: ["confirmed", "needs-design-change", "blocked"],
33
+ release: ["ready", "needs-mitigation", "blocked"],
34
+ };
35
+ const PASS_STATUS = {
36
+ characterized: true,
37
+ proceed: true,
38
+ confirmed: true,
39
+ ready: true,
40
+ };
41
+ const RUNNING_STATUS = {
42
+ "needs-safety-net": true,
43
+ "needs-clarification": true,
44
+ "needs-design-change": true,
45
+ "needs-mitigation": true,
46
+ "seam-required": true,
47
+ "refactor-first": true,
48
+ };
49
+ function isReviewKind(value) {
50
+ return REVIEW_KINDS.includes(value);
51
+ }
52
+ function mapGateState(status) {
53
+ if (PASS_STATUS[status] === true) {
54
+ return "passed";
55
+ }
56
+ if (status === "blocked") {
57
+ return "blocked";
58
+ }
59
+ if (RUNNING_STATUS[status] === true) {
60
+ return "running";
61
+ }
62
+ throw new Error(`sbtd_review: unmapped status ${status}`);
63
+ }
64
+ export function loadReviewManual(kind) {
65
+ const manualsRoot = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "manuals");
66
+ return readFileSync(join(manualsRoot, MANUAL_ID[kind], "SKILL.md"), "utf8");
67
+ }
68
+ export function sbtdReview(sessionId, input) {
69
+ if (!isReviewKind(input.kind)) {
70
+ throw new Error(`sbtd_review: kind must be one of ${REVIEW_KINDS.join(", ")}`);
71
+ }
72
+ const kind = input.kind;
73
+ const allowed = REVIEW_STATUSES[kind];
74
+ if (!allowed.includes(input.status)) {
75
+ throw new Error(`sbtd_review: status for ${kind} must be one of ${allowed.join(", ")}`);
76
+ }
77
+ const status = input.status;
78
+ const manual = loadReviewManual(kind);
79
+ const session = getSession(sessionId);
80
+ if (session.plan === undefined) {
81
+ throw new Error("尚未 sbtd_plan,请先调用 sbtd_plan。");
82
+ }
83
+ const gate = session.plan.gates[kind];
84
+ gate.state = mapGateState(status);
85
+ gate.reviewStatus = status;
86
+ const conclusions = input.conclusions ?? "";
87
+ const title = REVIEW_TITLES[kind];
88
+ const markdown = [
89
+ `# ${title}`,
90
+ `Status: ${status}`,
91
+ `requirement: ${gate.requirement}`,
92
+ `state: ${gate.state}`,
93
+ "",
94
+ conclusions,
95
+ ].join("\n");
96
+ return {
97
+ title,
98
+ kind,
99
+ reviewStatus: status,
100
+ requirement: gate.requirement,
101
+ state: gate.state,
102
+ conclusions,
103
+ markdown,
104
+ manual,
105
+ };
106
+ }
107
+ export const SBTD_REVIEW_DESCRIPTION = "Record a book-gate review. kind is legacy|refactor|ddd|ddia|release only (no skill ids or aliases). status is the source-skill reviewer enum. Without a plan, call sbtd_plan first. Does not change requirement.";
108
+ export function createReviewTool() {
109
+ return {
110
+ name: SBTD_REVIEW_TOOL_NAME,
111
+ description: SBTD_REVIEW_DESCRIPTION,
112
+ parameters: {
113
+ type: "object",
114
+ properties: {
115
+ kind: {
116
+ type: "string",
117
+ enum: [...REVIEW_KINDS],
118
+ description: "Book gate kind. Exactly legacy, refactor, ddd, ddia, or release.",
119
+ },
120
+ status: {
121
+ type: "string",
122
+ description: "Reviewer status from the loaded SKILL.md enum for that kind.",
123
+ },
124
+ conclusions: {
125
+ type: "string",
126
+ description: "Review conclusions. Returned only; not written to disk.",
127
+ },
128
+ },
129
+ required: ["kind", "status"],
130
+ },
131
+ output: {
132
+ schema: {
133
+ type: "object",
134
+ additionalProperties: false,
135
+ properties: {
136
+ title: { type: "string" },
137
+ kind: { type: "string" },
138
+ reviewStatus: { type: "string" },
139
+ requirement: { type: "string" },
140
+ state: { type: "string" },
141
+ conclusions: { type: "string" },
142
+ markdown: { type: "string" },
143
+ manual: { type: "string" },
144
+ },
145
+ },
146
+ render(_args, value) {
147
+ return [{ type: "text", text: `${value.markdown}\n\n${value.manual}` }];
148
+ },
149
+ },
150
+ isConcurrencySafe() {
151
+ return false;
152
+ },
153
+ async execute(args, exec) {
154
+ return sbtdReview(sessionIdFromExec(exec), args);
155
+ },
156
+ };
157
+ }
158
+ export function registerReviewTool(ctx) {
159
+ ctx.tools.register(createReviewTool());
160
+ }
161
+ //# sourceMappingURL=review.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review.js","sourceRoot":"","sources":["../../src/tools/review.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAkB,UAAU,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EAEL,iBAAiB,GAElB,MAAM,WAAW,CAAC;AAEnB,MAAM,CAAC,MAAM,qBAAqB,GAAG,aAAa,CAAC;AAEnD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,QAAQ;IACR,UAAU;IACV,KAAK;IACL,MAAM;IACN,SAAS;CACD,CAAC;AAIX,MAAM,CAAC,M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source": "KunoLu/640-skills",
3
+ "version": "1.0.13",
4
+ "sourceRevision": "f8aa0d7225a26c5e00b81d2f1b05121108e63630",
5
+ "files": [
6
+ {
7
+ "sourcePath": "sbtd-workflow-onboard/assets/external-skills/stable/skills/domain-modeling/SKILL.md",
8
+ "sha256": "327a2b50620e2fd70abc6893cd6965e76b20f8d0adb0dc2c8d5eb3845efb643e",
9
+ "sourceRevision": "f8aa0d7225a26c5e00b81d2f1b05121108e63630"
10
+ },
11
+ {
12
+ "sourcePath": "sbtd-workflow-onboard/assets/external-skills/stable/skills/grill-me/SKILL.md",
13
+ "sha256": "caaf8b8de1684f96e26b28f3c29189db5c89cce4b73e1c93d86164f66ef88637",
14
+ "sourceRevision": "f8aa0d7225a26c5e00b81d2f1b05121108e63630"
15
+ },
16
+ {
17
+ "sourcePath": "sbtd-workflow-onboard/assets/external-skills/stable/skills/grill-with-docs/SKILL.md",
18
+ "sha256": "7de372c13488f1ee96cc11cd8907b56b6809cc93eef776eeddd37de6b6cbe3fe",
19
+ "sourceRevision": "f8aa0d7225a26c5e00b81d2f1b05121108e63630"
20
+ },
21
+ {
22
+ "sourcePath": "sbtd-workflow-onboard/assets/external-skills/stable/skills/grilling/SKILL.md",
23
+ "sha256": "10ff989e7498b23b5acb49d5048f11dcd906757d2f79c5cdf8a00001381296f2",
24
+ "sourceRevision": "f8aa0d7225a26c5e00b81d2f1b05121108e63630"
25
+ },
26
+ {
27
+ "sourcePath": "sbtd-workflow-onboard/assets/external-skills/stable/skills/to-spec/SKILL.md",
28
+ "sha256": "43ad9cf318e5e7d3d1fa360253a37021796dc87a0c2e595ad262661a10f85088",
29
+ "sourceRevision": "f8aa0d7225a26c5e00b81d2f1b05121108e63630"
30
+ },
31
+ {
32
+ "sourcePath": "sbtd-workflow-onboard/assets/external-skills/stable/skills/to-tickets/SKILL.md",
33
+ "sha256": "5c9fba69845c2519b9b35b9af42ae5142c21f8ca15ac2123dc2722002c8058ae",
34
+ "sourceRevision": "f8aa0d7225a26c5e00b81d2f1b05121108e63630"
35
+ },
36
+ {
37
+ "sourcePath": "sbtd-workflow-onboard/templates/skills/book-ddd-distilled-modeling/SKILL.md",
38
+ "sha256": "b8006abc3f2e61c5b62ed7a1a79fad517bbcc614da8156e7157092ebdc20f62a",
39
+ "sourceRevision": "f8aa0d7225a26c5e00b81d2f1b05121108e63630"
40
+ },
41
+ {
42
+ "sourcePath": "sbtd-workflow-onboard/templates/skills/book-ddia-data-design/SKILL.md",
43
+ "sha256": "87e63a9595d66343ad6e64813b701fbfea74479a7ee986230592664f289a3d2b",
44
+ "sourceRevision": "f8aa0d7225a26c5e00b81d2f1b05121108e63630"
45
+ },
46
+ {
47
+ "sourcePath": "sbtd-workflow-onboard/templates/skills/book-legacy-change-safety/SKILL.md",
48
+ "sha256": "f3ade56807980d58874bd92694ebd5f26df7e836ace609c65e0aaf355d08fcea",
49
+ "sourceRevision": "f8aa0d7225a26c5e00b81d2f1b05121108e63630"
50
+ },
51
+ {
52
+ "sourcePath": "sbtd-workflow-onboard/templates/skills/book-refactoring-pass/SKILL.md",
53
+ "sha256": "36a255121e040b962d7019c642fdd9962979a1dd3fc600e5ce0d6cd897faad7f",
54
+ "sourceRevision": "f8aa0d7225a26c5e00b81d2f1b05121108e63630"
55
+ },
56
+ {
57
+ "sourcePath": "sbtd-workflow-onboard/templates/skills/book-release-readiness/SKILL.md",
58
+ "sha256": "1c572b8c31a0411d4be956ea17fb3a8b709b2d84c66385502092a61399e58fa5",
59
+ "sourceRevision": "f8aa0d7225a26c5e00b81d2f1b05121108e63630"
60
+ },
61
+ {
62
+ "sourcePath": "sbtd-workflow-onboard/templates/skills/trellis-workflow/SKILL.md",
63
+ "sha256": "3d6589cb346649886eed7d2e86be7e2650f2f0dda909d76704284e17f765f77e",
64
+ "sourceRevision": "f8aa0d7225a26c5e00b81d2f1b05121108e63630"
65
+ }
66
+ ]
67
+ }
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: book-ddd-distilled-modeling
3
+ description: Guides lightweight domain modeling with ubiquitous language, bounded contexts, and subdomain focus. Always run after every completed grill-with-docs session as an independent second-pass boundary review; also use before PRD, design, or implementation when domain ambiguity exists.
4
+ ---
5
+
6
+ # Book DDD Distilled Modeling
7
+
8
+ Use this Skill to sharpen domain language before turning a business request into PRD, issues, design, or code.
9
+
10
+ It is derived from the `mini` rule style of `agent-rules-books` and should run after project evidence is read. It complements `grill-with-docs`, `to-spec`, and Trellis planning.
11
+
12
+ ## Mandatory Post-grill Review
13
+
14
+ Every fully completed `grill-with-docs` session MUST be followed immediately by this Skill, whether the Agent initiated that session or the user invoked it explicitly. The `domain-modeling` activity embedded in `grill-with-docs` is the active interview-time modeling pass; it does not satisfy or replace this independent second-pass review.
15
+
16
+ Re-read the completed clarification result and the supporting project facts. Look for boundary errors, hidden term collisions, unsupported invariants, misplaced responsibilities, and unresolved context ownership rather than merely restating the interview.
17
+
18
+ The review is a gate before requirement confirmation, PRD, design, Trellis task creation, or implementation:
19
+
20
+ - `confirmed`: no unresolved boundary issue prevents the workflow from advancing.
21
+ - `needs-clarification`: output the findings, return to one-question-at-a-time clarification, and rerun this Skill after resolution.
22
+ - `blocked`: the Skill, required evidence, or relevant context is unavailable; output the exact blocker and do not advance.
23
+
24
+ Invocation origin, a prior `domain-modeling` pass, or an Agent judgment that the requirement is already clear MUST NOT skip this gate.
25
+
26
+ ## When To Use
27
+
28
+ - Every completed `grill-with-docs` session, without exception.
29
+ - A requirement uses business terms that may mean different things in different parts of the system.
30
+ - A change touches domain rules, permissions, lifecycle, workflow state, billing, identity, tenancy, inventory, orders, subscriptions, or similar concepts.
31
+ - It is unclear whether two concepts belong in the same model or bounded context.
32
+ - A PRD or design needs stable terminology before implementation.
33
+
34
+ When `grill-with-docs` was not used, do not use this Skill for purely technical refactors, simple UI copy, mechanical dependency updates, or features with no domain ambiguity.
35
+
36
+ ## Workflow
37
+
38
+ 1. Read existing project facts first: README, domain docs, `.trellis/spec`, ADRs, task artifacts, and relevant code.
39
+ 2. List the key terms and their current meanings in the project.
40
+ 3. Identify bounded contexts where the same word may have different meanings.
41
+ 4. Distinguish core, supporting, and generic subdomains when that affects priority or design.
42
+ 5. State invariants and business rules in the language used by the project.
43
+ 6. Feed the agreed language into `prd.md`, `design.md`, or `implement.md`.
44
+
45
+ ## Output
46
+
47
+ Always output the review visibly and separately from the requirement confirmation summary:
48
+
49
+ ```text
50
+ DDD Boundary Review
51
+ Status: confirmed | needs-clarification | blocked
52
+ Ubiquitous language: ...
53
+ Bounded contexts: ...
54
+ Invariants and business rules: ...
55
+ Core / supporting / generic subdomains: ...
56
+ Corrections to the grill-with-docs result: ...
57
+ Open conflicts and questions: ...
58
+ ```
59
+
60
+ Use `not-applicable` for a subdomain classification only when it has no bearing on the current decision; do not omit the field. A post-grill review must explicitly state whether it corrected the earlier result, even when the answer is `none`.
61
+
62
+ Only stable, cross-task domain decisions should be promoted to `docs/CONTEXT.md`, ADRs, or `.trellis/spec`. Keep the complete review in task-level output or the current `prd.md`, `design.md`, or `implement.md`.
63
+
64
+ ## Guardrails
65
+
66
+ Outside the mandatory post-grill gate, do not force DDD ceremony into small tasks. During the mandatory gate, keep the second pass concise but complete enough to prove the boundaries were independently checked.
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: book-ddia-data-design
3
+ description: Guides data-intensive design checks for consistency, reliability, schema evolution, and data flow risks. Mandatory before design stabilizes or implementation begins when changing persisted/shared data, schemas, migrations, shared/persistent/cross-request/cross-process caches, async or cross-service flows, data ownership, or recovery; otherwise use on demand.
4
+ ---
5
+
6
+ # Book DDIA Data Design
7
+
8
+ Use this Skill when a change can fail because of data semantics, distributed behavior, or operational reality rather than ordinary code structure.
9
+
10
+ It is derived from the `mini` rule style of `agent-rules-books` and should complement project architecture, Trellis design, GitNexus impact analysis, tests, and production validation.
11
+
12
+ ## Mandatory Development Gate
13
+
14
+ Run this Skill before design artifacts become stable or implementation begins when a development task changes any of the following:
15
+
16
+ - Persisted or shared data, databases, schemas, or migrations.
17
+ - shared, persistent, cross-request, or cross-process caches; queues, events, streams, jobs, ETL, or analytics pipelines.
18
+ - Cross-service data flow or API ownership.
19
+ - Data ownership, source of truth, transaction boundaries, or read / write paths.
20
+ - Backfill, replay, rollback, or recovery behavior.
21
+
22
+ Emit a separate visible review:
23
+
24
+ ```text
25
+ DDIA Data Design Review
26
+ Status: confirmed | needs-design-change | blocked
27
+ Data owner and source of truth: ...
28
+ Write / read / async / failure paths: ...
29
+ Consistency model: ...
30
+ Idempotency / ordering / retry / deduplication: ...
31
+ Schema / migration / backfill / rollback / replay: ...
32
+ Observability and repair: ...
33
+ Required tests: ...
34
+ ```
35
+
36
+ - `confirmed`: the data design and failure / recovery behavior are explicit enough to implement safely.
37
+ - `needs-design-change`: update the design or task artifacts, then rerun this Skill before implementation.
38
+ - `blocked`: required ownership, contract, environment, migration, or Skill evidence is missing; state the blocker and do not stabilize design or implement the data change.
39
+
40
+ ## When To Use
41
+
42
+ - Mandatory: every development task matching a persisted/shared-data, shared-cache, async-flow, cross-service-flow, ownership, migration, or recovery trigger above.
43
+ - A change affects databases, schemas, migrations, shared / persistent / cross-request / cross-process caches, queues, streams, jobs, ETL, analytics, or cross-service APIs.
44
+ - The system must handle duplicate messages, retries, partial failure, reordering, eventual consistency, or replay.
45
+ - A feature changes data ownership, source of truth, transactional boundaries, or read/write paths.
46
+ - Backfill, migration, rollback, or recovery behavior matters.
47
+
48
+ When no mandatory trigger matches, do not use this Skill for purely local UI work, simple in-memory code, or data changes already covered by clear project conventions unless the user requests it or another concrete data-semantics risk warrants it.
49
+
50
+ ## Workflow
51
+
52
+ 1. Identify the source of truth and data owner.
53
+ 2. Map the write path, read path, async path, and failure path.
54
+ 3. State consistency expectations: strong, eventual, read-your-writes, monotonic reads, or best effort.
55
+ 4. Check idempotency, ordering, retry, deduplication, and poison-message handling.
56
+ 5. Check schema compatibility, migrations, backfills, rollback, and replay.
57
+ 6. Define observability and repair signals for data drift or stuck processing.
58
+ 7. Validate with focused tests and project validation commands.
59
+
60
+ ## Output
61
+
62
+ Always emit the visible `DDIA Data Design Review` for a mandatory gate. For Trellis tasks, also write concise design/check notes:
63
+
64
+ - Data owner and source of truth.
65
+ - Consistency model.
66
+ - Failure and recovery behavior.
67
+ - Migration/backfill/rollback plan.
68
+ - Required tests and validation.
69
+
70
+ Promote only long-lived data architecture rules to `.trellis/spec`.
71
+
72
+ ## Guardrails
73
+
74
+ Do not design a distributed system when a local transaction is enough. A mandatory review may confirm that the existing simple model is sufficient; keep the design as simple as project constraints allow.
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: book-legacy-change-safety
3
+ description: Guides safe changes to legacy or weakly tested code by characterizing behavior before editing. Mandatory before the first behavior-changing edit for existing-behavior bug fixes or existing code with unclear behavior, low coverage, hidden dependencies, or high regression risk; otherwise use on demand.
4
+ ---
5
+
6
+ # Book Legacy Change Safety
7
+
8
+ Use this Skill when the main risk is not the requested change itself, but the uncertainty around existing behavior.
9
+
10
+ It is derived from the `mini` rule style of `agent-rules-books` and is intended to complement `diagnosing-bugs`, `tdd`, GitNexus impact analysis, and project validation.
11
+
12
+ ## Mandatory Development Gate
13
+
14
+ Run this Skill before the first behavior-changing edit when either condition is true:
15
+
16
+ - The task fixes a bug in existing observable behavior.
17
+ - Existing target code has weak / missing tests, unclear or undocumented behavior, hidden dependencies, or high regression risk.
18
+
19
+ Emit a separate visible review:
20
+
21
+ ```text
22
+ Legacy Change Safety Review
23
+ Status: characterized | needs-safety-net | seam-required | blocked
24
+ Behavior to change: ...
25
+ Behavior to preserve: ...
26
+ Current reproduction evidence: ...
27
+ Safety net: ...
28
+ Hidden dependencies / seam: ...
29
+ Validation plan: ...
30
+ Review mode: normal | safety-seam-only
31
+ ```
32
+
33
+ - `characterized`: current behavior was reproduced or otherwise established, preserved behavior is explicit, and an adequate safety net exists.
34
+ - `needs-safety-net`: the safety net can be added without production-code edits; add or select the smallest characterization / regression check, then rerun this Skill.
35
+ - `seam-required`: current and preserved behavior are established, but the safety net cannot be installed without a production seam. Record the exact seam scope, invoke `book-refactoring-pass` in `safety-seam-only` mode, implement and validate only that behavior-preserving seam, then return here to establish the safety net and reach `characterized`.
36
+ - `blocked`: current behavior, required dependencies, the Skill, or a safe reproduction path is unavailable; state the blocker and do not change behavior.
37
+
38
+ When `book-refactoring-pass` is also mandatory, this gate normally reaches `characterized` first. `seam-required` is the only exception and authorizes no feature / fix behavior or unrelated cleanup.
39
+
40
+ ## When To Use
41
+
42
+ - Mandatory: every existing-behavior bug fix and every existing-code change matching a listed uncertainty or regression-risk signal.
43
+ - The target code has weak or missing tests.
44
+ - The current behavior is unclear, accidental, or undocumented.
45
+ - Dependencies are hidden behind globals, singletons, network calls, files, time, randomness, or external services.
46
+ - A bug fix could change behavior that other callers rely on.
47
+
48
+ When neither mandatory condition matches, do not use this Skill for cleanly tested new code, docs-only work, or simple isolated edits with obvious behavior and low blast radius unless the user requests it or another concrete legacy risk warrants it.
49
+
50
+ ## Workflow
51
+
52
+ 1. State the exact behavior to change.
53
+ 2. State the behavior that must be preserved.
54
+ 3. Reproduce the current behavior before editing.
55
+ 4. Add the smallest useful safety net, such as a characterization test, focused unit test, integration check, or manual script. If this requires a production seam, emit `seam-required` before editing.
56
+ 5. Introduce a seam only through the `safety-seam-only` loop above, then rerun this Skill and complete the safety net.
57
+ 6. Make the smallest behavior change that satisfies the task only after `characterized`.
58
+ 7. Run focused tests first, then the project validation required by the changed area.
59
+
60
+ ## Output
61
+
62
+ Always emit the visible `Legacy Change Safety Review` for a mandatory gate. When used inside a Trellis task, also record:
63
+
64
+ - Current observed behavior.
65
+ - Preserved behavior.
66
+ - Added or chosen safety net.
67
+ - Dependency seam, if introduced.
68
+ - Validation command and result.
69
+
70
+ If a lesson is learned because a regression, tool mistake, or workflow error occurred, use `lessons-record`; otherwise do not create a lesson.
71
+
72
+ ## Guardrails
73
+
74
+ Do not rewrite legacy code just to make it nicer. Stabilize first, change second, improve only where the current task needs it; a mandatory review may conclude `characterized` without introducing a new seam when the existing safety net is sufficient.
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: book-refactoring-pass
3
+ description: Guides behavior-preserving refactoring with small, reversible steps. Mandatory before the first implementation edit to existing production code; otherwise use on demand when structural friction, duplication, long functions, tangled responsibilities, or unsafe cleanup could affect the change.
4
+ ---
5
+
6
+ # Book Refactoring Pass
7
+
8
+ Use this Skill as a focused refactoring check before or during implementation.
9
+
10
+ It is derived from the `mini` rule style of `agent-rules-books`. It is a mandatory development gate for existing-production-code edits and an on-demand engineering lens in other structural-risk scenarios; it does not replace project rules, tests, Trellis artifacts, GitNexus, or code review.
11
+
12
+ ## Mandatory Development Gate
13
+
14
+ Whenever a development task will modify existing production code, run this Skill before the first implementation edit to existing production code, even when the expected result is that no refactoring is needed.
15
+
16
+ Emit a separate visible review:
17
+
18
+ ```text
19
+ Refactoring Review
20
+ Status: proceed | refactor-first | blocked
21
+ Review mode: normal | safety-seam-only
22
+ Existing-code scope: ...
23
+ Behavior that must remain unchanged: ...
24
+ Structural friction: ...
25
+ Decision and smallest safe step: ...
26
+ Safety net and validation: ...
27
+ Deferred refactors: ...
28
+ ```
29
+
30
+ - `proceed`: in normal mode, the existing structure is safe enough for the requested edit; `no refactor needed` is a valid explicit conclusion.
31
+ - `refactor-first`: perform only the smallest behavior-preserving structural change allowed by the current review mode, validate it, and rerun the required gate before feature or fix edits.
32
+ - `blocked`: required behavior evidence, a safety net plan, or the Skill is unavailable; state the blocker and do not edit production behavior.
33
+
34
+ If `book-legacy-change-safety` is also mandatory, its review normally reaches `characterized` before this gate runs. Controlled exception: a legacy `seam-required` result may invoke this Skill in `safety-seam-only` mode. That mode may design and implement only the recorded behavior-preserving test seam, must validate observational equivalence, and must return to legacy review to establish the safety net. After legacy reaches `characterized`, rerun this Skill in normal mode before feature / fix edits.
35
+
36
+ ## When To Use
37
+
38
+ - Mandatory: every development task that modifies existing production code.
39
+ - Existing code structure is making a requested change risky or awkward.
40
+ - A change mixes behavior changes with cleanup.
41
+ - Duplication, long functions, feature envy, primitive obsession, or tangled responsibilities are blocking clarity.
42
+ - A review needs to decide whether a refactor should happen now or be deferred.
43
+
44
+ When existing production code will not be modified, do not use this Skill for simple text, docs, config-only edits, broad rewrites, speculative architecture changes, or code that is already easy to change safely unless the user explicitly requests the review or another concrete structural risk warrants it.
45
+
46
+ ## Workflow
47
+
48
+ 1. Identify the observable behavior that must remain unchanged.
49
+ 2. Confirm the available safety net: tests, characterization checks, manual repro, snapshots, or focused inspection.
50
+ 3. Separate structural refactoring from behavior changes.
51
+ 4. Prefer the smallest reversible move that lowers the current task risk.
52
+ 5. Preserve public contracts unless the task explicitly changes them.
53
+ 6. In `safety-seam-only` mode, reject feature behavior, bug-fix behavior, broad cleanup, or any structural change not required by the recorded test seam.
54
+ 7. Run the project validation appropriate to the touched code.
55
+
56
+ ## Output
57
+
58
+ Always emit the visible `Refactoring Review` for a mandatory gate. When used inside a Trellis task, also write only task-specific conclusions to `implement.md`, `design.md`, or the check summary:
59
+
60
+ - Current friction.
61
+ - Behavior that must not change.
62
+ - Proposed refactoring steps or explicit `no refactor needed`.
63
+ - Safety net and validation command.
64
+ - Deferred refactors, if any.
65
+
66
+ Only long-term conventions belong in `.trellis/spec`.
67
+
68
+ ## Stop Conditions
69
+
70
+ Stop refactoring when the requested change is safe and clear enough. The mandatory review does not require a refactor; never invent cleanup merely to produce `refactor-first`, and do not keep improving code outside the task boundary.
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: book-release-readiness
3
+ description: Reviews production readiness for services, APIs, jobs, queues, integrations, and deployment-sensitive changes. Mandatory after all applicable testing-tool gates and project validation, and before completion or release, when production-path runtime or deployment behavior changes; otherwise use on demand.
4
+ ---
5
+
6
+ # Book Release Readiness
7
+
8
+ Use this Skill as a production-readiness pass before considering a service or integration change complete.
9
+
10
+ It is derived from the `mini` rule style of `agent-rules-books` and complements project validation, Playwright, Maestro, Chrome DevTools diagnostics, Trellis check, and human release review.
11
+
12
+ ## Mandatory Development Gate
13
+
14
+ Run this Skill after all applicable testing-tool gates and project validation, and before the task is declared complete, the final release decision, or Channel preflight when a development task changes any production-path:
15
+
16
+ - Service, API, auth, billing, or notification behavior.
17
+ - Background job, queue, scheduler, or data pipeline.
18
+ - External integration.
19
+ - Deployment, rollout, migration, or runtime operational behavior.
20
+
21
+ Emit a separate visible review:
22
+
23
+ ```text
24
+ Release Readiness Review
25
+ Status: ready | needs-mitigation | blocked
26
+ Production path and affected users / systems: ...
27
+ Failure modes and safeguards: ...
28
+ Capacity / backpressure / limits: ...
29
+ Observability / alerts / runbook: ...
30
+ Rollout / migration / rollback / cleanup: ...
31
+ Required validation and result: ...
32
+ Optional checks, accountable owner acceptance, and residual risk: ...
33
+ ```
34
+
35
+ - `ready`: all required validation ran and passed; applicable production risks, rollout, rollback, and observability are addressed. An optional check may remain skipped only when an explicit accountable owner accepts the documented residual risk.
36
+ - `needs-mitigation`: implement the required mitigation or update the release plan, rerun every affected required validation and testing-tool gate, and rerun this Skill.
37
+ - `blocked`: any required validation, environment, operational evidence, or rollback path is missing or failed, or the Skill is unavailable. Required checks cannot be waived or converted to residual risk; state the blocker and do not declare the task complete or release-ready.
38
+
39
+ ## When To Use
40
+
41
+ - Mandatory: every development task matching a production-path runtime or deployment trigger above.
42
+ - The change affects APIs, background jobs, queues, schedulers, external services, auth, billing, notifications, data pipelines, or deployment behavior.
43
+ - Failure modes include timeouts, retries, overload, partial outage, data corruption, duplicate work, or user-visible degradation.
44
+ - The task is ready for `$trellis-check` or release review.
45
+
46
+ When no mandatory trigger matches, do not use this Skill for docs-only changes, local-only scripts, simple UI polish, or code paths that are not production-facing unless the user requests it or another concrete release risk warrants it.
47
+
48
+ ## Workflow
49
+
50
+ 1. Identify the production path and the users or systems affected.
51
+ 2. Check timeouts, retry limits, backoff, cancellation, and duplicate-work safety.
52
+ 3. Check fallback, graceful degradation, circuit breaking, or isolation where relevant.
53
+ 4. Check capacity, backpressure, rate limits, and queue growth behavior.
54
+ 5. Check logs, metrics, traces, alerts, dashboards, and runbook expectations.
55
+ 6. Check rollout, rollback, feature flag, migration, and cleanup paths.
56
+ 7. Confirm that all required validation and applicable testing-tool gates ran; separate them from optional checks, and record any optional-check acceptance by an explicit accountable owner.
57
+
58
+ ## Output
59
+
60
+ Always emit the visible `Release Readiness Review` for a mandatory gate. When used inside a Trellis task, also record:
61
+
62
+ - Production risk summary.
63
+ - Failure modes covered.
64
+ - Observability and alerting notes.
65
+ - Rollout and rollback path.
66
+ - Validation performed and skipped checks.
67
+ - Residual risk.
68
+
69
+ Only recurring release standards belong in `.trellis/spec`.
70
+
71
+ ## Guardrails
72
+
73
+ Do not block completion with theoretical production risks that do not apply to the current project. A mandatory review must still inspect every applicable category and may mark irrelevant checks `not-applicable`; required validation cannot be skipped, while an optional check needs explicit accountable-owner acceptance and a documented residual risk.