@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.
Files changed (44) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE.pstack +21 -0
  3. package/README.md +4 -0
  4. package/VENDOR_PSTACK.md +52 -0
  5. package/package.json +1 -1
  6. package/references/agent-session/customer-agents-block.md +5 -3
  7. package/references/agent-session/customer-architecture.mdc +1 -1
  8. package/references/agent-session/customer-code-review.md +2 -2
  9. package/references/agent-session/fleet-status.mjs +125 -0
  10. package/references/agent-session/production-merge.md +35 -19
  11. package/references/agent-session/projects.registry.json +5 -3
  12. package/references/agent-session/release-verification.md +82 -0
  13. package/skills/architect/SKILL.md +87 -0
  14. package/skills/architect/references/design-red-flags.md +57 -0
  15. package/skills/architect/references/rationale-template.md +35 -0
  16. package/skills/architect/references/runner-prompt.md +20 -0
  17. package/skills/blast-radius/SKILL.md +55 -0
  18. package/skills/coding-discipline/SKILL.md +2 -2
  19. package/skills/contentful-cms-core/SKILL.md +11 -0
  20. package/skills/how/SKILL.md +43 -0
  21. package/skills/how/references/explainer-prompt.md +55 -0
  22. package/skills/how/references/explorer-prompt.md +35 -0
  23. package/skills/interrogate/SKILL.md +78 -0
  24. package/skills/interrogate/references/code-quality-review.md +47 -0
  25. package/skills/interrogate/references/lead-judgment.md +58 -0
  26. package/skills/interrogate/references/reviewer-prompt.md +62 -0
  27. package/skills/interrogate/references/rubric.md +77 -0
  28. package/skills/principle-boundary-discipline/SKILL.md +38 -0
  29. package/skills/principle-encode-lessons-in-structure/SKILL.md +15 -0
  30. package/skills/principle-fix-root-causes/SKILL.md +27 -0
  31. package/skills/principle-guard-the-context-window/SKILL.md +16 -0
  32. package/skills/principle-make-operations-idempotent/SKILL.md +28 -0
  33. package/skills/principle-minimize-reader-load/SKILL.md +22 -0
  34. package/skills/principle-model-the-domain/SKILL.md +28 -0
  35. package/skills/principle-prove-it-works/SKILL.md +26 -0
  36. package/skills/principle-sequence-verifiable-units/SKILL.md +21 -0
  37. package/skills/principle-subtract-before-you-add/SKILL.md +22 -0
  38. package/skills/principle-test-behavior-not-implementation/SKILL.md +25 -0
  39. package/skills/principle-type-system-discipline/SKILL.md +22 -0
  40. package/skills/se-marketing-sites-smoke-test-setup/SKILL.md +27 -1
  41. package/skills/site-workflows-agent-session/SKILL.md +23 -10
  42. package/skills/tdd/SKILL.md +46 -0
  43. package/skills/typescript-best-practices/SKILL.md +35 -0
  44. package/skills/typescript-best-practices/references/patterns.md +324 -0
@@ -0,0 +1,35 @@
1
+ # Rationale template
2
+
3
+ The prose that ships alongside the type sketch. One page. Sentence-case headings, no boilerplate. Replace the italic notes with actual content.
4
+
5
+ ## Problem
6
+
7
+ *One paragraph. What we're trying to do, and what about the existing system or constraints makes the shape non-obvious. If [Phase A](../SKILL.md#phase-a-ground-the-problem) surfaced constraints the design must honor (existing types to interop with, callers we can't break, invariants that crossed our boundary), name them here so the reader sees the same constraints you saw.*
8
+
9
+ ## Usage (caller's view)
10
+
11
+ *Write this first, before the type sketch. Show the README or quickstart the consumer reads, plus two or three realistic call sites in their own code. What they import, what they call, what comes back. The type sketch in [Shape](#shape) is derived from this. The two must agree. When they diverge, reconcile the sketch to the usage, not the reverse. The caller's experience is the spec. The types serve it.*
12
+
13
+ ## Shape
14
+
15
+ *The recommended architecture. Data structures first. Then how data flows through the signatures. Name the load-bearing decisions. State which invariants are encoded in types, where validation lives, and what the system deliberately does not do. Judge interface depth explicitly. State what complexity the public surface hides, what remains exposed to callers, and why the interface is no larger than needed. Cite the principle behind each decision (e.g., `per boundary-discipline`). Don't restate it.*
16
+
17
+ ## Synthesis decision
18
+
19
+ *Filled in by the Phase B single-model sketch pass (SE Studio trial: arena disabled). Records which candidate became the base and why, what was adapted from each of the others, and what was rejected and why.*
20
+
21
+ ## Tradeoffs accepted
22
+
23
+ *One bullet per tradeoff the chosen shape makes. Form: "we accept X in exchange for Y." Name anything a future reader might mistake for an oversight, including things that look like premature optimization or premature simplification.*
24
+
25
+ ## Alternatives considered
26
+
27
+ *Required. Name at least one concrete alternative shape, with one line on why it lost. Judge each alternative on interface depth, not implementation simplicity alone. Name the complexity it exposes to callers and the complexity it hides. Two or three alternatives belong here when the design space had real contenders. One is fine when the constraints forced the answer, with the conclusion phrased as "this was the only viable shape because..." Avoid listing flavors of the same shape. This section covers design alternatives the chosen shape considered and rejected, not other runner candidates.*
28
+
29
+ ## Open questions and risks
30
+
31
+ *Things you noticed during the sketch that the human needs to weigh in on, and risks worth flagging before implementation starts. Phrase as questions, not assertions, so the human's answer is the resolution rather than a comment.*
32
+
33
+ ## Next implementation step
34
+
35
+ *The first thing to build against the sketch. One sentence. What you'd start writing immediately after synthesis (or after Phase D sign-off, if a checkpoint was opted into).*
@@ -0,0 +1,20 @@
1
+ # Architect runner prompt
2
+
3
+ **SE Studio trial:** Phase B uses a **single** Auto/`inherit-parent` sketch agent (arena disabled). The orchestrator passes this file to that one agent and fills in the variable inputs: the task, the Phase A grounding artifacts, the working directory, and the path to write outputs. The working directory is a git worktree when available, otherwise a subdirectory under the sketch dir.
4
+
5
+ You are producing candidate designs in architect's single-model sketch pass. Read the **architect** skill in full first. That's the workflow you're inside. Produce **at least two structurally distinct** candidate design packages (whole-shape alternatives, not point fixes), then synthesize one recommended package: type sketch, function signatures, module map, and prose rationale shaped per [`rationale-template.md`](rationale-template.md). Do not spawn further Task agents or invoke `arena` / `swarm`.
6
+
7
+ Apply the following discipline. Compare candidates on these axes when synthesizing.
8
+
9
+ - Caller's usage first. Write the README-style usage and two or three real call sites before the types, then derive the type sketch from them. The usage is the spec. The two must agree, so reconcile the sketch to the usage, not the reverse.
10
+ - Data structures first. Get the core types right and the code becomes obvious. Trace each dominant access pattern through the proposed structure. If the answer is "we'll add a map / index / cache later," the structure is wrong.
11
+ - Interface depth. Compare the capability hidden behind the public surface relative to the size of that surface. Prefer a simple interface that pulls complexity into the callee, even when the implementation becomes less simple. Do not put transport or wire types on the public API. Parse into domain types behind the interface.
12
+ - Shared state: if two actors might both write, ask "what happens?" If the answer isn't "nothing," default to per-actor state with a merge at the read boundary. If a **separate-before-serializing-shared-state** principle skill is installed, follow it; otherwise apply that idea inline and do not hunt for or install the missing skill.
13
+ - Make boundaries visible. `not implemented` errors for bodies, `// TODO` pseudocode for tricky logic, doc comments stating intent and invariants. A reader should trace data from input to output by reading types and signatures alone.
14
+ - Encode invariants in types: hard-to-misuse types > runtime checks > prose comments, per the **encode-lessons-in-structure** principle skill.
15
+ - Validate at boundaries, trust types inside, per the **boundary-discipline** principle skill. Business logic as pure functions. The shell stays thin.
16
+ - Single source of truth per invariant. Derive instead of sync.
17
+ - Idempotent state transitions where applicable, per the **make-operations-idempotent** principle skill. Ask what happens if the operation runs twice or crashes halfway.
18
+ - Short call chains. If tracing the flow needs more than three files, flatten the hierarchy. Prefer **minimize-reader-load**. If a **laziness-protocol** principle skill is installed, also follow it; otherwise apply the short-call-chain idea inline and do not hunt for or install the missing skill.
19
+
20
+ Produce the best designs you can on this model. Keep the candidates structurally distinct so synthesis has a real signal — converging on a safe-looking middle before exploring alternatives defeats the sketch.
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: blast-radius
3
+ description: "Find what a change could break somewhere else before it ships, beyond the diff, and prove the one fact it's safe because of by running real code instead of writing it up. Use for 'blast radius of X', 'what could this break', or reviewing a small diff you don't trust."
4
+ ---
5
+
6
+ # Blast radius
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:** no `arena` / `swarm`; optional second Auto reviewer only. Soft-deps **`why`** / **`unslop`**: **skip if not installed** (neither is in this trial). Apply the idea inline; do not hunt for, install, or fail because the skill directory is missing. Do not run `setup-pstack`.
13
+
14
+ Find what a change breaks somewhere else, before it ships. Use for "blast radius of X", "what could this break", or reviewing a small diff you don't trust yet.
15
+
16
+ Companion to `how` and (when installed) `why`. `how` tells you what the code does. `why` (if present) tells you why it's shaped that way; if `why` is missing, infer motivation from PR/commit history. Blast radius tells you what it breaks somewhere else.
17
+
18
+ Listing the callers is not the job. The agent can grep those in a second. The job is the breakage grep won't show you.
19
+
20
+ ## Don't trust your own writeup
21
+
22
+ A blast-radius writeup that sounds right is worthless. It reads as convincing whether or not it's true. So don't hand back the writeup. Find the one or two facts the whole thing depends on and prove them by running code.
23
+
24
+ ### How sure are you
25
+
26
+ For each fact the change's safety depends on, get it as far down this list as is cheap, and say where it stopped.
27
+
28
+ 1. You said so. Worthless on its own.
29
+ 2. You pointed at the line. A real `file:line`, or the library's own source.
30
+ 3. You showed the bad case can't happen. You walked the failure step by step and it doesn't reach.
31
+ 4. You ran it. A script or test that calls the real code and fails loud if you're wrong.
32
+ 5. You reproduced it in the running app.
33
+
34
+ Step 4 is usually one small script that imports the same library the app ships and calls the exact function you're worried about.
35
+
36
+ ## Steps
37
+
38
+ 1. Read the change. The diff, the symbols it adds, changes, and deletes, and what it now does differently, including the part the diff doesn't spell out. If a **`why`** skill is installed, use its step 2 to pull the PR and commits; otherwise pull PR/commit history yourself (**skip if `why` missing**).
39
+ 2. Find the one fact it's safe because of. Most changes that look risky are safe because of a single fact, like "this call only drops already-dead cache entries and does nothing else". Find that fact. If it holds, most risky cases are cleared at once. Spend your time here, not on a long list of maybes.
40
+ 3. Look where grep stops. Read the source of the library you call, and check its pinned version and any local patch. Work out when things run: microtasks, unmount and teardown, Solid versus React. Follow what a symbol search misses: the JSON an API returns, a DB column, a wire format, another language reading the same bytes, a feature flag, code three hops downstream.
41
+ 4. Be honest about each risk. Give it a real chance of happening and a real cost if it does. Keep the risks you confirmed. List the ones you checked and cleared separately. Same honesty bar as `why` (cite real `file:line`, a search that finds nothing is still an answer, never invent callers) — apply that bar yourself when **`why` is not installed**.
42
+ 5. Prove the one fact. Write a script or test that runs the real code, run it, and paste what happened.
43
+ 6. For a big or wide change, spawn a second Auto/`inherit-parent` readonly Task with the same question and merge the answers (panel ≤2). Do **not** invoke the `arena` or `swarm` skills.
44
+
45
+ ## What to hand back
46
+
47
+ - **What it does.** What changed, including the part that isn't obvious.
48
+ - **The one fact it's safe because of.** State it, say which step you got it to, and show the proof. If you couldn't prove it, write unproven.
49
+ - **Risks.** Each names how it breaks, the `file:line`, how likely and how bad, and how to check. Paste the proof for the ones that matter.
50
+ - **Cleared.** What you checked and why it's fine.
51
+ - **Before you merge.** The cheapest test or repro that catches the real bug, including the script you wrote.
52
+
53
+ Cite real code, strip private material before anything goes public, and keep the writeup tight (no filler). **`unslop` is not in this trial** — **skip if missing**; apply that tight-writeup bar yourself.
54
+
55
+ **Reply:** the writeup above, with the one safety fact either proven or marked unproven.
@@ -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