diff --git a/CHANGELOG.md b/CHANGELOG.md index 02a2a85..ca9b71d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ summary: Timeline of guardrail helper changes mirrored from Sweetistics and rela # Changelog +## 2026-08-19 — Diagnosis, Design, and Writing Skills +- Added Matt Pocock's `diagnosing-bugs` workflow plus minimally adapted Codex-native copies of PStack's `architect` and `blast-radius`, and an unchanged PStack `unslop` workflow, with upstream attribution, MIT notices, UI metadata, validation, and local skill-mirror discovery. + ## 2026-08-12 — Agent Performance Audit - Added a reusable personal skill and deterministic CLI for repository-scoped Codex-history audits with separate Claude activity coverage, injected-prompt exclusion, correction and shell-tool-output denominators, cumulative-delta per-turn token accounting, baseline comparisons, redacted causal notes, privacy validation, and self-contained local HTML reports. diff --git a/skills/architect/LICENSE b/skills/architect/LICENSE new file mode 100644 index 0000000..6b54002 --- /dev/null +++ b/skills/architect/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Lauren Tan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/skills/architect/SKILL.md b/skills/architect/SKILL.md new file mode 100644 index 0000000..bad3389 --- /dev/null +++ b/skills/architect/SKILL.md @@ -0,0 +1,86 @@ +--- +name: architect +description: "Sketch types, signatures, and module structure before code. Use for $architect, architecture design, or non-trivial work where coding first risks the wrong shape." +--- + +# Architect + +_Source: [PStack](https://github.com/cursor/plugins/tree/main/pstack/skills/architect), MIT license. Adapted only where its original orchestration assumes Cursor-specific skills or model configuration._ + +Design before implementing. Sketch types, function signatures, class shapes, and module boundaries with `not implemented` bodies and pseudocode. Synthesize across multiple perspectives, then fill in code against the chosen sketch. If implementation proves the sketch wrong, throw it out and redesign. + +## Start + +Open a task plan with one entry per phase before starting. Autonomous mode without checkpoints needs the list to show phase position and keep phases from silently disappearing. + +1. Ground +2. Sketch +3. Agree +4. Implement +5. Scrap + +## Phase A: Ground the problem + +Build a real mental model of every system the new code touches. If the `how` skill is available, run it over the relevant subsystems; otherwise trace the callers, data flow, state transitions, and runtime behavior directly. Use critique mode if existing structure is the constraint or the design must push back on it. + +Naming a file isn't grounding. Produce a traced model. If the design redefines ownership or layering, use the `why` skill when available; otherwise inspect documentation, history, issues, and source rationale so the existing shape becomes a constraint, not a guess. + +Skip Phase A only when the work is genuinely greenfield with no surrounding system to integrate. + +## Phase B: Sketch + +Produce at least two structurally distinct design candidates before synthesis, even when the first looks sufficient. Whole-shape alternatives, not point fixes inside one shape. + +If the `arena` skill is available, run it with the design-sketch task, the Phase A grounding artifacts, and `references/runner-prompt.md`. If it is unavailable, produce the alternatives directly. When the user explicitly requests parallel agent work, independent Codex agents may each produce one candidate using that runner prompt. + +Each candidate produces a design package shaped per `references/rationale-template.md`: the caller's usage written first, then the type sketch, function signatures, module map, and prose rationale derived from it. + +Screen every candidate against [`references/design-red-flags.md`](references/design-red-flags.md) before synthesis. Reject or revise shallow modules, information leakage, temporal decomposition, and pass-through methods. + +Compare viable candidates on interface depth. Prefer the design that hides more complexity behind a smaller, simpler public surface. A rich interface can keep call chains short by concentrating capability instead of scattering it across layers. + +Synthesize one design package and populate the rationale's "Synthesis decision" section. + +## Phase C: Agree (opt-in) + +For a design-only or review-only request, return the synthesized design package and stop. Enter Phase D only when the original request includes implementation, building, or fixing. + +For implementation requests, proceed directly with the synthesized design by default. No human checkpoint. + +Opt in to a checkpoint when the invoker explicitly asks: "$architect with checkpoint", "stop and show me before implementing", or similar. Then surface the synthesized design and pause for sign-off. + +The synthesis can ship as its own commit either way. Subsequent commits fill in bodies against a stable contract. Planned and scoped breakage during fill-in is fine. For adversarial pressure on the design before implementing, use the `interrogate` skill when available or an explicitly requested independent review. + +If the human pushes back on the shape, treat that as Phase A evidence. Re-ground and re-run Phase B before writing more code. + +## Phase D: Implement against the sketch + +Replace `not implemented` bodies with code, pseudocode with logic. The synthesized sketch is the contract. + +Deviations from the sketch are signal worth surfacing, not friction to absorb silently. If a function needs a parameter the sketch didn't anticipate, ask whether the sketch was wrong, the requirement was missed, or the implementation is overreaching. Surface it; don't bolt it on. + +## Phase E: Scrap when the architecture is wrong + +If implementation keeps producing friction the sketch can't absorb, throw the sketch out. Don't bolt fixes onto a wrong design. + +The signal is a *pattern*, not single instances. Tells: + +- The same shape of workaround appearing repeatedly across unrelated code. +- Multiple unrelated edge cases that all need special-case branches. +- Types that need escape hatches (`any`, casts, optional fields always set in practice) to compile. +- The "we need a lock" reflex when the sketch said the state wasn't shared. +- Callers having to know the abstraction's internal rules to use it. +- Two or more independent Phase D deviations of the same shape across the implementation. + +Use judgment. A few edge cases don't condemn an architecture. Some problems are legitimately complex; complexity in the data is not complexity in the design. The rewrite signal is repeated friction of the same shape, not single hard cases. + +When you scrap: + +1. Re-ground over what's been built. The implementation lessons enter the new design as inputs, not vibes. +2. Redesign as if the new constraints had been day-one assumptions. +3. Subtract before adding. The new sketch should be smaller than the old one before it grows. +4. Return to Phase B. + +## Outputs + +Write the caller's usage first and derive the type sketch from it. Use one file with new types and signatures for small changes; use a module map plus type definitions for larger work. Ship the rationale alongside, shaped per `references/rationale-template.md`, including the usage sketch and synthesis decision. diff --git a/skills/architect/agents/openai.yaml b/skills/architect/agents/openai.yaml new file mode 100644 index 0000000..50c734f --- /dev/null +++ b/skills/architect/agents/openai.yaml @@ -0,0 +1,6 @@ +interface: + display_name: "Architect" + short_description: "Sketch interfaces and module structure" + default_prompt: "Use $architect to sketch and compare architecture before implementing this change." +policy: + allow_implicit_invocation: false diff --git a/skills/architect/references/design-red-flags.md b/skills/architect/references/design-red-flags.md new file mode 100644 index 0000000..32cb240 --- /dev/null +++ b/skills/architect/references/design-red-flags.md @@ -0,0 +1,33 @@ +# Design red flags + +Screen every candidate before synthesis. A red flag is a reason to revise or reject the shape. + +## Shallow module + +A shallow module exposes a large interface while hiding little complexity. Judge depth by the capability and policy hidden behind the public surface relative to the size of that surface. Prefer a simple interface backed by substantial behavior. + +Do not confuse a deep module with a deep call chain. A deep call chain scatters understanding across layers. A deep module concentrates capability behind one interface. + +Look for these signs: + +- Callers coordinate several methods to complete one operation. +- Public options expose internal stages or implementation choices. +- Learning the interface does not save the caller from learning the implementation. + +## Information leakage + +Information leakage makes multiple modules depend on the same internal decision. A representation, policy, or protocol detail appears in more than one place, so changing it requires coordinated edits. + +Public re-exports of transport or wire types are leakage. Parse external data into domain types behind the interface. Keep storage schemas, framework objects, and protocol details private. + +## Temporal decomposition + +Temporal decomposition organizes modules by execution order instead of the knowledge they own. Separate load, validate, transform, and save stages often repeat one representation and its invariants across several boundaries. + +Group code around domain knowledge and ownership. Methods that run at different times can still belong to one module when they protect the same decisions. + +## Pass-through method + +A pass-through method forwards the same arguments to another method with the same shape. It adds a layer without hiding complexity. + +Remove it or move responsibility to the module that can complete the operation. Keep a forwarding boundary only when it adds policy, adaptation, or a distinct abstraction. diff --git a/skills/architect/references/rationale-template.md b/skills/architect/references/rationale-template.md new file mode 100644 index 0000000..7a718ef --- /dev/null +++ b/skills/architect/references/rationale-template.md @@ -0,0 +1,35 @@ +# Rationale template + +The prose that ships alongside the type sketch. One page. Sentence-case headings, no boilerplate. Replace the italic notes with actual content. + +## Problem + +*One paragraph. What we're trying to do, and what about the existing system or constraints makes the shape non-obvious. If Phase A surfaced constraints the design must honor, name them here so the reader sees the same constraints you saw.* + +## Usage (caller's view) + +*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 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.* + +## Shape + +*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.* + +## Synthesis decision + +*Record which candidate became the base and why, what was adapted from the others, and what was rejected and why.* + +## Tradeoffs accepted + +*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.* + +## Alternatives considered + +*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.* + +## Open questions and risks + +*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.* + +## Next implementation step + +*The first thing to build against the sketch. One sentence.* diff --git a/skills/architect/references/runner-prompt.md b/skills/architect/references/runner-prompt.md new file mode 100644 index 0000000..5741e06 --- /dev/null +++ b/skills/architect/references/runner-prompt.md @@ -0,0 +1,20 @@ +# Architect runner prompt + +Use this prompt for each independent candidate in Phase B. Pass the task and Phase A grounding artifacts. The runner is read-only and returns one candidate design package; it does not edit the repository. + +Read the **architect** skill in full first. Output a candidate design package: type sketch, function signatures, module map, and prose rationale shaped per [`rationale-template.md`](rationale-template.md). + +Apply this discipline: + +- Caller's usage first. Write README-style usage and two or three real call sites before the types, then derive the type sketch from them. +- Data structures first. Trace each dominant access pattern through the proposed structure. +- Interface depth. Prefer a simple interface that pulls complexity into the callee. Parse transport or wire types into domain types behind the interface. +- Shared state. If two actors might both write, ask what happens. Prefer per-actor state with a merge at the read boundary when sharing is not a real invariant. +- Make boundaries visible. Use `not implemented` bodies, pseudocode for tricky logic, and concise intent/invariant comments. +- Encode invariants in types where practical. Prefer hard-to-misuse types over runtime checks or prose. +- Validate at boundaries and trust types inside. Keep business logic pure and the shell thin. +- Keep a single source of truth per invariant. Derive instead of synchronizing. +- Prefer idempotent state transitions. Ask what happens if an operation runs twice or crashes halfway. +- Keep call chains short. If tracing the flow needs more than three files, consider flattening the hierarchy. + +Produce one strong, structurally distinct candidate. Do not hedge toward a safe-looking middle; differences between candidates are the exploration signal. diff --git a/skills/blast-radius/LICENSE b/skills/blast-radius/LICENSE new file mode 100644 index 0000000..6b54002 --- /dev/null +++ b/skills/blast-radius/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Lauren Tan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/skills/blast-radius/SKILL.md b/skills/blast-radius/SKILL.md new file mode 100644 index 0000000..f5e2b34 --- /dev/null +++ b/skills/blast-radius/SKILL.md @@ -0,0 +1,51 @@ +--- +name: blast-radius +description: "Find what a change could break elsewhere before it ships, beyond the diff, and prove its key safety assumption by running real code." +--- + +# Blast radius + +_Source: [PStack](https://github.com/cursor/plugins/tree/main/pstack/skills/blast-radius), MIT license. Adapted only to make optional PStack companion skills non-blocking._ + +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. + +Companion to `how` and `why` when those skills are available. `how` tells you what the code does. `why` tells you why it's shaped that way. Blast radius tells you what it breaks somewhere else. When either companion is unavailable, perform that investigation directly. + +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. + +## Don't trust your own writeup + +A blast-radius writeup that sounds right is worthless. It reads as convincing whether or not it's true, and that is the trap you are walking into. So don't hand back the writeup. Find the one or two facts the whole thing depends on and prove them by running code. Words are where you start, not what you ship. + +### How sure are you + +For each fact the change's safety depends on, get it as far down this list as is cheap, and say where it stopped. + +1. You said so. Worthless on its own. +2. You pointed at the line. A real `file:line`, or the library's own source. +3. You showed the bad case can't happen. You walked the failure step by step and it doesn't reach. +4. You ran it. A script or test that calls the real code and fails loud if you're wrong. +5. You reproduced it in the running app. + +Any safety fact you can't get to step 4, say so out loud. Don't write it up as settled. Step 4 is usually one small script that imports the same library the app ships and calls the exact function you're worried about. + +## Steps + +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 `why` is available, use its source/history inspection; otherwise inspect the PR, commits, documentation, and history directly. +2. Find the one fact it's safe because of. Most changes that look scary 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 of the scary cases die at once. Spend your time here, not on a long list of maybes. +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. +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. Cite a real `file:line`; a search that finds nothing is still an answer. Never make up a caller or an API. +5. Prove the one fact. Write a script or test that runs the real code, run it, and paste what happened. If you can't prove it cheaply, mark it unproven. Don't round up. +6. For a big or wide change, use `arena` when available. Otherwise use independent Codex agents only when the user explicitly requests parallel agent work, then merge the answers. + +## What to hand back + +- **What it does.** What changed, including the part that isn't obvious. +- **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. +- **Risks.** Only the real ones. 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. +- **Cleared.** What you checked and why it's fine. +- **Before you merge.** The cheapest test or repro that catches the real bug, including the script you wrote. + +Write it through `unslop`, cite real code, and strip anything private before it goes anywhere public. + +**Reply:** the writeup above, with the one safety fact either proven or marked unproven. diff --git a/skills/blast-radius/agents/openai.yaml b/skills/blast-radius/agents/openai.yaml new file mode 100644 index 0000000..6c52ae0 --- /dev/null +++ b/skills/blast-radius/agents/openai.yaml @@ -0,0 +1,6 @@ +interface: + display_name: "Blast Radius" + short_description: "Find and prove downstream change risks" + default_prompt: "Use $blast-radius to find what this change could break elsewhere and prove its key safety assumption." +policy: + allow_implicit_invocation: false diff --git a/skills/diagnosing-bugs/LICENSE b/skills/diagnosing-bugs/LICENSE new file mode 100644 index 0000000..f1dd2c0 --- /dev/null +++ b/skills/diagnosing-bugs/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Matt Pocock + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/skills/diagnosing-bugs/SKILL.md b/skills/diagnosing-bugs/SKILL.md new file mode 100644 index 0000000..4349b49 --- /dev/null +++ b/skills/diagnosing-bugs/SKILL.md @@ -0,0 +1,142 @@ +--- +name: diagnosing-bugs +description: "Diagnosis loop for hard bugs and performance regressions. Use when the user says diagnose/debug this, or reports something broken, throwing, failing, or slow." +--- + +# Diagnosing Bugs + +_Source: [mattpocock/skills](https://github.com/mattpocock/skills/tree/main/skills/engineering/diagnosing-bugs), MIT license._ + +A discipline for hard bugs. Skip phases only when explicitly justified. + +When exploring the codebase, read `CONTEXT.md` (if it exists) to get a clear mental model of the relevant modules, and check ADRs in the area you're touching. + +## Redact + +This skill has you show commands, outputs and captured artifacts. **Redact every secret first** — write `` in its place. Build loops against env vars, so the credential stays in the environment rather than in what you show. Captured artifacts carry auth headers: quote only the lines that carry the signal. + +If the redacted output is not enough to diagnose the bug, say so and ask the user. + +## Phase 1 — Build a feedback loop + +**This is the skill.** Everything else is mechanical. If you have a **tight** pass/fail signal for the bug — one that goes red on _this_ bug — you will find the cause; bisection, hypothesis-testing, and instrumentation all just consume it. If you don't have one, no amount of staring at code will save you. + +Spend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.** + +### Ways to construct one — try them in roughly this order + +1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e. +2. **Curl / HTTP script** against a running dev server. +3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot. +4. **Headless browser script** (Playwright / Puppeteer) — drives the UI, asserts on DOM/console/network. +5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation. +6. **Throwaway harness.** Spin up a minimal subset of the system (one service, mocked deps) that exercises the bug code path with a single function call. +7. **Property / fuzz loop.** If the bug is "sometimes wrong output", run 1000 random inputs and look for the failure mode. +8. **Bisection harness.** If the bug appeared between two known states (commit, dataset, version), automate "boot at state X, check, repeat" so you can `git bisect run` it. +9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs. +10. **HITL bash script.** Last resort. If a human must click, give _them_ `scripts/hitl-loop.template.sh` to run in their terminal so the loop is still structured. They return the captured output to you. + +Build the right feedback loop, and the bug is 90% fixed. + +### Tighten the loop + +Treat the loop as a product. Once you have _a_ loop, **tighten** it: + +- Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.) +- Can I make the signal sharper? (Assert on the specific symptom, not "didn't crash".) +- Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.) + +A 30-second flaky loop is barely better than no loop; a 2-second deterministic one is tight — a debugging superpower. + +### Non-deterministic bugs + +The goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100×, parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not — keep raising the rate until it's debuggable. + +### When you genuinely cannot build a loop + +Stop and say so explicitly. List what you tried. Ask the user for: (a) access to whatever environment reproduces it, (b) a redacted captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or (c) permission to add temporary production instrumentation. Do **not** proceed to hypothesise without a loop. + +### Completion criterion — a tight loop that goes red + +Phase 1 is done when the loop is **tight** and **red-capable**: you can name **one command** — a script path, a test invocation, a curl — that you have **already run at least once** (show the invocation and its output, redacted), and that is: + +- [ ] **Red-capable** — it drives the actual bug code path and asserts the **user's exact symptom**, so it can go red on this bug and green once fixed. Not "runs without erroring" — it must be able to _catch this specific bug_. +- [ ] **Deterministic** — same verdict every run (flaky bugs: a pinned, high reproduction rate, per above). +- [ ] **Fast** — seconds, not minutes. +- [ ] **Agent-runnable** — you can run it unattended; otherwise hand `scripts/hitl-loop.template.sh` to the user and ask them to return its captured output. + +If you catch yourself reading code to build a theory before this command exists, **stop — jumping straight to a hypothesis is the exact failure this skill prevents.** No red-capable command, no Phase 2. + +## Phase 2 — Reproduce + minimise + +Run the loop. Watch it go red — the bug appears. + +Confirm: + +- [ ] The loop produces the failure mode the **user** described — not a different failure that happens to be nearby. Wrong bug = wrong fix. +- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against). +- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it. + +### Minimise + +Once it's red, shrink the repro to the **smallest scenario that still goes red**. Cut inputs, callers, config, data, and steps **one at a time**, re-running the loop after each cut — keep only what's load-bearing for the failure. + +Why bother: a minimal repro shrinks the hypothesis space in Phase 3 (fewer moving parts left to suspect) and becomes the clean regression test in Phase 5. + +Done when **every remaining element is load-bearing** — removing any one of them makes the loop go green. + +Do not proceed until you have reproduced **and** minimised. + +## Phase 3 — Hypothesise + +Generate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea. + +Each hypothesis must be **falsifiable**: state the prediction it makes. + +> Format: "If is the cause, then will make the bug disappear / will make it worse." + +If you cannot state the prediction, the hypothesis is a vibe — discard or sharpen it. + +**Show the ranked list to the user before testing.** They often have domain knowledge that re-ranks instantly ("we just deployed a change to #3"), or know hypotheses they've already ruled out. Cheap checkpoint, big time saver. Don't block on it — proceed with your ranking if the user is AFK. + +## Phase 4 — Instrument + +Each probe must map to a specific prediction from Phase 3. **Change one variable at a time.** + +Tool preference: + +1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs. +2. **Targeted logs** at the boundaries that distinguish hypotheses. +3. Never "log everything and grep". + +**Tag every debug log** with a unique prefix, e.g. `[DEBUG-a4f2]`. Cleanup at the end becomes a single grep. Untagged logs survive; tagged logs die. + +**Perf branch.** For performance regressions, logs are usually wrong. Instead: establish a baseline measurement (timing harness, `performance.now()`, profiler, query plan), then bisect. Measure first, fix second. + +## Phase 5 — Fix + regression test + +Run this phase only when the user requested implementation or a fix. For a diagnosis-only request, stop after reporting the root cause, evidence, and recommended fix; do not modify the repository. + +Write the regression test **before the fix** — but only if there is a **correct seam** for it. + +A correct seam is one where the test exercises the **real bug pattern** as it occurs at the call site. If the only available seam is too shallow (single-caller test when the bug needs multiple callers, unit test that can't replicate the chain that triggered the bug), a regression test there gives false confidence. + +**If no correct seam exists, that itself is the finding.** Note it. The codebase architecture is preventing the bug from being locked down. Flag this for the next phase. + +If a correct seam exists: + +1. Turn the minimised repro into a failing test at that seam. +2. Watch it fail. +3. Apply the fix. +4. Watch it pass. +5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario. + +## Phase 6 — Cleanup + +Required before declaring done: + +- [ ] Original repro no longer reproduces (re-run the Phase 1 loop) +- [ ] Regression test passes (or absence of seam is documented) +- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix) +- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location) +- [ ] The hypothesis that turned out correct is stated in the commit / PR message — so the next debugger learns diff --git a/skills/diagnosing-bugs/agents/openai.yaml b/skills/diagnosing-bugs/agents/openai.yaml new file mode 100644 index 0000000..c50de6b --- /dev/null +++ b/skills/diagnosing-bugs/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "Diagnosing Bugs" + short_description: "Diagnose hard bugs and regressions" + default_prompt: "Use $diagnosing-bugs to build a tight reproduction loop, find the root cause, and verify the fix." diff --git a/skills/diagnosing-bugs/scripts/hitl-loop.template.sh b/skills/diagnosing-bugs/scripts/hitl-loop.template.sh new file mode 100755 index 0000000..0582255 --- /dev/null +++ b/skills/diagnosing-bugs/scripts/hitl-loop.template.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# Human-in-the-loop reproduction loop. +# Copy this file, edit the steps below, and run it. +# The user runs the script in their terminal and returns the Captured block to +# the agent. Do not run it inside an agent-owned process session. +# +# Usage: +# bash hitl-loop.template.sh +# +# Two helpers: +# step "" → show instruction, wait for Enter +# capture VAR "" → show question, read lines until terminator +# +# At the end, captured values are printed as KEY=VALUE for the agent to parse. +# +# `capture` prints its value back to the terminal, where the agent reads it — so +# capture observations, and leave signing in to the user as a `step`. + +set -euo pipefail + +step() { + printf '\n>>> %s\n' "$1" + read -r -p " [Enter when done] " _ +} + +capture() { + local var="$1" question="$2" answer="" line + printf '\n>>> %s\n' "$question" + printf ' Enter one or more lines, then type __END_CAPTURE__ on its own line.\n' + while IFS= read -r line; do + [[ "$line" == "__END_CAPTURE__" ]] && break + [[ -z "$answer" ]] || answer+=$'\n' + answer+="$line" + done + printf -v "$var" '%s' "$answer" +} + +# --- edit below --------------------------------------------------------- + +step "Open the app at http://localhost:3000 and sign in." + +capture ERRORED "Click the 'Export' button. Did it throw an error? (y/n)" + +capture ERROR_MSG "Paste the error message (or 'none'):" + +# --- edit above --------------------------------------------------------- + +printf '\n--- Captured ---\n' +printf 'ERRORED=%q\n' "$ERRORED" +printf 'ERROR_MSG=%q\n' "$ERROR_MSG" diff --git a/skills/unslop/LICENSE b/skills/unslop/LICENSE new file mode 100644 index 0000000..6b54002 --- /dev/null +++ b/skills/unslop/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Lauren Tan + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/skills/unslop/SKILL.md b/skills/unslop/SKILL.md new file mode 100644 index 0000000..51b2ab9 --- /dev/null +++ b/skills/unslop/SKILL.md @@ -0,0 +1,82 @@ +--- +name: unslop +description: "Cut AI tells from any writing. Must always apply." +--- + +# Unslop + +_Source: [PStack](https://github.com/cursor/plugins/tree/main/pstack/skills/unslop), MIT license._ + +Edit text to remove AI patterns and add human voice. + +## Process + +1. Scan for the patterns below. +2. Rewrite. Preserve meaning, match intended tone. +3. Add soul (see next section). +4. Self-audit: "What makes this obviously AI generated?" Fix remaining tells. + +## Adding soul + +Removing patterns is half the job. Sterile, voiceless writing is just as obvious. + +- **Have opinions.** React to facts instead of neutrally listing pros and cons. +- **Vary rhythm.** Short sentences. Then longer ones that take their time. Mix it up. +- **Acknowledge complexity.** "Impressive but also kind of unsettling" beats "impressive." +- **Use "I" when it fits.** First person isn't unprofessional. +- **Let some mess in.** Perfect structure looks machine-made. +- **Be specific.** Not "this is concerning" but "there's something unsettling about agents churning away at 3am." + +## Patterns to detect and fix + +### Content + +1. **Puffery.** "pivotal moment", "testament to", "evolving landscape", "setting the stage for", "indelible mark", "deeply rooted". Cut puffery, state what happened. +2. **Name-dropping.** Listing media outlets without context. Pick one, say what was said. +3. **Superficial -ing phrases.** "highlighting...", "ensuring...", "reflecting...", "showcasing...", "fostering...". Delete or expand with real sources. +4. **Promotional language.** "nestled", "vibrant", "breathtaking", "groundbreaking", "renowned", "stunning", "must-visit". Use neutral descriptions. +5. **Vague attributions.** "Experts believe", "Industry reports suggest", "Some critics argue". Name the source or delete. +6. **Formulaic challenges.** "Despite challenges... continues to thrive." Replace with specific facts. + +### Language + +7. **AI vocabulary.** Additionally, crucial, delve, enduring, enhance, fostering, garner, interplay, intricate, landscape (abstract), pivotal, showcase, tapestry (abstract), testament, underscore, vibrant. Replace with plain words. +8. **Fancy ways to say "is".** "serves as", "stands as", "boasts", "features". Just say "is" or "has". +9. **"Not just X, but Y."** State the point directly instead. +10. **Rule of three.** Forcing ideas into groups of three. Use the natural number. +11. **Synonym cycling.** Protagonist, main character, central figure, hero all in one paragraph. Pick one, repeat it. +12. **False ranges.** "from X to Y" where X and Y aren't on a meaningful scale. List topics directly. + +### Style + +13. **Em dash overuse.** Avoid em dashes entirely. Use periods or commas only (no parentheses, no en dashes, no hyphen-as-dash substitutes). Em dashes are an AI tell, and reaching for parentheses instead just trades one tell for another. If a thought needs separation, end the sentence or use a comma. +14. **Colon overuse.** Colons are fine before a list or example. Not as mid-sentence connectors. "If you're coming from traditional automation: instead of registering event handlers, you describe conditions" adds nothing with the colon. Rewrite to let the point stand on its own without comparison framing. "Describing when the scheduler should fire works best as plain English." Same meaning, no crutch punctuation. +15. **Boldface overuse.** Don't bold every proper noun or acronym. +16. **Inline-header lists.** The tell is a bold label and colon that restates the line: "**Performance:** Performance improved...". Convert those to prose. A bold lead-in that ends in a period, names the item, and is followed by genuinely new detail ("**Schema in TypeScript.** Tables live in one file.") is fine, not a tell. +17. **Title case headings.** Use sentence case. +18. **Decorative emojis.** Remove from headings and bullets. +19. **Curly quotes.** Replace with straight quotes. + +### Communication artifacts + +20. **Chatbot phrases.** "I hope this helps!", "Let me know if...", "Of course!", "Certainly!", "Found the smoking gun!" Remove. +21. **Cutoff disclaimers.** "While specific details are limited..." Find sources or remove. +22. **Sycophantic tone.** "Great question! You're absolutely right!" Respond directly. + +### Filler + +23. **Filler phrases.** "In order to" becomes "To". "Due to the fact that" becomes "Because". "It is important to note that" gets deleted. +24. **Excessive hedging.** "could potentially possibly be argued that it might" becomes "may". +25. **Generic conclusions.** "The future looks bright." State specific plans or facts. + +### Jargon + +26. **Abstract metaphor nouns.** Substrate, wedge, vector, locus, vantage, nexus, primitive (as noun), harness (as metaphor), surface (as in "API surface"), bedrock, scaffolding (as metaphor), modality, paradigm, gold-plating, ratchet (as metaphor), evacuate (for moving code), endgame, north star, flywheel. These read as technical but usually have a plainer concrete word. "Substrate" becomes "base". "Wedge in" becomes "add". "Vector" becomes "way" or "method". "Gold-plating" becomes "more than the job needs". "Ratchet" becomes the mechanism's real name or "a limit that only tightens". "Evacuate" becomes "move out". "Endgame" becomes "the last phase". Pick the concrete word. + +### Plain speech + +27. **Say what it does, not how it feels.** "the database stays close at hand", "SQL you can read", "types that follow your schema" name a feeling. The fix names the mechanism or a number: "`.toSQL()` returns the exact string sent to the database", "a column rename fails the build". Ask what the sentence tells the reader to do or know, then write that. If you can't restate it as a concrete instruction, fact, or number, cut it. One more check: if the sentence could appear unchanged in another project's docs, it says nothing about this one. Cut it. +28. **Shorten or split dense sentences.** If the reader has to backtrack to parse a sentence, break it in two or drop clauses. One idea per sentence. +29. **Active voice.** Prefer it. Catch "is/are/was/were + past participle" and name the actor: "queries are validated" becomes "the compiler validates queries", "the file is parsed by the loader" becomes "the loader parses the file". Passive is fine only when the actor is unknown or genuinely doesn't matter. +30. **Cut adverbs, or use a stronger verb.** "runs quickly" becomes "is fast" or the number. "significantly improves" becomes the measured delta. An adverb propping up a weak verb means the verb is wrong. +31. **Prefer the plain word.** "utilize" becomes "use", "leverage" becomes "use", "facilitate" becomes "help", "numerous" becomes "many", "in the event that" becomes "if". The fancier synonym is rarely clearer. diff --git a/skills/unslop/agents/openai.yaml b/skills/unslop/agents/openai.yaml new file mode 100644 index 0000000..20785e4 --- /dev/null +++ b/skills/unslop/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "Unslop" + short_description: "Remove AI tells and restore human voice" + default_prompt: "Use $unslop to rewrite this text without AI tells while preserving its meaning and intended tone."