@intentsolutionsio/contributing-clanker 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +173 -0
  2. package/hooks/.gitkeep +0 -0
  3. package/hooks/install.sh +115 -0
  4. package/hooks/uninstall.sh +70 -0
  5. package/package.json +42 -0
  6. package/skills/contribute/SKILL.md +457 -0
  7. package/skills/contribute/agents/draft-writer.md +110 -0
  8. package/skills/contribute/agents/repo-analyzer.md +68 -0
  9. package/skills/contribute/agents/researcher.md +246 -0
  10. package/skills/contribute/agents/scout.md +182 -0
  11. package/skills/contribute/agents/test-runner.md +70 -0
  12. package/skills/contribute/assets/claim-template.md +22 -0
  13. package/skills/contribute/assets/evidence-template.md +32 -0
  14. package/skills/contribute/assets/pr-template.md +49 -0
  15. package/skills/contribute/references/candidate-file-format.md +259 -0
  16. package/skills/contribute/references/workflow-guide.md +153 -0
  17. package/skills/contribute/scripts/audit-overrides.sh +180 -0
  18. package/skills/contribute/scripts/catalog-coverage.sh +99 -0
  19. package/skills/contribute/scripts/gate-runner.sh +191 -0
  20. package/skills/contribute/scripts/gates/a01-already-assigned.sh +24 -0
  21. package/skills/contribute/scripts/gates/a02-already-shipped.sh +31 -0
  22. package/skills/contribute/scripts/gates/a03-duplicate-flagged.sh +22 -0
  23. package/skills/contribute/scripts/gates/a04-issue-age.sh +80 -0
  24. package/skills/contribute/scripts/gates/a05-issue-still-open.sh +33 -0
  25. package/skills/contribute/scripts/gates/a06-claim-etiquette-required.sh +36 -0
  26. package/skills/contribute/scripts/gates/a09-mention-routing.sh +63 -0
  27. package/skills/contribute/scripts/gates/b01-base-branch.sh +29 -0
  28. package/skills/contribute/scripts/gates/b02-branch-naming.sh +34 -0
  29. package/skills/contribute/scripts/gates/b03-clone-fresh.sh +33 -0
  30. package/skills/contribute/scripts/gates/b05-dco-signoff.sh +50 -0
  31. package/skills/contribute/scripts/gates/b06-commit-format.sh +44 -0
  32. package/skills/contribute/scripts/gates/b07-scope-files.sh +68 -0
  33. package/skills/contribute/scripts/gates/b12-new-deps.sh +40 -0
  34. package/skills/contribute/scripts/gates/b14-local-checks.sh +55 -0
  35. package/skills/contribute/scripts/gates/b16-local-check-allowlist.sh +32 -0
  36. package/skills/contribute/scripts/gates/c01-draft-first.sh +23 -0
  37. package/skills/contribute/scripts/gates/c02-pr-title-format.sh +36 -0
  38. package/skills/contribute/scripts/gates/c03-pr-body-sections.sh +58 -0
  39. package/skills/contribute/scripts/gates/c04-ui-screenshots.sh +38 -0
  40. package/skills/contribute/scripts/gates/c05-test-evidence.sh +31 -0
  41. package/skills/contribute/scripts/gates/c07-coauthor-banned.sh +30 -0
  42. package/skills/contribute/scripts/gates/c09-issue-link.sh +31 -0
  43. package/skills/contribute/scripts/gates/c11-no-force-push.sh +32 -0
  44. package/skills/contribute/scripts/gates/c12-ci-green.sh +29 -0
  45. package/skills/contribute/scripts/gates/c13-bots-passed.sh +62 -0
  46. package/skills/contribute/scripts/gates/c16-no-self-merge.sh +24 -0
  47. package/skills/contribute/scripts/gates/c19-body-claim-vs-diff.sh +64 -0
  48. package/skills/contribute/scripts/gates/d02-no-ai-bug-reports.sh +48 -0
  49. package/skills/contribute/scripts/gates/d03-no-ai-pr-reviews.sh +42 -0
  50. package/skills/contribute/scripts/gates/d05-no-reopen.sh +25 -0
  51. package/skills/contribute/scripts/gates/e02-ai-strike-track.sh +57 -0
  52. package/skills/contribute/scripts/gates/e04-fork-target.sh +39 -0
  53. package/skills/contribute/scripts/gates/f01-license-compat.sh +92 -0
  54. package/skills/contribute/scripts/gates/f03-fixtures-clean.sh +30 -0
  55. package/skills/contribute/scripts/gates/f04-override-disclosure.sh +49 -0
  56. package/skills/contribute/scripts/gates/g01-no-vendored-edits.sh +52 -0
  57. package/skills/contribute/scripts/gates/g02-protected-paths.sh +30 -0
  58. package/skills/contribute/scripts/gates/g03-no-changelog-edits.sh +37 -0
  59. package/skills/contribute/scripts/gates/g04-no-version-bump.sh +36 -0
  60. package/skills/contribute/scripts/gates/g06-override-rate-limit.sh +31 -0
  61. package/skills/contribute/scripts/gates/lib/preamble.sh +105 -0
  62. package/skills/contribute/scripts/lint-candidate.sh +149 -0
  63. package/skills/contribute/scripts/researcher-build.sh +456 -0
  64. package/skills/contribute/scripts/test-known-traps.sh +142 -0
  65. package/skills/contribute/scripts/test-override-audit.sh +102 -0
  66. package/skills/contribute/scripts/test-plug-in.sh +113 -0
  67. package/skills/contribute/scripts/test-scout-refresh.sh +157 -0
  68. package/skills/contribute/scripts/test-stale-dossier-refresh.sh +96 -0
  69. package/skills/contribute/scripts/transition.sh +260 -0
@@ -0,0 +1,457 @@
1
+ ---
2
+ name: contribute
3
+ description: |
4
+ Local-only OSS contribution command center. Auto-refreshes the user's
5
+ in-flight PR and issue state on invoke so conversations start with full
6
+ context — no need to brief Claude on what's in flight. Helps the user
7
+ find issues to contribute to on GitHub, builds per-repo dossiers of what
8
+ each upstream expects (CLA, DCO, branch convention, AI policy, draft-first,
9
+ review bots, issue templates), runs deterministic gates before any
10
+ external action so AI-assisted contributions don't reach maintainers as
11
+ slop. State is markdown-only: candidate files at
12
+ ~/.contribute-system/candidates/, repo dossiers at
13
+ ~/.contribute-system/research/, append-only event log at
14
+ ~/.contribute-system/log.jsonl. No database, no cloud calls.
15
+ Use when the user asks about their PRs / issues / contributions, wants to
16
+ find new work to take on, claim an issue, build/refresh a repo's dossier,
17
+ or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR
18
+ status", "find a contribution", "claim issue X", "draft a Design Issue
19
+ for Y", "refresh dossier for Z".
20
+ allowed-tools:
21
+ - Read
22
+ - Write
23
+ - Edit
24
+ - Glob
25
+ - Grep
26
+ - AskUserQuestion
27
+ - Task
28
+ - Bash(gh:*)
29
+ - Bash(git:*)
30
+ - Bash(node:*)
31
+ - Bash(pnpm:*)
32
+ - Bash(yarn:*)
33
+ - Bash(npm:*)
34
+ - Bash(cargo:*)
35
+ - Bash(pytest:*)
36
+ - Bash(python:*)
37
+ - Bash(python3:*)
38
+ - Bash(bash:*)
39
+ - Bash(jq:*)
40
+ - Bash(base64:*)
41
+ version: "4.0.0"
42
+ author: "Jeremy Longshore <jeremy@intentsolutions.io>"
43
+ license: "MIT"
44
+ compatibility: "Designed for Claude Code; requires gh CLI and jq on PATH"
45
+ tags: [oss, contributions, github, contributing-clanker, ai-slop-prevention]
46
+ ---
47
+
48
+ # Contribute Command Center
49
+
50
+ ## Overview
51
+
52
+ Local-only OSS contribution workflow. The skill itself is the system — there is no separate CLI binary, dashboard, or cloud backend. State lives in three places:
53
+
54
+ 1. **GitHub itself** — fetched live via `gh` for any PR/issue state question. Never cached long-term.
55
+ 2. **Markdown candidate files** at `~/.contribute-system/candidates/<owner>__<repo>__issue<N>.md` — one per issue we're tracking. Frontmatter is the queryable layer (status, scout_score, repo, research_path, overrides). Body holds claim drafts, PR drafts, scope notes.
56
+ 3. **Markdown repo dossiers** at `~/.contribute-system/research/<owner>__<repo>.md` — one per upstream repo we contribute to. Built by the `@researcher` subagent. Frontmatter is canonical for every gate (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates). Body holds curated knowledge: pet peeves, failure log, free-form notes that survive refresh.
57
+ 4. **Append-only event log** at `~/.contribute-system/log.jsonl` — every gate run, transition attempt, override, scout/researcher invocation lands here with a UTC timestamp. Filterable via `jq`.
58
+
59
+ Use this skill when the user wants to:
60
+
61
+ - Know what's in flight (open PRs, claimed issues, candidate queue)
62
+ - Find a new issue to contribute to on GitHub
63
+ - Build or refresh a per-repo dossier (delegates to `@researcher`)
64
+ - Run gate-checked transitions (claim, work, submit) — every external action passes through `transition.sh` first
65
+ - Draft a claim comment, Design Issue, or PR description (default: Design Issue, NOT a PR)
66
+ - Run an upstream repo's test suite
67
+
68
+ The pre-2026-04-30 version of the skill used a SQLite tracker (`~/.contribute-system/contribute.db`, 32 tables) plus a separate `contribute-system/` monorepo (Next.js dashboard, TS CLI, Cloud Functions). Both were deleted because they were never used in practice. The skill now reads markdown directly. That tradeoff is deliberate: human-readable, greppable, git-trackable, survives any tool, no daemon process.
69
+
70
+ ## Prerequisites
71
+
72
+ - **`gh` CLI**, authenticated as the user (`gh auth status` should show "Logged in")
73
+ - **`jq`** on PATH (used by gates + log filtering)
74
+ - **Workspace** at `~/000-projects/contributing-clanker/` containing upstream clones (each clone has its own `CLAUDE.md` for project conventions)
75
+ - **Runtime state dir** at `~/.contribute-system/` — created on first scout/researcher run if missing
76
+
77
+ Run this DCI check at activation (output is auto-injected into the prompt):
78
+
79
+ ```!
80
+ gh auth status >/dev/null 2>&1 && echo "gh: ok" || echo "gh: NOT logged in"
81
+ [ -d ~/.contribute-system/gates ] && echo "gates: $(ls ~/.contribute-system/gates/*.sh 2>/dev/null | wc -l) installed" || echo "gates: not yet installed"
82
+ [ -d ~/.contribute-system/candidates ] && echo "candidates: $(ls ~/.contribute-system/candidates/*.md 2>/dev/null | wc -l) tracked" || echo "candidates: empty"
83
+ [ -d ~/.contribute-system/research ] && echo "dossiers: $(ls ~/.contribute-system/research/*.md 2>/dev/null | wc -l) built" || echo "dossiers: empty"
84
+ [ -f ~/.contribute-system/profile.md ] && echo "profile: ok" || echo "profile: missing — edit ~/.contribute-system/profile.md"
85
+ [ -f ~/.contribute-system/log.jsonl ] && echo "log: $(wc -l < ~/.contribute-system/log.jsonl) events" || echo "log: empty"
86
+ ```
87
+
88
+ ## Instructions
89
+
90
+ ### Step 0 — Refresh state (run first, every time)
91
+
92
+ Before answering anything contribution-related, surface current state. Run these in **parallel** with the Bash tool:
93
+
94
+ ```bash
95
+ # Upstream PRs in flight (filtered to outside-org repos only —
96
+ # the system tracks contributions INTO repos the user does not own;
97
+ # own-repo PRs are out of scope and must be excluded).
98
+ #
99
+ # OWN_ORGS is the prefix list of repos to exclude. Update if the user
100
+ # adds a new org. (Discoverable via `gh api user/orgs --jq '.[].login'`
101
+ # plus the user's own login from `gh api user --jq '.login'`.)
102
+ OWN_ORGS='jeremylongshore/ intent-solutions-io/'
103
+ gh search prs --author=@me --state=open --limit=50 \
104
+ --json number,title,url,repository,isDraft,createdAt | \
105
+ jq --arg own "$OWN_ORGS" '
106
+ ($own | split(" ")) as $excl |
107
+ map(select(.repository.nameWithOwner as $r |
108
+ ($excl | map(. as $p | $r | startswith($p)) | any) | not))
109
+ '
110
+
111
+ # Recently-merged + closed upstream PRs (last 30, same scope filter)
112
+ gh search prs --author=@me --state=closed --limit=30 \
113
+ --json number,title,url,repository,closedAt,createdAt | \
114
+ jq --arg own "$OWN_ORGS" '
115
+ ($own | split(" ")) as $excl |
116
+ map(select(.repository.nameWithOwner as $r |
117
+ ($excl | map(. as $p | $r | startswith($p)) | any) | not))
118
+ '
119
+
120
+ # Local candidate tracker — markdown frontmatter is the queryable layer.
121
+ # Candidates are upstream-only by construction (scout never enqueues
122
+ # own-repo issues), so no scope filter needed here.
123
+ for f in ~/.contribute-system/candidates/*.md; do
124
+ awk -v f="$(basename "$f" .md)" '
125
+ /^---$/ { fm = !fm ? 1 : 2; next }
126
+ fm == 1 && /^(repo|issue_number|status|scout_score|research_path|pr_number):/ { print f, $0 }
127
+ ' "$f"
128
+ done 2>/dev/null
129
+
130
+ # Recent activity from the event log
131
+ tail -50 ~/.contribute-system/log.jsonl 2>/dev/null \
132
+ | jq -c "select(.event | test(\"transition_|gate_|researcher_|scout_\"))" 2>/dev/null
133
+ ```
134
+
135
+ **Scope rule (non-negotiable)**: this skill applies *only* to contributions made INTO repos the user does not own. Own-org PRs (`jeremylongshore/*`, `intent-solutions-io/*`) are out of scope — they are personal-project work, not anti-slop OSS contributions. The whole architecture (gates, dossiers, lifecycle) exists because upstream maintainers need protection from low-quality AI work; that concern doesn't apply to the user's own repos. If a candidate file ever references an own-org repo, it's a scout bug — flag it.
136
+
137
+ Then summarize for the user:
138
+
139
+ - N open / draft PRs (and any blocked on review)
140
+ - N candidates in `claimed` or `working` status but not yet `submitted`
141
+ - N candidates in `open` / `shortlist` status (sorted by `scout_score` desc)
142
+ - Any contradictions between `gh` (PR state) and the candidate's `status:` field (e.g., PR merged but candidate still says `submitted`) — flag for cleanup
143
+ - N candidates whose `research_path:` is empty or stale (>14d) — flag for `@researcher` build/refresh
144
+ - Recent events worth surfacing (gate BLOCKs, overrides, dossier refreshes)
145
+
146
+ Skip Step 0 only when the user asks about something unrelated to their own contributions.
147
+
148
+ ### Step 0.5 — Ensure dossier exists for any repo we'll touch
149
+
150
+ Every repo we contribute to needs a dossier at
151
+ `~/.contribute-system/research/<owner>__<repo>.md` — that's where every gate
152
+ in `~/.contribute-system/gates/` reads its rules from (branch convention,
153
+ CLA/DCO, AI policy, draft-first preference, review bots, etc.).
154
+
155
+ Before any lifecycle transition (claim, work, submit) for a candidate at
156
+ repo `<owner>/<repo>`:
157
+
158
+ ```bash
159
+ DOSSIER=~/.contribute-system/research/$(echo <owner>/<repo> | tr '/' '_').md
160
+ DOSSIER=${DOSSIER/__/__} # ensure double underscore
161
+ if [[ ! -f "$DOSSIER" ]]; then
162
+ echo "no dossier — invoking @researcher"
163
+ # delegate to the researcher subagent
164
+ fi
165
+ # Also check staleness — refresh if >14 days old
166
+ LAST=$(awk '/^last_refreshed:/{print $2; exit}' "$DOSSIER")
167
+ if [[ -n "$LAST" ]]; then
168
+ AGE_DAYS=$(( ( $(date +%s) - $(date -d "$LAST" +%s) ) / 86400 ))
169
+ [[ "$AGE_DAYS" -gt 14 ]] && echo "stale ($AGE_DAYS d) — invoking @researcher refresh"
170
+ fi
171
+ ```
172
+
173
+ Delegate dossier build/refresh to the **`@researcher`** subagent (defined
174
+ at `${CLAUDE_SKILL_DIR}/agents/researcher.md`). It runs in its own context window so
175
+ the verbose CONTRIBUTING.md fetch + depth-1 link follows stay out of your
176
+ main conversation. It writes the dossier to disk and reports back a
177
+ one-paragraph summary.
178
+
179
+ If the user already invoked `@researcher` earlier in the session for this
180
+ repo, skip — don't re-build.
181
+
182
+ ### Step 1 — Discover
183
+
184
+ Find issues worth contributing to. Sources, in priority order:
185
+
186
+ - **Existing candidates** with `status: open` or `status: shortlist` already in `~/.contribute-system/candidates/` — already discovered + vetted, ranked by `scout_score:` frontmatter field
187
+ - **Fresh GitHub label searches** scoped to repos / languages in `~/.contribute-system/profile.md`: `gh search issues "label:'good first issue' state:open language:<lang>" --limit 50`
188
+
189
+ Delegate discovery to the **`@scout`** subagent (defined at `${CLAUDE_SKILL_DIR}/agents/scout.md`). It runs in its own context window so the verbose `gh search` output stays out of your main conversation. Pass it a mode: `baseline` (full per-tier sweep), `refresh` (re-evaluate existing candidates for momentum), or an ad-hoc query like "TypeScript repos at mainstream tier with no competing PRs." Scout writes ranked candidate markdown files to `~/.contribute-system/candidates/` and appends events to `~/.contribute-system/log.jsonl`. Summarize the top picks for the user from those files; do not re-run the search yourself.
190
+
191
+ ### Step 2 — Qualify
192
+
193
+ Before claiming any issue, run these in parallel against the target repo:
194
+
195
+ ```bash
196
+ gh pr list --repo <owner>/<repo> --search "<issue#>" --state=all
197
+ gh api repos/<owner>/<repo>/commits --jq '.[0:3] | map({date: .commit.author.date, msg: .commit.message[0:60]})'
198
+ gh api repos/<owner>/<repo>/contents/CONTRIBUTING.md --jq '.content' | base64 -d 2>/dev/null
199
+ ```
200
+
201
+ Quick-reject signals:
202
+
203
+ - 2+ active PRs already on the issue
204
+ - Issue >90 days old with maintainer silence
205
+ - CLA required for trivial work
206
+ - Stack mismatch with the user's strengths
207
+
208
+ Use the bundled `agents/repo-analyzer.md` for the structured eligibility / CLA / rules check.
209
+
210
+ ### Step 3 — Claim
211
+
212
+ Draft a claim comment from `assets/claim-template.md`. Adapt to the upstream's tone (lowercase if they use lowercase). Show the draft to the user for approval. Never `gh issue comment` autonomously.
213
+
214
+ **Gate-checked transitions** — before showing the claim draft to the user,
215
+ run the gate-runner via `transition.sh` to catch traps (already-assigned,
216
+ already-shipped, stale labels, AI-policy strikes, etc.):
217
+
218
+ ```bash
219
+ ~/.contribute-system/bin/transition.sh shortlist→claimed \
220
+ ~/.contribute-system/candidates/<owner>__<repo>__issue<N>.md
221
+ ```
222
+
223
+ If gates BLOCK, surface the blockers + fix hints to the user. They can fix
224
+ the underlying issue, pick a different candidate, or use
225
+ `--override-gate <ID> "reason"` if they have a specific justification (the
226
+ reason is logged to `~/.contribute-system/log.jsonl`).
227
+
228
+ After the user posts the claim and gates pass, the candidate's `status:`
229
+ field is bumped automatically by `transition.sh` (atomic write). No manual
230
+ SQLite update needed — the markdown candidate file IS the tracker.
231
+
232
+ ### Step 4 — Work
233
+
234
+ Each clone in `~/000-projects/contributing-clanker/` has its own `CLAUDE.md`. Read it first. Run the project's native test suite — common patterns:
235
+
236
+ | Stack | Run |
237
+ |-------|-----|
238
+ | Node + pnpm | `pnpm install && pnpm test && pnpm typecheck && pnpm lint` |
239
+ | Node + yarn | `yarn install && yarn test` |
240
+ | Python | `pytest -v` (or `flox activate -- bash -c "pytest -v"` for posthog) |
241
+ | Rust | `cargo build && cargo test && cargo clippy --all-targets` |
242
+ | Scala | `sbt compile && sbt test && sbt scalafmtCheckAll` |
243
+
244
+ Use `agents/test-runner.md` for the structured runner that tees output to `~/.contribute-system/test-logs/`.
245
+
246
+ ### Step 5 — Submit
247
+
248
+ **Default to a Design Issue, not a PR.** Auto-opening PRs creates "whack-a-mole slopfests" for maintainers (per the repo's `CLAUDE.md` philosophy).
249
+
250
+ Order:
251
+
252
+ 1. Open a Design Issue using `assets/pr-template.md` reshaped for an issue body — include problem, proposed solution, diff preview, test results
253
+ 2. Wait for maintainer approval of the approach
254
+ 3. Open the PR using `assets/pr-template.md`
255
+
256
+ Use `agents/draft-writer.md` for the body drafter. Always show the draft to the user for approval before posting.
257
+
258
+ **Gate-checked submission** — before opening the PR / Design Issue, run:
259
+
260
+ ```bash
261
+ ~/.contribute-system/bin/transition.sh working→submitted \
262
+ ~/.contribute-system/candidates/<owner>__<repo>__issue<N>.md
263
+ ```
264
+
265
+ This runs phase B (pre-PR), C (PR submission), E (identity), F (legal),
266
+ and G (infrastructure) gates against the local diff + dossier rules. BLOCK
267
+ gates refuse the transition; WARN gates surface in the briefing for the
268
+ user to acknowledge before proceeding.
269
+
270
+ After successful submission, `transition.sh` bumps the candidate's
271
+ `status:` to `submitted` atomically. Manually add the PR number to the
272
+ candidate's frontmatter:
273
+
274
+ ```bash
275
+ # After PR is opened
276
+ sed -i "s/^pr_number:.*/pr_number: <num>/; s|^pr_url:.*|pr_url: <url>|" \
277
+ ~/.contribute-system/candidates/<owner>__<repo>__issue<N>.md
278
+ ```
279
+
280
+ ### Reconciliation
281
+
282
+ Periodically (or on user request "reconcile candidates"), check candidates with a `pr_number:` field against live GitHub state:
283
+
284
+ ```bash
285
+ for f in ~/.contribute-system/candidates/*.md; do
286
+ PR=$(awk '/^pr_number:/{print $2; exit}' "$f")
287
+ REPO=$(awk '/^repo:/{print $2; exit}' "$f")
288
+ [[ -z "$PR" || "$PR" == "null" ]] && continue
289
+ gh pr view "$PR" --repo "$REPO" --json state,merged,closedAt
290
+ done
291
+ ```
292
+
293
+ For each candidate whose actual PR state has moved on:
294
+
295
+ - PR merged → set `status: merged` in the candidate (atomic write)
296
+ - PR closed unmerged → set `status: dropped` and append a row to the dossier's `## Failure log` section so we learn from it
297
+ - PR still open → no change (`status: submitted`)
298
+
299
+ ### Mandatory: human approval before external submission
300
+
301
+ Copied verbatim from the repo's `CLAUDE.md`:
302
+
303
+ > Before submitting ANYTHING to external repos:
304
+ >
305
+ > 1. Run all tests — ALL must pass
306
+ > 2. Run project-specific linters — no errors
307
+ > 3. ASK JEREMY FOR APPROVAL with test summary, file list, proposed body
308
+ > 4. Default to Design Issue, NOT a PR
309
+ >
310
+ > NEVER auto-submit PRs. NEVER bypass human approval. Design issues > PRs.
311
+
312
+ ## Output
313
+
314
+ After Step 0, output a status block. After each subsequent step, output structured progress.
315
+
316
+ ### State summary (after Step 0)
317
+
318
+ ```
319
+ PRs in flight: <N> open, <M> draft
320
+ - <repo>#<num>: <title> (state, age)
321
+ ...
322
+
323
+ Claimed but not submitted: <N>
324
+ - <id>: <repo>#<issue> ($value)
325
+ ...
326
+
327
+ Tracked opportunities: <N> (top 5 by value)
328
+ - <id>: <repo>#<issue> ($value, <competition flag>)
329
+ ...
330
+
331
+ Drift: <N> rows where tracker disagrees with GitHub
332
+ - <id>: tracker says <X>, gh says <Y> — suggest <Z>
333
+ ```
334
+
335
+ ### Per-step output
336
+
337
+ | Step | Output |
338
+ |------|--------|
339
+ | Discover | Three sections: Tracker queue / Fresh GitHub / Algora URLs. Top 3 picks highlighted. |
340
+ | Qualify | Verdict block: `claim` / `wait` / `skip` with one-sentence reason |
341
+ | Claim | Markdown draft of the comment, with placeholders filled. Awaits user approval. |
342
+ | Work | Test summary: pass/fail counts, duration, coverage %, log path |
343
+ | Submit | Markdown draft of the PR or Design Issue body. Awaits user approval. |
344
+
345
+ ### Audit subcommands
346
+
347
+ When the user asks "what gates am I overriding most?" or "audit my contribution
348
+ history" or "show me override frequency":
349
+
350
+ ```bash
351
+ ${CLAUDE_SKILL_DIR}/scripts/audit-overrides.sh # all-time
352
+ ${CLAUDE_SKILL_DIR}/scripts/audit-overrides.sh --since=30 # last 30 days
353
+ ${CLAUDE_SKILL_DIR}/scripts/audit-overrides.sh --scope=org:posthog # one org
354
+ ${CLAUDE_SKILL_DIR}/scripts/audit-overrides.sh --gate=A05 # one gate
355
+ ${CLAUDE_SKILL_DIR}/scripts/audit-overrides.sh --json # JSON
356
+ ```
357
+
358
+ Output is a per-gate table with `[overrides, blocks, override_rate, top_reason]`,
359
+ sorted by override_rate desc. Gates overridden ≥50% of the time get flagged for
360
+ investigation — either the gate is too strict (false-positive heavy) or it's
361
+ catching real risk that's being consistently dismissed. Either way, surface it.
362
+
363
+ ## Error Handling
364
+
365
+ | Symptom | Likely cause | Recovery |
366
+ |---------|--------------|----------|
367
+ | `gh: not logged in` | OAuth expired | Tell user to run `gh auth login` |
368
+ | `jq: command not found` | Missing on PATH | `apt-get install jq` (or equivalent) |
369
+ | `~/.contribute-system/` missing | First-time setup | `mkdir -p ~/.contribute-system/{candidates,research,gates,bin,check-runs}; touch ~/.contribute-system/log.jsonl` |
370
+ | `gh search` returns 0 results unexpectedly | Rate limit or wrong scope | Wait 60s and retry; check `gh auth status` token scopes |
371
+ | Candidate's `status: submitted` but PR is merged | Reconciliation drift | Run reconciliation step (above) |
372
+ | User asks to claim, but competing PR exists | Risk | Surface the competing PR explicitly; gate `A2 already-shipped` will BLOCK if it's a merged dupe |
373
+ | Test suite hangs (e.g., posthog without flox) | Wrong env | Wrap in `flox activate -- bash -c "..."` for flox-managed repos |
374
+ | `gh issue comment` permission denied | Repo private or token missing scope | Show the comment text to the user; they post manually |
375
+ | Gate run BLOCKs unexpectedly | Stale dossier or wrong rule | `@researcher refresh <owner>/<repo>`; if the rule itself is wrong, edit the dossier (manual sections survive refresh) or override with `transition.sh ... --override-gate <ID> "reason"` |
376
+ | Dossier missing for a candidate's repo | First time touching this repo | `@researcher build <owner>/<repo>` (auto-invoked by Step 0.5 anyway) |
377
+
378
+ If any external submission would happen without human approval, **stop and ask**. This is non-negotiable.
379
+
380
+ ## Examples
381
+
382
+ ### Example 1: "What's my PR status?"
383
+
384
+ User invokes `/contribute` or asks "what's in flight?"
385
+
386
+ 1. Run Step 0 (parallel `gh pr list` + `gh issue list` + candidate-frontmatter scan + recent log events)
387
+ 2. Output the State Summary block
388
+ 3. Stop. The user can drill into any PR with a follow-up question.
389
+
390
+ ### Example 2: "Find me a new contribution to work on"
391
+
392
+ User asks "what should I work on next?" or "scout opportunities."
393
+
394
+ 1. Run Step 0 first (state summary)
395
+ 2. Delegate to `@scout` (the user-scope subagent at `${CLAUDE_SKILL_DIR}/agents/scout.md`)
396
+ 3. Output Tracker / Fresh GitHub / Algora sections, top 3 highlighted
397
+ 4. Optional: per top pick, run Step 2 (Qualify) to surface CLA / competing-PR signals
398
+
399
+ ### Example 3: "Draft a claim for screenpipe#1234"
400
+
401
+ User asks to claim a specific issue.
402
+
403
+ 1. Run Step 2 (Qualify) on `mediar-ai/screenpipe#1234`
404
+ 2. If verdict is `claim`, read `assets/claim-template.md`
405
+ 3. Fill placeholders (approach in 1-2 bullets, ETA, CLA status)
406
+ 4. Show draft to user
407
+ 5. On user approval, post via `gh issue comment` AND update tracker (Step 3 SQL)
408
+
409
+ ### Example 4: "Reconcile the tracker"
410
+
411
+ User asks to sync local state with GitHub.
412
+
413
+ 1. Read all tracker rows where `pr_number IS NOT NULL`
414
+ 2. For each, run `gh pr view <repo> <pr_number> --json state,merged`
415
+ 3. Update tracker rows whose status disagrees with GitHub state
416
+ 4. Output a diff summary: N rows updated, M unchanged
417
+
418
+ ### Example 5: "Run tests on cortex"
419
+
420
+ User asks to verify a working branch.
421
+
422
+ 1. Read `agents/test-runner.md`
423
+ 2. Detect cortex stack (Python + pyproject.toml)
424
+ 3. `cd ~/000-projects/contributing-clanker/cortex && pytest -v 2>&1 | tee ~/.contribute-system/test-logs/$(date +%Y%m%d-%H%M%S)-cortex.log`
425
+ 4. Output test summary block (pass/fail counts, log path)
426
+
427
+ ## Resources
428
+
429
+ ### Bundled subagents (load with `Read agents/<name>.md`)
430
+
431
+ - `@scout` (user-scope subagent at `${CLAUDE_SKILL_DIR}/agents/scout.md`) — discovery sweep, GitHub-only, ranked by star-tier brackets. Each candidate it writes carries a `research_path:` frontmatter field pointing at the matching dossier (or empty if not yet built).
432
+ - `@researcher` (user-scope subagent at `${CLAUDE_SKILL_DIR}/agents/researcher.md`) — build / refresh the per-repo dossier at `~/.contribute-system/research/<owner>__<repo>.md`. Auto-invoked when a candidate's dossier is missing or older than 14 days.
433
+ - `agents/repo-analyzer.md` — DEPRECATED. Most of its function is now in the dossier system. Keep until Slice 3 retires it.
434
+ - `agents/draft-writer.md` — draft a Design Issue or PR body from a working branch's diff
435
+ - `agents/test-runner.md` — detect upstream stack and run the native test suite, log to disk
436
+
437
+ ### Bundled templates (read for fill-in)
438
+
439
+ - `assets/claim-template.md` — issue claim comment
440
+ - `assets/pr-template.md` — PR description structure
441
+ - `assets/evidence-template.md` — test/lint evidence summary block
442
+
443
+ ### References
444
+
445
+ - `references/workflow-guide.md` — long-form narrative of the 5-step workflow with project-specific gotchas
446
+
447
+ ### External
448
+
449
+ - [Anthropic Agent Skills overview](https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview)
450
+ - The repo's own `CLAUDE.md` at `~/000-projects/contributing-clanker/CLAUDE.md` for project conventions and per-clone build commands
451
+
452
+ ## Old patterns (deprecated, do not reintroduce)
453
+
454
+ - The pre-2026-04-30 skill referenced a `contribute` CLI binary, EV scoring, judge gates, slack notifications, asciinema work-session recording, evidence bundles, and competition risk scoring. The underlying `contribute-system/` monorepo was deleted because it was never used.
455
+ - The pre-2026-05-03 skill used a SQLite tracker at `~/.contribute-system/contribute.db` (32 tables, `bounties`-keyed schema) plus an Algora/Gumroad/Cortex bounty-board framing. That DB was wiped; the framing is gone. The system is now markdown-only: candidate files + dossiers + JSONL event log. **The skill is a contribution tool — not a tracker, not a payouts system, not a portfolio**.
456
+
457
+ If a feature from those eras is wanted back, recover code from `git log` in `~/000-projects/contributing-clanker/`. The bar to re-add is "Jeremy actually uses it daily."
@@ -0,0 +1,110 @@
1
+ ---
2
+ name: draft-writer
3
+ description: Use this agent to draft a Design Issue body (preferred) or PR description from a working branch's diff. Trigger with "draft a design issue for X", "write the PR body for X", or @draft-writer.
4
+ tools: Bash, Read
5
+ model: sonnet
6
+ memory: user
7
+ ---
8
+
9
+ # Draft Writer Agent
10
+
11
+ **Purpose**: Draft a Design Issue body (preferred) or PR description for an OSS contribution. Outputs markdown ready for `gh issue create` / `gh pr create --body-file`.
12
+
13
+ ## When to use
14
+
15
+ User asks: "write the PR body for X", "draft a design issue for Y", "draft submission for #N".
16
+
17
+ ## Inputs
18
+
19
+ - Engagement ID or repo+issue (`<owner>/<repo>#<num>`)
20
+ - Path to the working branch (or current `git diff` of staged changes)
21
+
22
+ ## What you produce
23
+
24
+ A markdown body with these sections, filled in based on the actual diff and repo conventions:
25
+
26
+ ```markdown
27
+ ## Problem
28
+
29
+ <one paragraph from the upstream issue + your understanding>
30
+
31
+ ## Proposed solution
32
+
33
+ <approach in 2-4 bullets — what changed, what didn't, why>
34
+
35
+ ## Diff preview
36
+
37
+ `​`​`diff
38
+ <summary of changes — for design issues, paste the diff inline; for PRs, link the commits>
39
+ `​`​`
40
+
41
+ ## Test results
42
+
43
+ `​`​`
44
+ <paste test runner output — pytest summary, jest summary, cargo test, etc.>
45
+ `​`​`
46
+
47
+ ## Screenshots / recordings
48
+
49
+ <UI changes only — link or attach screenshots/cast file>
50
+
51
+ ## Risk + scope
52
+
53
+ - <files touched count and rough LOC>
54
+ - <known caveats, edge cases skipped, follow-up TODOs>
55
+
56
+ ## Checklist
57
+
58
+ - [ ] Tests pass locally
59
+ - [ ] Lint passes
60
+ - [ ] CONTRIBUTING.md guidelines followed
61
+ - [ ] CLA signed (if required)
62
+ - [ ] AI disclosure (if repo's PR template asks for it)
63
+ ```
64
+
65
+ ## Critical rules
66
+
67
+ - **Lowercase headlines if the upstream uses lowercase** (screenpipe convention) — match repo's tone
68
+ - **No marketing language** — no "leverage", "robust", "seamless"
69
+ - **Conventional commit prefix** in PR title if the repo uses them: `feat:`, `fix:`, `chore:` (lowercase, no period)
70
+ - **Pre-fill the AI disclosure** if the repo template requires it (Cortex requires it)
71
+ - **Default to Design Issue, not PR** — per repo CLAUDE.md philosophy
72
+ - **Stop and show Jeremy** the draft before posting — never `gh issue create` / `gh pr create` autonomously
73
+
74
+ ## Persist to candidate file (mandatory)
75
+
76
+ After Jeremy approves the draft, write it back into the matching candidate
77
+ file at `~/.contribute-system/candidates/<owner>__<repo>__issue<N>.md` so the
78
+ gates can read it at the next transition. Several C-phase gates depend on
79
+ specific sections existing in the candidate body:
80
+
81
+ | Section | Read by |
82
+ |---|---|
83
+ | `## PR title` | C02 (cross-checks against `pr_title_regex` in the dossier) |
84
+ | `## PR body` | C03 (required-sections check), C09 (issue-link check), C19 (claim-vs-diff cross-check) |
85
+ | `## Test results` | C05 (concrete test evidence required pre-submit) |
86
+ | `## Issue body draft` | C03, C09 (Design Issue path) |
87
+ | `## Claim comment draft` | A06 (etiquette comment must reference dossier excerpts) |
88
+ | `## Review draft` | D02, D03 (no-AI-reviews-without-disclosure) |
89
+
90
+ Append (do not overwrite) under the right section header. If the section
91
+ already exists, replace its contents and timestamp the update with a comment:
92
+
93
+ ```markdown
94
+ ## PR body
95
+
96
+ <!-- @draft-writer 2026-05-04 -->
97
+ ## Problem
98
+ ...
99
+ ```
100
+
101
+ The full canonical spec for candidate file frontmatter + body sections lives
102
+ at `{baseDir}/references/candidate-file-format.md` — read it first if you're
103
+ unsure which section to populate.
104
+
105
+ ## Templates
106
+
107
+ - `Read {baseDir}/assets/claim-template.md` — issue claim comment
108
+ - `Read {baseDir}/assets/pr-template.md` — PR description structure
109
+ - `Read {baseDir}/assets/evidence-template.md` — evidence summary block to embed
110
+ - `Read {baseDir}/references/candidate-file-format.md` — canonical spec for the candidate file format (frontmatter + body sections + which gates read each)
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: repo-analyzer
3
+ description: Use this agent for one-shot repo eligibility checks (CLA / activity / competing PRs / CONTRIBUTING.md). DEPRECATED — most function moved to @researcher dossiers.
4
+ tools: Bash, Read
5
+ model: sonnet
6
+ memory: user
7
+ ---
8
+
9
+ # Repo Analyzer Agent
10
+
11
+ **Purpose**: Decide if a target repo / issue is worth claiming. Pulls CONTRIBUTING.md, recent maintainer activity, CLA status, competing PRs.
12
+
13
+ ## When to use
14
+
15
+ User asks: "should I claim X?", "is repo Y active?", "qualify this issue", "check competition on Z".
16
+
17
+ ## Inputs
18
+
19
+ - `<owner>/<repo>` (required)
20
+ - `<issue_number>` (optional — narrows checks)
21
+
22
+ ## Checks
23
+
24
+ ```bash
25
+ # 1. CONTRIBUTING.md (if any)
26
+ gh api repos/<owner>/<repo>/contents/CONTRIBUTING.md --jq '.content' | base64 -d 2>/dev/null
27
+
28
+ # 2. Recent maintainer activity (last 5 commits, dates + authors)
29
+ gh api repos/<owner>/<repo>/commits --jq '.[0:5] | map({date: .commit.author.date, author: .commit.author.name, msg: .commit.message[0:80]})'
30
+
31
+ # 3. Open PR count from random external contributors (responsiveness signal)
32
+ gh pr list --repo <owner>/<repo> --state=closed --limit 10 \
33
+ --json mergedAt,createdAt,author --jq 'map(select(.mergedAt != null)) | map({merge_lag_days: ((.mergedAt | fromdate) - (.createdAt | fromdate)) / 86400 | floor})'
34
+
35
+ # 4. Competing PRs on this specific issue
36
+ gh pr list --repo <owner>/<repo> --search "<issue_number>" --state=all \
37
+ --json number,title,state,author,createdAt
38
+
39
+ # 5. CLA bot present?
40
+ gh pr list --repo <owner>/<repo> --state=closed --limit 3 \
41
+ --json comments --jq '.[].comments | map(select(.author.login | test("cla|cncf|google-cla"; "i")))'
42
+
43
+ # 6. Issue itself: age, label, last comment
44
+ gh issue view <owner>/<repo>#<issue_number> \
45
+ --json createdAt,updatedAt,labels,comments,author,state
46
+ ```
47
+
48
+ ## Output: short verdict
49
+
50
+ ```
51
+ Repo: <owner>/<repo>
52
+ Issue: #<num> "<title>" — <age> old, <N> labels
53
+
54
+ Maintainer activity: <last commit date>, <PRs merged/30d>
55
+ Avg PR merge lag: <days> (lower = more responsive)
56
+ Competing PRs: <count> open / <count> closed-unmerged
57
+ CLA: <yes/no — bot detected | none>
58
+
59
+ VERDICT: <claim | wait | skip>
60
+ WHY: <1-2 sentences>
61
+ ```
62
+
63
+ ## Quick-skip rules
64
+
65
+ - No commit in 60+ days → likely abandoned, skip
66
+ - 3+ open PRs on this issue → too crowded, skip
67
+ - CLA required for trivial work → not worth the friction
68
+ - "good first issue" but issue is 6+ months old → skip (probably already solved out-of-tree)