@homericintelligence/athena-opencode 0.5.0 → 0.5.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 (136) hide show
  1. package/README.md +30 -17
  2. package/package.json +2 -2
  3. package/plugin.js +20 -5
  4. package/skills/TECHNICAL_ENGLISH.md +78 -0
  5. package/skills/_cli.py +26 -18
  6. package/skills/_support/docs/dependency-resolution.md +192 -0
  7. package/skills/_support/docs/policies/development.md +117 -0
  8. package/skills/_support/docs/policies/evidence-integrity.md +40 -0
  9. package/skills/_support/docs/principles/README.md +542 -0
  10. package/skills/_support/docs/principles/details/p001-kiss.md +114 -0
  11. package/skills/_support/docs/principles/details/p002-yagni.md +109 -0
  12. package/skills/_support/docs/principles/details/p003-dry.md +126 -0
  13. package/skills/_support/docs/principles/details/p004-solid.md +165 -0
  14. package/skills/_support/docs/principles/details/p005-modularity.md +123 -0
  15. package/skills/_support/docs/principles/details/p006-principle-of-least-astonishment.md +115 -0
  16. package/skills/_support/docs/principles/details/p007-subtraction-over-addition.md +113 -0
  17. package/skills/_support/docs/principles/details/p008-understand-before-subtracting.md +115 -0
  18. package/skills/_support/docs/principles/details/p009-general-mechanisms-over-special-cases.md +108 -0
  19. package/skills/_support/docs/principles/details/p010-scope-fidelity.md +117 -0
  20. package/skills/_support/docs/principles/details/p011-minimal-coherent-change.md +128 -0
  21. package/skills/_support/docs/principles/details/p012-evidence-before-modification.md +115 -0
  22. package/skills/_support/docs/principles/details/p013-avoid-hasty-abstractions.md +112 -0
  23. package/skills/_support/docs/principles/details/p014-preserve-unrequested-behavior.md +110 -0
  24. package/skills/_support/docs/principles/details/p015-architecture-conformance.md +124 -0
  25. package/skills/_support/docs/principles/details/p016-separation-of-concerns.md +125 -0
  26. package/skills/_support/docs/principles/details/p017-high-cohesion-low-coupling.md +130 -0
  27. package/skills/_support/docs/principles/details/p018-information-hiding.md +128 -0
  28. package/skills/_support/docs/principles/details/p019-explicit-contracts.md +134 -0
  29. package/skills/_support/docs/principles/details/p020-executable-architecture.md +130 -0
  30. package/skills/_support/docs/principles/details/p021-evolutionary-and-reversible-design.md +126 -0
  31. package/skills/_support/docs/principles/details/p022-test-behavior-not-implementation.md +129 -0
  32. package/skills/_support/docs/principles/details/p023-parameterized-table-driven-testing.md +129 -0
  33. package/skills/_support/docs/principles/details/p024-boundary-value-testing.md +128 -0
  34. package/skills/_support/docs/principles/details/p025-property-based-testing-for-invariants.md +133 -0
  35. package/skills/_support/docs/principles/details/p026-regression-before-repair.md +134 -0
  36. package/skills/_support/docs/principles/details/p027-deterministic-and-hermetic-tests.md +128 -0
  37. package/skills/_support/docs/principles/details/p028-test-failure-paths.md +133 -0
  38. package/skills/_support/docs/principles/details/p029-generalize-error-policy-preserve-specific-cause.md +131 -0
  39. package/skills/_support/docs/principles/details/p030-nearest-responsible-error-boundary.md +133 -0
  40. package/skills/_support/docs/principles/details/p031-propagate-rather-than-swallow.md +131 -0
  41. package/skills/_support/docs/principles/details/p032-handle-once-preserve-causality.md +137 -0
  42. package/skills/_support/docs/principles/details/p033-state-safe-failure-semantics.md +140 -0
  43. package/skills/_support/docs/principles/details/p034-fail-fast.md +132 -0
  44. package/skills/_support/docs/principles/details/p035-fail-secure-fail-closed.md +137 -0
  45. package/skills/_support/docs/principles/details/p036-graceful-degradation.md +137 -0
  46. package/skills/_support/docs/principles/details/p037-idempotency-before-retry.md +139 -0
  47. package/skills/_support/docs/principles/details/p038-bounded-retry.md +145 -0
  48. package/skills/_support/docs/principles/details/p039-bounded-waiting.md +151 -0
  49. package/skills/_support/docs/principles/details/p040-bounded-resources.md +138 -0
  50. package/skills/_support/docs/principles/details/p041-backpressure-and-load-shedding.md +141 -0
  51. package/skills/_support/docs/principles/details/p042-fault-isolation-bulkheads.md +140 -0
  52. package/skills/_support/docs/principles/details/p043-circuit-breakers.md +148 -0
  53. package/skills/_support/docs/principles/details/p044-atomicity-where-possible.md +141 -0
  54. package/skills/_support/docs/principles/details/p045-compensation-where-atomicity-is-impossible.md +163 -0
  55. package/skills/_support/docs/principles/details/p046-resumability.md +138 -0
  56. package/skills/_support/docs/principles/details/p047-observability-is-part-of-correctness.md +134 -0
  57. package/skills/_support/docs/principles/details/p048-secure-by-design.md +132 -0
  58. package/skills/_support/docs/principles/details/p049-secure-by-default.md +126 -0
  59. package/skills/_support/docs/principles/details/p050-least-privilege.md +123 -0
  60. package/skills/_support/docs/principles/details/p051-complete-mediation.md +124 -0
  61. package/skills/_support/docs/principles/details/p052-separation-of-duties.md +129 -0
  62. package/skills/_support/docs/principles/details/p053-validate-at-trust-boundaries.md +126 -0
  63. package/skills/_support/docs/principles/details/p054-defense-in-depth.md +135 -0
  64. package/skills/_support/docs/principles/details/p055-minimize-attack-surface.md +133 -0
  65. package/skills/_support/docs/principles/details/p056-secrets-stay-out-of-code-and-context.md +137 -0
  66. package/skills/_support/docs/principles/details/p057-supply-chain-integrity.md +135 -0
  67. package/skills/_support/docs/principles/details/p058-bounded-agent-authority.md +137 -0
  68. package/skills/_support/docs/principles/details/p059-data-is-not-instruction.md +130 -0
  69. package/skills/_support/docs/principles/details/p060-constrain-sub-agents.md +136 -0
  70. package/skills/_support/docs/principles/details/p061-separate-decision-from-high-impact-execution.md +131 -0
  71. package/skills/_support/docs/principles/details/p062-human-approval-for-irreversible-or-high-risk-actions.md +129 -0
  72. package/skills/_support/docs/principles/details/p063-requirement-to-code-traceability.md +116 -0
  73. package/skills/_support/docs/principles/details/p064-requirement-to-test-traceability.md +116 -0
  74. package/skills/_support/docs/principles/details/p065-verify-before-claiming-completion.md +129 -0
  75. package/skills/_support/docs/principles/details/p066-preserve-existing-work.md +114 -0
  76. package/skills/_support/docs/principles/details/p067-no-test-cheating.md +126 -0
  77. package/skills/_support/docs/principles/details/p068-no-validation-bypass.md +119 -0
  78. package/skills/_support/docs/principles/details/p069-independent-review-for-high-risk-changes.md +129 -0
  79. package/skills/_support/docs/principles/details/p070-code-health-must-not-regress.md +116 -0
  80. package/skills/_support/docs/principles/details/p071-consistency-over-personal-preference.md +117 -0
  81. package/skills/_support/docs/principles/details/p072-technical-evidence-over-preference.md +122 -0
  82. package/skills/_support/docs/principles/details/p073-optimize-only-with-evidence.md +123 -0
  83. package/skills/_support/docs/principles/details/p074-prefer-existing-mechanisms.md +121 -0
  84. package/skills/_support/docs/principles/details/p075-make-invalid-states-hard-to-represent.md +128 -0
  85. package/skills/_support/docs/principles/details/p076-parse-then-validate-then-operate.md +133 -0
  86. package/skills/_support/docs/principles/details/p077-separate-policy-from-mechanism.md +112 -0
  87. package/skills/_support/docs/principles/details/p078-single-source-of-truth.md +131 -0
  88. package/skills/_support/docs/principles/details/p079-explicit-ownership-and-lifetimes.md +124 -0
  89. package/skills/_support/docs/principles/details/p080-make-concurrency-deliberate.md +122 -0
  90. package/skills/_support/docs/principles/details/p081-forward-progress-with-safety.md +125 -0
  91. package/skills/_support/docs/principles/details/p082-design-for-cancellation.md +133 -0
  92. package/skills/_support/docs/principles/details/p083-irreversible-actions-last.md +124 -0
  93. package/skills/_support/docs/principles/details/p084-prefer-local-reasoning.md +131 -0
  94. package/skills/_support/docs/principles/details/p085-explicit-is-better-than-implicit.md +123 -0
  95. package/skills/_support/docs/principles/details/p086-readability-counts.md +113 -0
  96. package/skills/_support/docs/principles/details/p087-comments-explain-why-code-explains-what.md +120 -0
  97. package/skills/_support/docs/principles/details/p088-delete-dead-code.md +125 -0
  98. package/skills/_support/docs/principles/details/p089-delete-obsolete-configuration-and-dependencies.md +125 -0
  99. package/skills/_support/docs/principles/details/p090-prefer-negative-code.md +134 -0
  100. package/skills/_support/docs/principles/details/p091-test-driven-development.md +149 -0
  101. package/skills/_support/docs/review/README.md +59 -0
  102. package/skills/_support/docs/review/behavior-first-testing.md +73 -0
  103. package/skills/_support/docs/review/common.md +365 -0
  104. package/skills/_support/docs/review/design-docs.md +74 -0
  105. package/skills/_support/docs/review/issue-planning.md +220 -0
  106. package/skills/_support/docs/review/language-routing.md +141 -0
  107. package/skills/_support/docs/review/repository-scorecard.md +170 -0
  108. package/skills/advise/SKILL.md +93 -67
  109. package/skills/advise/scripts/list_retrievable_skills.py +3 -3
  110. package/skills/brainstorm/SKILL.md +160 -127
  111. package/skills/change-review/SKILL.md +91 -71
  112. package/skills/change-review/references/scope-resolution.md +69 -46
  113. package/skills/change-review/scripts/resolve_scope.py +119 -73
  114. package/skills/finalize-plan/SKILL.md +198 -139
  115. package/skills/git-worktrees/SKILL.md +100 -80
  116. package/skills/git-worktrees/scripts/prepare_worktree.py +16 -10
  117. package/skills/issue-review/SKILL.md +136 -79
  118. package/skills/learn/SKILL.md +276 -186
  119. package/skills/myrmidon-swarm/SKILL.md +126 -86
  120. package/skills/plan-issue/SKILL.md +122 -81
  121. package/skills/pr-review/SKILL.md +164 -114
  122. package/skills/pr-review/references/criteria.md +58 -37
  123. package/skills/pr-review/references/delivery.md +156 -98
  124. package/skills/pr-review/references/evidence.md +265 -148
  125. package/skills/pr-review/references/prevalidated.md +93 -61
  126. package/skills/pr-review/scripts/collect_evidence.py +211 -140
  127. package/skills/pr-review/scripts/diff_context.py +6 -4
  128. package/skills/pr-review/scripts/materialize_snapshot.py +112 -120
  129. package/skills/pr-review/scripts/pr_identity.py +27 -15
  130. package/skills/pr-review/scripts/resolve_pr.py +53 -31
  131. package/skills/repo-review/SKILL.md +202 -131
  132. package/skills/systematic-debugging/SKILL.md +210 -192
  133. package/skills/systematic-debugging/scripts/repository_evidence.py +9 -4
  134. package/skills/test-driven-development/SKILL.md +126 -96
  135. package/skills/tidy/SKILL.md +92 -59
  136. package/skills/tidy/scripts/run_tidy.py +3 -3
@@ -0,0 +1,134 @@
1
+ # P090 — Prefer Negative Code
2
+
3
+ ## Definition
4
+
5
+ **Prefer Negative Code** selects the smaller of two implementations that have the same correct
6
+ behavior. Compare code, mutable state, configuration, dependencies, and concepts. The principle selects
7
+ a possible fault surface that is smaller, not a smaller character count.
8
+
9
+ **Aliases:** negative code and subtractive implementation.
10
+
11
+ ## Provenance
12
+
13
+ **Classification:** practitioner heuristic.
14
+
15
+ Andy Hertzfeld's account about Bill Atkinson records the term. The account includes Atkinson's
16
+ "-2000" line entry after a QuickDraw change. The story gives examples of errors in a productivity measure.
17
+ The story does not give proof that line deletion makes software better. Athena uses the label for
18
+ simplification with evidence.
19
+
20
+ ## Decision rule
21
+
22
+ First, make sure that behavior and necessary quality are equal. Then, select the design with a
23
+ smaller surface for maintenance and operation. Count concepts and duties, not raw lines.
24
+
25
+ ## How to apply
26
+
27
+ - Remove obsolete branches, intermediaries, state, and configuration.
28
+ - Derive data from one source. Do not keep copies that authors can change independently.
29
+ - Replace custom machinery with an applicable repository mechanism.
30
+ - Replace stable duplicate behavior with one implementation. Before behavior becomes stable, do not make an abstraction.
31
+ - Compare readability, performance, security, operability, and compatibility before and after.
32
+ - Do behavioral tests and examine the completed diff.
33
+
34
+ ## Diagram
35
+
36
+ After tests give equal results, compare maintenance surfaces.
37
+
38
+ ```mermaid
39
+ flowchart LR
40
+ A["Two correct designs"] --> B["Behavior-equivalence tests"]
41
+ B --> C["Compare state, code, and duties"]
42
+ C --> D{"One surface is smaller?"}
43
+ D -->|Yes| E["Select smaller surface"]
44
+ D -->|No| F["Select clear design"]
45
+ ```
46
+
47
+ ## Language examples
48
+
49
+ The two examples use one status table, use the same domain for `u16` text, and reject malformed or
50
+ out-of-range input.
51
+
52
+ ### Python
53
+
54
+ ```python
55
+ STATUS_TEXT = ((200, "ok"), (404, "missing"), (503, "unavailable"))
56
+
57
+ def status_text(text: str) -> str:
58
+ if not text.isascii() or not text.isdecimal():
59
+ raise ValueError("invalid status")
60
+ code = int(text)
61
+ if code > 65_535:
62
+ raise ValueError("invalid status")
63
+ return next((label for value, label in STATUS_TEXT if value == code), "unknown")
64
+ ```
65
+
66
+ ### Rust
67
+
68
+ ```rust
69
+ const STATUS_TEXT: &[(u16, &str)] = &[(200, "ok"), (404, "missing"), (503, "unavailable")];
70
+
71
+ fn status_text(text: &str) -> Result<&'static str, &'static str> {
72
+ if text.is_empty() || !text.bytes().all(|byte| byte.is_ascii_digit()) {
73
+ return Err("invalid status");
74
+ }
75
+ let code = text.parse::<u16>().map_err(|_| "invalid status")?;
76
+ Ok(STATUS_TEXT.iter()
77
+ .find_map(|(value, label)| (*value == code).then_some(*label))
78
+ .unwrap_or("unknown"))
79
+ }
80
+ ```
81
+
82
+ ## Boundaries and tensions
83
+
84
+ Code golf, compressed expressions, and hidden conventions can decrease line count and increase
85
+ risk. Line counts are incorrect measures for generated code and declarative configuration. An
86
+ abstraction can remove code and add a concept with more complexity. Duplication can be safer than an incorrect
87
+ abstraction.
88
+ Keep necessary validation, diagnostics, compatibility, and explicit contracts.
89
+
90
+ ## Examples
91
+
92
+ **Positive:** A data-driven transition table replaces duplicate special-case branches. The table keeps
93
+ states with names, validation, and error behavior.
94
+
95
+ **Misuse:** A developer includes some clear checks in one expression. The expression is short but
96
+ causes more inspection and diagnosis work.
97
+
98
+ **Athena/agent workflow:** After verification that the package finds the canonical documentation tree,
99
+ an agent removes a document registry with duplicate information. The agent keeps only the check that
100
+ has a product consumer.
101
+
102
+ ## Related principles
103
+
104
+ - [P001 KISS](p001-kiss.md)
105
+ - [P007 Subtraction Over Addition](p007-subtraction-over-addition.md)
106
+ - [P013 AHA](p013-avoid-hasty-abstractions.md)
107
+ - [P074 Prefer Existing Mechanisms](p074-prefer-existing-mechanisms.md)
108
+ - [P086 Readability Counts](p086-readability-counts.md)
109
+ - [P088 Delete Dead Code](p088-delete-dead-code.md)
110
+
111
+ ## References
112
+
113
+ ### Source information
114
+
115
+ - [Folklore.org: -2000 Lines Of Code](https://www.folklore.org/Negative_2000_Lines_Of_Code.html)
116
+ is Andy Hertzfeld's historical account of the Bill Atkinson story. The account is a historical
117
+ anecdote, not controlled evidence for a code-quality metric.
118
+
119
+ ### Applicable information
120
+
121
+ - [Google SRE: Operational Simplicity](https://sre.google/sre-book/simplicity/) gives the difference
122
+ between necessary and accidental complexity. The guidance tells engineers to remove code with no
123
+ business function.
124
+ - [Google SRE: Regaining Simplicity](https://sre.google/workbook/simplicity/) includes simplification
125
+ as engineering work that decreases cognitive and operation load.
126
+
127
+ ### More information
128
+
129
+ - [People systematically overlook subtractive changes](https://www.nature.com/articles/s41586-021-03380-y)
130
+ gives experimental evidence for a general human bias for additive solutions. The study gives
131
+ subtraction as a possible solution. The study does not give proof that line count is a software-quality
132
+ measure.
133
+
134
+ [Back to the engineering principles catalog](../README.md#p090)
@@ -0,0 +1,149 @@
1
+ # P091 — Test-Driven Development
2
+
3
+ ## Definition
4
+
5
+ **Test-Driven Development** (TDD) is a short development cycle. First, an automated test shows the
6
+ next necessary behavior and fails. Then, the author makes the minimum necessary change to
7
+ production code. The test then passes.
8
+ After all tests pass, the author refactors production code while tests continue to pass. The cycle is Red-Green-Refactor.
9
+
10
+ **Aliases:** TDD and Red-Green-Refactor cycle.
11
+
12
+ ## Provenance
13
+
14
+ **Classification:** principle with source evidence.
15
+
16
+ Before 2000, Kent Beck's Extreme Programming practice included the TDD practice. His 2002
17
+ book, *Test-Driven Development: By Example*, records the practice. Athena keeps TDD because the TDD
18
+ order gives fast behavior and design feedback.
19
+
20
+ ## Decision rule
21
+
22
+ For one behavior change, use one Red-Green-Refactor cycle. Make sure the test gives the expected
23
+ failure. Make the test pass with a correct production change. Then, refactor production code without
24
+ a behavior change.
25
+
26
+ ## How to apply
27
+
28
+ - Record the next necessary behaviors, important failures, and boundaries.
29
+ - At a boundary where a user can see the result, write a test for one small behavior.
30
+ - Do the test and make sure that the failure shows the missing behavior.
31
+ - Write only the correct production code that is necessary to make all applicable tests pass.
32
+ - While the suite passes, refactor tests and production code.
33
+ - Do the cycle again. Then, do all necessary repository verification.
34
+
35
+ ## Diagram
36
+
37
+ The cycle adds one behavior and keeps the design clear.
38
+
39
+ ```mermaid
40
+ flowchart LR
41
+ A["Write one behavior test"] --> B["Do test and examine failure"]
42
+ B --> C["Make minimum correct change"]
43
+ C --> D{"Tests pass?"}
44
+ D -->|No| C
45
+ D -->|Yes| E["Refactor code"]
46
+ E --> G{"Post-refactor tests pass?"}
47
+ G -->|No| H["Correct refactor"]
48
+ H --> G
49
+ G -->|Yes| I{"More behavior?"}
50
+ I -->|Yes| F["Select next behavior"]
51
+ F --> A
52
+ I -->|No| J["Development completed"]
53
+ ```
54
+
55
+ ## Language examples
56
+
57
+ The two examples give the behavior first, use the same domain for signed `i32` text, and reject
58
+ malformed or out-of-range input.
59
+
60
+ ### Python
61
+
62
+ ```python
63
+ def test_clamps_negative_count() -> None:
64
+ assert clamp_count("-1") == 0
65
+
66
+ def clamp_count(text: str) -> int:
67
+ digits = text[1:] if text.startswith("-") else text
68
+ if not digits or not digits.isascii() or not digits.isdecimal():
69
+ raise ValueError("count must be i32")
70
+ value = int(text)
71
+ if not -(2**31) <= value <= 2**31 - 1:
72
+ raise ValueError("count must be i32")
73
+ return max(0, value)
74
+ ```
75
+
76
+ ### Rust
77
+
78
+ ```rust
79
+ #[test]
80
+ fn clamps_negative_count() {
81
+ assert_eq!(clamp_count("-1"), Ok(0));
82
+ }
83
+
84
+ fn clamp_count(text: &str) -> Result<i32, &'static str> {
85
+ let digits = text.strip_prefix('-').unwrap_or(text);
86
+ if digits.is_empty() || !digits.bytes().all(|byte| byte.is_ascii_digit()) {
87
+ return Err("count must be i32");
88
+ }
89
+ let value = text.parse::<i32>().map_err(|_| "count must be i32")?;
90
+ Ok(value.max(0))
91
+ }
92
+ ```
93
+
94
+ ## Boundaries and tensions
95
+
96
+ TDD is a development cycle, not the full test strategy. [P026 Regression Before
97
+ Repair](p026-regression-before-repair.md) is applicable only to a defect. TDD is applicable to incremental
98
+ behavior development. P022-P028 control test quality and scope.
99
+
100
+ TDD controls work order. Verification also includes builds, types, lint, integration, security, and
101
+ operation checks. A behavior-preserving refactor starts from a sufficient green baseline. Do not
102
+ make a test fail only to record an incorrect Red step.
103
+
104
+ ## Examples
105
+
106
+ **Positive:** A developer writes a behavioral test for the parser's next boundary case. The test
107
+ fails because the parser does not have the behavior. A small implementation makes the test pass. The developer then removes
108
+ duplication with a green suite.
109
+
110
+ **Misuse:** A developer completes the implementation first. The developer then adds a test that
111
+ has a dependency on private call order and records the work as TDD.
112
+
113
+ **Athena/agent workflow:** For a behavior change, an agent records the expected test failure. The
114
+ agent makes the minimum correct fix and does the applicable test suite again. Then, the agent
115
+ refactors the code and does the repository verification gate. For a behavior-preserving refactor,
116
+ the agent first records the green baseline.
117
+
118
+ ## Related principles
119
+
120
+ - [P022 Test Behavior, Not Implementation](p022-test-behavior-not-implementation.md)
121
+ - [P026 Regression Before Repair](p026-regression-before-repair.md)
122
+ - [P027 Deterministic and Hermetic Tests](p027-deterministic-and-hermetic-tests.md)
123
+ - [P064 Requirement-to-Test Traceability](p064-requirement-to-test-traceability.md)
124
+ - [P065 Verify Before Claiming Completion](p065-verify-before-claiming-completion.md)
125
+ - [P067 No Test Cheating](p067-no-test-cheating.md)
126
+
127
+ ## References
128
+
129
+ ### Source information
130
+
131
+ - [Kent Beck, *Test-Driven Development: By Example*](https://ptgmedia.pearsoncmg.com/images/9780321146533/samplepages/0321146530.pdf)
132
+ is the publisher's sample of the book and gives the Red–Green–Refactor rules.
133
+ - [Martin Fowler: Test Driven Development](https://martinfowler.com/bliki/TestDrivenDevelopment.html)
134
+ records the practice's Extreme Programming history and gives information about interface-design
135
+ feedback.
136
+
137
+ ### Applicable information
138
+
139
+ - [The GDS Way: Test-driven development](https://gds-way.digital.cabinet-office.gov.uk/standards/test-driven-development.html)
140
+ gives government engineering guidance for expected-failure, green implementation, and
141
+ Red-Green-Refactor cycles. The guidance also gives examples where other feedback mechanisms are necessary.
142
+
143
+ ### More information
144
+
145
+ - [Agile Alliance: Testing in agile software development](https://agilealliance.org/agile-qa-testing-in-agile-software-development/)
146
+ gives the differences between TDD, acceptance-test-driven practice, and behavior-driven practice.
147
+ The three practices help continuous quality.
148
+
149
+ [Back to the engineering principles catalog](../README.md#p091)
@@ -0,0 +1,59 @@
1
+ # Review framework
2
+
3
+ **Why:** Athena reviews must catch architecture and behavior regressions before lower-level checks
4
+ create false confidence. The shared framework keeps that standard consistent while each skill uses
5
+ the delivery channel appropriate to its scope. It applies the canonical
6
+ [engineering principles](../principles/README.md) through review-specific profiles instead of
7
+ redefining them.
8
+
9
+ Use the [ASD-STE100 technical-English policy](../../../TECHNICAL_ENGLISH.md) for all technical prose and review
10
+ output.
11
+
12
+ ## System at a glance
13
+
14
+ ```mermaid
15
+ flowchart LR
16
+ Request["Review request"] --> Scope{"Scope"}
17
+ Scope --> Change["change-review"]
18
+ Scope --> Issue["plan-issue / issue-review / finalize-plan"]
19
+ Scope --> Pull["pr-review"]
20
+ Scope --> Repository["repo-review"]
21
+
22
+ Change --> Framework["Shared framework\narchitecture, then checks, then evidence"]
23
+ Issue --> Framework
24
+ Pull --> Framework
25
+ Repository --> Framework
26
+
27
+ Framework --> Findings["Deduplicated findings"]
28
+ Findings --> Delivery{"Authorized delivery"}
29
+ Delivery --> Console["Console or local annotations"]
30
+ Delivery --> IssueComment["Actor-owned issue comment"]
31
+ Delivery --> PullReview["One atomic PR review"]
32
+ Delivery --> Tracker["Tracker and child work items"]
33
+ ```
34
+
35
+ ## Components
36
+
37
+ | Component | Owns | Read when |
38
+ | --- | --- | --- |
39
+ | [ASD-STE100 technical-English policy](../../../TECHNICAL_ENGLISH.md) | Method for technical prose and literal-text boundary. | Before you write or change technical prose or review output. |
40
+ | [Shared contract](common.md) | Architecture gate, evidence, canonical-principle application profiles, findings, and delivery boundaries. | Every review. |
41
+ | [Language routing](language-routing.md) | Applicable language and toolchain profile. | The changed or inventoried surface contains code or build tooling. |
42
+ | [Behavior-first testing](behavior-first-testing.md) | Functional-test quality and false-confidence rules. | Tests, validation, or a plan are in scope. |
43
+ | [Issue planning](issue-planning.md) | Canonical plan identity, review, and finalized-epoch artifacts. | Planning, reviewing, or finalizing an issue. |
44
+ | [Repository scorecard](repository-scorecard.md) | Full-inventory repository criteria and scoring. | Reviewing a repository. |
45
+ | [Design-document structure](design-docs.md) | A clear order for architecture and design decisions. | Writing a new mutable design document. |
46
+
47
+ ## Read order
48
+
49
+ 1. Read the ASD-STE100 technical-English policy.
50
+ 2. Read the shared contract and repository guidance.
51
+ 3. Confirm that the artifact aligns with the architecture.
52
+ 4. Classify the surface.
53
+ 5. Read only the applicable language and test guidance.
54
+ 6. If the scope includes issue planning, read the issue-planning contract.
55
+ 7. If the scope includes a repository review, read the repository scorecard.
56
+ 8. Follow the invoking skill for scope resolution and its authorized delivery channel.
57
+
58
+ The diagram appears only here. Component documents use tables or prose when those communicate their
59
+ own decision more clearly.
@@ -0,0 +1,73 @@
1
+ # Behavior-first testing
2
+
3
+ **Why:** Tests must prove core product behavior. They must fail if that behavior regresses. Do not
4
+ make tests preserve wording, implementation layout, or incidental timing. This contract applies to
5
+ planning, implementation, change review, pull request review, and repository review.
6
+
7
+ Use the [ASD-STE100 technical-English policy](../../../TECHNICAL_ENGLISH.md) for all technical prose and review
8
+ output.
9
+
10
+ This contract applies the catalog's testing rules:
11
+ [P022](../principles/README.md#p022), [P023](../principles/README.md#p023),
12
+ [P024](../principles/README.md#p024), [P025](../principles/README.md#p025),
13
+ [P026](../principles/README.md#p026), [P027](../principles/README.md#p027),
14
+ [P028](../principles/README.md#p028), and [P091](../principles/README.md#p091).
15
+ Apply only the rules that are relevant to the reviewed behavior and risk. Apply P091 to a behavior
16
+ change that uses test-driven development (TDD). Apply the other rules independently when they are
17
+ relevant.
18
+
19
+ ## What a good test proves
20
+
21
+ A good test proves one observable product contract. The contract can specify:
22
+
23
+ - a result;
24
+ - a state transition;
25
+ - a public error contract;
26
+ - a security property;
27
+ - a resource or performance limit; or
28
+ - executable artifact behavior.
29
+
30
+ Make each test deterministic and isolated. Make sure that its result does not depend on test order
31
+ or ambient machine state. The test must fail if the regression occurs again.
32
+
33
+ | Situation | Good test | Bad test |
34
+ | --- | --- | --- |
35
+ | API behavior | A request produces the documented result and rejects invalid or boundary input. | A private helper runs in a particular order. |
36
+ | Bug fix | A regression crosses a public or architectural boundary and fails without the fix. | Only an issue number or TODO appears. |
37
+ | State change | Durable state and externally visible transitions are correct on success and failure. | A snapshot freezes internal layout without an outcome assertion. |
38
+ | Documentation | Markdown, links, and executable examples validate syntax, navigation, or real output. | A test pins wording, headings, paragraph counts, or documentation counts. |
39
+ | Integration | Controlled substitutes exercise a real external boundary and error behavior. | A live service, wall-clock sleep, or ambient credential decides the result. |
40
+
41
+ ## Avoid flakiness and false confidence
42
+
43
+ If the product contract does not require and control a condition, flag a test that depends on any of
44
+ these conditions:
45
+
46
+ - wall-clock delays;
47
+ - unseeded randomness;
48
+ - test order;
49
+ - live network services;
50
+ - current machine paths;
51
+ - unspecified scheduling; or
52
+ - shared mutable state.
53
+
54
+ Use mocks only at genuine external boundaries. Do not count a test that only verifies its mock
55
+ arrangement as behavior coverage. Use controlled time, seeded data, temporary paths, fake
56
+ transports, and explicit synchronization.
57
+
58
+ A name-filtered command can pass when it selects no tests. Before you accept `pytest -k`, `ctest -R`,
59
+ `go test -run`, or an equivalent filter as evidence, verify that it selects at least one registered
60
+ test. For CMake, also verify that a real build target includes the test source. Treat a successful
61
+ command that runs no relevant test as a coverage failure.
62
+
63
+ ## Planning and review rules
64
+
65
+ - Map each changed acceptance criterion to observable verification.
66
+ - If no concrete documented constraint prevents a regression test, add one for every bug fix.
67
+ - Verify error, boundary, and relevant concurrency paths proportionately to product risk.
68
+ - Do not weaken, skip, xfail, delete, or mock around a test solely to make a change green.
69
+ - Do not claim a benchmark, model metric, or runtime measurement succeeded without reproducible
70
+ execution evidence bound to the reviewed revision.
71
+
72
+ Documentation-only changes use existing Markdown, link, and executable-example checks. They do not
73
+ justify a prose-string test harness.