@hobin/developer 0.1.1 → 0.1.3
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 +61 -20
- package/SOURCES.md +104 -0
- package/extensions/developer.ts +202 -44
- package/extensions/references/behavior-preserving-structural-change.md +149 -0
- package/extensions/skills.ts +1 -16
- package/extensions/state.ts +96 -10
- package/extensions/tui.ts +140 -25
- package/package.json +11 -25
- package/skills/abstraction-review/references/field-card.md +7 -0
- package/skills/abstraction-review/references/recipe-cards.md +67 -0
- package/skills/abstraction-review/references/repair-table.md +5 -0
- package/skills/model/SKILL.md +6 -1
- package/skills/model/references/problem-modeling.md +294 -235
- package/skills/model/references/worked-models-and-specialized-techniques.md +218 -0
- package/skills/naming-judgment/SKILL.md +5 -3
- package/skills/naming-judgment/references/domain-naming.md +202 -0
- package/skills/schedule/SKILL.md +1 -1
- package/skills/schedule/references/structural-change-timing.md +80 -13
- package/skills/signal/SKILL.md +2 -2
- package/skills/signal/references/structural-movement.md +202 -0
- package/skills/sketch/SKILL.md +35 -8
- package/skills/sketch/references/abstraction-barriers-and-closure.md +160 -0
- package/skills/sketch/references/abstraction-composition-and-state.md +184 -0
- package/skills/sketch/references/composition-generative-recursion-and-accumulators.md +196 -0
- package/skills/sketch/references/data-driven-design.md +177 -0
- package/skills/sketch/references/data-shape-template-catalog.md +241 -0
- package/skills/sketch/references/generic-operations-and-languages.md +134 -0
- package/skills/sketch/references/processes-state-and-time.md +171 -0
- package/skills/sketch/references/responsibility-and-variation.md +245 -0
- package/skills/verify/references/verifier-selection-and-pass-but-wrong.md +61 -3
- package/skills/naming-judgment/references/elements-of-clojure-naming.md +0 -74
- package/skills/signal/references/flocking-and-structural-movement.md +0 -157
- package/skills/sketch/references/design-recipe-and-abstraction-barriers.md +0 -169
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Elements Of Clojure Naming Notes
|
|
2
|
-
|
|
3
|
-
These notes adapt naming ideas from Zachary Tellman's *Elements of Clojure*
|
|
4
|
-
(2019), especially the `Names` chapter and the beginning of `Indirection`. Use
|
|
5
|
-
them as judgment prompts, not hard rules.
|
|
6
|
-
|
|
7
|
-
## Core Observations
|
|
8
|
-
|
|
9
|
-
- Names are a common form of indirection. A name lets a reader stop at what the
|
|
10
|
-
code means without reading how it works.
|
|
11
|
-
- A name has a textual sign, a current referent, and a sense. In software, the
|
|
12
|
-
sense matters most because the referent can change while callers keep relying
|
|
13
|
-
on the same idea.
|
|
14
|
-
- Narrow does not mean maximally specific. A too-general name hides necessary
|
|
15
|
-
properties; a too-specific name exposes implementation details that should be
|
|
16
|
-
free to change.
|
|
17
|
-
- Consistency is contextual. A name is understood through local code, domain
|
|
18
|
-
language, ecosystem conventions, documentation, and conversation.
|
|
19
|
-
- Natural names help readers reason by analogy but carry multiple senses.
|
|
20
|
-
Synthetic names can be precise for experts but create a cliff for new readers.
|
|
21
|
-
- A name can be valid in one audience or namespace and misleading in another.
|
|
22
|
-
Reusing a natural word across different product contexts requires active
|
|
23
|
-
boundary management.
|
|
24
|
-
|
|
25
|
-
## Data Names
|
|
26
|
-
|
|
27
|
-
- Data names should communicate the invariant or role readers can rely on, not
|
|
28
|
-
every structural detail.
|
|
29
|
-
- A function parameter only controls the sign; the caller controls the value. If
|
|
30
|
-
the name assumes an invariant, enforce it at the boundary where outside data
|
|
31
|
-
enters.
|
|
32
|
-
- A local binding name should let the reader skip the right-hand expression. If
|
|
33
|
-
the name does not improve skimming, prefer direct composition or keep the
|
|
34
|
-
expression inline.
|
|
35
|
-
- Avoid naming every intermediate value. Introduce a name when it adds a stable
|
|
36
|
-
concept or removes real cognitive load.
|
|
37
|
-
- Collection and map shape can help when it distinguishes real cases. Prefer
|
|
38
|
-
local project conventions over imported notation.
|
|
39
|
-
|
|
40
|
-
## Function Names
|
|
41
|
-
|
|
42
|
-
- Functions pull data into scope, transform data already in scope, push data into
|
|
43
|
-
another scope, or combine those actions.
|
|
44
|
-
- A function that crosses a data-scope boundary should usually have a verb.
|
|
45
|
-
- A pure transform can often be named by its result, property, or conversion
|
|
46
|
-
rather than a generic verb.
|
|
47
|
-
- A function that both pushes and returns data should make the combined behavior
|
|
48
|
-
explicit or be split.
|
|
49
|
-
- Namespace/module context can narrow function names. If every function operates
|
|
50
|
-
on the same domain object or data scope, the repeated noun can often move to
|
|
51
|
-
the module boundary.
|
|
52
|
-
|
|
53
|
-
## Indirection And Modules
|
|
54
|
-
|
|
55
|
-
- Indirection separates what from how and gives permission not to inspect deeper
|
|
56
|
-
layers.
|
|
57
|
-
- A software module can be viewed as model, interface, and environment. Names
|
|
58
|
-
live on the interface side: they describe what the model is and what it is
|
|
59
|
-
expected to become.
|
|
60
|
-
- An abstraction is useful only in an environment. A name that is internally tidy
|
|
61
|
-
but wrong for the product context is not a good name.
|
|
62
|
-
- Every model omits facets of the environment; the omissions become assumptions.
|
|
63
|
-
Names should not quietly turn fragile assumptions into permanent facts.
|
|
64
|
-
|
|
65
|
-
## Practical Review Prompts
|
|
66
|
-
|
|
67
|
-
- What does this name let a reader safely ignore?
|
|
68
|
-
- Which property must remain true if the implementation changes?
|
|
69
|
-
- Is the name too close to the current implementation, storage, UI widget, or
|
|
70
|
-
library?
|
|
71
|
-
- Is the name too broad to exclude invalid uses?
|
|
72
|
-
- Is a natural word carrying different senses in different parts of the system?
|
|
73
|
-
- Would a shorter name become clear if this code moved into a better module?
|
|
74
|
-
- Is the name hiding a side effect, external boundary, or mutation?
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
# Flocking And Structural Movement
|
|
2
|
-
|
|
3
|
-
Use this reference when duplication, parallel branches, similar tests, repeated
|
|
4
|
-
UI states, conditionals, or a recent refactor create pressure for structural
|
|
5
|
-
movement and the safest next move is not obvious.
|
|
6
|
-
|
|
7
|
-
## Contents
|
|
8
|
-
|
|
9
|
-
- Change Pressure
|
|
10
|
-
- The Flocking Cycle
|
|
11
|
-
- Evidence That Keeps The Move Green
|
|
12
|
-
- Horizontal And Vertical Movement
|
|
13
|
-
- Model-Code Mismatch
|
|
14
|
-
- Small-Step Discipline
|
|
15
|
-
- Failure Checks
|
|
16
|
-
- Reporting Shape
|
|
17
|
-
- Conceptual Lineage
|
|
18
|
-
|
|
19
|
-
## Change Pressure
|
|
20
|
-
|
|
21
|
-
Start with the current requirement or invariant. Ask whether the existing code
|
|
22
|
-
is already open to the change. If it is, similarity alone does not justify a
|
|
23
|
-
refactor. If it is not, locate the smallest part of the code whose present shape
|
|
24
|
-
blocks or obscures the change.
|
|
25
|
-
|
|
26
|
-
Structural movement should answer an observed pressure:
|
|
27
|
-
|
|
28
|
-
- two paths express the same responsibility differently;
|
|
29
|
-
- a stable domain difference is hidden in incidental branching;
|
|
30
|
-
- a default or absence policy is duplicated;
|
|
31
|
-
- a modeled transition is represented as an unrelated current-state check;
|
|
32
|
-
- callers repeat knowledge that should belong behind a boundary;
|
|
33
|
-
- names describe mechanics while the model describes meaning.
|
|
34
|
-
|
|
35
|
-
## The Flocking Cycle
|
|
36
|
-
|
|
37
|
-
Work with one selected pair at a time:
|
|
38
|
-
|
|
39
|
-
1. Select the two things most alike.
|
|
40
|
-
2. State why they are alike: responsibility, vocabulary, transition, failure
|
|
41
|
-
mode, model element, or user-visible outcome.
|
|
42
|
-
3. Find the smallest meaningful difference between only those two things.
|
|
43
|
-
4. Choose the simplest behavior-preserving move that removes or exposes that
|
|
44
|
-
difference.
|
|
45
|
-
5. Run the smallest relevant check.
|
|
46
|
-
6. Observe the new shape before choosing another pair.
|
|
47
|
-
7. Delete newly unused code only after the replacement is exercised.
|
|
48
|
-
|
|
49
|
-
Possible small moves include matching an expression or name, aligning a branch,
|
|
50
|
-
introducing a temporary parameter or adapter, moving one responsibility, or
|
|
51
|
-
calling the new shape before deleting the old one.
|
|
52
|
-
|
|
53
|
-
If the proposed move changes behavior, touches many unrelated sites, or creates
|
|
54
|
-
a public concept, it is no longer a routine flocking step. Split it or return a
|
|
55
|
-
vertical/ambiguous candidate for review.
|
|
56
|
-
|
|
57
|
-
## Evidence That Keeps The Move Green
|
|
58
|
-
|
|
59
|
-
"Behavior preserving" is a claim, not a visual impression. Name the evidence:
|
|
60
|
-
|
|
61
|
-
- focused tests for the affected responsibility;
|
|
62
|
-
- a characterization test for legacy behavior;
|
|
63
|
-
- typecheck, build, or contract evidence for an interface movement;
|
|
64
|
-
- a representative UI or integration check;
|
|
65
|
-
- a diff inspection showing only structural change;
|
|
66
|
-
- an explicit residual when no cheap verifier exists.
|
|
67
|
-
|
|
68
|
-
Lower confidence when evidence cannot distinguish the original and moved
|
|
69
|
-
behavior. Do not use a broad green suite as proof when it never exercises the
|
|
70
|
-
selected difference.
|
|
71
|
-
|
|
72
|
-
## Horizontal And Vertical Movement
|
|
73
|
-
|
|
74
|
-
Keep movement horizontal when it aligns already-related code inside the current
|
|
75
|
-
abstraction level and leaves no stable new concept behind.
|
|
76
|
-
|
|
77
|
-
Treat movement as vertical only when, after the difference is understood, a
|
|
78
|
-
nameable concept remains:
|
|
79
|
-
|
|
80
|
-
- a policy with its own cases;
|
|
81
|
-
- an invariant-bearing boundary;
|
|
82
|
-
- a responsibility with distinct reasons to change;
|
|
83
|
-
- a conversion or representation barrier;
|
|
84
|
-
- state/history ownership;
|
|
85
|
-
- a caller contract shared across uses.
|
|
86
|
-
|
|
87
|
-
Similarity is not enough. Two pieces may look alike while changing for
|
|
88
|
-
different reasons. Conversely, a vertical concept may first appear as a stable
|
|
89
|
-
difference rather than as duplicated text.
|
|
90
|
-
|
|
91
|
-
For a vertical or ambiguous candidate, state its pressure, contract-shaped
|
|
92
|
-
meaning, hidden detail, invariant risk, concrete evidence, and evidence still
|
|
93
|
-
needed. Do not promote or schedule it here.
|
|
94
|
-
|
|
95
|
-
## Model-Code Mismatch
|
|
96
|
-
|
|
97
|
-
When a problem model exists, check whether code and model disagree:
|
|
98
|
-
|
|
99
|
-
- a forbidden case remains representable or reachable;
|
|
100
|
-
- a decision space has a missing or conflicting branch;
|
|
101
|
-
- a transition rule sees only the current state and loses history;
|
|
102
|
-
- a caller does not establish a callee precondition;
|
|
103
|
-
- a type admits invalid states without a boundary check;
|
|
104
|
-
- progress or retry behavior is absent from a temporal requirement;
|
|
105
|
-
- a ranking or objective is hidden in incidental ordering;
|
|
106
|
-
- product vocabulary and code vocabulary point to different concepts.
|
|
107
|
-
|
|
108
|
-
A mismatch may justify structural review even without textual duplication.
|
|
109
|
-
|
|
110
|
-
## Small-Step Discipline
|
|
111
|
-
|
|
112
|
-
Keep each move reversible and locally explainable. After every green move,
|
|
113
|
-
reselect the comparison instead of executing a predetermined refactoring plan.
|
|
114
|
-
The newly aligned code may reveal that the next difference is meaningful and
|
|
115
|
-
should remain.
|
|
116
|
-
|
|
117
|
-
When a move fails its check, revert or repair that move before continuing. Do
|
|
118
|
-
not stack more structural guesses on top of ambiguous evidence.
|
|
119
|
-
|
|
120
|
-
## Failure Checks
|
|
121
|
-
|
|
122
|
-
The observation is not ready when:
|
|
123
|
-
|
|
124
|
-
- no selected pair is named;
|
|
125
|
-
- "duplicate" is the only similarity basis;
|
|
126
|
-
- the smallest difference is actually several differences;
|
|
127
|
-
- the move has no behavior-preserving evidence;
|
|
128
|
-
- a helper is proposed before its stable concept can be stated;
|
|
129
|
-
- line count or static complexity is treated as the only improvement measure;
|
|
130
|
-
- product scope is expanded during structural observation;
|
|
131
|
-
- timing is decided before a concrete candidate exists.
|
|
132
|
-
|
|
133
|
-
## Reporting Shape
|
|
134
|
-
|
|
135
|
-
Keep the result auditable:
|
|
136
|
-
|
|
137
|
-
```text
|
|
138
|
-
Pressure: the requirement, invariant, or mismatch driving observation
|
|
139
|
-
Selected pair: the two most alike artifacts and why
|
|
140
|
-
Smallest difference: one concrete distinction
|
|
141
|
-
Smallest move: one behavior-preserving experiment
|
|
142
|
-
Evidence: the check that keeps the move green
|
|
143
|
-
Classification: no-signal | horizontal | vertical | ambiguous
|
|
144
|
-
Candidate: only for vertical or ambiguous movement
|
|
145
|
-
Missing evidence: what could change the classification
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
## Conceptual Lineage
|
|
149
|
-
|
|
150
|
-
This reference adapts the flocking rules and small, behavior-preserving
|
|
151
|
-
refactoring discipline presented by Sandi Metz, Katrina Owen, and TJ Stankus in
|
|
152
|
-
*99 Bottles of OOP*. It extends the comparison with model-code mismatch and
|
|
153
|
-
explicit evidence because the skill must judge real product changes, not only
|
|
154
|
-
remove duplication.
|
|
155
|
-
|
|
156
|
-
- 99 Bottles of OOP: https://sandimetz.com/99bottles
|
|
157
|
-
- JavaScript sample: https://sandimetz.com/99bottles-sample-js
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
# Design Recipe And Abstraction Barriers
|
|
2
|
-
|
|
3
|
-
Use this reference when a sketch must do more than name files or helpers: the
|
|
4
|
-
data shape, ownership, traversal, representation boundary, or wished interfaces
|
|
5
|
-
must carry part of the design judgment.
|
|
6
|
-
|
|
7
|
-
## Contents
|
|
8
|
-
|
|
9
|
-
- Design Pressure
|
|
10
|
-
- Data Definitions And Templates
|
|
11
|
-
- Wishful Top-Level Design
|
|
12
|
-
- Wished Interfaces As Barriers
|
|
13
|
-
- Representative Cases And Checks
|
|
14
|
-
- Deferred Abstractions
|
|
15
|
-
- Failure Checks
|
|
16
|
-
- Compact Example
|
|
17
|
-
- Conceptual Lineage
|
|
18
|
-
|
|
19
|
-
## Design Pressure
|
|
20
|
-
|
|
21
|
-
A useful sketch preserves a chain of reasoning:
|
|
22
|
-
|
|
23
|
-
```text
|
|
24
|
-
accepted intent
|
|
25
|
-
-> purpose
|
|
26
|
-
-> data or state definitions
|
|
27
|
-
-> representative cases
|
|
28
|
-
-> data-shaped template
|
|
29
|
-
-> wishful top level
|
|
30
|
-
-> wished interfaces and checks
|
|
31
|
-
-> smallest implementation item
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Do not start with a file list. A file list records placement after the design is
|
|
35
|
-
known; it does not explain why the design has that shape.
|
|
36
|
-
|
|
37
|
-
## Data Definitions And Templates
|
|
38
|
-
|
|
39
|
-
A data definition does more than repeat a type name. State:
|
|
40
|
-
|
|
41
|
-
- what domain information the data represents;
|
|
42
|
-
- which values are valid members;
|
|
43
|
-
- which values are excluded or impossible;
|
|
44
|
-
- which variants, lifecycle states, or ownership boundaries matter;
|
|
45
|
-
- which fields are available at each branch or traversal point.
|
|
46
|
-
|
|
47
|
-
Derive the template from that definition. The template should expose the
|
|
48
|
-
structural inventory an implementation must handle:
|
|
49
|
-
|
|
50
|
-
- one branch for each meaningfully different variant;
|
|
51
|
-
- selectors or fields available in each branch;
|
|
52
|
-
- recursive or collection traversal positions;
|
|
53
|
-
- state transitions and the old/new values they require;
|
|
54
|
-
- ownership handoffs and conversion boundaries.
|
|
55
|
-
|
|
56
|
-
Merging two branches is allowed only when the accepted intent treats them the
|
|
57
|
-
same. Omitting a branch requires an explicit reason, such as an upstream
|
|
58
|
-
guarantee that makes the state unreachable.
|
|
59
|
-
|
|
60
|
-
The template is not final code. It is the smallest skeleton that makes missing
|
|
61
|
-
cases, hidden state, and accidental representation choices visible.
|
|
62
|
-
|
|
63
|
-
## Wishful Top-Level Design
|
|
64
|
-
|
|
65
|
-
Write the top-level operation as if the right lower-level operations already
|
|
66
|
-
existed. Use the vocabulary of the product contract and problem model rather
|
|
67
|
-
than storage, framework, DOM, transport, or mutation mechanics.
|
|
68
|
-
|
|
69
|
-
Wishful top-level design should reveal:
|
|
70
|
-
|
|
71
|
-
- the order of domain operations;
|
|
72
|
-
- which decisions belong at the top level;
|
|
73
|
-
- which details callers should not need to know;
|
|
74
|
-
- which missing concepts need names and contracts;
|
|
75
|
-
- where evidence can check the result.
|
|
76
|
-
|
|
77
|
-
Do not invent a helper only to shorten code. A wished operation earns a name
|
|
78
|
-
when its purpose and caller-facing assumption can be stated without describing
|
|
79
|
-
its body.
|
|
80
|
-
|
|
81
|
-
## Wished Interfaces As Barriers
|
|
82
|
-
|
|
83
|
-
Treat each wished interface as a proposed abstraction barrier. Record:
|
|
84
|
-
|
|
85
|
-
- purpose: what callers obtain or may assume;
|
|
86
|
-
- input and output shape;
|
|
87
|
-
- contract: preconditions, postconditions, and meaningful failure;
|
|
88
|
-
- owner: the component or layer responsible for the guarantee;
|
|
89
|
-
- hidden detail: representation or mechanism callers must not depend on;
|
|
90
|
-
- stop check: the smallest evidence that would falsify the contract.
|
|
91
|
-
|
|
92
|
-
An interface is too weak when callers still inspect the hidden representation.
|
|
93
|
-
It is too broad when unrelated policy or lifecycle decisions are bundled behind
|
|
94
|
-
one name. It is speculative when no representative case needs the boundary.
|
|
95
|
-
|
|
96
|
-
## Representative Cases And Checks
|
|
97
|
-
|
|
98
|
-
Choose cases before implementation shape hardens. Include only cases that
|
|
99
|
-
distinguish meaningful behavior:
|
|
100
|
-
|
|
101
|
-
- a normal case;
|
|
102
|
-
- each relevant data variant;
|
|
103
|
-
- a boundary or absence/default case;
|
|
104
|
-
- a forbidden or impossible case;
|
|
105
|
-
- a product-meaning case that a mechanically plausible implementation could
|
|
106
|
-
get wrong.
|
|
107
|
-
|
|
108
|
-
Map cases to evidence. Unit examples are not always enough: a type, contract,
|
|
109
|
-
property check, runtime validation, state-transition check, UI inspection, or
|
|
110
|
-
human acceptance may carry the guarantee more directly.
|
|
111
|
-
|
|
112
|
-
## Deferred Abstractions
|
|
113
|
-
|
|
114
|
-
Separate three things:
|
|
115
|
-
|
|
116
|
-
1. design artifacts needed to understand the current change;
|
|
117
|
-
2. implementation items needed to make the accepted behavior real;
|
|
118
|
-
3. abstraction candidates that the sketch noticed but current evidence has not
|
|
119
|
-
earned.
|
|
120
|
-
|
|
121
|
-
For each deferred candidate, state the pressure that would reopen it. Do not
|
|
122
|
-
promote it merely because the wished top level uses a convenient name.
|
|
123
|
-
|
|
124
|
-
## Failure Checks
|
|
125
|
-
|
|
126
|
-
A sketch is too shallow when:
|
|
127
|
-
|
|
128
|
-
- it can be reduced to "edit these files" without losing information;
|
|
129
|
-
- the data definition is a type name with no valid/excluded members;
|
|
130
|
-
- the template does not mirror the important variants or traversal shape;
|
|
131
|
-
- wished helpers expose no caller contract or hidden detail;
|
|
132
|
-
- the top level speaks in framework or storage vocabulary;
|
|
133
|
-
- examples all follow the happy path;
|
|
134
|
-
- checks prove execution but not the accepted meaning;
|
|
135
|
-
- deferred ideas silently enter the implementation queue.
|
|
136
|
-
|
|
137
|
-
Return to product clarification or modeling when the purpose, valid members, or
|
|
138
|
-
case outcomes cannot be stated without guessing.
|
|
139
|
-
|
|
140
|
-
## Compact Example
|
|
141
|
-
|
|
142
|
-
For a form-to-domain conversion, do not begin with `add mapper.ts`.
|
|
143
|
-
|
|
144
|
-
```text
|
|
145
|
-
Purpose: convert editable form state into valid schedule content.
|
|
146
|
-
Data variants: one-time | recurring; optional end date; local date/time input.
|
|
147
|
-
Cases: one-time, recurring without end, recurring with end, invalid interval.
|
|
148
|
-
Template: branch by schedule kind, normalize shared time fields, validate the
|
|
149
|
-
variant, construct domain content.
|
|
150
|
-
Wishful top level: validate(form) -> normalize(form) -> makeScheduleContent(...)
|
|
151
|
-
Barrier: makeScheduleContent hides the domain representation and rejects
|
|
152
|
-
impossible combinations.
|
|
153
|
-
Checks: one table row per meaningful variant and forbidden combination.
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
The concrete functions may change after repository inspection. The design
|
|
157
|
-
pressure should remain stable.
|
|
158
|
-
|
|
159
|
-
## Conceptual Lineage
|
|
160
|
-
|
|
161
|
-
This reference adapts procedural abstraction, data abstraction, wishful
|
|
162
|
-
thinking, and abstraction barriers from Abelson and Sussman's *Structure and
|
|
163
|
-
Interpretation of Computer Programs*, together with the data-directed design
|
|
164
|
-
recipe from Felleisen, Findler, Flatt, and Krishnamurthi's *How to Design
|
|
165
|
-
Programs*. It uses those ideas as design judgment, not as a mandatory phase
|
|
166
|
-
sequence.
|
|
167
|
-
|
|
168
|
-
- SICP: https://mitpress.mit.edu/sites/default/files/sicp/full-text/book/book.html
|
|
169
|
-
- HtDP: https://htdp.org/2026-5-28/Book/index.html
|