@hobin/developer 0.1.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/LICENSE +21 -0
- package/README.md +231 -0
- package/extensions/developer.ts +700 -0
- package/extensions/skills.ts +89 -0
- package/extensions/state.ts +283 -0
- package/extensions/tool-policy.ts +65 -0
- package/extensions/tui.ts +391 -0
- package/package.json +43 -0
- package/skills/abstraction-review/SKILL.md +87 -0
- package/skills/abstraction-review/references/field-card.md +209 -0
- package/skills/abstraction-review/references/recipe-cards.md +255 -0
- package/skills/abstraction-review/references/repair-table.md +98 -0
- package/skills/abstraction-review/references/worked-examples.md +306 -0
- package/skills/adversarial-eval/SKILL.md +87 -0
- package/skills/model/SKILL.md +76 -0
- package/skills/model/references/problem-modeling.md +262 -0
- package/skills/naming-judgment/SKILL.md +77 -0
- package/skills/naming-judgment/references/elements-of-clojure-naming.md +74 -0
- package/skills/schedule/SKILL.md +71 -0
- package/skills/signal/SKILL.md +75 -0
- package/skills/sketch/SKILL.md +70 -0
- package/skills/specify/SKILL.md +67 -0
- package/skills/verify/SKILL.md +71 -0
- package/skills/visualize/SKILL.md +65 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# Problem Modeling Reference
|
|
2
|
+
|
|
3
|
+
Use this reference when condition modeling needs more than a light invariant.
|
|
4
|
+
|
|
5
|
+
This reference models conditions only. It does not choose capability routing or
|
|
6
|
+
task ownership.
|
|
7
|
+
|
|
8
|
+
## Contents
|
|
9
|
+
|
|
10
|
+
- Core Question
|
|
11
|
+
- Requirement Normalization
|
|
12
|
+
- Lens Selection
|
|
13
|
+
- Problem Shape Router
|
|
14
|
+
- Modeling Tool Selection
|
|
15
|
+
- Modeling Rules
|
|
16
|
+
- Guarantee Placement
|
|
17
|
+
- Common Failure Signals
|
|
18
|
+
- Verification Target Derivation
|
|
19
|
+
- Stop Checks
|
|
20
|
+
- AI Delegation Boundary
|
|
21
|
+
|
|
22
|
+
## Core Question
|
|
23
|
+
|
|
24
|
+
Model the condition space under judgment:
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
What facts, rules, constraints, forbidden cases, transitions, and objectives must
|
|
28
|
+
be true for any acceptable solution?
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Do not model the whole real-world domain. Include only the facts that affect the
|
|
32
|
+
current invariant, product decision, or verification target.
|
|
33
|
+
|
|
34
|
+
## Requirement Normalization
|
|
35
|
+
|
|
36
|
+
When starting from natural language, lower the prose into condition-space parts
|
|
37
|
+
before choosing a modeling tool:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
1. Nouns become domain facts: user, document, cart, item, order, state, event.
|
|
41
|
+
2. Actions and judgments become predicates: canEdit, canCheckout, isValidTransition.
|
|
42
|
+
3. Quantity words become quantifiers: all, at least one, none, exactly one, at most one.
|
|
43
|
+
4. Conditional words become implication: if, only if, unless, whenever.
|
|
44
|
+
5. Implications become counterexamples: P => Q means the failure shape is P && !Q.
|
|
45
|
+
6. Finite policy combinations become decision spaces.
|
|
46
|
+
7. Time words become transition or temporal questions.
|
|
47
|
+
8. Unspecified domain choices become open policy questions.
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Do not skip this step when a requirement contains words such as valid, ready,
|
|
51
|
+
allowed, all, any, never, always, unless, only if, after, retry, or timeout.
|
|
52
|
+
Those words are often the actual problem.
|
|
53
|
+
|
|
54
|
+
## Lens Selection
|
|
55
|
+
|
|
56
|
+
Use multiple lenses when the task mixes concerns.
|
|
57
|
+
|
|
58
|
+
| Lens | Use when | Output emphasis |
|
|
59
|
+
| --- | --- | --- |
|
|
60
|
+
| `predicate-logic` | hidden booleans, quantifiers, implication, rewrite/equivalence questions | predicates, domains, counterexamples, equivalence risks |
|
|
61
|
+
| `test-specification` | tests should express behavior, structural properties, or metamorphic relations | examples, properties, generators, counterexamples |
|
|
62
|
+
| `contract-property` | function/API behavior, caller/callee boundaries, valid inputs | preconditions, postconditions, invariants |
|
|
63
|
+
| `equation-invariant` | a compact formula, precedence rule, or conserved relationship is clearer than rows | formula, invariant, counterexample shape |
|
|
64
|
+
| `proof-invariant` | proof, loop correctness, or preservation across steps matters | loop invariant, proof obligation, termination condition |
|
|
65
|
+
| `data-relation` | data facts, queries, constraints, or representation replacement matter | relations, joins, violation queries, schema/model compatibility |
|
|
66
|
+
| `absence-default-semantics` | configurable, optional, nullable, defaulted, persisted, or externally supplied values may be missing | valid members, absence meanings, default owner, legacy shape, misplaced-default counterexample |
|
|
67
|
+
| `decision-space` | finite policy/case matrix, role/status/flag combinations | inputs, finite partitions, outputs, missing/conflicting cases |
|
|
68
|
+
| `domain-relation` | entities and relationships drive behavior | entities, relations, assumptions, properties |
|
|
69
|
+
| `transition-temporal` | state changes, async flows, retries, workers, lifecycle | states, actions, safety, liveness, stale events |
|
|
70
|
+
| `constraint-objective` | assignment, optimization, configuration, solver-like work | variables, constraints, objective, invalid representations |
|
|
71
|
+
| `logic-programming` | facts and rules should be queried directly or recursively | facts, rules, queries, possible worlds |
|
|
72
|
+
| `ai-delegation` | preparing a clear task for another agent or skill | facts, rules, forbidden cases, objective, verification |
|
|
73
|
+
|
|
74
|
+
## Problem Shape Router
|
|
75
|
+
|
|
76
|
+
Choose the first representation from the shape of uncertainty, not from tool
|
|
77
|
+
preference.
|
|
78
|
+
|
|
79
|
+
| Problem shape | Start with | Why |
|
|
80
|
+
| --- | --- | --- |
|
|
81
|
+
| A boolean name feels vague: valid, ready, allowed, safe, complete | `predicate-naming` | Forces the domain question behind the boolean to be explicit |
|
|
82
|
+
| The rule says all, any, none, at least one, exactly one, or at most one | `set-quantifier-model` | Separates the domain set from the required count |
|
|
83
|
+
| The rule is conditional: if, only if, unless, whenever | `implication-counterexample` | Turns a policy into the failure shape to exclude |
|
|
84
|
+
| A refactor, rewrite, schema change, or optimization must preserve meaning | `rewrite-equivalence-check` or `replacement-schema-model` | Separates logical equivalence from language/runtime semantics |
|
|
85
|
+
| A fact must remain true across calls, steps, data mutations, or loops | `equation-invariant`, `contract-model`, or `loop-invariant-proof` | Names the preserved guarantee before choosing a representation or change |
|
|
86
|
+
| Role/status/flag/action combinations are finite and reviewable | `decision-table` | Finds missing and conflicting cases |
|
|
87
|
+
| Facts and relationships drive correctness | `domain-model`, `relational-query`, or `data-constraint` | Makes possible instances and impossible fact combinations visible |
|
|
88
|
+
| Correctness depends on movement through time | `state-transition` or `temporal-model` | Distinguishes valid snapshots from valid behavior |
|
|
89
|
+
| The task is to find a satisfying value, allocation, plan, or counterexample | `constraint-objective`, `smt-counterexample`, or `logic-programming` | Models the conditions a solution must satisfy |
|
|
90
|
+
| The answer depends on stakeholder policy | `human-decision-surface` | Prevents the model from inventing product meaning |
|
|
91
|
+
|
|
92
|
+
## Modeling Tool Selection
|
|
93
|
+
|
|
94
|
+
Select tools after selecting lenses. A lens says what to look for; a tool says
|
|
95
|
+
how to represent the condition space. Use the full modeling range, not only
|
|
96
|
+
decision tables or solvers.
|
|
97
|
+
|
|
98
|
+
| Tool | Use when | Do not use when |
|
|
99
|
+
| --- | --- | --- |
|
|
100
|
+
| `predicate-naming` | important booleans hide product meaning | sequence, data relationships, or optimization are the main issue |
|
|
101
|
+
| `set-quantifier-model` | rules use all, any, none, at least one, exactly one | the domain cannot be stated |
|
|
102
|
+
| `implication-counterexample` | a rule is conditional: if P then Q | no useful `P && !Q` failure case exists |
|
|
103
|
+
| `rewrite-equivalence-check` | refactoring conditionals, predicates, sets, or quantifiers | language semantics, side effects, evaluation order, or runtime representation changes meaning |
|
|
104
|
+
| `example-test-spec` | concrete scenarios define required behavior | examples are arbitrary and miss the intended property |
|
|
105
|
+
| `structural-property-test` | behavior has a general property over many valid inputs | valid input generation or property definition is unclear |
|
|
106
|
+
| `metamorphic-relation` | exact output is hard to know but related runs should agree | no meaningful relation exists between transformed inputs |
|
|
107
|
+
| `contract-model` | the risk is at a function/API/component boundary | the main issue is stakeholder policy over many cases |
|
|
108
|
+
| `type-representation-model` | invalid states can be excluded or exposed by data shape | the language cannot express the semantic guarantee |
|
|
109
|
+
| `loop-invariant-proof` | correctness depends on every loop or proof step preserving a fact | tests provide enough evidence for the risk |
|
|
110
|
+
| `relational-query` | facts are best modeled as relations, joins, projections | behavior is mainly local branching |
|
|
111
|
+
| `data-constraint` | schema, uniqueness, existence, or update constraints matter | the rule is purely transient UI behavior |
|
|
112
|
+
| `replacement-schema-model` | changing schema/API/representation must preserve old meaning | no old abstract model must be recovered |
|
|
113
|
+
| `absence-default-model` | a value can be omitted, null, empty, defaulted, inherited, hydrated, or supplied by another boundary | the value is always required and has no legacy or external shape |
|
|
114
|
+
| `decision-table` | independent inputs can be partitioned into finite buckets and mapped to outputs/actions | inputs depend strongly on each other, side effects dominate, a loop/recursion is required, inputs are unbounded lists/complex types, or the table is too large |
|
|
115
|
+
| `equation-invariant` | a formula, precedence rule, or always-true relationship is clearer than enumerating rows | policy genuinely differs by many discrete buckets |
|
|
116
|
+
| `domain-model` | entities, relations, possible instances, and properties matter | the task is a local transform with no domain ambiguity |
|
|
117
|
+
| `state-transition` | a state can be valid but invalidly reached | current-state validity fully captures correctness |
|
|
118
|
+
| `temporal-model` | concurrency, retry, timeout, stale event, fairness, or liveness matters | finite deterministic examples cover the risk |
|
|
119
|
+
| `constraint-objective` | variables, hard constraints, and preferences must be separated | a bespoke algorithm is simple, fixed, and performance-critical |
|
|
120
|
+
| `smt-counterexample` | satisfaction, contract, arithmetic, string, bitvector, or data-structure edge cases need counterexample search | the model cannot be encoded accurately enough |
|
|
121
|
+
| `logic-programming` | facts, rules, recursive relations, or possible worlds are the program model | deterministic imperative control flow is simpler |
|
|
122
|
+
| `human-decision-surface` | reasonable stakeholders could choose different policies | the answer follows from existing rules or data |
|
|
123
|
+
| `ai-delegation-model` | another skill, tool, or agent needs a task contract | success criteria and verification cannot be stated |
|
|
124
|
+
|
|
125
|
+
For decision tables, check the four fit questions before selecting the tool:
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
1. Is there a clear map between independent inputs and outputs?
|
|
129
|
+
2. Can the inputs be cleanly and concisely enumerated as finite partitions?
|
|
130
|
+
3. Is a table clearer than prose, an equation, an invariant, or a state model?
|
|
131
|
+
4. Will the table stay small enough to review?
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
If any answer is no, prefer another tool or split the model.
|
|
135
|
+
|
|
136
|
+
When presenting selected tools to the user, explain each tool in plain terms:
|
|
137
|
+
|
|
138
|
+
```text
|
|
139
|
+
Tool:
|
|
140
|
+
What the tool means.
|
|
141
|
+
Why this tool:
|
|
142
|
+
What shape of uncertainty or correctness risk it exposes.
|
|
143
|
+
Not this tool when:
|
|
144
|
+
The boundary where another tool is more appropriate.
|
|
145
|
+
Output:
|
|
146
|
+
What the tool should make visible: predicate, property, counterexample,
|
|
147
|
+
table row, transition, query, constraint, objective, or human decision.
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Modeling Rules
|
|
151
|
+
|
|
152
|
+
- Normalize prose before solving. First identify domain facts, predicates,
|
|
153
|
+
quantifiers, implications, counterexamples, finite decision spaces, temporal
|
|
154
|
+
language, and open policy questions.
|
|
155
|
+
- Separate meaning from implementation. Predicate names should say what is true,
|
|
156
|
+
not how it is computed.
|
|
157
|
+
- Separate predicate roles. A decision predicate can be true or false; an
|
|
158
|
+
assumption or precondition defines when a property is meaningful; a property
|
|
159
|
+
is a guarantee that must not be false in valid states.
|
|
160
|
+
- Separate assumptions from guarantees. Use assumptions for well-formedness,
|
|
161
|
+
preconditions, and product decisions that must be true before a property means
|
|
162
|
+
anything.
|
|
163
|
+
- Treat `P => Q` as a failure condition: `P && !Q`.
|
|
164
|
+
- For finite decisions, prefer explicit case coverage over prose, but only when
|
|
165
|
+
inputs form reviewable finite partitions.
|
|
166
|
+
- Prefer an equation or invariant over a decision table when a compact
|
|
167
|
+
relationship communicates the rule more clearly.
|
|
168
|
+
- For stateful behavior, distinguish current-state invariants from transition
|
|
169
|
+
rules over old and new state.
|
|
170
|
+
- For optimization, distinguish constraints that must hold from objectives that
|
|
171
|
+
choose among valid solutions.
|
|
172
|
+
- For optional, nullable, defaulted, persisted, configurable, or externally
|
|
173
|
+
supplied values, model absence before design. State valid members; whether
|
|
174
|
+
absent, `undefined`, `null`, empty, and false-like values differ; the default;
|
|
175
|
+
the owner of that default; the legacy shape; and the counterexample that
|
|
176
|
+
proves the default was enforced in the wrong layer.
|
|
177
|
+
- Preserve domain-specific unknowns as questions. Do not answer them by
|
|
178
|
+
aesthetic preference or by over-formalizing.
|
|
179
|
+
|
|
180
|
+
## Guarantee Placement
|
|
181
|
+
|
|
182
|
+
For each property, choose the cheapest trustworthy layer that can carry the
|
|
183
|
+
guarantee:
|
|
184
|
+
|
|
185
|
+
- Use `type` when the language can exclude invalid states directly.
|
|
186
|
+
- Use `contract` when the rule is semantic and must guide callers/callees.
|
|
187
|
+
- Use `runtime-validation` when invalid external input must be rejected.
|
|
188
|
+
- Use `assertion` when an internal state must already be guaranteed and cheap to
|
|
189
|
+
check.
|
|
190
|
+
- Use `unit-test` or `integration-test` when behavior has concrete examples.
|
|
191
|
+
- Use `property-test` when a domain generator can express the valid input set.
|
|
192
|
+
- Use `proof`, `model-check`, or `solver` only when exhaustive reasoning or
|
|
193
|
+
counterexample search is worth the modeling cost.
|
|
194
|
+
- Use `human` when the rule is a product decision, not a derivable fact.
|
|
195
|
+
- Use an explicit default or normalization owner when missing or legacy data
|
|
196
|
+
should be translated into a domain value before consumers rely on it.
|
|
197
|
+
|
|
198
|
+
If the chosen layer is not a test, still create a verification target explaining
|
|
199
|
+
what evidence will prove the guarantee.
|
|
200
|
+
|
|
201
|
+
## Common Failure Signals
|
|
202
|
+
|
|
203
|
+
- A natural-language `and/or` requirement has no explicit grouping.
|
|
204
|
+
- A rule uses "all", "any", "never", "always", "at least one", or "exactly one"
|
|
205
|
+
without a domain.
|
|
206
|
+
- A quantifier can be read in more than one order, such as "some resource all
|
|
207
|
+
users can access" versus "each user can access some resource."
|
|
208
|
+
- A predicate mixes decision, assumption, and property roles.
|
|
209
|
+
- A type accepts values outside the valid domain, but there is no validation or
|
|
210
|
+
precondition.
|
|
211
|
+
- A fallback expression silently becomes the owner of product or domain default
|
|
212
|
+
policy.
|
|
213
|
+
- A default value appears in multiple layers without one explicit owner.
|
|
214
|
+
- A decision table is complete internally but may not be correct product policy.
|
|
215
|
+
- A state enum exists, but allowed transitions are not represented.
|
|
216
|
+
- A representation change loses information needed to reconstruct the old model.
|
|
217
|
+
- An AI task prompt gives procedure but not facts, constraints, objective, or
|
|
218
|
+
verification.
|
|
219
|
+
|
|
220
|
+
## Verification Target Derivation
|
|
221
|
+
|
|
222
|
+
Turn model elements into verification targets:
|
|
223
|
+
|
|
224
|
+
- `predicate`: unit test, property test, contract check, or proof obligation.
|
|
225
|
+
- `forbiddenCase`: negative test, runtime validation, type exclusion, or model
|
|
226
|
+
check.
|
|
227
|
+
- `decisionSpace`: case matrix, table validation, branch coverage by meaning.
|
|
228
|
+
- `stateTransition`: transition tests, temporal model, stale event checks.
|
|
229
|
+
- `constraint`: assertion, database constraint, validation, solver check.
|
|
230
|
+
- `absenceDefault`: legacy/missing-value case, normalization contract, creation
|
|
231
|
+
default, serialization round trip, and consumer fallback boundary.
|
|
232
|
+
- `objective`: ranking/optimization evidence and accepted tradeoff.
|
|
233
|
+
- `openQuestion`: human decision before any action that depends on it, or
|
|
234
|
+
explicit acceptance of the uncertainty.
|
|
235
|
+
|
|
236
|
+
## Stop Checks
|
|
237
|
+
|
|
238
|
+
Before treating the model as usable, confirm:
|
|
239
|
+
|
|
240
|
+
- Each important boolean names a domain question, not an implementation trick.
|
|
241
|
+
- Each rule has a domain: the values, states, entities, or transitions it talks
|
|
242
|
+
about.
|
|
243
|
+
- Quantifiers have a clear scope and order.
|
|
244
|
+
- Conditional rules have a counterexample shape.
|
|
245
|
+
- Decision predicates, assumptions, and properties are not collapsed into one
|
|
246
|
+
vague predicate.
|
|
247
|
+
- The selected tool explains the uncertainty it exposes.
|
|
248
|
+
- Each guarantee has an owner and an evidence target.
|
|
249
|
+
- Human policy choices remain open questions instead of guessed rules.
|
|
250
|
+
|
|
251
|
+
## AI Delegation Boundary
|
|
252
|
+
|
|
253
|
+
When delegating to an AI helper, sub-agent, or specialized skill, do not provide
|
|
254
|
+
only a procedure. Provide:
|
|
255
|
+
|
|
256
|
+
- context: where the work lives;
|
|
257
|
+
- variables/concepts: relevant entities, states, and predicates;
|
|
258
|
+
- constraints: must-hold rules and forbidden cases;
|
|
259
|
+
- objective: what to optimize or preserve;
|
|
260
|
+
- verification: counterexamples, gates, and accepted evidence.
|
|
261
|
+
|
|
262
|
+
AI helpers are not solvers. Their output must still be checked against the model.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: naming-judgment
|
|
3
|
+
description: "Review or create code names by separating stable domain meaning from the current implementation. Use when variables, functions, types, modules, components, APIs, fields, or abstractions are generic, misleading, filler-like, implementation-shaped, or carrying multiple product senses."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Naming Judgment
|
|
7
|
+
|
|
8
|
+
Choose names that preserve domain sense across implementation change.
|
|
9
|
+
|
|
10
|
+
## Core Question
|
|
11
|
+
|
|
12
|
+
What domain sense should this name expose, what detail should it hide, and what
|
|
13
|
+
change boundary should it preserve?
|
|
14
|
+
|
|
15
|
+
## Inputs
|
|
16
|
+
|
|
17
|
+
- Current name and the code or artifact it identifies
|
|
18
|
+
- Nearby callers, callees, tests, and module context
|
|
19
|
+
- Product vocabulary, invariant, or model when available
|
|
20
|
+
- Audience: local helper, cross-module API, UI domain code, or integration
|
|
21
|
+
|
|
22
|
+
## Output
|
|
23
|
+
|
|
24
|
+
Lead with the user's product language; keep naming theory secondary.
|
|
25
|
+
Produce the naming pressure, current sense, hidden or overexposed detail,
|
|
26
|
+
failure mode, proposed name or placement move, affected scope, and intentionally
|
|
27
|
+
deferred names. When used inside a larger task, return:
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
Status: resolved | needs-evidence | not-applicable | blocked
|
|
31
|
+
Result: the proposed name or boundary move and the sense it preserves
|
|
32
|
+
Basis: callers, behavior, domain vocabulary, and conventions
|
|
33
|
+
Open questions: unresolved domain meaning or boundary pressure, or none
|
|
34
|
+
Artifacts: rename map and affected scope
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Return only this skill's judgment for the question at hand; leave subsequent
|
|
38
|
+
routing to the caller.
|
|
39
|
+
|
|
40
|
+
## Completion
|
|
41
|
+
|
|
42
|
+
Finish when a reader can rely on the name's sense without inspecting the current
|
|
43
|
+
implementation, and the name neither admits invalid uses nor freezes incidental
|
|
44
|
+
detail. Revisit when callers, product vocabulary, or the named boundary changes.
|
|
45
|
+
|
|
46
|
+
## Method
|
|
47
|
+
|
|
48
|
+
1. Read nearby callers and callees before judging the word.
|
|
49
|
+
2. Identify the audience and the named thing's role.
|
|
50
|
+
3. Separate stable sense from current referent.
|
|
51
|
+
4. Classify the failure: overly general, overly specific, filler action, verb
|
|
52
|
+
mismatch, false abstraction, or sense collision.
|
|
53
|
+
5. Choose a name shape appropriate to data, pure transformation, side effect,
|
|
54
|
+
predicate, event glue, or public API.
|
|
55
|
+
6. Use module placement to supply context when an honest local name becomes too
|
|
56
|
+
long, but do not invent a module solely to shorten a name.
|
|
57
|
+
7. Before editing, state: `<old> says <X>, but callers rely on <Y>`.
|
|
58
|
+
8. Bound an accepted rename as a mechanical follow-up and identify the callers
|
|
59
|
+
and tests that must be verified.
|
|
60
|
+
|
|
61
|
+
## Missing Evidence
|
|
62
|
+
|
|
63
|
+
Return `needs-evidence` when callers or domain language can reveal the intended
|
|
64
|
+
sense. Return `blocked` when only a product owner can decide the concept. Return
|
|
65
|
+
`not-applicable` when the apparent naming problem is actually a model or design
|
|
66
|
+
problem.
|
|
67
|
+
|
|
68
|
+
## Boundary
|
|
69
|
+
|
|
70
|
+
Do not implement the rename, promote a new abstraction, invent product meaning,
|
|
71
|
+
rename external conventions, or replace every short name with a longer one.
|
|
72
|
+
Reuse does not prove that a generic name is sound.
|
|
73
|
+
|
|
74
|
+
## References
|
|
75
|
+
|
|
76
|
+
Read [the naming reference](references/elements-of-clojure-naming.md) for
|
|
77
|
+
subtle, disputed, or recurring naming pressure.
|
|
@@ -0,0 +1,74 @@
|
|
|
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?
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: schedule
|
|
3
|
+
description: "Decide whether a concrete structural change or reviewed abstraction candidate belongs now, after, or never using invariant pressure, evidence, reversibility, nested-work pressure, and cost of delay. Use when the candidate is concrete and the consequential question is timing."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Schedule
|
|
7
|
+
|
|
8
|
+
Decide when a concrete structural move belongs.
|
|
9
|
+
|
|
10
|
+
## Core Question
|
|
11
|
+
|
|
12
|
+
When should this candidate be done: now, after, or never?
|
|
13
|
+
|
|
14
|
+
## Inputs
|
|
15
|
+
|
|
16
|
+
- Concrete candidate and scope
|
|
17
|
+
- Evidence and accepted contract when available
|
|
18
|
+
- Current invariant pressure and nested-work pressure
|
|
19
|
+
- Reversibility, cost of delay, risk if done now, and risk if delayed
|
|
20
|
+
|
|
21
|
+
## Output
|
|
22
|
+
|
|
23
|
+
Lead with the user's current risk and cost of delay; keep timing labels secondary.
|
|
24
|
+
Produce `now`, `after`, or `never` with rationale, evidence, invariant pressure,
|
|
25
|
+
risks, and a reopen condition for deferred work. When used inside a larger task,
|
|
26
|
+
return:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
Status: resolved | needs-evidence | not-applicable | blocked
|
|
30
|
+
Result: now, after, or never with the decisive reason
|
|
31
|
+
Basis: candidate, evidence, current pressure, reversibility, and delay cost
|
|
32
|
+
Open questions: missing timing evidence, or none
|
|
33
|
+
Artifacts: timing decision and reopen condition
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Return only this skill's judgment for the question at hand; leave subsequent
|
|
37
|
+
routing to the caller.
|
|
38
|
+
|
|
39
|
+
## Completion
|
|
40
|
+
|
|
41
|
+
Finish when the current timing decision follows from observable pressure and
|
|
42
|
+
deferred work has a concrete reopen condition. Revisit only when that condition,
|
|
43
|
+
the invariant, reversibility, or cost of delay changes.
|
|
44
|
+
|
|
45
|
+
## Method
|
|
46
|
+
|
|
47
|
+
1. Restate the smallest concrete candidate and scope.
|
|
48
|
+
2. Ask whether the current invariant or accepted implementation is blocked
|
|
49
|
+
without it.
|
|
50
|
+
3. Check whether the candidate is evidence-backed and stable enough to act on.
|
|
51
|
+
4. Compare the guarantee gained with the freedom and implementation paths lost.
|
|
52
|
+
5. Consider nested-work growth, reversibility, and cost of delay.
|
|
53
|
+
6. Decide:
|
|
54
|
+
- `now`: required to protect the invariant or unblock accepted work;
|
|
55
|
+
- `after`: useful but not required now;
|
|
56
|
+
- `never`: speculative, harmful, or outside this scope.
|
|
57
|
+
7. For `after`, state evidence that should reopen the decision. For `never`,
|
|
58
|
+
state whether any scope change could make it relevant.
|
|
59
|
+
|
|
60
|
+
## Missing Evidence
|
|
61
|
+
|
|
62
|
+
Return `not-applicable` when no concrete candidate exists. Return
|
|
63
|
+
`needs-evidence` when the candidate exists but present pressure or reversibility
|
|
64
|
+
cannot be assessed. Return `blocked` when timing depends on a human-owned
|
|
65
|
+
priority or risk choice that cannot be inferred. Bias away from `now` when
|
|
66
|
+
evidence is thin.
|
|
67
|
+
|
|
68
|
+
## Boundary
|
|
69
|
+
|
|
70
|
+
Do not discover a signal, form or review the abstraction, implement the change,
|
|
71
|
+
prioritize unrelated product work, or verify the final result.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: signal
|
|
3
|
+
description: "Inspect requirements, code, diffs, tests, UI states, names, or recent changes for observable structural movement and classify it as absent, horizontal, vertical, or ambiguous. Use when evidence suggests duplication, model-code mismatch, boundary pressure, or an emerging refactoring candidate."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Signal
|
|
7
|
+
|
|
8
|
+
Observe structural movement without promoting or scheduling it.
|
|
9
|
+
|
|
10
|
+
## Core Question
|
|
11
|
+
|
|
12
|
+
What structural movement is actually visible in the evidence?
|
|
13
|
+
|
|
14
|
+
## Inputs
|
|
15
|
+
|
|
16
|
+
- Requirement, code slice, diff, tests, command output, or UI state
|
|
17
|
+
- Selected comparable artifacts
|
|
18
|
+
- Invariant or condition model when available
|
|
19
|
+
- Known callers when shared helpers, APIs, or boundaries are involved
|
|
20
|
+
|
|
21
|
+
## Output
|
|
22
|
+
|
|
23
|
+
Lead with the observed code or product pressure; keep signal labels secondary.
|
|
24
|
+
Produce a judgment of `no-signal`, `horizontal`, `vertical`, or `ambiguous`,
|
|
25
|
+
with confidence, evidence, selected comparison, smallest meaningful difference,
|
|
26
|
+
smallest behavior-preserving movement, model-code mismatch, and a concrete
|
|
27
|
+
review candidate only when vertical or ambiguous. When used inside a larger
|
|
28
|
+
task, return:
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
Status: resolved | needs-evidence | not-applicable | blocked
|
|
32
|
+
Result: observed structural movement and confidence
|
|
33
|
+
Basis: selected artifacts, differences, callers, and model evidence
|
|
34
|
+
Open questions: stabilizing or rejecting evidence still needed, or none
|
|
35
|
+
Artifacts: horizontal movement or concrete review candidate
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Return only this skill's judgment for the question at hand; leave subsequent
|
|
39
|
+
routing to the caller.
|
|
40
|
+
|
|
41
|
+
## Completion
|
|
42
|
+
|
|
43
|
+
Finish when the smallest meaningful difference is visible and the evidence
|
|
44
|
+
supports a structural classification or an explicit evidence gap. Revisit after
|
|
45
|
+
a behavior-preserving change, new caller evidence, or a changed model reshapes
|
|
46
|
+
the comparison.
|
|
47
|
+
|
|
48
|
+
## Method
|
|
49
|
+
|
|
50
|
+
1. State the observed change pressure.
|
|
51
|
+
2. Select the two artifacts most alike by responsibility, vocabulary, state
|
|
52
|
+
transition, failure mode, model element, or user-visible outcome.
|
|
53
|
+
3. Name their smallest meaningful difference.
|
|
54
|
+
4. Identify the smallest behavior-preserving movement that would expose whether
|
|
55
|
+
the difference is incidental or meaningful.
|
|
56
|
+
5. Keep same-level alignment horizontal. Similarity alone is not evidence for a
|
|
57
|
+
new abstraction.
|
|
58
|
+
6. Classify movement as vertical only when a nameable concept, policy, boundary,
|
|
59
|
+
responsibility, or invariant remains after the difference is understood.
|
|
60
|
+
7. Check model-code mismatches, hidden caller policy, duplicated defaults,
|
|
61
|
+
history, state, and misleading vocabulary.
|
|
62
|
+
8. For vertical or ambiguous movement, state the candidate, pressure, hidden
|
|
63
|
+
detail, invariant risk, selected evidence, and evidence still needed.
|
|
64
|
+
|
|
65
|
+
## Missing Evidence
|
|
66
|
+
|
|
67
|
+
Return `needs-evidence` when another caller, comparison, diff, or model can
|
|
68
|
+
change the classification. Return `not-applicable` when no structural movement
|
|
69
|
+
is visible. Return `blocked` only when the relevant evidence cannot be accessed;
|
|
70
|
+
otherwise keep product-meaning claims provisional when no accepted model exists.
|
|
71
|
+
|
|
72
|
+
## Boundary
|
|
73
|
+
|
|
74
|
+
Do not implement the movement, promote a candidate, decide timing, or turn
|
|
75
|
+
horizontal similarity into a vertical abstraction.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sketch
|
|
3
|
+
description: "Shape an implementable design surface from a requirement, invariant, problem model, existing code, or representative cases using data definitions, templates, wishful top-level design, interfaces, checks, and a small implementation queue. Use when behavior is understood but ownership, boundaries, data flow, or implementation shape remains unresolved."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Sketch
|
|
7
|
+
|
|
8
|
+
Turn accepted intent into an implementable design surface.
|
|
9
|
+
|
|
10
|
+
## Core Question
|
|
11
|
+
|
|
12
|
+
What design surface makes this intent implementable?
|
|
13
|
+
|
|
14
|
+
## Inputs
|
|
15
|
+
|
|
16
|
+
- Requirement, invariant, or problem model when available
|
|
17
|
+
- Existing code, API, data shape, UI flow, or failing behavior
|
|
18
|
+
- Representative normal, boundary, forbidden, and product-meaning cases
|
|
19
|
+
- Constraints and verification targets
|
|
20
|
+
|
|
21
|
+
## Output
|
|
22
|
+
|
|
23
|
+
Lead with the user's product language; keep design labels secondary.
|
|
24
|
+
Produce purpose, relevant data definitions, representative cases, a template,
|
|
25
|
+
wishful top level, wished interfaces, checks, a small implementation queue, and
|
|
26
|
+
explicitly deferred abstractions. When used inside a larger task, return:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
Status: resolved | needs-evidence | not-applicable | blocked
|
|
30
|
+
Result: the smallest implementable design surface
|
|
31
|
+
Basis: accepted intent, model, code, cases, and assumptions
|
|
32
|
+
Open questions: unresolved design consequences, or none
|
|
33
|
+
Artifacts: wished interfaces, checks, and implementation queue
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Return only this skill's judgment for the question at hand; leave subsequent
|
|
37
|
+
routing to the caller.
|
|
38
|
+
|
|
39
|
+
## Completion
|
|
40
|
+
|
|
41
|
+
Finish when the first implementation item is small enough to execute and check,
|
|
42
|
+
and non-local or invariant-bearing candidates are explicit rather than silently
|
|
43
|
+
assumed. Revisit when implementation evidence breaks the ownership or data-flow
|
|
44
|
+
assumptions.
|
|
45
|
+
|
|
46
|
+
## Method
|
|
47
|
+
|
|
48
|
+
1. Choose the strongest available source of intent and state its confidence.
|
|
49
|
+
2. State the design unit's purpose in the user's language.
|
|
50
|
+
3. Derive relevant data or state definitions and their ownership pressure.
|
|
51
|
+
4. List representative cases before choosing code shape.
|
|
52
|
+
5. Derive the template from data, state, traversal, or ownership flow.
|
|
53
|
+
6. Write wishful top-level code, pseudocode, or interaction flow.
|
|
54
|
+
7. For each wished interface, state its purpose, contract, owner, hidden detail,
|
|
55
|
+
and representative stop check.
|
|
56
|
+
8. Separate design artifacts, implementation items, and deferred candidates.
|
|
57
|
+
9. Keep the queue small; do not turn the sketch into a project plan.
|
|
58
|
+
|
|
59
|
+
## Missing Evidence
|
|
60
|
+
|
|
61
|
+
Return `needs-evidence` when repository inspection or representative cases can
|
|
62
|
+
settle the design pressure. Return `blocked` when a product-owned choice would
|
|
63
|
+
materially change the surface. Return `not-applicable` when the local
|
|
64
|
+
implementation shape is already clear. Label all provisional design
|
|
65
|
+
assumptions.
|
|
66
|
+
|
|
67
|
+
## Boundary
|
|
68
|
+
|
|
69
|
+
Do not own product scope, decide model correctness, promote an abstraction,
|
|
70
|
+
schedule structural timing, implement the change, or verify completion.
|