@shadowclone/cli 0.0.17 → 0.0.19
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/README.md +3 -0
- package/dist/_.._/web/client/index.html +13 -12
- package/dist/shadowclone.js +529 -508
- package/dist/web/index-3mf7t8r9.js +134 -0
- package/dist/web/index-t330dg8e.css +1 -0
- package/package.json +3 -9
- package/plugins/shadowclone/.claude-plugin/plugin.json +1 -1
- package/plugins/shadowclone/.codex-plugin/plugin.json +1 -1
- package/plugins/shadowclone/plugin.json +1 -1
- package/skills/choose-by-consequence/SKILL.md +66 -0
- package/skills/design-deep-modules/SKILL.md +32 -15
- package/skills/diagnose-before-editing/SKILL.md +38 -17
- package/skills/plan-with-review-page/SKILL.md +73 -0
- package/skills/plan-with-review-page/assets/review-page.html +160 -0
- package/skills/plan-with-review-page/scripts/validate-page.mjs +158 -0
- package/skills/research-primary-sources/SKILL.md +32 -14
- package/skills/resolve-conflicts-by-intent/SKILL.md +34 -15
- package/skills/scope-confirmed-changes/SKILL.md +44 -14
- package/skills/shadowclone-work/SKILL.md +5 -2
- package/skills/tests-that-catch-bugs/SKILL.md +73 -0
- package/skills/typescript-type-safety/SKILL.md +32 -16
- package/skills/verify-and-review/SKILL.md +40 -16
- package/skills/verify-review-findings/SKILL.md +59 -0
- package/skills/write-plain-english/SKILL.md +58 -0
- package/skills/write-plain-english/scripts/check-ste.mjs +200 -0
- package/dist/web/index-ntyv9x8a.css +0 -1
- package/dist/web/index-twq4tm3n.js +0 -135
- package/skills/prove-regression-tests/SKILL.md +0 -33
- package/skills/testing-first/SKILL.md +0 -35
- package/skills/testing-risk-based/SKILL.md +0 -34
|
@@ -1,33 +1,51 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: research-primary-sources
|
|
3
|
-
description:
|
|
3
|
+
description: 'Use when a decision depends on how a library, platform, protocol, or tool behaves, and that behavior can change by version. Also use it when the user says "check the docs", "is this still true?", or "what does the spec say?". Finds the first-party source for the installed version and reads it. Separates what the source guarantees from what you infer. Not for debugging a failure in your own code (use `diagnose-before-editing`).'
|
|
4
4
|
metadata:
|
|
5
5
|
shadowclone-category: research
|
|
6
6
|
shadowclone-section: workflow
|
|
7
|
-
shadowclone-applies-when:
|
|
7
|
+
shadowclone-applies-when: when a decision depends on facts outside the repository
|
|
8
8
|
---
|
|
9
9
|
# Research Primary Sources
|
|
10
10
|
|
|
11
11
|
## Use when
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
A decision depends on outside facts about a library, a platform, a protocol, a standard, or a tool. Those facts change with versions, and memory or a search snippet can be out of date.
|
|
14
|
+
|
|
15
|
+
## Gates
|
|
16
|
+
|
|
17
|
+
1. Is the question specific enough to have one answer?
|
|
18
|
+
2. Did you record the installed version, the runtime, and the platform that the answer must match?
|
|
19
|
+
3. Did you read the first-party source itself, such as the specification, the official documents, the source code, or the release notes?
|
|
20
|
+
4. Does each claim say whether the source guarantees it or you infer it?
|
|
21
|
+
5. If no source answers the question, did you say so and keep the choice easy to reverse?
|
|
14
22
|
|
|
15
23
|
## Process
|
|
16
24
|
|
|
17
|
-
1.
|
|
18
|
-
2. Find the specification, official
|
|
19
|
-
3. Open the exact
|
|
20
|
-
4. Compare the
|
|
21
|
-
5.
|
|
25
|
+
1. Write the decision as a question. Record the version, the runtime, the platform, and the limits that apply.
|
|
26
|
+
2. Find the source that defines the behavior. Prefer the specification, the official documents, the source code, a release note, or a first-party issue.
|
|
27
|
+
3. Open the exact page or file. Check that its version and date match yours.
|
|
28
|
+
4. Compare the source with the installed code. Explain each difference that comes from a version or an environment.
|
|
29
|
+
5. Write the answer, the link or `file:line` for each claim, and the limit that it puts on the change.
|
|
22
30
|
|
|
23
|
-
##
|
|
31
|
+
## Example
|
|
24
32
|
|
|
25
|
-
|
|
33
|
+
**Situation:** A change must know which instruction file a coding agent reads when two files exist in one folder.
|
|
34
|
+
**Easy route:** Answer from memory: "it reads both".
|
|
35
|
+
**Hidden cost:** If memory is wrong, an install can write a file that hides a file of the team, and nobody notices.
|
|
36
|
+
**Best route:** Open the official documents for the installed version, find the section about file order, and quote it.
|
|
37
|
+
**Evidence:** The documents said that the agent reads the override file first, and reads at most one file in each folder. The install now stops before it writes a file that hides another one.
|
|
26
38
|
|
|
27
|
-
|
|
39
|
+
## Guardrails
|
|
28
40
|
|
|
29
|
-
|
|
41
|
+
- A search result is a lead. Read the source that it points to.
|
|
42
|
+
- Quote only the lines that support the decision.
|
|
43
|
+
- Keep credentials, private links, and user data out of research notes.
|
|
44
|
+
- If the evidence is old, say so, and name the version that it covers.
|
|
30
45
|
|
|
31
|
-
|
|
46
|
+
## Completion
|
|
32
47
|
|
|
33
|
-
|
|
48
|
+
- The answer, or the exact unknown.
|
|
49
|
+
- Each claim with its source: a link, or a `file:line`.
|
|
50
|
+
- The version that each source covers.
|
|
51
|
+
- The limit that the answer puts on the change.
|
|
@@ -1,34 +1,53 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: resolve-conflicts-by-intent
|
|
3
|
-
description:
|
|
3
|
+
description: 'Use when Git reports conflicts during a merge, a rebase, or a cherry-pick. Also use it when the user says "fix the merge conflicts", "rebase onto main", or "the merge broke the build". Traces each side of a conflict to the change that it came from. Keeps both intents when they fit together, and asks when they do not. Then runs the checks on the combined result. Not for choosing what a new behavior should be (use `choose-by-consequence`).'
|
|
4
4
|
metadata:
|
|
5
5
|
shadowclone-category: version-control
|
|
6
6
|
shadowclone-section: workflow
|
|
7
|
-
shadowclone-applies-when:
|
|
7
|
+
shadowclone-applies-when: while a merge, rebase, or cherry-pick has conflicts
|
|
8
8
|
---
|
|
9
9
|
# Resolve Conflicts by Intent
|
|
10
10
|
|
|
11
11
|
## Use when
|
|
12
12
|
|
|
13
|
-
A merge
|
|
13
|
+
A merge, a rebase, or a cherry-pick stops with conflicted files. Each side of a conflict carries an intent. A correct resolution keeps each intent that still applies.
|
|
14
|
+
|
|
15
|
+
## Gates
|
|
16
|
+
|
|
17
|
+
1. For each conflicted file, can you name the commit and the intent behind each side?
|
|
18
|
+
2. Does the resolution keep both intents when they fit together?
|
|
19
|
+
3. When the intents do not fit together, did you ask the user instead of picking one?
|
|
20
|
+
4. Did you check related names and code outside the conflict markers?
|
|
21
|
+
5. Do the checks pass on the combined result, and did you separate failures that were already on a parent?
|
|
22
|
+
6. Are all conflict markers gone, with no file left unmerged?
|
|
14
23
|
|
|
15
24
|
## Process
|
|
16
25
|
|
|
17
|
-
1.
|
|
18
|
-
2.
|
|
19
|
-
3.
|
|
20
|
-
4.
|
|
21
|
-
5. Run focused checks and the
|
|
22
|
-
6.
|
|
26
|
+
1. Read the operation in progress, the conflicted paths, and the commits on each side.
|
|
27
|
+
2. For each side, read the commit message, the tests, and the design notes that explain it.
|
|
28
|
+
3. Resolve each conflict in the current design. Keep the compatible parts of both sides.
|
|
29
|
+
4. Search the rest of the code for names and assumptions that either side changed.
|
|
30
|
+
5. Run the focused checks and the required merge check.
|
|
31
|
+
6. Read the combined diff against both intents, then finish the operation that the user asked for.
|
|
23
32
|
|
|
24
|
-
##
|
|
33
|
+
## Example
|
|
25
34
|
|
|
26
|
-
|
|
35
|
+
**Situation:** A rebase conflicts in a lock file. One side adds a package, and the other side updates a different package.
|
|
36
|
+
**Easy route:** Take one whole side of the lock file, because a tool writes it.
|
|
37
|
+
**Hidden cost:** One change is lost. The build passes on a machine that still has the old cache, and it fails for everyone else.
|
|
38
|
+
**Best route:** Take the lock file from the base branch. Apply the package change from the other side again, and run the install so that the tool writes the lock file.
|
|
39
|
+
**Evidence:** The new lock file has both packages. A clean install and the full check passed.
|
|
27
40
|
|
|
28
|
-
|
|
41
|
+
## Guardrails
|
|
29
42
|
|
|
30
|
-
|
|
43
|
+
- Take a whole side of a file only when nobody wants that side any more.
|
|
44
|
+
- Keep schema changes, migrations, generated files, and tests consistent with each other.
|
|
45
|
+
- Treat rename and delete conflicts as behavior changes.
|
|
46
|
+
- Do not add a third design that neither side asked for.
|
|
47
|
+
- Keep unrelated edits of the user, and follow the approval rules of the repository for Git operations.
|
|
31
48
|
|
|
32
|
-
|
|
49
|
+
## Completion
|
|
33
50
|
|
|
34
|
-
|
|
51
|
+
- Each conflicted file, with the intent that you kept from each side.
|
|
52
|
+
- The check that covers the combined behavior, with its result line.
|
|
53
|
+
- The operation that you finished, and the final commit hash.
|
|
@@ -1,33 +1,63 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: scope-confirmed-changes
|
|
3
|
-
description:
|
|
3
|
+
description: 'Use when fixing a bug, a regression, or a confirmed review finding. Also use it when the user says "fix this bug", "it is broken", or "keep the change small". Reproduces the issue before any fix, with a test, a real command, or the real interface. After the fix, the same reproduction must pass. Keeps the change to confirmed, reachable behavior. Not for checking review comments before a fix (use `verify-review-findings`).'
|
|
4
4
|
metadata:
|
|
5
5
|
shadowclone-category: change-control
|
|
6
6
|
shadowclone-section: workflow
|
|
7
|
-
shadowclone-applies-when: fixing a
|
|
7
|
+
shadowclone-applies-when: when fixing a bug, a regression, or a confirmed review finding
|
|
8
|
+
shadowclone-voice: "true"
|
|
8
9
|
---
|
|
9
10
|
# Scope Confirmed Changes
|
|
10
11
|
|
|
11
12
|
## Use when
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
You fix a bug, a regression, or a review finding that you confirmed. Only a reproduction proves that a bug is real. Only the same reproduction after the fix proves that the fix works.
|
|
15
|
+
|
|
16
|
+
## Gates
|
|
17
|
+
|
|
18
|
+
1. Did you reproduce the issue before you changed code, with a test, a real command, or the real interface?
|
|
19
|
+
2. After the fix, does the same reproduction show the expected result?
|
|
20
|
+
3. If you could not reproduce the issue, did you label the cause as inferred, with the data and code that support it?
|
|
21
|
+
4. Does each changed line serve the fix, or a test or check that the fix needs?
|
|
22
|
+
5. Do all checks that passed before your change still pass?
|
|
23
|
+
6. If an approach caused a new regression, did you remove it instead of adding a second fix on top?
|
|
14
24
|
|
|
15
25
|
## Process
|
|
16
26
|
|
|
17
|
-
|
|
18
|
-
2. Trace the current path and verify the finding against the working branch.
|
|
19
|
-
3. Keep edits that correct the outcome, plus supporting changes required for correctness or verification.
|
|
20
|
-
4. Leave unrelated cleanup and speculative guards outside the diff.
|
|
21
|
-
5. Verify the behavior through a stable public interface and map each final hunk back to the request.
|
|
27
|
+
Write in the user's voice. Before you write, read `~/.agents/voice.md`. If it does not exist, build it once from the user's merged pull requests, review comments, and commit messages. Use only text that the user wrote, and name those sources in your handoff. Never overwrite an existing or linked `voice.md`.
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
1. Write the issue as a concrete input, the wrong result, and the expected result.
|
|
30
|
+
2. Reproduce it in the cheapest way that shows the real symptom:
|
|
31
|
+
- a failing unit or integration test,
|
|
32
|
+
- the real command in a temporary home, or
|
|
33
|
+
- the real interface, such as browser or desktop automation when the host has it.
|
|
34
|
+
3. Keep the reproduction and its wrong output, because you run it again after the fix.
|
|
35
|
+
4. Find the cause in the code that the reproduction runs. Fix it at the boundary that owns it.
|
|
36
|
+
5. Run the same reproduction. It must now show the expected result.
|
|
37
|
+
6. Run the focused tests and the required check of the repository.
|
|
38
|
+
7. Read the diff. Remove each line that does not serve the fix or its proof.
|
|
39
|
+
8. If reproduction is impossible, say why. Reason from logs, data, and code, and label the conclusion as inferred.
|
|
24
40
|
|
|
25
|
-
|
|
41
|
+
## Example
|
|
26
42
|
|
|
27
|
-
|
|
43
|
+
**Situation:** A user reports that `sync` lost an edit to an installed skill. All unit tests pass.
|
|
44
|
+
**Easy route:** Read the code, guess that the copy check is wrong, and change it.
|
|
45
|
+
**Hidden cost:** A guess can be wrong, and nothing proves the fix. The edit can still disappear in the case that the user hit.
|
|
46
|
+
**Best route:** Reproduce the report. Install the skill, edit one copy, apply the build again, and run `sync`. The edit disappears. Fix the cause, and run the same steps again.
|
|
47
|
+
**Evidence:** Before the fix, the reproduction printed "Updated design-deep-modules to the bundled version (3 copies)." and the edit was gone. After the fix, it printed "Kept your edited copy of design-deep-modules at ..." and the edit stayed.
|
|
28
48
|
|
|
29
|
-
##
|
|
49
|
+
## Guardrails
|
|
50
|
+
|
|
51
|
+
- Keep the unrelated edits of the user in the worktree.
|
|
52
|
+
- Do not widen a public contract to fit an internal shortcut.
|
|
53
|
+
- Refactor only when the fix or its proof needs it.
|
|
54
|
+
- Do not add a guard for a case that cannot happen. Fix the cause of a case that can.
|
|
55
|
+
- Put each later review round in its own commit. Never rewrite pushed history.
|
|
30
56
|
|
|
31
|
-
|
|
57
|
+
## Completion
|
|
32
58
|
|
|
33
|
-
|
|
59
|
+
- The reproduction command or test, with the wrong output before the fix.
|
|
60
|
+
- The same reproduction after the fix, with the expected output.
|
|
61
|
+
- The focused test command and the required check, with their result lines.
|
|
62
|
+
- Each changed file, with the reason that it is in scope.
|
|
63
|
+
- For an issue that you could not reproduce: the reason, and the evidence for the inferred cause.
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: shadowclone-work
|
|
3
|
-
description:
|
|
3
|
+
description: 'Use when the user asks to implement a change and open a pull request, or to get a pull request ready to merge. Also use it when the user says "fix the red PR", "address the review comments", or "restack my PRs". Covers CI failures and flakes, bot and human review threads, conflicts with a moving base, and stack restacks. Takes the work to a pull request that is ready for review, and keeps it there without merging. Not for checking review comments before you act on them (use `verify-review-findings`).'
|
|
4
4
|
metadata:
|
|
5
5
|
shadowclone-category: workflow
|
|
6
6
|
shadowclone-section: workflow
|
|
7
|
-
shadowclone-applies-when: taking a change or a pull request to ready for review
|
|
7
|
+
shadowclone-applies-when: when taking a change or a pull request to ready for review
|
|
8
|
+
shadowclone-voice: "true"
|
|
8
9
|
---
|
|
9
10
|
# Take Work to a Ready Pull Request
|
|
10
11
|
|
|
@@ -14,6 +15,8 @@ The user wants a change delivered as a pull request that is ready to merge, or w
|
|
|
14
15
|
|
|
15
16
|
## Process
|
|
16
17
|
|
|
18
|
+
Write in the user's voice. Before you write, read `~/.agents/voice.md`. If it does not exist, build it once from the user's merged pull requests, review comments, and commit messages. Use only text that the user wrote, and name those sources in your handoff. Never overwrite an existing or linked `voice.md`.
|
|
19
|
+
|
|
17
20
|
1. **Find the target.** For a request or an issue, branch from an up-to-date default branch. For an existing pull request, check out its branch and run `git fetch`. Run `gh stack view` to learn whether the branch is part of a stack, and note each pull request's base.
|
|
18
21
|
2. **Read the repository's rules.** Read `README.md`, `CONTRIBUTING.md`, `AGENTS.md`, and the pull request template when they exist. Follow their title format (for example conventional commits for squash-merged repositories), template sections, and check commands.
|
|
19
22
|
3. **Build the change.** Make the smallest complete change, add tests through public interfaces, and run the repository's checks locally before pushing.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tests-that-catch-bugs
|
|
3
|
+
description: 'Use when adding, changing, or reviewing tests. Also use it when the user says "add a regression test", "write the test first", or "make sure this cannot break again". Writes a few tests that each name a bug and check the result where the user sees it. Expected values come from an independent source, and each test fails without the change. Test first is an ordering choice inside this skill. Not for checking finished work against the real command output (use `verify-and-review`).'
|
|
4
|
+
metadata:
|
|
5
|
+
shadowclone-category: testing
|
|
6
|
+
shadowclone-section: workflow
|
|
7
|
+
shadowclone-applies-when: when adding, changing, or proving a test
|
|
8
|
+
---
|
|
9
|
+
# Tests That Catch Bugs
|
|
10
|
+
|
|
11
|
+
## Use when
|
|
12
|
+
|
|
13
|
+
You add or change a test, you fix a bug, or the user asks for test first work. A test has value only if it fails when the behavior it guards breaks. Three tests that catch real bugs are better than ten tests that pass whatever the code does.
|
|
14
|
+
|
|
15
|
+
## Gates
|
|
16
|
+
|
|
17
|
+
1. Can you name the bug that the test catches, as a wrong output for a given input? If not, do not write the test.
|
|
18
|
+
2. Does the test check the result where the user sees it, such as the command output, the exit code, or a written file? If the symptom is at the command, a helper test alone does not count.
|
|
19
|
+
3. Does the expected value come from a source other than the code under test? Use the bug report, the specification, a value you calculated by hand, or a recorded real output.
|
|
20
|
+
4. Did you see the test fail without the change, for the reason you named, and then pass with the change?
|
|
21
|
+
5. Would the test fail if the code under test returned nothing, an empty list, or a constant? If not, make the test specific or delete it.
|
|
22
|
+
6. Is the final diff free of each temporary mutation and debug line?
|
|
23
|
+
|
|
24
|
+
## Process
|
|
25
|
+
|
|
26
|
+
### Choose the order
|
|
27
|
+
|
|
28
|
+
- Test first: write the failing test before the change. Use this order when the user or a saved preference asks for it. Also use it when the behavior is new and you know its interface. Run the test and see it fail because the behavior is missing.
|
|
29
|
+
- Fix first, then prove: use this order when the fix for a confirmed bug already exists. Write the test, then undo the smallest part of the fix and see the test fail.
|
|
30
|
+
- Both orders end with the same proof.
|
|
31
|
+
|
|
32
|
+
### Choose what to test
|
|
33
|
+
|
|
34
|
+
1. List the behaviors that the change can break. Rank them by their consequence for the user. Data loss, wrong output, a wrong count or status, a security boundary, and a crash come first.
|
|
35
|
+
2. Read the nearby tests. Use their fixtures and the public interface that they call.
|
|
36
|
+
3. For each material risk, write one test at the layer where the user sees the failure.
|
|
37
|
+
4. Use the smallest fixture that reaches the real boundary, such as a temporary home folder or a real file on disk.
|
|
38
|
+
5. Do not test private branches, log wording, or styling, unless they are a documented contract.
|
|
39
|
+
|
|
40
|
+
### Prove each test
|
|
41
|
+
|
|
42
|
+
1. Find the smallest production change that makes the test pass.
|
|
43
|
+
2. Invert or remove that change, and keep the code compilable.
|
|
44
|
+
3. Show the mutated lines with their file and line number.
|
|
45
|
+
4. Run only that test. Make sure that the intended assertion fails with the wrong value that you named.
|
|
46
|
+
5. Restore the change. Run the same test again and make sure that it passes.
|
|
47
|
+
6. If the test passes under the mutation, or fails for a different reason, it is not proof. Fix the test and do the proof again.
|
|
48
|
+
|
|
49
|
+
## Example
|
|
50
|
+
|
|
51
|
+
**Situation:** A setup command skips one agent because the instruction file of that agent is a symbolic link. The fix also changes the summary line.
|
|
52
|
+
**Easy route:** Add a unit test for the helper that decides to skip. It passes, and the work looks done.
|
|
53
|
+
**Hidden cost:** The helper was already correct. The command still printed "Installed for 2 agents" after it skipped one agent, so the user trusted a false count.
|
|
54
|
+
**Best route:** Run the real command in a temporary home that contains the symbolic link. Assert the summary line, the final line that names the skipped agent, and the exit code.
|
|
55
|
+
**Evidence:** With the old counting code, the test failed: expected "Installed for 1 agent", received "Installed for 2 agents". With the fix, the same test passed.
|
|
56
|
+
|
|
57
|
+
## Guardrails
|
|
58
|
+
|
|
59
|
+
- Mutate production code, never the assertion. A setup error, a compile error, a timeout, or an unrelated failure does not prove a test.
|
|
60
|
+
- Do not weaken an assertion to make the code pass. Fix the code, or get the expected value again from its independent source.
|
|
61
|
+
- Use the real collaborators inside the module. Replace a dependency only at an external boundary, such as the network, the clock, a paid model call, or another process.
|
|
62
|
+
- Assert the lines that carry meaning, such as a count, a status, or a path. A full snapshot breaks on each wording change and hides the line that matters.
|
|
63
|
+
- Do not depend on clock timing, test order, or machine load. A flaky test teaches people to ignore failures.
|
|
64
|
+
- Name each test for the behavior that it protects, so that a failure explains itself.
|
|
65
|
+
- Keep each mutation local and reversible, and restore it before other work. Keep unrelated changes in the worktree.
|
|
66
|
+
|
|
67
|
+
## Completion
|
|
68
|
+
|
|
69
|
+
- The test command and its result line, for example `4 pass, 0 fail`.
|
|
70
|
+
- For each new test, its `file:line` and the bug that it catches, in one sentence.
|
|
71
|
+
- For each proof, the mutated `file:line` and the assertion line that failed under the mutation.
|
|
72
|
+
- The passing run of the same test after the restore.
|
|
73
|
+
- The `git diff` after the restore, with no mutated line left.
|
|
@@ -1,36 +1,52 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: typescript-type-safety
|
|
3
|
-
description:
|
|
3
|
+
description: 'Use when changing TypeScript types, parsing input that enters typed code, or removing unsafe casts. Also use it when the user says "fix the types", "remove the as casts", or "make invalid states impossible". Models each valid state with types, so that invalid combinations fail to compile. Checks outside input with a type guard or a schema instead of an assertion. Not for designing module boundaries (use `design-deep-modules`).'
|
|
4
4
|
metadata:
|
|
5
5
|
shadowclone-category: typescript
|
|
6
6
|
shadowclone-section: engineering
|
|
7
|
-
shadowclone-applies-when:
|
|
7
|
+
shadowclone-applies-when: when changing TypeScript types or input that enters typed code
|
|
8
8
|
---
|
|
9
9
|
# Represent State in TypeScript Types
|
|
10
10
|
|
|
11
11
|
## Use when
|
|
12
12
|
|
|
13
|
-
Values change together, optional fields hide
|
|
13
|
+
Values change together, optional fields hide different states, outside input enters typed code, or the compiler asks for an assertion. Each of these signals a missing type or a missing check.
|
|
14
|
+
|
|
15
|
+
## Gates
|
|
16
|
+
|
|
17
|
+
1. Does each valid state have its own type, such as a member of a discriminated union?
|
|
18
|
+
2. Does outside input enter as `unknown`, and pass a type guard or a schema before use?
|
|
19
|
+
3. Is the code free of `any`, non-null assertions, and casts, except `as const`?
|
|
20
|
+
4. Does each switch over a union handle each member, so that a new member fails to compile?
|
|
21
|
+
5. Does a failure that callers must handle appear in the return type?
|
|
14
22
|
|
|
15
23
|
## Process
|
|
16
24
|
|
|
17
|
-
1. Name valid states and
|
|
18
|
-
2.
|
|
19
|
-
3. Accept
|
|
20
|
-
4. Narrow
|
|
21
|
-
5. Return
|
|
22
|
-
6. Run type
|
|
25
|
+
1. Name the valid states and the moves between them. Use a discriminated union when only some field combinations are valid.
|
|
26
|
+
2. Keep the relation between keys and values with generics, mapped types, or a typed setter.
|
|
27
|
+
3. Accept outside input as `unknown`. Check it at the boundary with a schema or a type guard.
|
|
28
|
+
4. Narrow values with control flow, type guards, or destructuring. Make a valid absence explicit.
|
|
29
|
+
5. Return a type that makes callers handle each meaningful failure.
|
|
30
|
+
6. Run the type check, and run the tests for the boundary checks.
|
|
23
31
|
|
|
24
|
-
##
|
|
32
|
+
## Example
|
|
25
33
|
|
|
26
|
-
|
|
34
|
+
**Situation:** A function reads a config file and casts the parsed JSON to `Config`.
|
|
35
|
+
**Easy route:** Keep the cast, because the file usually has the right shape.
|
|
36
|
+
**Hidden cost:** A config file with one wrong field passes the cast. The program fails later, far from the cause.
|
|
37
|
+
**Best route:** Parse the JSON with a schema at the boundary. Return a clear error that names the field.
|
|
38
|
+
**Evidence:** A test with a wrong field type now fails at the boundary with "sources.git-metadata: expected boolean". The type check passed with no cast left.
|
|
27
39
|
|
|
28
|
-
|
|
40
|
+
## Guardrails
|
|
29
41
|
|
|
30
|
-
|
|
42
|
+
- Keep one source of truth for each discriminator.
|
|
43
|
+
- Keep literal types until a wider type is necessary.
|
|
44
|
+
- Put an imprecise library type in one adapter that returns a precise project type.
|
|
45
|
+
- Use a narrow assertion only for a fact that a runtime check cannot express, and write down why.
|
|
46
|
+
- Follow the stricter rules of the repository where they apply.
|
|
31
47
|
|
|
32
48
|
## Completion
|
|
33
49
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
50
|
+
- The type that now rejects the invalid state.
|
|
51
|
+
- One example that the compiler now rejects, with its error line.
|
|
52
|
+
- The type check command and the boundary test command, with their result lines.
|
|
@@ -1,34 +1,58 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: verify-and-review
|
|
3
|
-
description:
|
|
3
|
+
description: 'Use before you say that work is done, fixed, or ready for review. Also use it when the user says "make sure it works", "verify this", or "is it ready?". Runs the command or page that the user will use, and reads every count, status line, and exit code. Reviews the whole diff, and labels each claim as measured, inferred, or not verified. This catches a wrong count or a buried warning before handoff. Not for writing or proving tests (use `tests-that-catch-bugs`).'
|
|
4
4
|
metadata:
|
|
5
5
|
shadowclone-category: review
|
|
6
6
|
shadowclone-section: workflow
|
|
7
|
-
shadowclone-applies-when:
|
|
7
|
+
shadowclone-applies-when: before you say that work is done or ready for review
|
|
8
8
|
---
|
|
9
|
-
# Verify
|
|
9
|
+
# Verify the Real Outcome
|
|
10
10
|
|
|
11
11
|
## Use when
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
You are about to say that a change is done, fixed, or ready for review. A question does not need this skill. Answer it directly.
|
|
14
|
+
|
|
15
|
+
## Gates
|
|
16
|
+
|
|
17
|
+
1. Did you run what the user runs: the command, the page, or the request, on the surface that they use? A passing unit test does not show that the command works.
|
|
18
|
+
2. Did you read every line of the real output, including counts, totals, the final lines, and the exit code? Does each one match what happened?
|
|
19
|
+
3. If the command writes files, did it run in a temporary home or a copy? Did you read the files that it wrote?
|
|
20
|
+
4. Does each claim in your report have a label: measured, inferred, or not verified?
|
|
21
|
+
5. Did you read the whole diff, including new files, and remove debug output, temporary mutations, and unrelated edits?
|
|
22
|
+
6. Does the report list each behavior choice, such as a skip or a fallback, with its output line?
|
|
14
23
|
|
|
15
24
|
## Process
|
|
16
25
|
|
|
17
|
-
1.
|
|
18
|
-
2. Run focused
|
|
19
|
-
3.
|
|
20
|
-
4.
|
|
21
|
-
5.
|
|
22
|
-
6.
|
|
26
|
+
1. List what changed for the user: commands, output lines, exit codes, written files, pages, and documents.
|
|
27
|
+
2. Run the focused tests, then the required check of the repository. Run a broad check again only when a later change needs it.
|
|
28
|
+
3. Run the real command, or open the real page. Use a temporary home folder for a command that writes files. For a page, take a screenshot and look at it.
|
|
29
|
+
4. Read the output line by line. Compare each count, status, and path with what you know happened. A wrong count is a bug, even when all tests pass.
|
|
30
|
+
5. Do one failure path as well, such as a missing file or a bad value. Check the message and the exit code.
|
|
31
|
+
6. Read the full diff with its context. Look for secrets, generated files, debug lines, and edits outside the request.
|
|
32
|
+
7. Compare the changed documents with the behavior that you saw.
|
|
33
|
+
8. Write the report, and give each claim its label.
|
|
23
34
|
|
|
24
|
-
##
|
|
35
|
+
## Example
|
|
25
36
|
|
|
26
|
-
|
|
37
|
+
**Situation:** A change adds a `--json` flag to a status command. The unit tests for the formatter pass.
|
|
38
|
+
**Easy route:** Report "Done, all tests pass."
|
|
39
|
+
**Hidden cost:** The real command printed a warning line before the JSON. Each script that read the output failed to parse it.
|
|
40
|
+
**Best route:** Run the command with `--json`, send its output to a JSON parser, and check the exit code.
|
|
41
|
+
**Evidence:** The first run failed to parse at line 1, which was "Warning: the config file is old". After the fix, the parser read the output, and the command exited with code 0.
|
|
27
42
|
|
|
28
|
-
|
|
43
|
+
## Guardrails
|
|
29
44
|
|
|
30
|
-
|
|
45
|
+
- Match each claim to a check that you ran or a thing that you saw. A successful build does not prove that an unused path works.
|
|
46
|
+
- Never verify a command that writes files against the real home or data of the user. Use a copy.
|
|
47
|
+
- Report each failure that existed before your change apart from new failures, with the evidence that it existed before.
|
|
48
|
+
- Keep captured user content and secrets out of the report.
|
|
49
|
+
- Keep unrelated work in the worktree. A worktree with other changes is not a reason to delete them.
|
|
50
|
+
- When a pull request exists, put the full command output in its verification section, not in the chat reply.
|
|
31
51
|
|
|
32
|
-
|
|
52
|
+
## Completion
|
|
33
53
|
|
|
34
|
-
|
|
54
|
+
- Each command that you ran, with its exit code.
|
|
55
|
+
- The output lines that show the result, quoted exactly.
|
|
56
|
+
- Each claim with its label: measured, inferred, or not verified.
|
|
57
|
+
- The `file:line` of each behavior choice, with the output line that shows it.
|
|
58
|
+
- Each failure that existed before the change, and each path that you did not verify.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verify-review-findings
|
|
3
|
+
description: 'Use when a pull request has review comments or bot findings to check. Also use it when the user says "are these comments right?", "triage the review", or "check what the bot found". Checks each finding against the code at the head of the pull request, and confirms the file, the line, and the claim. Asks what each suggested fix would break, reports a verdict for each finding, and waits. Not for writing the fix (use `scope-confirmed-changes`).'
|
|
4
|
+
metadata:
|
|
5
|
+
shadowclone-category: review
|
|
6
|
+
shadowclone-section: workflow
|
|
7
|
+
shadowclone-applies-when: when a pull request has review comments or bot findings
|
|
8
|
+
shadowclone-voice: "true"
|
|
9
|
+
---
|
|
10
|
+
# Verify Review Findings
|
|
11
|
+
|
|
12
|
+
## Use when
|
|
13
|
+
|
|
14
|
+
A pull request has review comments, bot findings, or a list of issues from another agent. A finding is a claim, not a fact. Check each one before you change code or reply.
|
|
15
|
+
|
|
16
|
+
## Gates
|
|
17
|
+
|
|
18
|
+
1. Did you read each finding at the head commit of the pull request? A finding about an older commit can be stale.
|
|
19
|
+
2. For each finding, do the file and the line exist, and does the code there do what the finding says?
|
|
20
|
+
3. Can you show the claim with a test, a command, or the code itself? If not, label it as not verified.
|
|
21
|
+
4. Did you ask what each suggested fix would break, such as a caller, a test, or a documented behavior?
|
|
22
|
+
5. Does each finding have a verdict: confirmed, partly right, wrong, stale, or not verified?
|
|
23
|
+
6. Did you wait for the user before you changed code or replied to a reviewer?
|
|
24
|
+
|
|
25
|
+
## Process
|
|
26
|
+
|
|
27
|
+
Write in the user's voice. Before you write, read `~/.agents/voice.md`. If it does not exist, build it once from the user's merged pull requests, review comments, and commit messages. Use only text that the user wrote, and name those sources in your handoff. Never overwrite an existing or linked `voice.md`.
|
|
28
|
+
|
|
29
|
+
1. Fetch the pull request, and check out its head commit. Write down the commit hash.
|
|
30
|
+
2. List each finding in one table, with its source, its `file:line`, and its claim.
|
|
31
|
+
3. For each finding, read the code at that location and its callers. Compare the claim with the real behavior.
|
|
32
|
+
4. When the claim is about behavior, run a focused test or a command that shows it.
|
|
33
|
+
5. For each suggested fix, list what it changes for callers, tests, and users. A fix that is right in one place can break another place.
|
|
34
|
+
6. Give each finding a verdict, with the evidence that supports it.
|
|
35
|
+
7. Put the confirmed findings first, with the highest risk at the top.
|
|
36
|
+
8. Report the table, and wait. Change code or reply only after the user decides.
|
|
37
|
+
|
|
38
|
+
## Example
|
|
39
|
+
|
|
40
|
+
**Situation:** A review bot says that a function can return null and crash its caller. It suggests a null check.
|
|
41
|
+
**Easy route:** Add the null check, and reply "Fixed".
|
|
42
|
+
**Hidden cost:** The function never returns null, because a type guard on the line above handles that case. The extra check hides the real contract, and the reply tells the reviewer something false.
|
|
43
|
+
**Best route:** Read the function at the head commit, and run its test with an empty input. Report the finding as wrong, with the line that handles the case.
|
|
44
|
+
**Evidence:** The test with the empty input passed at the head commit. The report quoted the guard at its `file:line` and gave the verdict "wrong".
|
|
45
|
+
|
|
46
|
+
## Guardrails
|
|
47
|
+
|
|
48
|
+
- Never change code or post a reply before the user decides.
|
|
49
|
+
- Do not accept a finding because a bot or a senior reviewer wrote it. Do not reject it for that reason either.
|
|
50
|
+
- Quote the code that proves each verdict. Do not paraphrase it.
|
|
51
|
+
- Keep each finding separate. Do not merge two findings into one verdict.
|
|
52
|
+
- A finding that you cannot check stays "not verified" in the report.
|
|
53
|
+
|
|
54
|
+
## Completion
|
|
55
|
+
|
|
56
|
+
- The head commit hash that you checked.
|
|
57
|
+
- A table row for each finding: the source, the `file:line`, the claim, the verdict, and the evidence.
|
|
58
|
+
- Each command or test that you ran, with its result line.
|
|
59
|
+
- For each confirmed finding, what its fix changes for callers and tests.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: write-plain-english
|
|
3
|
+
description: 'Use when writing or editing prose that people read, such as documents, pull requests, commit messages, review comments, chat replies, or skills. Also use it when the user says "make this clearer", "simplify the wording", or "this is a wall of text". Rewrites the text in plain technical English, with one idea in each sentence and no dashes. Then runs a checker that reports long sentences and dashes. Not for checking code behavior (use `verify-and-review`).'
|
|
4
|
+
metadata:
|
|
5
|
+
shadowclone-category: writing
|
|
6
|
+
shadowclone-section: workflow
|
|
7
|
+
shadowclone-applies-when: when writing prose that people read
|
|
8
|
+
shadowclone-voice: "true"
|
|
9
|
+
---
|
|
10
|
+
# Write Plain English
|
|
11
|
+
|
|
12
|
+
## Use when
|
|
13
|
+
|
|
14
|
+
You write or edit text for people: a document, a pull request, a commit message, a review comment, a chat reply, or a skill. The rules come from ASD-STE100 Simplified Technical English. Clarity comes first. If a rule makes the text wrong or unclear, break the rule.
|
|
15
|
+
|
|
16
|
+
## Gates
|
|
17
|
+
|
|
18
|
+
1. Does each sentence carry one idea, with 20 words or fewer for an instruction and 25 or fewer for a description?
|
|
19
|
+
2. Is each instruction in the active voice, with the condition before the action?
|
|
20
|
+
3. Do you use one term for one thing, every time?
|
|
21
|
+
4. Is the text free of em dashes and en dashes?
|
|
22
|
+
5. Did you run `scripts/check-ste.mjs` on the text, and fix or explain each finding?
|
|
23
|
+
6. Are code, commands, paths, and product names exactly as they were?
|
|
24
|
+
|
|
25
|
+
## Process
|
|
26
|
+
|
|
27
|
+
Write in the user's voice. Before you write, read `~/.agents/voice.md`. If it does not exist, build it once from the user's merged pull requests, review comments, and commit messages. Use only text that the user wrote, and name those sources in your handoff. Never overwrite an existing or linked `voice.md`.
|
|
28
|
+
|
|
29
|
+
1. Put the main point first. Give the reader the result, then the reason.
|
|
30
|
+
2. Use common words that have one meaning. Use a single verb, not a phrasal verb: "start", not "kick off".
|
|
31
|
+
3. Keep the articles "the" and "a". Do not drop words to save space.
|
|
32
|
+
4. Use numbered steps for a procedure, with one action in each step.
|
|
33
|
+
5. Put a condition before its instruction: "If the test fails, read the first error."
|
|
34
|
+
6. Replace each dash with a comma, a period, parentheses, or two sentences. For a range, write "to", as in "2 to 5".
|
|
35
|
+
7. Save the text to a file, and run `node scripts/check-ste.mjs <file>`. If Node is not available, run the script with `bun`. If neither one runs, say that the check did not run.
|
|
36
|
+
8. Fix each error. For each warning, fix it, or keep it and say why the rule makes the text worse.
|
|
37
|
+
|
|
38
|
+
## Example
|
|
39
|
+
|
|
40
|
+
**Situation:** A pull request explains a bug in one sentence of 45 words. The sentence joins the symptom, the cause, and the fix with "so" and "which", and it has an em dash.
|
|
41
|
+
**Easy route:** Keep the sentence. It is accurate, and a rewrite takes time.
|
|
42
|
+
**Hidden cost:** Reviewers skim it and miss the cause, so they ask about it in review. The dash also fails the prose check of the repository.
|
|
43
|
+
**Best route:** Split it into three sentences: the symptom, the cause, and the fix. Replace the dash with a period.
|
|
44
|
+
**Evidence:** Before the edit, the checker reported the 45 word sentence and the dash. After the edit, it printed "check-ste: 0 errors, 0 warnings in 1 file".
|
|
45
|
+
|
|
46
|
+
## Guardrails
|
|
47
|
+
|
|
48
|
+
- Keep technical terms, identifiers, and quoted text exactly as they are. Do not paraphrase an error message.
|
|
49
|
+
- Do not change the meaning to obey a rule.
|
|
50
|
+
- Do not rewrite text that another person wrote, unless they ask. Suggest the change instead.
|
|
51
|
+
- Do not add filler, praise, or hedging words, such as "robust", "seamless", or "simply".
|
|
52
|
+
- Keep each term the same in the whole document.
|
|
53
|
+
|
|
54
|
+
## Completion
|
|
55
|
+
|
|
56
|
+
- The checker command and its summary line, for example `check-ste: 0 errors, 1 warning in 1 file`.
|
|
57
|
+
- Each warning that you kept, with its `file:line` and your reason.
|
|
58
|
+
- The path of the voice file that you read, or the sources that you used to build it.
|