Skip to content

Commit cc5a50d

Browse files
Initialize
0 parents  commit cc5a50d

262 files changed

Lines changed: 169098 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/ci-prep/SKILL.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
name: ci-prep
3+
description: Prepares the current branch for CI by running the exact same steps locally and fixing issues. If CI is already failing, fetches the GH Actions logs first to diagnose. Use before pushing, when CI is red, or when the user says "fix ci".
4+
argument-hint: "[--failing] [optional job name to focus on]"
5+
---
6+
<!-- agent-pmo:d58c330 -->
7+
8+
# CI Prep
9+
10+
Prepare the current state for CI. If CI is already failing, fetch and analyze the logs first.
11+
12+
## Arguments
13+
14+
- `--failing` -- Indicates a GitHub Actions run is already failing. When present, you MUST execute **Step 1** before doing anything else.
15+
- Any other argument is treated as a job name to focus on (but all failures are still reported).
16+
17+
If `--failing` is NOT passed, skip directly to **Step 2**.
18+
19+
## Step 1 -- Fetch failed CI logs (only when `--failing`)
20+
21+
You MUST do this before any other work.
22+
23+
```bash
24+
BRANCH=$(git branch --show-current)
25+
PR_JSON=$(gh pr list --head "$BRANCH" --state open --json number,title,url --limit 1)
26+
```
27+
28+
If the JSON array is empty, **stop immediately**:
29+
> No open PR found for branch `$BRANCH`. Create a PR first.
30+
31+
Otherwise fetch the logs:
32+
33+
```bash
34+
PR_NUMBER=$(echo "$PR_JSON" | jq -r '.[0].number')
35+
gh pr checks "$PR_NUMBER"
36+
RUN_ID=$(gh run list --branch "$BRANCH" --limit 1 --json databaseId --jq '.[0].databaseId')
37+
gh run view "$RUN_ID"
38+
gh run view "$RUN_ID" --log-failed
39+
```
40+
41+
Read **every line** of `--log-failed` output. For each failure note the exact file, line, and error message. If a job name argument was provided, prioritize that job but still report all failures.
42+
43+
## Step 2 -- Analyze the CI workflow
44+
45+
1. Find the CI workflow file. Look in `.github/workflows/` for `ci.yml`, `build.yml`, `test.yml`, `checks.yml`, `main.yml`, `pull_request.yml`, or any workflow triggered on `pull_request` or `push`.
46+
2. Read the workflow file completely. Parse every job and every step.
47+
3. Extract the ordered list of commands the CI actually runs (e.g., `make lint`, `make fmt-check`, `make test`, `make coverage-check`, `make build`, or whatever the workflow specifies -- it may use `npm`, `cargo`, `dotnet`, raw shell commands, or anything else).
48+
4. Note any environment variables, matrix strategies, or conditional steps that affect execution.
49+
50+
**Do NOT assume the steps are `make lint`, `make test`, `make coverage-check`, `make build`.** The actual CI may run different commands, in a different order, with different targets. Extract what the CI *actually does*.
51+
52+
## Step 3 -- Run each CI step locally, in order
53+
54+
Work through failures in this priority order:
55+
56+
1. **Formatting** -- run auto-formatters first to clear noise
57+
2. **Compilation errors** -- must compile before lint/test
58+
3. **Lint violations** -- fix the code pattern
59+
4. **Runtime / test failures** -- fix source code to satisfy the test
60+
61+
For each command extracted from the CI workflow:
62+
63+
1. Run the command exactly as CI would run it (adjusting only for local environment differences like not needing `actions/checkout`).
64+
2. If the step fails, **stop and fix the issues** before continuing to the next step.
65+
3. After fixing, re-run the same step to confirm it passes.
66+
4. Move to the next step only after the current one succeeds.
67+
68+
### Hard constraints
69+
70+
- **NEVER modify test files** -- fix the source code, not the tests
71+
- **NEVER add suppressions** (`#pragma warning disable`, `// eslint-disable`, `#[allow(...)]`)
72+
- **NEVER delete or ignore failing tests**
73+
- **NEVER remove assertions**
74+
75+
If stuck on the same failure after 5 attempts, ask the user for help.
76+
77+
## Step 4 -- Report
78+
79+
- List every step that was run and its result (pass/fail/fixed).
80+
- If any step could not be fixed, report what failed and why.
81+
- Confirm whether the branch is ready to push.
82+
83+
## Step 5 -- Commit/Push (only when `--failing`)
84+
85+
Once all CI steps pass locally:
86+
87+
1. Commit, but DO NOT MARK THE COMMIT WITH YOU AS AN AUTHOR!!! Only the user authors the commit!
88+
2. Push
89+
3. Monitor until completion or failure
90+
4. Upon failure, go back to Step 1
91+
92+
## Rules
93+
94+
- **Always read the CI workflow first.** Never assume what commands CI runs.
95+
- Do not push if any step fails (unless `--failing` and all steps now pass)
96+
- Fix issues found in each step before moving to the next
97+
- Never skip steps or suppress errors
98+
- If the CI workflow has multiple jobs, run all of them (respecting dependency order)
99+
- Skip steps that are CI-infrastructure-only (checkout, setup-node/python/rust actions, cache steps, artifact uploads) -- focus on the actual build/test/lint commands
100+
101+
## Success criteria
102+
103+
- Every command that CI runs has been executed locally and passed
104+
- All fixes are applied to the working tree
105+
- The CI passes successfully (if you are correcting an existing failure)

.claude/skills/code-dedup/SKILL.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
name: code-dedup
3+
description: Searches for duplicate code, duplicate tests, and dead code, then safely merges or removes them. Use when the user says "deduplicate", "find duplicates", "remove dead code", "DRY up", or "code dedup". Requires test coverage -- refuses to touch untested code.
4+
---
5+
<!-- agent-pmo:d58c330 -->
6+
7+
# Code Dedup
8+
9+
Carefully search for duplicate code, duplicate tests, and dead code across the repo. Merge duplicates and delete dead code -- but only when test coverage proves the change is safe.
10+
11+
## Prerequisites -- hard gate
12+
13+
Before touching ANY code, verify these conditions. If any fail, stop and report why.
14+
15+
1. Run `make test` -- all tests must pass. If tests fail, stop. Do not dedup a broken codebase.
16+
2. Run `make coverage-check` -- coverage must meet the repo's threshold. If it doesn't, stop.
17+
3. This is a C# repo with static typing -- proceed.
18+
19+
## Steps
20+
21+
Copy this checklist and track progress:
22+
23+
```
24+
Dedup Progress:
25+
- [ ] Step 1: Prerequisites passed (tests green, coverage met, typed)
26+
- [ ] Step 2: Dead code scan complete
27+
- [ ] Step 3: Duplicate code scan complete
28+
- [ ] Step 4: Duplicate test scan complete
29+
- [ ] Step 5: Changes applied
30+
- [ ] Step 6: Verification passed (tests green, coverage stable)
31+
```
32+
33+
### Step 1 -- Inventory test coverage
34+
35+
1. Run `make test` and `make coverage-check` to confirm green baseline
36+
2. Note the current coverage percentage -- this is the floor. It must not drop.
37+
3. Identify which files/modules have coverage and which do not. Only files WITH coverage are candidates for dedup.
38+
39+
### Step 2 -- Scan for dead code
40+
41+
1. Look for unused exports, unused functions, unused classes, unused variables
42+
2. C# analyzer warnings for unused members -- check `make lint` output
43+
3. For each candidate: **grep the entire codebase** for references. Only mark as dead if truly zero references.
44+
4. List all dead code found with file paths and line numbers. Do NOT delete yet.
45+
46+
### Step 3 -- Scan for duplicate code
47+
48+
1. Look for functions/methods with identical or near-identical logic
49+
2. Look for copy-pasted blocks (same structure, maybe different variable names)
50+
3. Look for multiple implementations of the same algorithm or pattern
51+
4. Check across module boundaries -- duplicates often hide in different projects
52+
5. For each duplicate pair: note both locations, what they do, and how they differ
53+
6. List all duplicates found. Do NOT merge yet.
54+
55+
### Step 4 -- Scan for duplicate tests
56+
57+
1. Look for test functions with identical assertions against the same code paths
58+
2. Look for test fixtures/helpers that are duplicated across test files
59+
3. Look for integration tests that fully cover what a unit test also covers (keep the integration test)
60+
4. List all duplicate tests found. Do NOT delete yet.
61+
62+
### Step 5 -- Apply changes (one at a time)
63+
64+
For each change: **change -> test -> verify coverage -> continue or revert**.
65+
66+
#### 5a. Remove dead code
67+
- After each deletion: run `make test` and `make coverage-check`
68+
- If tests fail or coverage drops: **revert immediately**
69+
70+
#### 5b. Merge duplicate code
71+
- Extract shared logic into a single function/module, update all call sites
72+
- After each merge: run `make test` and `make coverage-check`
73+
- If tests fail: **revert immediately**
74+
75+
#### 5c. Remove duplicate tests
76+
- Delete the redundant test (keep the more thorough one)
77+
- After each deletion: run `make coverage-check`
78+
- If coverage drops: **revert immediately**
79+
80+
### Step 6 -- Final verification
81+
82+
1. Run `make test` -- all tests must still pass
83+
2. Run `make coverage-check` -- coverage must be >= the baseline from Step 1
84+
3. Run `make lint` and `make fmt-check` -- code must be clean
85+
4. Report: what was removed, what was merged, final coverage vs baseline
86+
87+
## Rules
88+
89+
- **No test coverage = do not touch.** If a file has no tests covering it, leave it alone entirely.
90+
- **Coverage must not drop.** The coverage floor from Step 1 is sacred.
91+
- **One change at a time.** Never batch multiple dedup changes before testing.
92+
- **When in doubt, leave it.**
93+
- **Preserve public API surface.**
94+
- **Three similar lines is fine.** Only dedup when shared logic is substantial (>10 lines) or 3+ copies.

.claude/skills/spec-check/SKILL.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
---
2+
name: spec-check
3+
description: Audit spec/plan documents against the codebase. Ensures every spec section has implementing code, tests, and matching logic. Use when the user says "check specs", "spec audit", or "verify specs".
4+
argument-hint: "[optional spec ID or filename filter]"
5+
---
6+
<!-- agent-pmo:d58c330 -->
7+
8+
# spec-check
9+
10+
> **Portable skill.** This skill adapts to the current repository. The agent MUST inspect the repo structure and use judgment to apply these instructions appropriately.
11+
12+
Audit spec/plan documents against the codebase. Ensures every spec section has implementing code, tests, and that the code logic matches the spec.
13+
14+
## Arguments
15+
16+
- `$ARGUMENTS` -- optional spec name or ID to check (e.g., `AUTH-TOKEN-VERIFY` or `repo-standards`). If empty, check ALL specs. Spec IDs are descriptive slugs, NEVER numbered (see Step 1).
17+
18+
## Instructions
19+
20+
Follow these steps exactly. Be strict and pedantic. Stop on the first failure.
21+
22+
---
23+
24+
### Step 1: Validate spec ID structure
25+
26+
Before checking code/test references, verify that the specs themselves are well-formed.
27+
28+
1. Find all spec documents (see locations in Step 2).
29+
2. Extract every section ID using the regex `\[([A-Z][A-Z0-9]*(-[A-Z0-9]+)+)\]`.
30+
3. **Flag invalid IDs:**
31+
- Numbered IDs (`[SPEC-001]`, `[REQ-003]`, `[CI-004]`) -- must be renamed to descriptive hierarchical slugs.
32+
- Single-word IDs (`[TIMEOUT]`) -- must have a group prefix.
33+
- IDs with trailing numbers (`[FEAT-AUTH-01]`) -- the number is meaningless, remove it.
34+
4. **Check group clustering:** The first word of each ID is its group. All sections in the same group MUST appear together (adjacent) in the document. If they're scattered, flag it.
35+
5. **Check for missing IDs:** Any heading that defines a requirement or behavior should have an ID. Flag headings in spec files that look like they define behavior but lack an ID.
36+
37+
If any ID violations are found, report them all and **STOP**.
38+
39+
If all IDs are valid, proceed to Step 2.
40+
41+
---
42+
43+
### Step 2: Find all spec/plan documents
44+
45+
Search for markdown files that contain spec sections with IDs. Look in these locations:
46+
47+
- `docs/*.md`
48+
- `docs/**/*.md`
49+
- `SPEC.md`
50+
- `PLAN.md`
51+
- `specs/*.md`
52+
53+
Use Glob to find candidate files, then use Grep to confirm they contain spec IDs.
54+
55+
**Spec ID patterns** -- IDs appear in square brackets, typically at the start of a heading or section line. Match this regex pattern:
56+
57+
```
58+
\[([A-Z][A-Z0-9]*(-[A-Z0-9]+)+)\]
59+
```
60+
61+
Spec IDs are **hierarchical descriptive slugs, NEVER numbered.** The format is `[GROUP-TOPIC]` or `[GROUP-TOPIC-DETAIL]`.
62+
63+
For each file, extract every spec ID and its associated section title and full section content.
64+
65+
---
66+
67+
### Step 3: Filter specs
68+
69+
- If `$ARGUMENTS` is non-empty, filter the discovered specs.
70+
- If `$ARGUMENTS` is empty, process ALL discovered specs.
71+
72+
---
73+
74+
### Step 4: Check each spec section
75+
76+
For EACH spec section that has an ID, perform checks A, B, and C below. **Stop on the first failure.**
77+
78+
#### Check A: Code references the spec ID
79+
80+
Search the entire codebase for the spec ID string, **excluding** `docs/`, `node_modules/`, `.git/`, and `*.md` files.
81+
82+
Any comment containing the exact spec ID string counts as a valid code reference.
83+
84+
**If NO code files reference the spec ID:**
85+
86+
```
87+
SPEC VIOLATION: [ID] "Section Title" has no implementing code.
88+
89+
ACTION REQUIRED: Add a comment referencing [ID] in the file(s) that implement
90+
this spec section, then re-run spec-check.
91+
```
92+
93+
**STOP HERE.**
94+
95+
#### Check B: Tests reference the spec ID
96+
97+
Search test files (`**/*.Tests/**`, `**/*Tests.*`, `**/*Test.*`) for the literal spec ID string.
98+
99+
**If NO test files reference the spec ID:**
100+
101+
```
102+
SPEC VIOLATION: [ID] "Section Title" has no tests.
103+
104+
ACTION REQUIRED: Add tests for [ID] with a comment or test name containing
105+
the spec ID, then re-run spec-check.
106+
```
107+
108+
**STOP HERE.**
109+
110+
#### Check C: Code logic matches the spec
111+
112+
1. Read the spec section content carefully.
113+
2. Read the implementing code.
114+
3. Compare spec vs. code. Be SENSITIVE and PEDANTIC. Check for ordering violations, missing conditions, wrong logic, missing steps, wrong defaults.
115+
4. If the code deviates from the spec, report a detailed error with quotes from both spec and code.
116+
117+
**STOP HERE on any deviation.**
118+
119+
5. If the code matches the spec, this check passes. Move to the next spec.
120+
121+
---
122+
123+
### Step 5: Report results
124+
125+
On failure: output ONLY the first violation found.
126+
127+
On success: output a summary table of all specs checked.
128+
129+
## Key principles
130+
131+
- **Fail fast.** Stop on the first violation. One fix at a time.
132+
- **Be pedantic.** If the spec says it, the code must do it.
133+
- **Quote everything.** Always quote the spec text and the code in error messages.
134+
- **Be actionable.** Every error must tell the developer what file to change and what to do.
135+
- **No numbered IDs.** Spec IDs are hierarchical descriptive slugs, NEVER sequential numbers.

.claude/skills/submit-pr/SKILL.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: submit-pr
3+
description: Creates a pull request with a well-structured description after verifying CI passes. Use when the user asks to submit, create, or open a pull request.
4+
disable-model-invocation: true
5+
---
6+
<!-- agent-pmo:d58c330 -->
7+
8+
# Submit PR
9+
10+
Create a pull request for the current branch with a well-structured description.
11+
12+
## Steps
13+
14+
1. Run `make ci` -- must pass completely before creating PR
15+
2. **Generate the diff against main.** Run `git diff main...HEAD > /tmp/pr-diff.txt` to capture the full diff between the current branch and the head of main. This is the ONLY source of truth for what the PR contains. **Warning:** the diff can be very large. If the diff file exceeds context limits, process it in chunks (e.g., read sections with `head`/`tail` or split by file) rather than trying to load it all at once.
16+
3. **Derive the PR title and description SOLELY from the diff.** Read the diff output and summarize what changed. Ignore commit messages, branch names, and any other metadata -- only the actual code/content diff matters.
17+
4. Write PR body using the template in `.github/pull_request_template.md`
18+
5. Fill in (based on the diff analysis from step 3):
19+
- TLDR: one sentence
20+
- What Was Added: new files, features, deps
21+
- What Was Changed/Deleted: modified behaviour
22+
- How Tests Prove It Works: specific test names or output
23+
- Spec/Doc Changes: if any
24+
- Breaking Changes: yes/no + description
25+
6. Use `gh pr create` with the filled template
26+
27+
## Rules
28+
29+
- Never create a PR if `make ci` fails
30+
- PR description must be specific and tight -- no vague placeholders
31+
- Link to the relevant GitHub issue if one exists
32+
33+
## Success criteria
34+
35+
- `make ci` passed
36+
- PR created with `gh pr create`
37+
- PR URL returned to user

0 commit comments

Comments
 (0)