arey-pi 0.4.0 → 0.5.0

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/README.md CHANGED
@@ -50,6 +50,12 @@ The rules are the policy layer.
50
50
  The skills and prompts make those policies usable inside Pi.
51
51
  The agents define the intended specialist roles for subagent-backed delivery.
52
52
 
53
+ Arey Pi includes focused prompt templates and skills for feature specs,
54
+ strict Red-Green-Refactor,
55
+ spec drift repair,
56
+ ADR assessment,
57
+ and adversarial engineering review.
58
+
53
59
  ## Current subagent architecture
54
60
 
55
61
  Arey Pi is designed to work with `pi-subagents`.
@@ -191,6 +197,12 @@ documentation sync rule,
191
197
  core subagent role definitions,
192
198
  and professional extension commands exist.
193
199
 
194
- Next milestones include richer templates,
200
+ Arey Pi now includes stronger workflow command contracts,
201
+ focused prompts,
202
+ TDD/spec-sync/review skills,
203
+ and extension-core tests.
204
+
205
+ Next improvements include guided interactive workflows,
195
206
  stronger bootstrap scaffolding,
196
- and deeper integration with `pi-subagents` discovery.
207
+ custom Arey Pi tools,
208
+ and deeper enforcement through Pi extension events.
package/docs/commands.md CHANGED
@@ -181,13 +181,16 @@ The expected workflow is:
181
181
  spec-author → tdd-implementer → spec-syncer → engineering-reviewer
182
182
  ```
183
183
 
184
+ The command now sends a stronger execution contract.
184
185
  The workflow should:
185
186
 
186
- - confirm or update canonical specs;
187
+ - identify scope, non-goals, risk, and unknowns;
188
+ - confirm or update canonical specs before production behaviour changes;
187
189
  - preserve TDD through Red → Green → Refactor;
188
- - synchronise specs, docs, tests, code, DBML, ADRs, glossary, and architecture docs;
189
- - run engineering review when risk warrants it;
190
- - report validation evidence and residual risks.
190
+ - keep tests outside production source directories by default;
191
+ - synchronise specs, docs, tests, code, DBML, ADRs, glossary, README files, AGENTS.md, skills, prompts, rules, agents, commands, templates, and tooling instructions when affected;
192
+ - run fresh-context engineering review when risk warrants it;
193
+ - report validation evidence and residual risks using the Arey Pi final evidence format.
191
194
 
192
195
  ## `/arey-bugfix`
193
196
 
@@ -205,12 +208,15 @@ Example:
205
208
  /arey-bugfix Users can bypass email verification by refreshing the session
206
209
  ```
207
210
 
211
+ The command now sends a regression-test-first execution contract.
208
212
  The workflow should:
209
213
 
210
- - reproduce the bug with a failing regression test;
214
+ - identify expected versus actual behaviour and affected scope;
215
+ - reproduce the bug with a meaningful failing regression test before production changes;
211
216
  - implement the smallest high-quality fix;
212
- - keep TDD evidence visible;
217
+ - keep Red → Green → Refactor evidence visible;
213
218
  - update Gherkin, docs, DBML, ADRs, glossary, or architecture docs when affected;
219
+ - request fresh engineering review for security, data-loss, concurrency, auth, payment, migration, or public API bugs;
214
220
  - run validation and report residual risks.
215
221
 
216
222
  ## `/arey-sync`
@@ -247,6 +253,12 @@ The command asks the parent agent to verify alignment across:
247
253
  - skills, prompts, rules, agents, examples, templates;
248
254
  - command and tooling instructions.
249
255
 
256
+ The sync contract asks the agent to classify drift as blocking,
257
+ recommended,
258
+ or unaffected.
259
+ It may fix safe drift directly when canonical intent is clear,
260
+ but it must ask before changing intent.
261
+
250
262
  The final report should include both:
251
263
 
252
264
  ```txt
@@ -329,6 +341,32 @@ and propose a prioritised improvement plan.
329
341
 
330
342
  Use this when adopting Arey Pi in an existing repository or checking whether a project remains aligned.
331
343
 
344
+ ## Prompt templates and skills
345
+
346
+ Arey Pi also ships focused prompt templates:
347
+
348
+ ```txt
349
+ /feature-spec
350
+ /red-green-refactor
351
+ /sync-drift
352
+ /engineering-review
353
+ /adr-review
354
+ /assess-project
355
+ ```
356
+
357
+ And focused skills:
358
+
359
+ ```txt
360
+ /skill:tdd-red-green-refactor
361
+ /skill:spec-sync
362
+ /skill:engineering-review
363
+ /skill:project-readiness
364
+ ```
365
+
366
+ Use slash commands for full workflow orchestration,
367
+ prompts for targeted one-off work,
368
+ and skills when you want the model to load specialised Arey Pi instructions on demand.
369
+
332
370
  ## Busy agent behaviour
333
371
 
334
372
  Workflow commands send a user message to the current Pi session.
@@ -58,23 +58,91 @@ export function parseBootstrapFlags(args: string): BootstrapPlan {
58
58
 
59
59
  export type WorkflowKind = "feature" | "bugfix" | "sync" | "review" | "assess" | string;
60
60
 
61
+ const evidenceSummary = `Final evidence format:\n- Behaviour/spec impact:\n- Tests/TDD, including test location:\n- Validation commands and results:\n- Quality tooling:\n- Spec sync:\n- Documentation sync:\n- Architecture/ADR/glossary impact:\n- Database/DBML impact:\n- Residual risks:`;
62
+
63
+ function commonWorkflowMessage(): string {
64
+ return [
65
+ "Act as the Arey Pi tech lead.",
66
+ "Use pi-subagents when available and appropriate.",
67
+ "Keep orchestration authority in the parent session, give child agents bounded tasks, and keep one writer in the active worktree at a time.",
68
+ "Clarify blocking ambiguity before editing; otherwise proceed incrementally.",
69
+ "Follow Arey Pi rules, preserve TDD for behaviour changes, and report evidence clearly.",
70
+ ].join(" ");
71
+ }
72
+
73
+ function featureWorkflow(target: string): string {
74
+ return [
75
+ commonWorkflowMessage(),
76
+ "",
77
+ `Run the Arey Pi feature workflow for: ${target}`,
78
+ "",
79
+ "Execution contract:",
80
+ "1. Scope: identify behaviour, impacted users, non-goals, risk level, and unknowns.",
81
+ "2. Specs: confirm or update canonical Gherkin before production behaviour changes; use arey-pi.spec-author when available.",
82
+ "3. TDD: use arey-pi.tdd-implementer for Red → Green → Refactor; tests must live outside production source directories by default.",
83
+ "4. Implementation: make the smallest high-quality change; avoid speculative architecture.",
84
+ "5. Sync: use arey-pi.spec-syncer to align specs, tests, code, DBML, ADRs, glossary, README, docs, AGENTS.md, skills, prompts, rules, agents, commands, and tooling instructions when affected.",
85
+ "6. Review: use fresh-context arey-pi.engineering-reviewer or reviewers when risk warrants it.",
86
+ "",
87
+ "Use scout/context-builder/planner first if codebase context is not clear.",
88
+ evidenceSummary,
89
+ ].join("\n");
90
+ }
91
+
92
+ function bugfixWorkflow(target: string): string {
93
+ return [
94
+ commonWorkflowMessage(),
95
+ "",
96
+ `Run the Arey Pi bugfix workflow for: ${target}`,
97
+ "",
98
+ "Execution contract:",
99
+ "1. Reproduce: identify expected vs actual behaviour and affected scope.",
100
+ "2. Regression test first: add or update a meaningful failing test that proves the bug before changing production code.",
101
+ "3. Fix: implement the smallest high-quality correction without broad rewrites unless necessary.",
102
+ "4. Refactor: improve design only while regression tests and existing tests remain green.",
103
+ "5. Sync: update Gherkin, docs, DBML, ADRs, glossary, or architecture docs when the intended behaviour or design contract changed.",
104
+ "6. Review: request fresh engineering review for security, data-loss, concurrency, auth, payment, migration, or public API bugs.",
105
+ "",
106
+ "If a failing regression test cannot be demonstrated, state the blocker explicitly and do not claim TDD evidence.",
107
+ evidenceSummary,
108
+ ].join("\n");
109
+ }
110
+
111
+ function syncWorkflow(target: string): string {
112
+ return [
113
+ commonWorkflowMessage(),
114
+ "",
115
+ `Run Arey Pi spec and documentation sync for: ${target}`,
116
+ "",
117
+ "Sync contract:",
118
+ "1. Inspect the requested scope and current diff before editing.",
119
+ "2. Verify alignment across canonical Gherkin, tests, production code, DBML, ADRs, glossary, architecture docs, README files, docs, AGENTS.md, skills, prompts, rules, agents, commands, templates, and tooling instructions.",
120
+ "3. Classify drift as blocking, recommended, or unaffected.",
121
+ "4. Fix safe drift directly when the intended behaviour is clear; otherwise ask for a decision.",
122
+ "5. Do not rewrite specs to hide implementation defects.",
123
+ "6. Run relevant validation after changes.",
124
+ "",
125
+ "End with both statuses exactly: `Specs updated` or `Specs unaffected`; `Docs updated` or `Docs unaffected`, with evidence.",
126
+ evidenceSummary,
127
+ ].join("\n");
128
+ }
129
+
61
130
  export function workflowMessage(kind: WorkflowKind, args: string): string {
62
131
  const target = args.trim() || "the current repository/task";
63
- const common = `Act as the Arey Pi tech lead. Use pi-subagents when available and appropriate. Keep orchestration authority in the parent session, give child agents bounded tasks, and keep one writer in the active worktree at a time. Follow Arey Pi rules, preserve TDD, and report evidence clearly.`;
64
132
 
65
133
  switch (kind) {
66
134
  case "feature":
67
- return `${common}\n\nRun the Arey Pi feature workflow for: ${target}\n\nExpected flow: arey-pi.spec-author for canonical specs, arey-pi.tdd-implementer for Red-Green-Refactor, arey-pi.spec-syncer for final alignment, and fresh reviewers or arey-pi.engineering-reviewer for adversarial quality review when risk warrants it. Use scout/context-builder/planner first if the codebase context is not clear.`;
135
+ return featureWorkflow(target);
68
136
  case "bugfix":
69
- return `${common}\n\nRun the Arey Pi bugfix workflow for: ${target}\n\nStart with a regression test that fails for the bug, keep tests outside production source directories by default, implement the minimal high-quality fix, synchronise specs and docs, and review engineering quality.`;
137
+ return bugfixWorkflow(target);
70
138
  case "sync":
71
- return `${common}\n\nRun Arey Pi spec and documentation sync for: ${target}\n\nVerify Gherkin, tests, code, DBML, ADRs, glossary, architecture docs, README files, docs, AGENTS.md, skills, prompts, rules, agents, commands, and tooling instructions. End with both a spec status and a documentation status.`;
139
+ return syncWorkflow(target);
72
140
  case "review":
73
- return `${common}\n\nRun an Arey Pi engineering review for: ${target}\n\nPrefer fresh-context review. Review architecture, code quality, test quality and location, quality tooling, security, privacy, operability, maintainability, and spec/ADR/DBML/documentation concerns. Classify findings by severity.`;
141
+ return `${commonWorkflowMessage()}\n\nRun an Arey Pi engineering review for: ${target}\n\nPrefer fresh-context review. Review architecture, code quality, test quality and location, quality tooling, security, privacy, operability, maintainability, and spec/ADR/DBML/documentation concerns. Classify findings by severity.`;
74
142
  case "assess":
75
- return `${common}\n\nAssess this repository against Arey Pi Project Readiness. Audit only by default. Produce scores, evidence, blockers, quick wins, and a prioritised improvement plan.`;
143
+ return `${commonWorkflowMessage()}\n\nAssess this repository against Arey Pi Project Readiness. Audit only by default. Produce scores, evidence, blockers, quick wins, and a prioritised improvement plan.`;
76
144
  default:
77
- return `${common}\n\nWork on: ${target}`;
145
+ return `${commonWorkflowMessage()}\n\nWork on: ${target}`;
78
146
  }
79
147
  }
80
148
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arey-pi",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "A Pi package for canonical Gherkin specs, non-negotiable TDD, spec synchronisation, AI harness readiness, and senior-quality software delivery.",
5
5
  "license": "MIT",
6
6
  "author": "Alejandro Rey Leyva",
@@ -0,0 +1,33 @@
1
+ ---
2
+ description: Decide whether a change needs an ADR and review ADR quality
3
+ argument-hint: "[decision or change]"
4
+ ---
5
+
6
+ Assess ADR impact for:
7
+
8
+ $ARGUMENTS
9
+
10
+ Inspect relevant specs, architecture docs, existing ADRs, README/docs, tests, and implementation context.
11
+
12
+ Determine whether the change records a significant technical decision because it affects architecture, data model, security model, operability, public contracts, deployment, dependency strategy, or long-term maintainability.
13
+
14
+ If an ADR is needed:
15
+
16
+ - propose the ADR title and location under `specs/decisions/`;
17
+ - capture context, decision, alternatives considered, consequences, risks, and follow-up work;
18
+ - keep the decision durable and independent of transient implementation details;
19
+ - update glossary, DBML, architecture docs, or README when affected.
20
+
21
+ If no ADR is needed, explain why.
22
+
23
+ Return:
24
+
25
+ ```txt
26
+ ADR assessment:
27
+ - Decision/change reviewed:
28
+ - ADR required: yes/no
29
+ - Evidence:
30
+ - Proposed ADR changes:
31
+ - Architecture/docs/glossary/DBML impact:
32
+ - Open questions:
33
+ ```
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Run an adversarial Arey Pi engineering review
3
+ argument-hint: "[scope]"
4
+ ---
5
+
6
+ Run an adversarial Arey Pi engineering review for:
7
+
8
+ $ARGUMENTS
9
+
10
+ Prefer fresh-context review and use `arey-pi.engineering-reviewer` when available.
11
+
12
+ Review:
13
+
14
+ - correctness and behavioural completeness;
15
+ - architecture and code quality;
16
+ - test quality, meaningful assertions, and test location;
17
+ - TDD evidence where behaviour changed;
18
+ - formatter/lint/static analysis/typecheck/test/coverage evidence;
19
+ - security, privacy, reliability, operability, and maintainability;
20
+ - generated-code risks;
21
+ - spec, ADR, DBML, glossary, README, docs, AGENTS.md, skills, prompts, rules, agents, commands, and tooling sync.
22
+
23
+ Do not modify files unless explicitly asked to fix findings.
24
+
25
+ Return:
26
+
27
+ ```txt
28
+ Engineering review:
29
+ - Scope:
30
+ - Blocking findings:
31
+ - Major findings:
32
+ - Minor findings:
33
+ - Positive evidence:
34
+ - Missing validation:
35
+ - Sync concerns:
36
+ - Recommended next actions:
37
+ ```
@@ -0,0 +1,35 @@
1
+ ---
2
+ description: Draft or update canonical Arey Pi Gherkin specs for a feature
3
+ argument-hint: "<feature request>"
4
+ ---
5
+
6
+ Draft or update canonical Arey Pi feature specs for:
7
+
8
+ $ARGUMENTS
9
+
10
+ Work in spec-first mode.
11
+
12
+ Requirements:
13
+
14
+ - inspect existing `specs/features/`, glossary, ADRs, docs, tests, and related code before writing;
15
+ - identify actors, business terms, rules, assumptions, non-goals, edge cases, and open questions;
16
+ - write behaviour-focused Gherkin, not UI or implementation scripts;
17
+ - prefer `Rule` sections and concrete examples where they clarify intent;
18
+ - update glossary, ADR, DBML, architecture docs, or README only when affected;
19
+ - do not change production code;
20
+ - if requirements are ambiguous, ask focused questions instead of inventing policy.
21
+
22
+ Prefer using `arey-pi.spec-author` when available.
23
+
24
+ Return:
25
+
26
+ ```txt
27
+ Spec handoff:
28
+ - Feature scope:
29
+ - Files read:
30
+ - Specs added/updated:
31
+ - Scenarios/rules covered:
32
+ - Open questions:
33
+ - Test implications:
34
+ - ADR/DBML/glossary/docs impact:
35
+ ```
@@ -0,0 +1,34 @@
1
+ ---
2
+ description: Implement accepted behaviour with strict Arey Pi Red-Green-Refactor
3
+ argument-hint: "<accepted behaviour or spec>"
4
+ ---
5
+
6
+ Implement the accepted behaviour through strict Arey Pi TDD:
7
+
8
+ $ARGUMENTS
9
+
10
+ Rules:
11
+
12
+ - read applicable specs, tests, code, AGENTS.md, and quality tooling first;
13
+ - add or update a meaningful failing test before production behaviour changes;
14
+ - keep tests outside production source directories by default;
15
+ - implement the smallest high-quality production change to pass;
16
+ - refactor only while tests remain green;
17
+ - run formatter, lint/static analysis, typecheck, tests, and coverage/mutation checks where relevant and available;
18
+ - do not claim TDD if the Red phase cannot be demonstrated.
19
+
20
+ Prefer using `arey-pi.tdd-implementer` when available.
21
+
22
+ Return:
23
+
24
+ ```txt
25
+ Red-Green-Refactor report:
26
+ - Behaviour implemented:
27
+ - Tests added/updated and location:
28
+ - Red evidence:
29
+ - Green evidence:
30
+ - Refactor notes:
31
+ - Validation commands and results:
32
+ - Spec/docs/ADR/DBML/glossary impact:
33
+ - Residual risks:
34
+ ```
@@ -0,0 +1,44 @@
1
+ ---
2
+ description: Find and fix Arey Pi spec, docs, tests, and implementation drift
3
+ argument-hint: "[scope]"
4
+ ---
5
+
6
+ Run Arey Pi sync review for:
7
+
8
+ $ARGUMENTS
9
+
10
+ If no scope is provided, inspect the current repository or current diff.
11
+
12
+ Verify alignment across:
13
+
14
+ - canonical Gherkin specs;
15
+ - tests and production code;
16
+ - DBML/database schema specs;
17
+ - ADRs and architecture docs;
18
+ - glossary/business terminology;
19
+ - README files and `docs/`;
20
+ - AGENTS.md, skills, prompts, rules, agents, commands, templates, and tooling instructions.
21
+
22
+ Prefer using `arey-pi.spec-syncer` when available.
23
+
24
+ Classify drift as:
25
+
26
+ - blocking: must fix before completion;
27
+ - recommended: should fix soon but does not invalidate current work;
28
+ - unaffected: explicitly checked or not applicable.
29
+
30
+ Fix safe drift when intent is clear. Ask before changing canonical intent.
31
+
32
+ End with:
33
+
34
+ ```txt
35
+ Sync report:
36
+ - Scope:
37
+ - Blocking drift:
38
+ - Recommended drift:
39
+ - Files changed:
40
+ - Validation:
41
+ - Specs updated/unaffected:
42
+ - Docs updated/unaffected:
43
+ - Residual risks:
44
+ ```
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: engineering-review
3
+ description: Perform an adversarial Arey Pi engineering review of a diff, feature, bugfix, plan, or repository area. Use to assess correctness, tests, quality tooling, security, maintainability, and spec/docs sync before completion.
4
+ ---
5
+
6
+ # Engineering Review
7
+
8
+ Use this skill for independent, adversarial review.
9
+
10
+ Default mode is read-only. Do not edit files unless the user explicitly asks for fixes after findings are reported.
11
+
12
+ Prefer fresh context when running as a subagent so the review does not inherit the implementer's assumptions.
13
+
14
+ ## Required Reading
15
+
16
+ Read these files when available:
17
+
18
+ - `rules/engineering/engineering-quality.md`
19
+ - `rules/engineering/test-quality.md`
20
+ - `rules/engineering/quality-tooling.md`
21
+ - `rules/engineering/tdd.md`
22
+ - `rules/core/definition-of-done.md`
23
+ - `rules/specs/spec-sync.md`
24
+ - `rules/workflow/documentation-sync.md`
25
+ - `rules/architecture/adrs.md`
26
+ - current diff, relevant specs, tests, code, and validation output
27
+
28
+ ## Review Checklist
29
+
30
+ Assess:
31
+
32
+ - behaviour correctness and edge cases;
33
+ - simplicity and maintainability;
34
+ - architecture boundaries and coupling;
35
+ - security, privacy, data-loss, concurrency, auth, payments, migrations, and public API risks;
36
+ - test quality, assertion strength, and test location;
37
+ - whether TDD evidence exists for behaviour changes;
38
+ - formatter, lint/static analysis, typecheck, tests, coverage, mutation, and dynamic validation evidence;
39
+ - generated-code quality and hallucination risk;
40
+ - spec, DBML, ADR, glossary, README, docs, AGENTS.md, skills, prompts, rules, agents, commands, templates, and tooling sync.
41
+
42
+ ## Severity
43
+
44
+ - **Blocker**: must fix before completion.
45
+ - **Major**: should fix before merge unless explicitly accepted.
46
+ - **Minor**: improvement or maintainability concern.
47
+ - **Question**: needs product/architecture/user decision.
48
+
49
+ ## Output
50
+
51
+ Return:
52
+
53
+ ```txt
54
+ Engineering review:
55
+ - Scope:
56
+ - Files inspected:
57
+ - Blockers:
58
+ - Major findings:
59
+ - Minor findings:
60
+ - Questions:
61
+ - Positive evidence:
62
+ - Missing validation:
63
+ - Sync concerns:
64
+ - Recommended next actions:
65
+ ```
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: spec-sync
3
+ description: Find and repair drift between Arey Pi specs, tests, code, DBML, ADRs, glossary, docs, prompts, skills, agents, and tooling instructions. Use before finalising non-trivial work or when drift is suspected.
4
+ ---
5
+
6
+ # Spec Sync
7
+
8
+ Use this skill to verify and restore alignment across Arey Pi project artefacts.
9
+
10
+ The goal is not to make documentation match broken implementation. The goal is to preserve canonical intent and keep executable truth, production code, and docs aligned.
11
+
12
+ ## Required Reading
13
+
14
+ Read these files when available:
15
+
16
+ - `rules/specs/spec-sync.md`
17
+ - `rules/workflow/documentation-sync.md`
18
+ - `rules/specs/canonical-specs.md`
19
+ - `rules/specs/database-specs.md`
20
+ - `rules/architecture/adrs.md`
21
+ - `rules/architecture/architecture-memory.md`
22
+ - `rules/core/definition-of-done.md`
23
+ - current diff and changed files
24
+
25
+ ## Inspect
26
+
27
+ Check affected areas for drift across:
28
+
29
+ - Gherkin specs under `specs/features/`;
30
+ - tests and production code;
31
+ - DBML/database schema specs;
32
+ - ADRs and architecture docs;
33
+ - glossary terms;
34
+ - README files and `docs/`;
35
+ - `AGENTS.md` and harness instructions;
36
+ - skills, prompts, rules, agents, commands, templates, examples, and package metadata;
37
+ - validation scripts and quality tooling instructions.
38
+
39
+ ## Classify Findings
40
+
41
+ - **Blocking**: intent, tests, code, or docs conflict in a way that invalidates completion.
42
+ - **Recommended**: useful improvement but not completion-blocking.
43
+ - **Unaffected**: inspected or clearly not applicable.
44
+
45
+ ## Repair Rules
46
+
47
+ - Fix safe mechanical drift when the intended behaviour is clear.
48
+ - Ask for a decision before changing canonical intent.
49
+ - Do not update specs merely to excuse defective implementation.
50
+ - Preserve terminology consistency with the glossary.
51
+ - Keep updates focused and incremental.
52
+
53
+ ## Output
54
+
55
+ Return:
56
+
57
+ ```txt
58
+ Spec sync report:
59
+ - Scope:
60
+ - Files inspected:
61
+ - Blocking drift:
62
+ - Recommended drift:
63
+ - Files changed:
64
+ - Validation commands and results:
65
+ - Specs updated/unaffected:
66
+ - Docs updated/unaffected:
67
+ - ADR/DBML/glossary impact:
68
+ - Residual risks:
69
+ ```
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: tdd-red-green-refactor
3
+ description: Implement behaviour changes with Arey Pi strict Red-Green-Refactor. Use when adding features, fixing bugs, or changing production behaviour where tests must drive implementation.
4
+ ---
5
+
6
+ # TDD Red-Green-Refactor
7
+
8
+ Use this skill for production behaviour changes under Arey Pi.
9
+
10
+ TDD is mandatory unless the user explicitly chooses a non-behaviour mode or a project constraint blocks it. If blocked, report the blocker; do not claim TDD evidence.
11
+
12
+ ## Required Reading
13
+
14
+ Read these files when available:
15
+
16
+ - `AGENTS.md`
17
+ - `rules/engineering/tdd.md`
18
+ - `rules/engineering/test-quality.md`
19
+ - `rules/engineering/engineering-quality.md`
20
+ - `rules/engineering/quality-tooling.md`
21
+ - `rules/core/definition-of-done.md`
22
+ - `rules/specs/spec-sync.md`
23
+ - affected Gherkin specs under `specs/features/`
24
+ - existing tests and test runner configuration
25
+
26
+ ## Workflow
27
+
28
+ 1. **Understand accepted behaviour**
29
+ - Identify the canonical spec, bug report, or explicit user acceptance criteria.
30
+ - Ask focused questions if behaviour is ambiguous.
31
+
32
+ 2. **Red**
33
+ - Add or update meaningful tests before production code changes.
34
+ - Prefer `tests/`, `test/`, `spec/`, or equivalent dedicated test directories.
35
+ - Do not place tests inside production source directories by default.
36
+ - Run the narrowest relevant test command and capture failure evidence.
37
+
38
+ 3. **Green**
39
+ - Implement the smallest high-quality production change.
40
+ - Avoid speculative abstractions and broad rewrites.
41
+ - Run the failing test again and capture passing evidence.
42
+
43
+ 4. **Refactor**
44
+ - Improve clarity/design only while tests remain green.
45
+ - Keep behaviour unchanged during refactor.
46
+
47
+ 5. **Validate**
48
+ - Run available formatter, lint/static analysis, typecheck, tests, coverage, mutation testing, or dynamic checks appropriate to risk.
49
+ - Surface missing quality tooling as a gap.
50
+
51
+ 6. **Sync**
52
+ - Update specs, docs, DBML, ADRs, glossary, or architecture docs when the intended behaviour or contract changed.
53
+
54
+ ## Output
55
+
56
+ Return:
57
+
58
+ ```txt
59
+ TDD report:
60
+ - Behaviour:
61
+ - Tests added/updated and location:
62
+ - Red evidence:
63
+ - Green evidence:
64
+ - Refactor evidence:
65
+ - Validation commands and results:
66
+ - Spec/docs/ADR/DBML/glossary impact:
67
+ - Quality notes:
68
+ - Residual risks:
69
+ ```