@se-studio/skills 1.9.9 → 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 +6 -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/production-merge.md +35 -19
- 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 +8 -5
- 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
|
@@ -391,7 +391,7 @@ When making changes, update the relevant documentation:
|
|
|
391
391
|
- [Core Data Types Docs](./packages/core-data-types/README.md) — LLM ref: [docs/llms.md](./packages/core-data-types/docs/llms.md)
|
|
392
392
|
- [Core UI Docs](./packages/core-ui/README.md) — LLM ref: [docs/llms.md](./packages/core-ui/docs/llms.md)
|
|
393
393
|
- [A/B Testing Docs](./packages/ab-testing/README.md) — LLM ref: [docs/llms.md](./packages/ab-testing/docs/llms.md)
|
|
394
|
-
- [HubSpot Docs](./packages/hubspot/README.md) — LLM ref: [docs/llms.md](./packages/hubspot/docs/llms.md)
|
|
394
|
+
- [HubSpot Docs](./packages/hubspot/README.md) — LLM ref: [docs/llms.md](./packages/hubspot/docs/llms.md) (optional package; **not** the fleet default forms provider)
|
|
395
395
|
- [Search Docs](./packages/search/README.md) — LLM ref: [docs/llms.md](./packages/search/docs/llms.md)
|
|
396
396
|
- [Markdown Renderer Docs](./packages/markdown-renderer/README.md) — LLM ref: [docs/llms.md](./packages/markdown-renderer/docs/llms.md)
|
|
397
397
|
- [Contentful CMS CLI Docs](./packages/contentful-cms/README.md)
|
|
@@ -404,7 +404,7 @@ When working in a project that installs `@se-studio` packages, tell LLMs to read
|
|
|
404
404
|
- `node_modules/@se-studio/core-data-types/docs/llms.md`
|
|
405
405
|
- `node_modules/@se-studio/core-ui/docs/llms.md`
|
|
406
406
|
- `node_modules/@se-studio/ab-testing/docs/llms.md`
|
|
407
|
-
- `node_modules/@se-studio/hubspot/docs/llms.md`
|
|
407
|
+
- `node_modules/@se-studio/hubspot/docs/llms.md` (only when the site uses HubSpot)
|
|
408
408
|
- `node_modules/@se-studio/search/docs/llms.md`
|
|
409
409
|
- `node_modules/@se-studio/markdown-renderer/docs/llms.md`
|
|
410
410
|
|
|
@@ -867,6 +867,17 @@ cms-edit index dump --reference-only # Full catalog snapshot in termina
|
|
|
867
867
|
|
|
868
868
|
If someone else also changed an entry, ask all versus mine and `publish choose`. The Contentful role must allow it. Unpublish, archive, and revalidate use the same plan-then-yes rule. Do not apply a plan on your own.
|
|
869
869
|
|
|
870
|
+
### Before a production promote
|
|
871
|
+
|
|
872
|
+
When pages that use **templates**, **person** entries, or other linked content are about to go live, verify publish state **before** merging the promote (release verification rule 1):
|
|
873
|
+
|
|
874
|
+
1. List the page(s), linked **template**(s), **person** / person-type entries, and any other content stack pieces the live render walks.
|
|
875
|
+
2. Confirm each is published in the production environment with no pending drafts — compare CDA (Delivery) vs CPA (Preview), or use `@se-studio/site-check/publish-state` / `check-publish-state`.
|
|
876
|
+
3. Record results on the promote PR. A Nick override never skips this check.
|
|
877
|
+
4. Do not assume publishing the page alone published a shared template or person — those often need their own publish (and template webhooks refresh pages that use them).
|
|
878
|
+
|
|
879
|
+
See `packages/skills/references/agent-session/release-verification.md` and `docs/editor-tasks/publish-handoff.md` (in contentful-cms).
|
|
880
|
+
|
|
870
881
|
## Concurrent Sessions
|
|
871
882
|
|
|
872
883
|
Use `--session <name>` or `CONTENTFUL_CMS_SESSION=<name>` to isolate parallel workflows.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: how
|
|
3
|
+
description: "Use for \"how does X work\", code walkthroughs before changing something, and placement / ownership / layering questions (\"where should this live\", \"which package owns this\", \"is this the right layer\"). Explains subsystem architecture, runtime flow, onboarding mental models. Use why for motivation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# How
|
|
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
|
+
- **SE Studio trial: Auto only.** Omit `model` on Task spawns. Do not create or read `pstack-models.mdc` / run `setup-pstack`. Never use `xhigh` or `max`.
|
|
13
|
+
- Soft-dep **`why`**: description mentions it for motivation questions. **`why` is not in this trial install** — skip if missing; answer motivation from PR/commit history and code comments instead. Do not install `why` to satisfy the reference.
|
|
14
|
+
- **Trial spend posture (keep `/how` value; make cost explicit):** complex `/how` can spawn 2–4 explorers + 1 explainer ≈ **up to 5 Auto Tasks**. Prefer the simple path when in doubt. Cap explorers at **4**. Log multi-explorer `/how` runs in the two-week trial spend notes. Prefer fewer angles over silent truncation of depth.
|
|
15
|
+
|
|
16
|
+
Explore the codebase to answer "how does X work?" questions. Produce architectural explanations at the level of a senior engineer onboarding onto a subsystem, enough to build a working mental model, not so much that it reads like annotated source code.
|
|
17
|
+
|
|
18
|
+
Every spawn is a Task subagent with `subagent_type: generalPurpose` and `readonly: true`. **SE Studio trial:** omit `model` on every spawn (`auto` / `inherit-parent`). Do not read or create `~/.cursor/rules/pstack-models.mdc`. Do not use `xhigh` or `max` tiers. Upstream defaults (`grok-4.7-xhigh-fast` / `claude-opus-5-5-xhigh`) are **forbidden** for this trial.
|
|
19
|
+
|
|
20
|
+
## 1. Assess complexity
|
|
21
|
+
|
|
22
|
+
If the scope is ambiguous, state your interpretation and explore. The user can redirect.
|
|
23
|
+
|
|
24
|
+
- **Simple** (a single module, a small utility, a narrow question such as "how does function X work"): no explorers. Spawn one explainer that explores and explains in one pass, built from `references/explainer-prompt.md` without the explorer-findings section. Go to step 4.
|
|
25
|
+
- **Complex** (a subsystem spanning multiple files or services, a cross-cutting feature, a full architectural overview): go to step 2. Budget: 2–4 explorer Tasks + 1 explainer Task (max **5** Auto Tasks for one `/how`). Prefer 2 explorers when two angles cover the question.
|
|
26
|
+
|
|
27
|
+
When in doubt, take the simple path.
|
|
28
|
+
|
|
29
|
+
## 2. Explore (complex only)
|
|
30
|
+
|
|
31
|
+
Decompose the question into 2 to 4 angles, each a distinct slice of the subsystem. Spawn all explorers in a single message, each with `references/explorer-prompt.md` and its angle filled in. Do not exceed 4 explorers.
|
|
32
|
+
|
|
33
|
+
## 3. Synthesize (complex only)
|
|
34
|
+
|
|
35
|
+
Once all explorers have returned, spawn one explainer with `references/explainer-prompt.md` and every explorer's findings filled in.
|
|
36
|
+
|
|
37
|
+
## 4. Present
|
|
38
|
+
|
|
39
|
+
Present the explainer's output. Light edits for clarity or context from the conversation are fine. Do not substantially rewrite it.
|
|
40
|
+
|
|
41
|
+
## Output format
|
|
42
|
+
|
|
43
|
+
The explanation uses the sections defined in `references/explainer-prompt.md`, dropping any that do not apply: Overview, Key Concepts, How It Works, Where Things Live, Gotchas.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Explainer Prompt Template
|
|
2
|
+
|
|
3
|
+
Build the explainer subagent's prompt from this template. Fill in the placeholders.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are writing an architectural explanation for a senior engineer. Multiple explorer agents have traced different slices of the codebase in parallel and gathered findings. Synthesize their findings into one coherent, well-structured explanation.
|
|
8
|
+
|
|
9
|
+
## Original Question
|
|
10
|
+
|
|
11
|
+
> {QUESTION}
|
|
12
|
+
|
|
13
|
+
## Explorer Findings
|
|
14
|
+
|
|
15
|
+
{EXPLORER_FINDINGS_ALL}
|
|
16
|
+
|
|
17
|
+
## Instructions
|
|
18
|
+
|
|
19
|
+
The explorers each investigated a different angle of the same subsystem. Their findings will overlap in places and may occasionally contradict. Reconcile them. Merge overlapping descriptions, resolve contradictions by checking the code yourself, and combine the separate slices into a unified picture.
|
|
20
|
+
|
|
21
|
+
Write an explanation a senior engineer unfamiliar with this area could read and walk away with a solid mental model, understanding the architecture well enough to start working in it confidently.
|
|
22
|
+
|
|
23
|
+
You have read-only access to the codebase to check anything, clarify a detail, or fill a gap. Use Read, Grep, and Glob as needed. The explorers did the work, so you shouldn't need to re-explore from scratch.
|
|
24
|
+
|
|
25
|
+
## Output Format
|
|
26
|
+
|
|
27
|
+
Use this structure, adapted to what makes sense for the question. Not every section is needed for every question.
|
|
28
|
+
|
|
29
|
+
### Overview
|
|
30
|
+
1-2 paragraphs. What is this thing, what does it do, why does it exist. Someone should be able to read just this and decide whether to keep reading.
|
|
31
|
+
|
|
32
|
+
### Key Concepts
|
|
33
|
+
The important types, services, or abstractions needed to follow the rest. Brief definitions, not exhaustive.
|
|
34
|
+
|
|
35
|
+
### How It Works
|
|
36
|
+
The core of the explanation, and the longest section. Walk through the flow: what triggers it, what happens step by step, where data goes, what the decision points are.
|
|
37
|
+
|
|
38
|
+
Use prose, not pseudocode. Reference specific files and functions so the reader knows where to look, but don't dump large code blocks unless a snippet is essential to a point.
|
|
39
|
+
|
|
40
|
+
When the flow involves multiple components talking to each other, or data transforming through stages, include a diagram. Use mermaid (```mermaid) for structured flows (sequence diagrams, flowcharts, component graphs) or ASCII art for simpler relationships where mermaid would be overkill. Use your judgment. A diagram should clarify, not decorate. If prose covers the flow, skip the diagram.
|
|
41
|
+
|
|
42
|
+
### Where Things Live
|
|
43
|
+
A brief file/directory map. Just the ones someone would need to start working here.
|
|
44
|
+
|
|
45
|
+
### Gotchas
|
|
46
|
+
Non-obvious things, surprising behavior, historical context, pitfalls. Skip this section if there's nothing worth calling out.
|
|
47
|
+
|
|
48
|
+
## Communication Style
|
|
49
|
+
|
|
50
|
+
- Use concrete language, not abstractions-about-abstractions
|
|
51
|
+
- Say "the `UserService` calls `AuthClient.refresh()`" not "the service delegates to the client"
|
|
52
|
+
- When something is complex, explain why it's complex. Don't just describe the complexity
|
|
53
|
+
- When something is simple, don't pad it out
|
|
54
|
+
- If there's a helpful analogy, use it. If there isn't, don't force one
|
|
55
|
+
- If the explorers flagged open questions or gaps, acknowledge them rather than hiding them
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Explorer Prompt Template
|
|
2
|
+
|
|
3
|
+
Build each explorer subagent's prompt from this template. Fill in the placeholders.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Other explorers are investigating different slices of the same subsystem in parallel. Don't try to cover everything. Focus on your assigned angle and go deep.
|
|
8
|
+
|
|
9
|
+
## Question
|
|
10
|
+
|
|
11
|
+
> {QUESTION}
|
|
12
|
+
|
|
13
|
+
## Your Exploration Angle
|
|
14
|
+
|
|
15
|
+
{EXPLORATION_ANGLE}
|
|
16
|
+
|
|
17
|
+
## Output
|
|
18
|
+
|
|
19
|
+
### Components Found
|
|
20
|
+
The key types, services, classes, and abstractions. For each: name, file path, and a one-sentence description of what it does.
|
|
21
|
+
|
|
22
|
+
### Flow
|
|
23
|
+
The execution flow step by step. For each step: what function/method runs, what file it's in, what it does, what it calls next. Include the data that flows between steps.
|
|
24
|
+
|
|
25
|
+
### Files Read
|
|
26
|
+
Every file you read during exploration, so the explainer can reference them.
|
|
27
|
+
|
|
28
|
+
### Boundaries
|
|
29
|
+
Where this subsystem connects to other parts of the codebase. The inputs and outputs.
|
|
30
|
+
|
|
31
|
+
### Non-Obvious Things
|
|
32
|
+
Anything surprising, historically motivated, or easy to get wrong. Things that look like they should work one way but work another.
|
|
33
|
+
|
|
34
|
+
### Open Questions
|
|
35
|
+
Anything you couldn't fully trace or understand. Be honest about gaps.
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: interrogate
|
|
3
|
+
description: "Use for \"interrogate\", \"adversarial review\", \"multi-model review\", \"challenge this\", \"stress test this code\", \"find blind spots\", or \"tear this apart\". Multiple LLM reviewers challenge changes from independent angles."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Interrogate
|
|
7
|
+
|
|
8
|
+
Spawn reviewers to adversarially review code changes. In the SE Studio trial the adversarial signal is independent review passes on Auto, not model diversity. The deliverable is a synthesized verdict. Do NOT auto-apply changes.
|
|
9
|
+
|
|
10
|
+
## SE Studio vendoring notes
|
|
11
|
+
|
|
12
|
+
- Upstream frontmatter `disable-model-invocation: true` moved out of YAML (SE Studio skills allow only name + description).
|
|
13
|
+
- **SE Studio trial: Auto only.** Never create or read `~/.cursor/rules/pstack-models.mdc`. Never run `setup-pstack`. Never use `xhigh` or `max` model tiers. Cap reviewers at **1 or 2**, both `auto` / `inherit-parent` (omit `model` on Task).
|
|
14
|
+
|
|
15
|
+
## Step 1, Scope
|
|
16
|
+
|
|
17
|
+
Identify what to review from context:
|
|
18
|
+
|
|
19
|
+
- If the user points at specific files or a diff, use that.
|
|
20
|
+
- If on a feature branch, run `git diff main...HEAD` (or the appropriate base branch — for se-core-product use `dev`) for the full changeset.
|
|
21
|
+
- If the user's message references recent work, gather the relevant files.
|
|
22
|
+
|
|
23
|
+
Package the diff or file contents with any surrounding context files the reviewers need to understand the code.
|
|
24
|
+
|
|
25
|
+
## Step 2, Intent
|
|
26
|
+
|
|
27
|
+
Before spawning reviewers, state the intent in one clear paragraph from the user's message, commit messages, the PR description if one exists, and the code. If you're unsure about the intent, ask the user before proceeding.
|
|
28
|
+
|
|
29
|
+
## Step 3, Spawn Reviewers
|
|
30
|
+
|
|
31
|
+
**SE Studio trial defaults (authoritative — ignore any local `pstack-models.mdc`):**
|
|
32
|
+
|
|
33
|
+
| Subagent | Default model | When |
|
|
34
|
+
|----------|---------------|------|
|
|
35
|
+
| Reviewer A | `auto` / `inherit-parent` (omit `model`) | Always |
|
|
36
|
+
| Reviewer B | `auto` / `inherit-parent` (omit `model`) | Optional second pass when the user asks for dual review or the change is large; otherwise skip |
|
|
37
|
+
|
|
38
|
+
Do **not** fall back to `claude-opus-5-5-xhigh`, `grok-4.7-xhigh-fast`, or any other xhigh/max slug. Panel size is **1 or 2** max.
|
|
39
|
+
|
|
40
|
+
Each reviewer gets `subagent_type: generalPurpose`, `readonly: true`, and **no** `model` field (inherit parent / Auto). Label them Reviewer A (and B if used).
|
|
41
|
+
|
|
42
|
+
Read `references/reviewer-prompt.md` and fill in the same template for every reviewer with the stated intent, the diff or file contents, the rubric from `references/rubric.md`, and the code-quality lens from `references/code-quality-review.md`.
|
|
43
|
+
|
|
44
|
+
## Step 4, Synthesize
|
|
45
|
+
|
|
46
|
+
As results come back, build a unified picture. Parse every reviewer's findings. Merge findings that describe the same issue differently, and note which reviewer raised each one. Findings two reviewers raised independently are the highest signal when dual review was used. Note disagreements.
|
|
47
|
+
|
|
48
|
+
## Step 5, Lead Judgment
|
|
49
|
+
|
|
50
|
+
You are the lead reviewer, a pragmatic senior engineer, not a neutral aggregator. Read `references/lead-judgment.md` for the full framework. Put every finding in one of four buckets, with the reviewer(s) that raised it and a one-line rationale.
|
|
51
|
+
|
|
52
|
+
- **Act on**. Real issues affecting correctness, security, or maintainability given the actual goals. They would block a real PR.
|
|
53
|
+
- **Consider**. Legitimate, but you're not sure they outweigh the cost of addressing them now. Worth the user's attention.
|
|
54
|
+
- **Noted**. Technically valid but not actionable. Context-dependent, premature optimization, or low-impact at this stage.
|
|
55
|
+
- **Dismissed**. Wrong, nitpicky, or missing context, with a brief reason.
|
|
56
|
+
|
|
57
|
+
## Output Format
|
|
58
|
+
|
|
59
|
+
### Intent
|
|
60
|
+
> [The stated intent paragraph from Step 2]
|
|
61
|
+
|
|
62
|
+
### Reviewers
|
|
63
|
+
- Reviewer [label]: [model name], [N findings] (one bullet per reviewer)
|
|
64
|
+
|
|
65
|
+
### Act On
|
|
66
|
+
[Each: description, which reviewers raised it, why it matters.]
|
|
67
|
+
|
|
68
|
+
### Consider
|
|
69
|
+
[Each: description, which reviewers raised it, the tradeoff.]
|
|
70
|
+
|
|
71
|
+
### Noted
|
|
72
|
+
[Brief list.]
|
|
73
|
+
|
|
74
|
+
### Dismissed
|
|
75
|
+
[Each with a brief rationale.]
|
|
76
|
+
|
|
77
|
+
### Agreement Map
|
|
78
|
+
[Where reviewers agreed and diverged, and what that pattern tells us.]
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Code Quality Review
|
|
2
|
+
|
|
3
|
+
Each reviewer applies this code-quality lens in addition to the rubric. It is a strict standard focused on implementation quality, maintainability, abstraction quality, and codebase health.
|
|
4
|
+
|
|
5
|
+
Above all, be ambitious about code structure. Do not merely identify local cleanup. Actively search for "code judo" moves, restructurings that preserve behavior while making the implementation dramatically simpler, smaller, more direct, and more elegant.
|
|
6
|
+
|
|
7
|
+
## Core Prompt
|
|
8
|
+
|
|
9
|
+
Start from this baseline:
|
|
10
|
+
|
|
11
|
+
> Perform a deep code quality audit of the current branch's changes.
|
|
12
|
+
> Rethink how to structure / implement the changes to meaningfully improve code quality without impacting behavior.
|
|
13
|
+
> Work to improve abstractions, modularity, reduce Spaghetti code, improve succinctness and legibility.
|
|
14
|
+
> Be ambitious, if there is a clear path to improving the implementation that involves restructuring some of the codebase, go for it.
|
|
15
|
+
> Be extremely thorough and rigorous. Measure twice, cut once.
|
|
16
|
+
|
|
17
|
+
## Dimensions
|
|
18
|
+
|
|
19
|
+
Each dimension is stated once. Apply the ones that are relevant.
|
|
20
|
+
|
|
21
|
+
0. **Be ambitious about structural simplification.** Do not stop at "this could be a bit cleaner." Look for reframings that make whole branches, helpers, modes, conditionals, or layers disappear. Assume a "code judo" move is often available. It uses the existing architecture more effectively and makes the change dramatically simpler. If you can delete complexity rather than rearrange it, push hard for that.
|
|
22
|
+
|
|
23
|
+
1. **Do not let a PR push a file from under 1k lines to over 1k lines without a very strong reason.** Treat this as a strong smell. Prefer extracting helpers, subcomponents, or modules. If the diff crosses that threshold, ask whether the code should be decomposed first. Waive only for a compelling structural reason where the resulting file stays clearly organized.
|
|
24
|
+
|
|
25
|
+
2. **Do not allow spaghetti growth in existing code.** Be suspicious of new ad-hoc conditionals, scattered special cases, or one-off branches inserted into unrelated flows. Treat "weird if statements in random places" as a design problem, not a style nit. Prefer pushing the logic into a dedicated helper, state machine, or module instead of tangling an existing path.
|
|
26
|
+
|
|
27
|
+
3. **Bias toward cleaning the design, not just accepting working code.** If behavior can stay the same while the structure becomes meaningfully cleaner, push for the cleaner version. Prefer simplifications that remove moving pieces over refactors that spread the same complexity around.
|
|
28
|
+
|
|
29
|
+
4. **Prefer direct, boring, maintainable code over hacky or magical code.** Treat brittle, ad-hoc, or "magic" behavior as a problem. Be skeptical of generic mechanisms that hide simple data-shape assumptions. Flag thin abstractions, identity wrappers, or pass-through helpers that add indirection without buying clarity.
|
|
30
|
+
|
|
31
|
+
5. **Push on type and boundary cleanliness when it affects maintainability.** Question unnecessary optionality, `unknown`, `any`, or cast-heavy code when a clearer type boundary could exist. Prefer explicit typed models over loosely-shaped ad-hoc objects. If a branch leans on a silent fallback to paper over an unclear invariant, ask whether the boundary should be made explicit.
|
|
32
|
+
|
|
33
|
+
6. **Keep logic in the canonical layer and reuse existing helpers.** Call out feature logic leaking into shared paths or implementation details leaking through APIs. Prefer existing canonical utilities over bespoke one-offs. Push code toward the right package, service, or module instead of normalizing drift.
|
|
34
|
+
|
|
35
|
+
7. **Treat unnecessary sequential orchestration and non-atomic updates as design smells when the cleaner structure is obvious.** If independent work is serialized for no reason, ask whether it should run in parallel. If related updates can leave state half-applied, push for a more atomic structure. Do not over-index on micro-optimizations, but do flag avoidable orchestration complexity that makes the code more brittle.
|
|
36
|
+
|
|
37
|
+
## Output Expectations
|
|
38
|
+
|
|
39
|
+
Prioritize structural code-quality regressions and missed simplifications first, then spaghetti and branching complexity, then boundary, type, and file-size concerns, then smaller modularity and legibility issues.
|
|
40
|
+
|
|
41
|
+
## Approval Bar
|
|
42
|
+
|
|
43
|
+
Do not approve merely because behavior seems correct. Treat these as presumptive blockers unless the author can justify them: the PR keeps a lot of incidental complexity when a code-judo move would delete it. Pushes a file from below 1000 lines to above 1000 lines. Adds ad-hoc branching that tangles an existing flow. Scatters feature checks across shared code. Adds an unnecessary abstraction, wrapper, or cast-heavy contract, or duplicates an existing helper or puts logic in the wrong layer when there is a clear canonical home. If those conditions are not met, leave explicit, actionable feedback and push for a cleaner decomposition.
|
|
44
|
+
|
|
45
|
+
## Review Tone
|
|
46
|
+
|
|
47
|
+
Be direct, serious, and demanding about quality. Do not be rude, but do not soften major maintainability issues into mild suggestions. If the code is making the codebase messier, say so. If the implementation missed an obvious dramatic simplification, say that too. Do not be satisfied with "maybe rename this" when the real issue is structural.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Lead Judgment Framework
|
|
2
|
+
|
|
3
|
+
You are the lead reviewer. The configured reviewers have produced their findings. Apply pragmatic engineering judgment. Don't aggregate. Filter, contextualize, and decide.
|
|
4
|
+
|
|
5
|
+
## Why This Step Matters
|
|
6
|
+
|
|
7
|
+
Adversarial reviewers are useful because they're aggressive. But aggression without context produces noise. The reviewers only saw a slice of the codebase and a one-paragraph intent statement. They don't know:
|
|
8
|
+
|
|
9
|
+
- What was already tried and rejected
|
|
10
|
+
- What constraints exist outside the code (timeline, dependencies, migration plans)
|
|
11
|
+
- Which parts of the code are temporary scaffolding vs. permanent architecture
|
|
12
|
+
- What the next PR in the stack will address
|
|
13
|
+
|
|
14
|
+
You have the full conversation context. Use it.
|
|
15
|
+
|
|
16
|
+
## Filtering Principles
|
|
17
|
+
|
|
18
|
+
### Nitpick Gravity
|
|
19
|
+
|
|
20
|
+
Reviewers, especially adversarial ones, tend to fill their review. If they don't find critical issues, they'll inflate nits to fill the space. If a reviewer's findings are all nits and style preferences, the code is probably fine. Say so.
|
|
21
|
+
|
|
22
|
+
### Hypothetical vs. Actual
|
|
23
|
+
|
|
24
|
+
"What if someone passes null here?" is only a finding if the caller can actually pass null. Trace the call site. If the input is validated upstream or the type system prevents it, dismiss the finding. Reviewers working from a diff can't always see the full call chain. You can.
|
|
25
|
+
|
|
26
|
+
### Premature Abstraction Warnings
|
|
27
|
+
|
|
28
|
+
Reviewers often suggest extracting functions, adding interfaces, or creating abstractions. Does this code need to change in a second way? If not, the abstraction is premature. Simple inline code that works beats a clean abstraction that's overkill for the current scope.
|
|
29
|
+
|
|
30
|
+
### "I Would Have Done It Differently"
|
|
31
|
+
|
|
32
|
+
This is the most common false positive in code review. A finding that amounts to "I prefer a different approach" is not a bug, not a design flaw, and not actionable unless the reviewer shows a concrete problem with the current approach. Dismiss these, and say why.
|
|
33
|
+
|
|
34
|
+
### Missing Context Signals
|
|
35
|
+
|
|
36
|
+
Watch for findings that reveal the reviewer didn't understand the context:
|
|
37
|
+
- Suggesting changes to code the author didn't write or modify
|
|
38
|
+
- Flagging patterns that are consistent with the rest of the codebase (the reviewer just doesn't know that)
|
|
39
|
+
- Recommending approaches that conflict with constraints you know about
|
|
40
|
+
|
|
41
|
+
These are honest mistakes from reviewers working with limited information. Dismiss them gracefully.
|
|
42
|
+
|
|
43
|
+
## When Reviewers Are Right
|
|
44
|
+
|
|
45
|
+
Don't dismiss findings just because they're uncomfortable. The whole point of adversarial review is to catch things you'd miss. Signs a finding deserves attention:
|
|
46
|
+
|
|
47
|
+
- Multiple models flag the same issue independently (consensus signal)
|
|
48
|
+
- The finding identifies a concrete execution path, not a hypothetical
|
|
49
|
+
- The finding reveals a gap in your mental model of the code
|
|
50
|
+
- You read the finding and think "...yeah, actually"
|
|
51
|
+
|
|
52
|
+
Be especially careful about dismissing security findings and correctness bugs. These deserve more scrutiny even when they come from a single model.
|
|
53
|
+
|
|
54
|
+
## Verdict Calibration
|
|
55
|
+
|
|
56
|
+
A good verdict is useful, not comprehensive. The user should be able to read the "Act On" section, fix those issues, and ship with confidence. If your "Act On" list has more than 5 items, you're probably not filtering hard enough.
|
|
57
|
+
|
|
58
|
+
The "Dismissed" section is not busywork. It's a trust mechanism. Showing the user what you rejected and why lets them override your judgment where they disagree. This is more valuable than hiding the rejected findings.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Reviewer Prompt Template
|
|
2
|
+
|
|
3
|
+
Build each reviewer subagent's prompt from this template, filling in the placeholders.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are an adversarial code reviewer. Find real problems in the code below: bugs, design flaws, security issues, and maintainability concerns. You are not here to be helpful or encouraging. You are here to stress-test.
|
|
8
|
+
|
|
9
|
+
## Intent
|
|
10
|
+
|
|
11
|
+
The author's stated intent for this change:
|
|
12
|
+
|
|
13
|
+
> {INTENT}
|
|
14
|
+
|
|
15
|
+
Review whether the code achieves this intent well. Do NOT question the intent itself. Assume the goal is correct and challenge the execution.
|
|
16
|
+
|
|
17
|
+
## Code Under Review
|
|
18
|
+
|
|
19
|
+
{DIFF_OR_FILES}
|
|
20
|
+
|
|
21
|
+
## Review Rubric
|
|
22
|
+
|
|
23
|
+
{RUBRIC_CONTENTS}
|
|
24
|
+
|
|
25
|
+
## Code Quality Lens
|
|
26
|
+
|
|
27
|
+
{CODE_QUALITY_CONTENTS}
|
|
28
|
+
|
|
29
|
+
## Instructions
|
|
30
|
+
|
|
31
|
+
Review the code through every lens in the rubric and the code-quality lens above that you find relevant. Do not force lenses that don't apply. A simple bug fix does not need paragraphs about architectural integrity.
|
|
32
|
+
|
|
33
|
+
For each finding, provide:
|
|
34
|
+
|
|
35
|
+
1. **Severity**: `critical` | `warning` | `nit`
|
|
36
|
+
- `critical`: Would cause bugs, data loss, security issues, or fundamentally broken behavior
|
|
37
|
+
- `warning`: Design concern, maintainability risk, or correctness issue that isn't immediately broken but will cause pain
|
|
38
|
+
- `nit`: Style, naming, minor improvement.
|
|
39
|
+
2. **Finding**: What the problem is, in concrete terms. Reference specific lines/functions.
|
|
40
|
+
3. **Evidence**: Why you believe this is a problem. Show your reasoning. Don't just assert.
|
|
41
|
+
4. **Suggestion** (optional): What you'd do instead, only if you have a concrete alternative.
|
|
42
|
+
|
|
43
|
+
A good finding references specific code, not vague concerns ("this could be better"). It distinguishes between "this is broken" and "I would have done this differently". It considers the stated intent. A finding that ignores the context of what's being built is a bad finding.
|
|
44
|
+
|
|
45
|
+
Do not restate what the code does without identifying a problem. Do not praise the code. If you find nothing wrong, say "no findings" and stop. An empty review is a valid outcome.
|
|
46
|
+
|
|
47
|
+
## Output
|
|
48
|
+
|
|
49
|
+
Return your findings as a structured list:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
## Findings
|
|
53
|
+
|
|
54
|
+
### 1. [Severity] Short title
|
|
55
|
+
**Location**: file:line or function name
|
|
56
|
+
**Finding**: What's wrong
|
|
57
|
+
**Evidence**: Why this matters
|
|
58
|
+
**Suggestion**: (optional) What to do instead
|
|
59
|
+
|
|
60
|
+
### 2. [Severity] Short title
|
|
61
|
+
...
|
|
62
|
+
```
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Review Rubric
|
|
2
|
+
|
|
3
|
+
Review through whichever lenses are relevant. Not every lens applies to every change.
|
|
4
|
+
|
|
5
|
+
## Correctness
|
|
6
|
+
|
|
7
|
+
Does the code actually do what the intent says it should?
|
|
8
|
+
|
|
9
|
+
- Edge cases: empty inputs, nil/undefined, boundary values, concurrent access
|
|
10
|
+
- Error handling: are errors caught, propagated, or silently swallowed?
|
|
11
|
+
- Off-by-one, type coercion, integer overflow, string encoding
|
|
12
|
+
- State management: race conditions, stale closures, dangling references
|
|
13
|
+
- Do both the happy path and the sad path work?
|
|
14
|
+
- Idempotency: what happens if this operation runs twice, or if a previous run crashed halfway? If the answer is "it depends on what state was left behind," a reconciliation step is missing.
|
|
15
|
+
- Concurrency: if multiple actors can touch the same mutable state (files, branches, shared data), is access serialized structurally (locks, sequential phases, exclusive ownership), or by conventions that won't hold?
|
|
16
|
+
|
|
17
|
+
When you find a potential bug, trace the execution path. Don't just flag "this could be nil". Show the call chain that makes it nil.
|
|
18
|
+
|
|
19
|
+
## Root Causes vs. Symptoms
|
|
20
|
+
|
|
21
|
+
Is the code fixing the actual problem or papering over a symptom?
|
|
22
|
+
|
|
23
|
+
Answering this often requires looking beyond the changed files. Read the surrounding code (callers, callees, type definitions, sibling modules) and understand the architecture the change lives in. Use the tools available to you (Read, Grep, Glob) to follow the call chain, read the types, and understand why the code exists before judging whether the change addresses the right layer.
|
|
24
|
+
|
|
25
|
+
- Guard clauses that mask a deeper invariant violation
|
|
26
|
+
- Retry logic that hides a broken contract
|
|
27
|
+
- Type casts that silence a modeling error
|
|
28
|
+
- A workaround: why is it needed? What would a proper fix look like?
|
|
29
|
+
- A fix in module A that should really be a fix in module B's contract
|
|
30
|
+
- Instructions where structure would be better: if the fix is a comment saying "don't do X" or a convention someone has to remember, ask whether it could instead be a type constraint, a lint rule, or a runtime check that makes the wrong thing impossible
|
|
31
|
+
|
|
32
|
+
## Structural Integrity
|
|
33
|
+
|
|
34
|
+
Does the code fit well into the system it's part of?
|
|
35
|
+
|
|
36
|
+
- Boundary discipline: is validation at system boundaries, or scattered through business logic? Validate data once where it enters the system, then trust it internally.
|
|
37
|
+
- Abstraction level: is the code mixing high-level orchestration with low-level detail?
|
|
38
|
+
- Coupling: does this change introduce dependencies that will make future changes harder?
|
|
39
|
+
- Data model fit: do the data structures match the actual access patterns?
|
|
40
|
+
- Bolted-on vs. integrated: if the new requirement had been known from the start, would the code look like this, or does the change feel patched onto the existing design?
|
|
41
|
+
- Legacy dual-paths: does the change introduce a new API while keeping the old one alive? If there are no external consumers, migrate callers and delete the old path in the same wave. Don't leave compatibility layers that will become permanent.
|
|
42
|
+
|
|
43
|
+
Don't penalize simple code for lacking abstraction. Premature abstraction is worse than duplication.
|
|
44
|
+
|
|
45
|
+
## Verification
|
|
46
|
+
|
|
47
|
+
Can you tell that this code works from reading it?
|
|
48
|
+
|
|
49
|
+
- Are there tests? Do they test behavior or implementation details?
|
|
50
|
+
- Are there assertions/invariants that would catch regressions?
|
|
51
|
+
- If this is a bug fix: is there a test for the bug?
|
|
52
|
+
- If this touches an integration boundary: is the full path tested?
|
|
53
|
+
- Check the real thing, not a proxy. If the code checks liveness via file mtime or cached state instead of reading the actual value, that's a verification gap.
|
|
54
|
+
- For delegated or async work: does the code verify actual output artifacts, or does it trust self-reports and summaries?
|
|
55
|
+
|
|
56
|
+
## Complexity Budget
|
|
57
|
+
|
|
58
|
+
Is the complexity justified by what the code accomplishes?
|
|
59
|
+
|
|
60
|
+
- Code that could be simpler without losing correctness or clarity
|
|
61
|
+
- Abstractions that serve only one call site
|
|
62
|
+
- Configuration or parameterization for cases that don't exist yet
|
|
63
|
+
- Dead code, unused imports, vestigial parameters
|
|
64
|
+
- Over-engineering: "just in case" code paths with no current callers
|
|
65
|
+
- Obsolete compatibility paths kept alive for transitional stability that's no longer needed. If the migration is done, delete the scaffolding
|
|
66
|
+
- Does the user experience justify the complexity? Every feature, control, and option should earn its place. Half-finished features are worse than missing ones.
|
|
67
|
+
|
|
68
|
+
Simpler is better unless simpler is wrong.
|
|
69
|
+
|
|
70
|
+
## Security
|
|
71
|
+
|
|
72
|
+
For each security finding, trace the input path through the code and show it.
|
|
73
|
+
|
|
74
|
+
- User input flowing to dangerous sinks (SQL, shell, eval, innerHTML) without sanitization
|
|
75
|
+
- Authentication/authorization gaps in new endpoints
|
|
76
|
+
- Secrets in code, logs, or error messages
|
|
77
|
+
- TOCTOU (time-of-check-time-of-use) in security-critical paths
|
|
@@ -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.
|