@se-studio/skills 1.9.8 → 1.9.10
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/CHANGELOG.md +12 -0
- package/LICENSE.pstack +21 -0
- package/README.md +4 -0
- package/VENDOR_PSTACK.md +52 -0
- package/package.json +1 -1
- package/references/agent-session/customer-agents-block.md +5 -3
- package/references/agent-session/customer-architecture.mdc +1 -1
- package/references/agent-session/customer-code-review.md +2 -2
- package/references/agent-session/fleet-status.mjs +125 -0
- package/references/agent-session/production-merge.md +35 -19
- package/references/agent-session/projects.registry.json +5 -3
- package/references/agent-session/release-verification.md +82 -0
- package/skills/architect/SKILL.md +87 -0
- package/skills/architect/references/design-red-flags.md +57 -0
- package/skills/architect/references/rationale-template.md +35 -0
- package/skills/architect/references/runner-prompt.md +20 -0
- package/skills/blast-radius/SKILL.md +55 -0
- package/skills/coding-discipline/SKILL.md +2 -2
- package/skills/contentful-cms-core/SKILL.md +11 -0
- package/skills/how/SKILL.md +43 -0
- package/skills/how/references/explainer-prompt.md +55 -0
- package/skills/how/references/explorer-prompt.md +35 -0
- package/skills/interrogate/SKILL.md +78 -0
- package/skills/interrogate/references/code-quality-review.md +47 -0
- package/skills/interrogate/references/lead-judgment.md +58 -0
- package/skills/interrogate/references/reviewer-prompt.md +62 -0
- package/skills/interrogate/references/rubric.md +77 -0
- package/skills/principle-boundary-discipline/SKILL.md +38 -0
- package/skills/principle-encode-lessons-in-structure/SKILL.md +15 -0
- package/skills/principle-fix-root-causes/SKILL.md +27 -0
- package/skills/principle-guard-the-context-window/SKILL.md +16 -0
- package/skills/principle-make-operations-idempotent/SKILL.md +28 -0
- package/skills/principle-minimize-reader-load/SKILL.md +22 -0
- package/skills/principle-model-the-domain/SKILL.md +28 -0
- package/skills/principle-prove-it-works/SKILL.md +26 -0
- package/skills/principle-sequence-verifiable-units/SKILL.md +21 -0
- package/skills/principle-subtract-before-you-add/SKILL.md +22 -0
- package/skills/principle-test-behavior-not-implementation/SKILL.md +25 -0
- package/skills/principle-type-system-discipline/SKILL.md +22 -0
- package/skills/se-marketing-sites-smoke-test-setup/SKILL.md +27 -1
- package/skills/site-workflows-agent-session/SKILL.md +23 -10
- package/skills/tdd/SKILL.md +46 -0
- package/skills/typescript-best-practices/SKILL.md +35 -0
- package/skills/typescript-best-practices/references/patterns.md +324 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: principle-boundary-discipline
|
|
3
|
+
description: "Apply when wiring validation, error handling, or framework adapters. Concentrate guards at system boundaries (CLI, config, network, external APIs); trust internal types and keep business logic in pure functions."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Boundary Discipline
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## SE Studio vendoring notes
|
|
10
|
+
|
|
11
|
+
- Upstream frontmatter `disable-model-invocation: true` moved out of YAML (SE Studio skills allow only name + description).
|
|
12
|
+
|
|
13
|
+
Place validation, type narrowing, and error handling at system boundaries. Trust internal code unconditionally. Business logic lives in pure functions. The shell is thin and mechanical.
|
|
14
|
+
|
|
15
|
+
**Why:** Scattered validation is noisy, redundant, and gives a false sense of safety. Keep logic out of framework wiring so it can be tested without the framework.
|
|
16
|
+
|
|
17
|
+
**The pattern:**
|
|
18
|
+
- **At boundaries** (CLI args, config files, external APIs, network protocols): validate, return errors, handle defensively.
|
|
19
|
+
- **Inside the system:** typed data, error propagation, no re-validation. Trust the types.
|
|
20
|
+
- **Across the boundary.** Expose domain concepts, not the boundary's private representation. Keep general-purpose mechanism inside and special-purpose policy at the edge.
|
|
21
|
+
|
|
22
|
+
**Applications:**
|
|
23
|
+
|
|
24
|
+
Validation and error handling:
|
|
25
|
+
- Validate config at parse time (the boundary), not inside business logic
|
|
26
|
+
- Parse raw data into domain types at the boundary
|
|
27
|
+
- Do not re-export transport, storage, framework, or wire types through the public surface
|
|
28
|
+
- No redundant nil checks deep in call chains if the boundary already validated
|
|
29
|
+
|
|
30
|
+
Code organization:
|
|
31
|
+
- Business logic in pure functions with no framework dependencies
|
|
32
|
+
- Parse functions: pure transforms from raw bytes to typed state
|
|
33
|
+
- Prompt construction: structured state in, string out
|
|
34
|
+
- Scoring and assessment: pure transforms from state to results
|
|
35
|
+
|
|
36
|
+
**The tests:**
|
|
37
|
+
- "Is this data crossing a system boundary right now?" If not, validation is redundant.
|
|
38
|
+
- "Can this be a pure function that the shell just calls?" If yes, extract it.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: principle-encode-lessons-in-structure
|
|
3
|
+
description: "Apply when you catch yourself writing the same instruction a second time, or notice a recurring correction. Encode the rule as a lint, metadata flag, runtime check, or script instead of more text."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Encode Lessons in Structure
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## SE Studio vendoring notes
|
|
10
|
+
|
|
11
|
+
- Upstream frontmatter `disable-model-invocation: true` moved out of YAML (SE Studio skills allow only name + description).
|
|
12
|
+
|
|
13
|
+
If the lesson needs judgment and cannot be encoded, make the instruction more prominent and add an example of the failure mode.
|
|
14
|
+
|
|
15
|
+
**Corollary:** If the fix is structural, only use the structural fix. The instruction is the symptom.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: principle-fix-root-causes
|
|
3
|
+
description: "Apply when debugging. Trace each symptom to its root cause and fix it there; reproduce first, ask why until you reach it, resist nil-check guards that silence crashes."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Fix Root Causes
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## SE Studio vendoring notes
|
|
10
|
+
|
|
11
|
+
- Upstream frontmatter `disable-model-invocation: true` moved out of YAML (SE Studio skills allow only name + description).
|
|
12
|
+
|
|
13
|
+
When debugging, do not fix symptoms. Trace every problem to its root cause and fix it there.
|
|
14
|
+
|
|
15
|
+
**Why:** Symptom fixes accumulate. Each workaround makes the system harder to reason about, and the real bug remains. Root-cause fixes are slower upfront but reduce total debugging time.
|
|
16
|
+
|
|
17
|
+
**Pattern:**
|
|
18
|
+
- Reproduce first
|
|
19
|
+
- Ask "why" until you hit the root cause
|
|
20
|
+
- Do not add guards (adding a nil check to silence a crash is a symptom fix)
|
|
21
|
+
- If a workaround needs a paragraph-long comment to justify it, the code is wrong (fix the code, not the comment)
|
|
22
|
+
- Check for the pattern, not just the instance (grep for the same pattern, fix all instances)
|
|
23
|
+
- When stuck, instrument. Don't guess (add logging, read the actual error)
|
|
24
|
+
|
|
25
|
+
**Restart bugs: suspect state before code**
|
|
26
|
+
|
|
27
|
+
When something "fails after restart," suspect stale persistent state first: config files, caches, lock files, serialized state. If clearing a state file restores behavior, prioritize state validation as the fix.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: principle-guard-the-context-window
|
|
3
|
+
description: "Apply when context is filling up: large outputs, long files, repeated reads, fan-out planning. Route bulk to subagents; keep summaries in the main thread, not raw payloads."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Guard the Context Window
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## SE Studio vendoring notes
|
|
10
|
+
|
|
11
|
+
- Upstream frontmatter `disable-model-invocation: true` moved out of YAML (SE Studio skills allow only name + description).
|
|
12
|
+
|
|
13
|
+
**Why:** Context overflow degrades reasoning quality, creates compression artifacts, and halts progress.
|
|
14
|
+
|
|
15
|
+
**Pattern:**
|
|
16
|
+
- **Size phases and cap scope.** Limit files per phase, set turn budgets, account for mechanism costs.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: principle-make-operations-idempotent
|
|
3
|
+
description: "Apply when designing commands, lifecycle steps, or processing loops that run amid crashes, restarts, and retries. Converge to the same end state regardless of partial prior runs."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Make Operations Idempotent
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## SE Studio vendoring notes
|
|
10
|
+
|
|
11
|
+
- Upstream frontmatter `disable-model-invocation: true` moved out of YAML (SE Studio skills allow only name + description).
|
|
12
|
+
|
|
13
|
+
Design operations so they converge to the correct state regardless of how many times they run or where they start from. Every state-mutating operation should answer: "What happens if this runs twice? What happens if the previous run crashed halfway?"
|
|
14
|
+
|
|
15
|
+
**Why:** Commands, lifecycle operations, and processing loops run where crashes, restarts, and retries are normal. If partial state changes the next run's outcome, every restart becomes a debugging session.
|
|
16
|
+
|
|
17
|
+
**The pattern:**
|
|
18
|
+
- Convergent startup: scan for existing state, clean stale artifacts, adopt live sessions
|
|
19
|
+
- Content-based cleanup: compare by content equivalence, not creation order
|
|
20
|
+
- Self-healing locks: use PID-based stale lock detection
|
|
21
|
+
- Idempotent scheduling: failed work respawns cleanly, fresh input regenerated after each cycle
|
|
22
|
+
|
|
23
|
+
**The test:**
|
|
24
|
+
1. What happens if this runs twice in a row?
|
|
25
|
+
2. What happens if the previous run crashed at every possible point?
|
|
26
|
+
3. Does re-execution converge to the same end state?
|
|
27
|
+
|
|
28
|
+
If any answer is "it depends on what state was left behind," the operation needs a reconciliation step.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: principle-minimize-reader-load
|
|
3
|
+
description: "Apply when reviewing or shaping code that's hard to trace. Count layers between question and answer, and hidden state in the reader's head; collapse one-caller wrappers and shrink mutable scope."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Minimize Reader Load
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## SE Studio vendoring notes
|
|
10
|
+
|
|
11
|
+
- Upstream frontmatter `disable-model-invocation: true` moved out of YAML (SE Studio skills allow only name + description).
|
|
12
|
+
|
|
13
|
+
Maintainability is the work a reader must do to understand code. Track two axes: **layers to trace** (indirections between the question and the answer) and **state to hold** (hidden or mutable context the reader must keep in their head). LOC, cyclomatic complexity, and "clean architecture" are proxies. Reader load is the thing that matters. The two axes are independent. A flat file with 50 globals can be as hard to reason about as a 6-layer adapter stack. Guard both. This is the human analog of [Guard the Context Window](../principle-guard-the-context-window/SKILL.md). Working memory is finite for readers too.
|
|
14
|
+
|
|
15
|
+
- **Collapse layers** that cost more than they save: wrappers with one caller, adapters with no second implementation, speculative indirection that was never needed. Inline them.
|
|
16
|
+
- **Make adjacent layers change the abstraction.** A layer that repeats the same methods and arguments adds reader load without compression. Collapse pass-through layers.
|
|
17
|
+
- **Demand interface compression.** A broad interface that hides little complexity makes readers learn both the surface and the implementation. Prefer boundaries that hide meaningful decisions.
|
|
18
|
+
- **Shrink state scope:** prefer pure functions (returns over mutations), locals over fields, fields over module state, and module state over globals. Derive instead of sync.
|
|
19
|
+
- **Name the invariant at the boundary,** not in every consumer, so the reader learns it once.
|
|
20
|
+
- Before adding a layer or a piece of state, ask: does it reduce reader load elsewhere by at least as much?
|
|
21
|
+
|
|
22
|
+
**The test:** can a new reader answer "where does X come from?" and "what can change X?" in under 30 seconds? If not, cut layers or cut state.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: principle-model-the-domain
|
|
3
|
+
description: "Apply when writing stateful logic, or when code branches a lot or repeats a shape assumption across files."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Model the Domain
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## SE Studio vendoring notes
|
|
10
|
+
|
|
11
|
+
- Upstream frontmatter `disable-model-invocation: true` moved out of YAML (SE Studio skills allow only name + description).
|
|
12
|
+
|
|
13
|
+
Encode the real domain in a data structure instead of scattering it across conditionals. A structure that matches the domain makes invalid states unrepresentable and deletes branches. Choosing it at write time is cheap. Recovering it later reads as a refactor and gets deferred.
|
|
14
|
+
|
|
15
|
+
Reach for:
|
|
16
|
+
|
|
17
|
+
- A state machine instead of scattered booleans, phases, or lifecycle checks.
|
|
18
|
+
- A typed model instead of loose parameters or repeated shape assumptions.
|
|
19
|
+
- A map, registry, lookup table, or discriminated union instead of branching spread across files.
|
|
20
|
+
- A reducer or command/event model instead of ad hoc state mutations.
|
|
21
|
+
- A module organized around one body of domain knowledge instead of a sequence such as load, validate, transform, and save. Execution order is not ownership.
|
|
22
|
+
- A small module boundary that gathers repeated behavior, ownership, or invariants.
|
|
23
|
+
- A queue, cache, index, graph, tree, or normalized collection where the access pattern calls for it.
|
|
24
|
+
- Any other structure that fits. When none fits, work out what the code must never allow and how the data gets read, then find the structure that encodes exactly that.
|
|
25
|
+
|
|
26
|
+
Do not force an abstraction. Prefer boring code if the current shape is already clear, local, and unlikely to grow. Be skeptical of an abstraction that adds indirection without removing branches, duplicated rules, invalid states, or lifecycle risk.
|
|
27
|
+
|
|
28
|
+
The sign that you skipped this is a new feature that grows an existing if/else chain by one more branch, or a second boolean that must stay in sync with the first. Temporal decomposition is another sign. Phase-named modules repeat the same domain rules across steps.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: principle-prove-it-works
|
|
3
|
+
description: "Apply after completing a task, before declaring done. Verify against the real artifact (run the feature, read the actual value, inspect the diff), not a proxy, self-report, or 'it compiles.'"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Prove It Works
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## SE Studio vendoring notes
|
|
10
|
+
|
|
11
|
+
- Upstream frontmatter `disable-model-invocation: true` moved out of YAML (SE Studio skills allow only name + description).
|
|
12
|
+
|
|
13
|
+
Verify every task output by checking the real thing directly. Do not infer from proxies, self-reports, or "it compiles."
|
|
14
|
+
|
|
15
|
+
**Why:** Unverified work has unknown correctness. Indirect verification (file mtimes, output freshness, agent self-reports, cached screenshots) feels cheaper than direct observation. Acting on a wrong inference costs far more than checking the source.
|
|
16
|
+
|
|
17
|
+
Check the real thing, not a proxy:
|
|
18
|
+
- Check process liveness directly, not indirectly through derived state
|
|
19
|
+
- Read the actual value, not a cached or derived representation
|
|
20
|
+
- When verification fails, suspect the observation method before suspecting the system
|
|
21
|
+
|
|
22
|
+
## Script the check when you can
|
|
23
|
+
|
|
24
|
+
The strongest proof is a deterministic script that re-runs the same comparison, not a one-time eyeball. Write the script, run it, and keep its output as an artifact a reviewer can re-run instead of trusting your word.
|
|
25
|
+
|
|
26
|
+
Keep the artifact visible for the human. Commit it only for large or complex work where the trail has to be auditable later, like a big port or migration. If a **show-me-your-work** skill is installed, follow it; otherwise (**skip if missing**) keep artifacts under the usual Project / walkthrough paths without installing that skill.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: principle-sequence-verifiable-units
|
|
3
|
+
description: "Apply to multi-step work (sweeps, migrations, runs of similar edits) and to how you stack commits and PRs. Break work into small units that each end in a verifiable state, check each before the next, and order delivery so the sequence proves itself to a reviewer."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Sequence work into verifiable units
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## SE Studio vendoring notes
|
|
10
|
+
|
|
11
|
+
- Upstream frontmatter `disable-model-invocation: true` moved out of YAML (SE Studio skills allow only name + description).
|
|
12
|
+
|
|
13
|
+
Order work as a sequence of small units, each ending in a state you can check, and don't advance until the current one is green.
|
|
14
|
+
|
|
15
|
+
**Why:** A break caught at the unit that caused it is cheap to localize. A break caught after a batch is buried, and you have already built further on a broken base. Sequencing those same units into a delivery a reviewer can replay turns "trust me" into "watch it go red, then green."
|
|
16
|
+
|
|
17
|
+
**Execution.** In a sweep, migration, or any run of similar edits, verify each change before starting the next. Each unit is a before/after bracket: known-good state, one change, run the check, then proceed. Rebase onto clean trunk first so every check measures against the real baseline. When a lever does the edits, the per-unit check is nearly free. Run it anyway.
|
|
18
|
+
|
|
19
|
+
**Delivery.** Stack commits and PRs in the order that proves the work. The canonical shape is the failing test first, then the fix on top. Other story orders are a subtraction before the reshape, a baseline capture before the treatment, the scaffold before the feature. Each commit lands on its own and the sequence reads as an argument.
|
|
20
|
+
|
|
21
|
+
The sequencing complement to the **prove-it-works** principle skill, which keeps each check real. If a **build-the-lever** principle skill is installed, also use it to make per-unit checks cheap; otherwise (**skip if missing**) keep checks cheap with existing scripts/tests and do not install that skill.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: principle-subtract-before-you-add
|
|
3
|
+
description: "Apply when sequencing an addition, refactor, or rewrite. Remove dead code, redundant validators, and stub references first, then build on the simpler base."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Subtract Before You Add
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## SE Studio vendoring notes
|
|
10
|
+
|
|
11
|
+
- Upstream frontmatter `disable-model-invocation: true` moved out of YAML (SE Studio skills allow only name + description).
|
|
12
|
+
|
|
13
|
+
When evolving a system, remove complexity first, then build. Default to subtraction.
|
|
14
|
+
|
|
15
|
+
Make simplification a continual investment. Leave the design slightly simpler and more capable behind the same or smaller surface than you found it.
|
|
16
|
+
|
|
17
|
+
- Sequence removal before construction
|
|
18
|
+
- Cut before you polish (get to the minimum before investing in quality)
|
|
19
|
+
- Design for observed usage, not speculative edge cases
|
|
20
|
+
- No speculative validators, parsers, or guards beyond what the spec demands
|
|
21
|
+
- Simplify prompts (remove redundant instructions, excessive templates)
|
|
22
|
+
- When a reference has no novel content, delete it rather than leaving a stub
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: principle-test-behavior-not-implementation
|
|
3
|
+
description: "Apply when you write, change, or keep a test. Call the code as its users do and assert the exact result they see. Rewrite or delete a test that would pass if every imported function returned undefined."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test Behavior, Not Implementation
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## SE Studio vendoring notes
|
|
10
|
+
|
|
11
|
+
- Upstream frontmatter `disable-model-invocation: true` moved out of YAML (SE Studio skills allow only name + description).
|
|
12
|
+
|
|
13
|
+
A test calls the code as its users do and asserts the exact result they see. Rewrite or delete any test that would still pass if every imported function returned `undefined` or a wrong value.
|
|
14
|
+
|
|
15
|
+
These shapes fail that check:
|
|
16
|
+
|
|
17
|
+
- Loose or no assertion: `toBeDefined`, `toBeTruthy`, `not.toThrow`, `toBeGreaterThan(0)`.
|
|
18
|
+
- Call or absence only: `toHaveBeenCalled`, `not.toHaveBeenCalled`, `toBeUndefined`, `toEqual([])`.
|
|
19
|
+
- Expected value computed by the code under test: `expect(f(a)).toBe(f(a))`.
|
|
20
|
+
- Restated constant, config default, table row, or prompt string.
|
|
21
|
+
- Assertions on data the test built, with no call to the subject.
|
|
22
|
+
|
|
23
|
+
Fix: call the subject in the test body with one concrete input and assert the literal output or effect. For a mock, assert the payload it received. For an absence, also assert the presence on another input. For a constant, test the mechanism that reads it with one input instead of restating the value.
|
|
24
|
+
|
|
25
|
+
Keep relation checks across table rows (a key in two tables, a parent that exists) and `*.test-d.ts` type checks.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: principle-type-system-discipline
|
|
3
|
+
description: "Apply when designing types, reviewing a function signature, or writing code in any statically-typed language. Make illegal states unrepresentable, brand semantic primitives, parse external data at boundaries, refuse to lie to the compiler, exhaust variants, derive from authoritative schemas."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Type System Discipline
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## SE Studio vendoring notes
|
|
10
|
+
|
|
11
|
+
- Upstream frontmatter `disable-model-invocation: true` moved out of YAML (SE Studio skills allow only name + description).
|
|
12
|
+
|
|
13
|
+
Make the compiler reject impossible states, mismatched primitives, and unhandled variants. Prefer defining errors and special cases out of existence over proliferating handlers. For TypeScript syntax, see the `typescript-best-practices` skill.
|
|
14
|
+
|
|
15
|
+
- **Make illegal states unrepresentable.** Model variants as sum types (discriminated unions, enums with payloads, sealed classes), not as a bag of optional fields where contradictory combinations compile. `{ completed: boolean; completedAt?: Date }` admits `completed: true` with no date. Derive the boolean from `completedAt`, or model `{ kind: 'open' } | { kind: 'done'; at: Date }`. If you can write a comment explaining when a combination of fields is valid, split it into a sum type.
|
|
16
|
+
- **Types are constructions, not restrictions.** Build the type up from the values you want instead of carving them out of a looser type with checks. A non-empty list is a head plus a rest. A valid time range is a start plus a duration. Choose the shape that cannot build the illegal value and expose the interface callers need on top.
|
|
17
|
+
- **Brand semantic primitives.** `UserId` and `OrderId` are strings underneath but should not be interchangeable. Give each its own type, such as a branded intersection in TypeScript or a newtype elsewhere. Validate once at creation, trust the type downstream. If two arguments share a primitive type but mean different things, brand them.
|
|
18
|
+
- **External data is untyped until parsed.** RPC payloads, JSON, IPC messages, CLI args, config files, environment variables, database rows. Have a parse function at every boundary that turns unstructured input into the typed model. The **boundary-discipline** principle skill says where to put validation.
|
|
19
|
+
- **Don't lie to the type system.** Casts, unsafe coercions, and assertion functions that bypass the compiler are latent runtime crashes. If the compiler can't prove a fact, prove it (validate, narrow, refine the model) or accept that the cast is a hazard. Trace each `any`, `as`, or `assertNotNull` to the boundary and validate there.
|
|
20
|
+
- **Exhaustive matching is the compiler's job.** A match on a sum type must fail compilation when a new variant is added without handling, so the compiler tells the next agent where to add a case. Use your language's idiom: a `never`-typed binding in TypeScript, an unannotated `match` in Rust, `-Wincomplete-patterns` in Haskell, sealed-class match exhaustiveness in Kotlin.
|
|
21
|
+
- **Derive types from authoritative schemas.** When a protocol buffer, OpenAPI spec, GraphQL schema, database migration, design-token file, or another file owns a shape, derive from it instead of hand-rolling a parallel type. See the **encode-lessons-in-structure** principle skill.
|
|
22
|
+
- **Strengthen a type only where partiality appears.** A runtime assertion, null check, or "this should never happen" throw marks the place a type is too weak. Push that check up into the type. Then stop. The type system's job is to track the cases each use site must handle, not to describe the data as precisely as possible. Prefer total functions. `sum` of an empty list is 0, so it takes the plain list. `head` of an empty list has no answer, so it demands the non-empty one. If nothing would otherwise panic, keep the plain type.
|
|
@@ -276,6 +276,32 @@ Add `/llms.txt`, `/markdown-index.txt`, and `/site-info.md` to `route-build-poli
|
|
|
276
276
|
|
|
277
277
|
`expectHtmlStatus` requires `@se-studio/site-check@^2.7.2`. Omit for normal 2xx HTML checks.
|
|
278
278
|
|
|
279
|
+
### Content assertions (release verification)
|
|
280
|
+
|
|
281
|
+
Live / production smoke must assert **key blocks render**, not only HTTP 200 (release verification rule 2). Add optional `contentAssert` on representative cases:
|
|
282
|
+
|
|
283
|
+
```json
|
|
284
|
+
{
|
|
285
|
+
"category": "person",
|
|
286
|
+
"label": "Provider — hero",
|
|
287
|
+
"path": "/providers/jane-doe/",
|
|
288
|
+
"expectMarkdown": true,
|
|
289
|
+
"contentAssert": {
|
|
290
|
+
"mustInclude": ["Jane Doe"],
|
|
291
|
+
"mustHaveSelector": ["img"],
|
|
292
|
+
"imagesMustLoad": true
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
| Field | Meaning |
|
|
298
|
+
|-------|---------|
|
|
299
|
+
| `mustInclude` | Substrings that must appear in the HTML body |
|
|
300
|
+
| `mustHaveSelector` | Cheap checks: tag (`img`, `h1`), `.class`, `#id`, or `img[src]` |
|
|
301
|
+
| `imagesMustLoad` | Every `<img src>` must return HTTP 2xx |
|
|
302
|
+
|
|
303
|
+
Use on person heroes (name + headshot) and listing cards (images). Requires a site-check version that exports content-assert support. See `docs/RELEASE_VERIFICATION.md`.
|
|
304
|
+
|
|
279
305
|
Optional `cmsIntegrity` (local only — see section below):
|
|
280
306
|
|
|
281
307
|
```json
|
|
@@ -410,7 +436,7 @@ Commit `route-build-policy.json` beside `smoke.cases.json`. Start from `@se-stud
|
|
|
410
436
|
|
|
411
437
|
`pnpm smoke-test:cache` / `smoke-test:deploy-check` catches breakage lint/policy miss. Keep mandatory in CI / Vercel build gates.
|
|
412
438
|
|
|
413
|
-
**HubSpot bootstrap:** use `createHubSpotBootstrapScript()` with no args in root layout — not `headers()` + middleware pathname.
|
|
439
|
+
**HubSpot bootstrap (only if the site uses HubSpot tracking):** use `createHubSpotBootstrapScript()` with no args in root layout — not `headers()` + middleware pathname.
|
|
414
440
|
|
|
415
441
|
## Deploy / live smoke failure playbook
|
|
416
442
|
|
|
@@ -5,7 +5,7 @@ description: "Start and manage agent work sessions across se-core-product and cu
|
|
|
5
5
|
|
|
6
6
|
# Agent session workflow
|
|
7
7
|
|
|
8
|
-
Orchestrates **where** to work, **where code belongs**, and **how to isolate parallel features**. Customer production merges need a **human ask plus a second confirmation** ([`production-merge.md`](../../references/agent-session/production-merge.md)).
|
|
8
|
+
Orchestrates **where** to work, **where code belongs**, and **how to isolate parallel features**. Customer production merges **and** se-core-product `dev` → `main` (npm promote) need a **human ask plus a second confirmation** ([`production-merge.md`](../../references/agent-session/production-merge.md)).
|
|
9
9
|
|
|
10
10
|
**Registry:** [`packages/skills/references/agent-session/projects.registry.json`](../../references/agent-session/projects.registry.json) — repo paths, `worktreesRoot`, `productionPath` / `productionBranch`, integration branches, hosted MCP keys, `localEnvRoot`.
|
|
11
11
|
|
|
@@ -61,11 +61,21 @@ Integration branches (agents push feature branches here via PR or merge — **ne
|
|
|
61
61
|
|
|
62
62
|
| Repo type | Integration branch | Production |
|
|
63
63
|
|-----------|-------------------|------------|
|
|
64
|
-
| `se-core-product` | `dev` | `main` —
|
|
64
|
+
| `se-core-product` | `dev` | `main` — ask + confirm ([`production-merge.md`](../../references/agent-session/production-merge.md); publishes npm) |
|
|
65
65
|
| Customer sites | `develop` (or registry override) | Usually `main`; HSD **`production`**. Merge only after [`production-merge.md`](../../references/agent-session/production-merge.md) (ask + confirm) |
|
|
66
66
|
|
|
67
67
|
**Never** work in `productionPath`. Agent work uses `path` (develop checkout) only.
|
|
68
68
|
|
|
69
|
+
### Fleet status
|
|
70
|
+
|
|
71
|
+
Run this at the **start** of every coding session, and **again before you say the session is done**:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pnpm --dir ~/source/se/se-core-product fleet-status
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Read the whole report before editing. A tracked dirty file or a worktree is unfinished work: commit it, push it, drop it, or name it in the handoff. Do not start another feature on a dirty primary checkout. The script lists every registry checkout, hides generated paths, and is the only list of those paths.
|
|
78
|
+
|
|
69
79
|
---
|
|
70
80
|
|
|
71
81
|
## Step 2 — Ledger: PRs and worktrees (not yaml)
|
|
@@ -74,8 +84,8 @@ Customer-only work **must not** create or update files in `se-core-product`. Cro
|
|
|
74
84
|
|
|
75
85
|
**What's in flight** (when the user asks, or before a tidy-up):
|
|
76
86
|
|
|
77
|
-
1. **
|
|
78
|
-
2. **
|
|
87
|
+
1. **This machine:** `pnpm --dir ~/source/se/se-core-product fleet-status`.
|
|
88
|
+
2. **Open PRs** targeting `dev` (core) or `develop` (customer) — `gh pr list --base <integration> --state open`. This includes Cursor cloud / other machines. Fleet-status does not see those.
|
|
79
89
|
|
|
80
90
|
Do not invent a second ledger in git. Stale local trees vs merged PRs are a prune problem, not a yaml problem.
|
|
81
91
|
|
|
@@ -292,10 +302,11 @@ Agents may push to:
|
|
|
292
302
|
- `dev` / `develop` (via feature branch merge or direct **only when Nick approves in chat**)
|
|
293
303
|
- `feature/*` branches
|
|
294
304
|
- Customer production (`main`, HSD `production`) **only** after [`production-merge.md`](../../references/agent-session/production-merge.md): human **asked** in this conversation, agent **restated** the exact merge (site, branches, publishes production), human **confirmed** with a second yes. cms-edit host diffs also need [`cms-edit-prod-merge.md`](../../references/agent-session/cms-edit-prod-merge.md).
|
|
305
|
+
- **se-core-product** `main` **only** after the same ask + confirm gate: restate repo = se-core-product, `dev` → `main`, and that Release Main **publishes npm** (and may deploy anything on `main`); wait for a second **yes**. Also post `## Merge approval` on the promote PR.
|
|
295
306
|
|
|
296
307
|
Do **not** wait for or require a `nick-go` GitHub label.
|
|
297
308
|
|
|
298
|
-
Agents must **never**
|
|
309
|
+
Agents must **never** ship from a registry `productionPath` (e.g. HSD `~/source/customers/hopskipdrive/production-hsd-website`). Opening a production or core `main` PR is not a merge.
|
|
299
310
|
|
|
300
311
|
**Preferred:** open a **draft PR** targeting the integration branch (this is how cloud + other laptops see the work):
|
|
301
312
|
|
|
@@ -313,6 +324,8 @@ If `gh` is unavailable or user prefers direct push, push `feature/*` and note th
|
|
|
313
324
|
|
|
314
325
|
When **marketing** work is ready for production, **stop** and hand off. Do **not** merge `develop` → production unless [`production-merge.md`](../../references/agent-session/production-merge.md) passed in this conversation (ask + restatement + second yes). One customer repo at a time. cms-edit host extra gate: [`cms-edit-prod-merge.md`](../../references/agent-session/cms-edit-prod-merge.md).
|
|
315
326
|
|
|
327
|
+
When the promote depends on new/changed Contentful content, also complete [`release-verification.md`](../../references/agent-session/release-verification.md) (publish state, content smoke, preview compare). A Nick override never skips publish-state or content smoke.
|
|
328
|
+
|
|
316
329
|
Deliver handoff using the template below. If a core release was part of the work, list published package versions needed for the customer bump.
|
|
317
330
|
|
|
318
331
|
### Handoff template
|
|
@@ -341,8 +354,8 @@ Deliver handoff using the template below. If a core release was part of the work
|
|
|
341
354
|
2. <customer pnpm update @se-studio/...>
|
|
342
355
|
3. <customer PR>
|
|
343
356
|
|
|
344
|
-
### Production
|
|
345
|
-
Do not merge until the human asks **and** confirms (`production-merge.md`). Not `productionPath`, not `vercel deploy`. se-core-product `main`:
|
|
357
|
+
### Production / core main
|
|
358
|
+
Do not merge until the human asks **and** confirms (`production-merge.md`). Not `productionPath`, not `vercel deploy`. se-core-product `dev` → `main`: same ask + confirm (publishes npm).
|
|
346
359
|
```
|
|
347
360
|
|
|
348
361
|
---
|
|
@@ -351,7 +364,7 @@ Do not merge until the human asks **and** confirms (`production-merge.md`). Not
|
|
|
351
364
|
|
|
352
365
|
| Outcome | Action |
|
|
353
366
|
|---------|--------|
|
|
354
|
-
| Merged / done | Remove the **local** worktree if you created one; the PR close is the record |
|
|
367
|
+
| Merged / done | Remove the **local** worktree if you created one; the PR close is the record. Run fleet-status again and deal with anything it still lists |
|
|
355
368
|
| Parked | Leave the branch + draft PR; say why in chat |
|
|
356
369
|
|
|
357
370
|
```bash
|
|
@@ -372,7 +385,7 @@ Feature: hero-redesign
|
|
|
372
385
|
Branch: feature/om1/hero-redesign
|
|
373
386
|
```
|
|
374
387
|
|
|
375
|
-
Agent must load this skill, run placement checklist, create a **local** worktree (or use the cloud checkout), then proceed. **Do not** write `work/active/*.yaml`.
|
|
388
|
+
Agent must load this skill, run fleet-status, run the placement checklist, create a **local** worktree (or use the cloud checkout), then proceed. **Do not** write `work/active/*.yaml`.
|
|
376
389
|
|
|
377
390
|
---
|
|
378
391
|
|
|
@@ -388,6 +401,6 @@ Agent must load this skill, run placement checklist, create a **local** worktree
|
|
|
388
401
|
| `pedestal` | `develop` | `main` | customer monorepo |
|
|
389
402
|
| `hsd` | `develop` (`develop-hsd-website`) | `production` (`production-hsd-website`) | customer |
|
|
390
403
|
| `highlander` | `develop` | `main` | customer |
|
|
391
|
-
| `eagle` | `
|
|
404
|
+
| `eagle` | `develop` | `main` | customer |
|
|
392
405
|
|
|
393
406
|
Full paths (`path`, `worktreesRoot`, `productionPath`), MCP keys: `projects.registry.json`.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tdd
|
|
3
|
+
description: "Use only when the user explicitly asks for TDD, a failing test, or a regression test, OR when the bug has an obvious cheap local test target. Skip when the test path is unclear, expensive, integration-heavy, or not requested."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# TDD Bug Fix
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## SE Studio vendoring notes
|
|
10
|
+
|
|
11
|
+
- Upstream frontmatter `disable-model-invocation: true` moved out of YAML (SE Studio skills allow only name + description).
|
|
12
|
+
|
|
13
|
+
When fixing a bug with a clear, cheap test path, make the broken behavior executable before changing production code. The goal is a focused regression test that fails before the fix and passes after it.
|
|
14
|
+
|
|
15
|
+
Do not force a test when it would be impractical. If the available test would require broad harness setup, brittle mocks, slow end-to-end infrastructure, production-only state, vague reproduction steps, or large unrelated fixture churn, skip adding a new test and use the closest useful verification instead.
|
|
16
|
+
|
|
17
|
+
## Workflow
|
|
18
|
+
|
|
19
|
+
1. **Understand the bug.** Identify the intended behavior, current behavior, affected path, and smallest observable reproduction.
|
|
20
|
+
2. **Choose the narrowest executable check.** Prefer the closest unit, component, integration, or regression test already used for that codepath. If no practical test path is obvious, do not create one from scratch just to satisfy the workflow.
|
|
21
|
+
3. **Write the failing test first.** Add the smallest focused test that would have caught the bug. The test should encode intended behavior, not mirror the current implementation.
|
|
22
|
+
4. **Run the new test before fixing.** Confirm it fails for the intended reason. If it passes or fails for an unrelated reason, correct the test or reproduction before editing the implementation.
|
|
23
|
+
5. **Fix the bug.** Make the smallest production change that satisfies the intended behavior while preserving nearby contracts.
|
|
24
|
+
6. **Rerun the regression test.** Confirm the test now passes.
|
|
25
|
+
|
|
26
|
+
## If a Failing Test Is Impractical
|
|
27
|
+
|
|
28
|
+
Use the closest executable regression check instead: a targeted script, manual reproduction command, browser automation, snapshot comparison, log assertion, or focused integration check.
|
|
29
|
+
|
|
30
|
+
Prefer no new test over a bad test. A bad test is one that mostly tests mocks, encodes current implementation details, depends on timing or unrelated global state, needs expensive infrastructure for a small fix, or would be deleted immediately after proving the fix.
|
|
31
|
+
|
|
32
|
+
## Guardrails
|
|
33
|
+
|
|
34
|
+
- Do not change tests merely to match a wrong implementation.
|
|
35
|
+
- Do not weaken existing assertions unless the expected behavior has genuinely changed and the reason is clear.
|
|
36
|
+
- Keep the regression test focused on the bug. Avoid broad fixture churn or unrelated coverage expansion.
|
|
37
|
+
- If the bug is flaky, make the test deterministic where possible and document the signal being locked down.
|
|
38
|
+
- If the bug exposes a broader class of failures, first land the focused regression path, then consider additional sibling coverage.
|
|
39
|
+
|
|
40
|
+
## Final Response
|
|
41
|
+
|
|
42
|
+
Report the evidence, not just the outcome:
|
|
43
|
+
|
|
44
|
+
- Name the failing-before test or executable check and the failure it produced.
|
|
45
|
+
- Name the passing-after test run and any nearby validation performed.
|
|
46
|
+
- If failing-before evidence could not be demonstrated, state why and describe the closest regression check used instead.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: typescript-best-practices
|
|
3
|
+
description: "TypeScript best practices. Use when reading or editing any .ts or .tsx file."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# TypeScript best practices
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## SE Studio vendoring notes
|
|
10
|
+
|
|
11
|
+
- Upstream frontmatter `paths: ["**/*.ts", "**/*.tsx"]` moved out of YAML (SE Studio skills allow only name + description).
|
|
12
|
+
- Upstream frontmatter `disable-model-invocation: true` moved out of YAML (SE Studio skills allow only name + description).
|
|
13
|
+
|
|
14
|
+
Apply the **type-system-discipline** principle skill first.
|
|
15
|
+
|
|
16
|
+
| Rule | Summary |
|
|
17
|
+
|------|---------|
|
|
18
|
+
| Discriminated unions | Model variants with a `kind` literal discriminant so impossible states can't be represented. No optional-field bags. |
|
|
19
|
+
| Branded types | Brand primitives with `& { readonly __brand: "X" }` so they can't be mixed up. Validate once at the boundary. |
|
|
20
|
+
| Constructive modeling | Build the shape so the illegal value can't be constructed. `[T, ...T[]]` for non-empty, `[T, T][]` for even length, `start` plus `duration` for a range. Not a runtime guard, not a wish for refinement types. |
|
|
21
|
+
| Simplest total type | Keep `T[]` while every operation on it stays total. Strengthen to `NonEmpty<T>` only where the loose type forces `!`, a cast, or a "should never happen" throw. |
|
|
22
|
+
| `unknown` over `any` | External data is `unknown`. |
|
|
23
|
+
| Schemas before guards | Before hand-writing a property-by-property type guard, use the repository's runtime schema library and infer the type from the schema, such as `z.infer`. |
|
|
24
|
+
| No `as` casts | Every `as` is a runtime crash waiting. Cast only after validation. |
|
|
25
|
+
| Narrowing hierarchy | Discriminant switch > `in` operator > `typeof`/`instanceof` > user-defined type guard > `as`. |
|
|
26
|
+
| Type guards | Must verify the claim. A lying guard is worse than `as` because the bug hides behind a name that says it's safe. Name them `isX` or `hasX`. |
|
|
27
|
+
| Exhaustiveness | Inline `const _exhaustive: never = x;` in default arms so the compiler errors when a new variant is added. |
|
|
28
|
+
| `satisfies` over `as` | Validates the value without widening literal types. |
|
|
29
|
+
| Boundary validation | Parse where data crosses in, into a named domain type. `Record<string, unknown>` (however spelled) stops at that parse. Trust types inside. See the **boundary-discipline** principle skill. |
|
|
30
|
+
| Schema-derived types | Reach for `Pick`/`Omit`/`Parameters`/`ReturnType`/`Awaited`/`typeof` before declaring a new interface. |
|
|
31
|
+
| Object args | Pass objects, not positional, so argument order is self-documenting. Skip on hot paths (per-frame render, tokenizers, parsers). |
|
|
32
|
+
| Real tests | Don't mock what you can run. Prefer the framework's real test primitives with leak/disposable checks, and verify UI in a running build. Mock only what you can't run locally. |
|
|
33
|
+
| Structured telemetry | Prefer structured logger diagnostics with enough context to debug from an id. No `console.log` in shipped code. |
|
|
34
|
+
|
|
35
|
+
Examples: `references/patterns.md`.
|