@solaqua/ghosts 0.4.32 → 0.4.35

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 (34) hide show
  1. package/README.md +13 -1
  2. package/experience/README.md +89 -0
  3. package/experience/skills/curate/SKILL.md +72 -0
  4. package/experience/skills/curate/references/candidate-contract.md +84 -0
  5. package/experience/skills/curate/templates/INDEX.md +11 -0
  6. package/experience/skills/curate/templates/knowledge.md +29 -0
  7. package/experience/skills/harvest/SKILL.md +60 -0
  8. package/experience/skills/harvest/assets/config.example.json +18 -0
  9. package/experience/skills/harvest/references/candidate-contract.md +84 -0
  10. package/experience/skills/harvest/references/sources.md +82 -0
  11. package/experience/skills/harvest/scripts/experience.py +544 -0
  12. package/experience/skills/harvest/templates/candidate.md +31 -0
  13. package/experience/skills/harvest/tests/EVALUATION.md +46 -0
  14. package/experience/skills/harvest/tests/test_experience.py +274 -0
  15. package/experience/skills/recall/SKILL.md +47 -0
  16. package/experience/skills/recall/library/INDEX.md +4 -0
  17. package/experience/skills/recall/library/engineering/INDEX.md +16 -0
  18. package/experience/skills/recall/library/engineering/entry-point-flow.md +30 -0
  19. package/experience/skills/recall/library/engineering/events-and-commands.md +29 -0
  20. package/experience/skills/recall/library/engineering/meaning-at-call-sites.md +64 -0
  21. package/experience/skills/recall/library/engineering/names-and-effects.md +39 -0
  22. package/experience/skills/recall/library/engineering/operational-signals.md +23 -0
  23. package/experience/skills/recall/library/engineering/public-contract.md +27 -0
  24. package/experience/skills/recall/library/engineering/purpose-docstrings.md +25 -0
  25. package/experience/skills/recall/library/engineering/responsibility-before-reuse.md +37 -0
  26. package/experience/skills/recall/library/engineering/single-source-state.md +52 -0
  27. package/experience/skills/recall/library/engineering/test-file-placement.md +42 -0
  28. package/experience/skills/recall/library/engineering/test-value.md +21 -0
  29. package/experience/skills/recall/library/engineering/visible-test-scenarios.md +100 -0
  30. package/experience/skills/recall/library/writing/INDEX.md +5 -0
  31. package/experience/skills/recall/library/writing/change-explanations.md +32 -0
  32. package/experience/skills/recall/library/writing/durable-guidance.md +28 -0
  33. package/experience/skills/recall/library/writing/reviewable-scope.md +40 -0
  34. package/package.json +2 -1
@@ -0,0 +1,52 @@
1
+ ---
2
+ title: "Derive repeated state from its source"
3
+ scope: "global"
4
+ status: "proposed"
5
+ confidence: "medium"
6
+ candidate_ids: ["candidate-5c5181b13641e16905d6f4fe"]
7
+ ---
8
+
9
+ # Derive repeated state from its source
10
+
11
+ When a new variable or metadata declaration represents an existing fact, prefer deriving it from the original. Independently updating both copies creates missed updates and divergence that is hard to trace.
12
+
13
+ Executable Python reduction of a derived UI label; the same choice applies to computed reactive state.
14
+
15
+ ### Before
16
+
17
+ ```python
18
+ from dataclasses import dataclass
19
+
20
+ @dataclass
21
+ class Selection:
22
+ category: str
23
+ title: str
24
+
25
+ selection = Selection(category="books", title="Books")
26
+ selection.category = "music"
27
+ # The title still says Books.
28
+ ```
29
+
30
+ ### After
31
+
32
+ ```python
33
+ from dataclasses import dataclass
34
+
35
+ @dataclass
36
+ class Selection:
37
+ category: str
38
+
39
+ @property
40
+ def title(self) -> str:
41
+ return self.category.title()
42
+
43
+ selection = Selection(category="books")
44
+ selection.category = "music"
45
+ assert selection.title == "Music"
46
+ ```
47
+
48
+ The same omission risk appears when dependency objects already declare relationships but developers must also maintain an equivalent string-metadata list.
49
+
50
+ ## When storage is intentional
51
+
52
+ Keep a stored field when DB filtering requires it. A stored view count can avoid loading very many rows when small divergence is acceptable. Inspect dependency direction before replacing storage with a property: deriving a price from a value that already depends on that price would reverse the dependency.
@@ -0,0 +1,42 @@
1
+ ---
2
+ title: "Place tests alongside their target module structure"
3
+ scope: "global"
4
+ status: "proposed"
5
+ confidence: "medium"
6
+ candidate_ids: ["candidate-f12222dbee13b32d56d14d81"]
7
+ ---
8
+
9
+ # Place tests alongside their target module structure
10
+
11
+ When adding or renaming tests, start with the file corresponding to the target module. A new feature, result or scenario alone does not call for another file.
12
+
13
+ These generalized paths illustrate placement; they do not describe a particular checkout.
14
+
15
+ ### Before
16
+
17
+ ```text
18
+ app/accounts/views/team.py
19
+ tests/accounts/views/test_team_search.py
20
+ tests/accounts/views/test_team_invitation.py
21
+
22
+ app/mail/services/delivery.py
23
+ tests/mail/test_delivery.py
24
+
25
+ src/use-quotes.ts
26
+ tests/use-prices.spec.ts
27
+ ```
28
+
29
+ ### After
30
+
31
+ ```text
32
+ app/accounts/views/team.py
33
+ tests/accounts/views/test_team.py
34
+
35
+ app/mail/services/delivery.py
36
+ tests/mail/services/test_delivery.py
37
+
38
+ src/use-quotes.ts
39
+ tests/use-quotes.spec.ts
40
+ ```
41
+
42
+ Group scenarios within the matching file; pytest test classes can provide that grouping. Check for duplicate coverage when the existing file already verifies the same behavior.
@@ -0,0 +1,21 @@
1
+ ---
2
+ title: "Protect a distinct behavior with each test"
3
+ scope: "global"
4
+ status: "proposed"
5
+ confidence: "medium"
6
+ candidate_ids: ["candidate-dbfc753fd64e620c485082f2"]
7
+ ---
8
+
9
+ # Protect a distinct behavior with each test
10
+
11
+ When adding or revising coverage, identify the behavior that would lose protection without this test. Construction wiring, incidental HTML and duplicated lower-layer assertions can add maintenance without independent confidence.
12
+
13
+ A service test does not establish that the HTTP response matches its schema. Conversely, a view test may legitimately assert that it calls its service correctly. Judge the boundary protected, rather than banning mocks or requiring every layer to repeat the same scenarios.
14
+
15
+ ## Template changes
16
+
17
+ Exact headings, CSS classes and element order make a delivery test fail when presentation changes even if delivery behavior remains correct. Check the behavior the test owns, and inspect presentation through a populated render.
18
+
19
+ ## Refactoring
20
+
21
+ Ask what existing coverage already checks before adding tests for implementation-only changes. A test that recreates a constructor's wiring does not independently show that the service works.
@@ -0,0 +1,100 @@
1
+ ---
2
+ title: "Keep test scenarios visible in the test body"
3
+ scope: "global"
4
+ status: "proposed"
5
+ confidence: "medium"
6
+ candidate_ids: ["candidate-181c8ce22f7c8a5659cffeeb"]
7
+ ---
8
+
9
+ # Keep test scenarios visible in the test body
10
+
11
+ Make the conditions and expected results clear without requiring readers to trace branches or hidden setup.
12
+
13
+ ## Explicit setup values
14
+
15
+ Deidentified setup fragments from asynchronous coupon-reservation tests. The host project supplies the models, async creation helper and database session. Each After block is a separate scenario.
16
+
17
+ ### Before
18
+
19
+ ```python
20
+ usage = await create_coupon_usage(
21
+ session,
22
+ subscription=subscription,
23
+ coupon=coupon,
24
+ payment_id=None if linked else subscription.last_payment_id,
25
+ link_subscription=linked,
26
+ applied_amount=coupon.discount_amount,
27
+ usage_pending=True,
28
+ )
29
+ ```
30
+
31
+ ### After
32
+
33
+ ```python
34
+ # Given: a subscription-linked reservation not yet applied to a payment
35
+ usage = await create_coupon_usage(
36
+ session,
37
+ subscription=subscription,
38
+ coupon=coupon,
39
+ payment_id=None,
40
+ link_subscription=True,
41
+ applied_amount=coupon.discount_amount,
42
+ usage_pending=True,
43
+ )
44
+ ```
45
+
46
+ ```python
47
+ # Given: a legacy trial-payment reservation without a subscription link
48
+ usage = await create_coupon_usage(
49
+ session,
50
+ subscription=subscription,
51
+ coupon=coupon,
52
+ payment_id=subscription.last_payment_id,
53
+ link_subscription=False,
54
+ applied_amount=coupon.discount_amount,
55
+ usage_pending=True,
56
+ )
57
+ ```
58
+
59
+ Explicit call-site values can still leave branching inside the helper. To remove that branch too, change the helper to accept an explicit `subscription_id` instead of `link_subscription`.
60
+
61
+ Do not select inputs or expectations through conditionals in test setup, actions or assertions.
62
+
63
+ Keep small scenario data beside the test. Move data elsewhere when its size obstructs reading the test itself. Put test cases before supporting fixtures and helpers.
64
+
65
+ ## Parameterized scenarios
66
+
67
+ Keep parameterization when it makes cases easy to compare. Group related inputs under field names, and give failure cases IDs that describe the failing condition.
68
+
69
+ The following deidentified fragments illustrate an approval test. The host project supplies the async persistence helpers, organization and document types.
70
+
71
+ ### Before
72
+
73
+ Positional values need the parameter header to be understood; the setup helper also chooses email and income-earner values from the settlement type.
74
+
75
+ ```python
76
+ pytest.param("WITHHOLDING", "SOLE_PROPRIETOR", True, True, document_types)
77
+ # In the test body:
78
+ await prepare_approval(session, organization, settlement_type, document_types)
79
+ ```
80
+
81
+ ### After
82
+
83
+ ```python
84
+ pytest.param(
85
+ {"business_type": "SOLE_PROPRIETOR", "is_domestic_resident": True,
86
+ "is_representative": True, "tax_invoice_email": None},
87
+ {"settlement_type": "WITHHOLDING", "income_earner_name": "Applicant"},
88
+ document_types,
89
+ id="withholding-sole-proprietor",
90
+ )
91
+ # The parameter names are application, settlement, document_types.
92
+ # In the test body:
93
+ organization.update(application)
94
+ await add_submission_documents(session, organization.id, document_types)
95
+ await add_settlement_profile(session, organization.id, **settlement)
96
+ ```
97
+
98
+ The helper persists the supplied settlement values; it does not choose scenario conditions or overwrite application fields. Name failure cases such as `missing-bank` and `blank-account-holder` so test output identifies the condition.
99
+
100
+ Keep the action, response checks, and resulting state/history assertions visible in the test body. This cleanup does not require a scenario class or builder.
@@ -0,0 +1,5 @@
1
+ # Writing
2
+
3
+ - Does the reader know why the change is needed, what it looks like, and what was checked? → [Change explanations](change-explanations.md)
4
+ - A guide leaves readers to reconstruct its current rules. What context and wording should it provide? → [Durable guidance](durable-guidance.md)
5
+ - Should related work share a PR or be split for review? → [Reviewable scope](reviewable-scope.md)
@@ -0,0 +1,32 @@
1
+ ---
2
+ title: "Give reviewers the reason and concrete result"
3
+ scope: "global"
4
+ status: "proposed"
5
+ confidence: "medium"
6
+ candidate_ids: ["candidate-53a3933960e792259de992ea", "candidate-6ab63dccb2f8f9d6bd09877b", "candidate-7c93707f12050e47539d15d6"]
7
+ ---
8
+
9
+ # Give reviewers the reason and concrete result
10
+
11
+ When describing a change, give a reader who missed the conversation enough information to understand why it is needed and assess its result. Listing operations or showing a Before/After table alone may leave the reason unanswered.
12
+
13
+ Generalized PR text illustrates the distinction.
14
+
15
+ ### Before
16
+
17
+ ```text
18
+ Split the scheduler into input and render phases.
19
+ ```
20
+
21
+ ### After
22
+
23
+ ```text
24
+ Drawing before queued input can paint the previous drag position. Process
25
+ input before drawing so the render uses the updated position.
26
+ ```
27
+
28
+ Report only checks actually run. Mark manual checks as manual and state their conditions and observable result; implementation details are not test cases. This lets reviewers identify missing coverage.
29
+
30
+ Choose a concrete artifact that answers the reader's question: sample input/output and types for a schema, code blocks for an interface, or a populated render for an email or UI. These choices do not require screenshots for every change.
31
+
32
+ Keep explanation focused on the decision. Capture-environment narration and incidental investigation details can be omitted when they do not help assess the change.
@@ -0,0 +1,28 @@
1
+ ---
2
+ title: "Write guidance around the reader\u2019s current decision"
3
+ scope: "global"
4
+ status: "proposed"
5
+ confidence: "medium"
6
+ candidate_ids: ["candidate-91e3e891e9f6eec5c3e2a791", "candidate-81dda8089bc1dd947703ce07"]
7
+ ---
8
+
9
+ # Write guidance around the reader’s current decision
10
+
11
+ When writing a policy, operating guide or reusable knowledge document, explain the behavior and conditions readers need now. Define unfamiliar domain terms instead of assuming readers share the context.
12
+
13
+ ### Before
14
+
15
+ ```text
16
+ Legacy records were backfilled during the migration.
17
+ ```
18
+
19
+ ### After
20
+
21
+ ```text
22
+ The recorded amount can differ from the amount actually billed. Check the
23
+ billing report when reconciling a payment.
24
+ ```
25
+
26
+ The reusable caveat and next action survive; the completed migration history does not help the reader decide.
27
+
28
+ Write conditions and cause-and-effect relationships in complete sentences when compressed noun labels hide them.
@@ -0,0 +1,40 @@
1
+ ---
2
+ title: "Group changes into reviewable decisions"
3
+ scope: "global"
4
+ status: "proposed"
5
+ confidence: "medium"
6
+ candidate_ids: ["candidate-140020b103ec3346e4f91762"]
7
+ ---
8
+
9
+ # Group changes into reviewable decisions
10
+
11
+ When setting PR boundaries, group work by what a reviewer can assess together. Split an oversized change, while avoiding mechanical one-task-per-resource fragmentation that does not reduce the code reviewers must understand.
12
+
13
+ ### Before
14
+
15
+ ```text
16
+ One PR contains the whole observability migration.
17
+ ```
18
+
19
+ ### After
20
+
21
+ ```text
22
+ Split the migration into related, assessable changes with explicit dependencies.
23
+ ```
24
+
25
+ The opposite choice can also be appropriate:
26
+
27
+ ### Before
28
+
29
+ ```text
30
+ Each permission conversion gets its own PR even though the changes are small
31
+ and repeat the same surrounding code.
32
+ ```
33
+
34
+ ### After
35
+
36
+ ```text
37
+ Group related conversions by the amount of code to review.
38
+ ```
39
+
40
+ If a correction shares almost all of the current change and must prevent its release, keeping it in the same PR can reduce repeated review and avoid releasing the incomplete version. The evidence does not establish a universal line count or number of PRs.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solaqua/ghosts",
3
- "version": "0.4.32",
3
+ "version": "0.4.35",
4
4
  "description": "Reusable agent skills and reviewers.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -10,6 +10,7 @@
10
10
  "files": [
11
11
  "common",
12
12
  "engineering",
13
+ "experience",
13
14
  "product",
14
15
  "registry",
15
16
  "research",