@gallopsystems/agent-skills 1.1.0 → 1.4.0

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 (24) hide show
  1. package/README.md +57 -0
  2. package/commands/contribute-skill.md +65 -0
  3. package/package.json +2 -1
  4. package/plugins/copier-template/.claude-plugin/plugin.json +8 -0
  5. package/plugins/copier-template/skills/copier-template/SKILL.md +74 -0
  6. package/plugins/copier-template/skills/copier-template/applying-updates.md +87 -0
  7. package/plugins/copier-template/skills/copier-template/template-authoring.md +89 -0
  8. package/plugins/doctl/.claude-plugin/plugin.json +2 -2
  9. package/plugins/doctl/skills/doctl/SKILL.md +80 -48
  10. package/plugins/doctl/skills/doctl/other-services.md +56 -0
  11. package/plugins/doctl/skills/doctl/spec-management.md +74 -0
  12. package/plugins/git-github/.claude-plugin/plugin.json +8 -0
  13. package/plugins/git-github/skills/git-github/SKILL.md +91 -0
  14. package/plugins/git-github/skills/git-github/actions-debugging.md +102 -0
  15. package/plugins/git-github/skills/git-github/external-review.md +39 -0
  16. package/plugins/git-github/skills/git-github/getting-unstuck.md +106 -0
  17. package/plugins/git-github/skills/git-github/gh-api-recipes.md +73 -0
  18. package/plugins/git-github/skills/git-github/releases.md +53 -0
  19. package/plugins/kysely-postgres/skills/kysely-postgres/SKILL.md +6 -0
  20. package/plugins/linear/skills/linear/SKILL.md +6 -0
  21. package/plugins/nitro-testing/skills/nitro-testing/SKILL.md +6 -0
  22. package/plugins/nuxt-nitro-api/skills/nuxt-nitro-api/SKILL.md +7 -0
  23. package/plugins/nuxt-nitro-api/skills/nuxt-nitro-api/composables-utils.md +5 -0
  24. package/plugins/nuxt-nitro-api/skills/nuxt-nitro-api/formatters.md +139 -0
@@ -0,0 +1,56 @@
1
+ # Databases, Spaces, Droplets, DNS
2
+
3
+ ## Managed Databases
4
+
5
+ ```bash
6
+ doctl databases list --format ID,Name,Engine,Version,NumNodes,Size
7
+ doctl databases connection <db-id> --format URI --no-header # full credentialed URI
8
+ doctl databases ca <db-id> # cluster CA certificate
9
+ ```
10
+
11
+ - **The connection URI contains live credentials** — treat command output as a secret. Don't echo it into logs; pipe it directly to where it's needed.
12
+ - **Check `Version`** and keep CI/local database versions in sync with production — a test suite running `postgres:15` against a pg-18 production cluster hides version-specific behavior.
13
+ - Connections use port 25060 with `sslmode=require`. **TLS trap**: some clients (e.g. newer `pg-connection-string`) silently upgrade `require` to `verify-full`, which rejects DO's CA under the default trust store. Fix: supply the CA from `doctl databases ca <db-id>` explicitly, or configure ssl options in code rather than relying on the URI.
14
+
15
+ ## Spaces
16
+
17
+ **`doctl spaces` manages access keys only — not buckets.** Create and manage buckets with the `aws` CLI (or s3cmd) against the Spaces endpoint:
18
+
19
+ ```bash
20
+ aws s3 mb s3://<bucket> --endpoint-url https://<region>.digitaloceanspaces.com
21
+ ```
22
+
23
+ Keys:
24
+
25
+ ```bash
26
+ doctl spaces keys create <name> --grants 'bucket=<bucket>;permission=readwrite' -o json > /tmp/key.json
27
+ doctl spaces keys list
28
+ doctl spaces keys delete <ACCESS_KEY> # no --force flag; prompts — use `yes |` when non-interactive
29
+ ```
30
+
31
+ - Grant permissions: `read`, `readwrite`, `fullaccess`. An empty `bucket=` grants all buckets.
32
+ - **The secret key is shown exactly once, at creation.** Capture it to a temp file with `-o json`, never print it, and delete the file after storing it where it belongs.
33
+ - Unlike most doctl delete commands, `spaces keys delete` has no `--force` flag (it errors `unknown flag`).
34
+ - Bootstrap pattern: create a temporary `fullaccess` key to create the bucket, mint a bucket-scoped `readwrite` key for the app, swap it in, then delete the full-access key.
35
+
36
+ ## Droplets
37
+
38
+ ```bash
39
+ doctl compute ssh-key list # find key IDs (match yours via ssh-keygen -l -E md5)
40
+ doctl compute droplet create <name> --region <region> --size s-1vcpu-1gb \
41
+ --image ubuntu-24-04-x64 --ssh-keys <key-id> --enable-monitoring --wait
42
+ doctl compute droplet list --format Name,PublicIPv4,Status
43
+ doctl compute ssh <droplet-name> # ssh by name (interactive)
44
+ doctl compute firewall list --format Name,InboundRules,DropletIDs
45
+ ```
46
+
47
+ `--wait` blocks until the droplet is active, so the IP is immediately available from `droplet list`. For non-interactive remote commands prefer plain ssh: `ssh -o StrictHostKeyChecking=accept-new root@<ip> "<cmd>"`.
48
+
49
+ ## DNS
50
+
51
+ Domain commands live under `compute` — `doctl domains ...` fails with `unknown command`:
52
+
53
+ ```bash
54
+ doctl compute domain list
55
+ doctl compute domain records list <domain>
56
+ ```
@@ -0,0 +1,74 @@
1
+ # App Specs: Env Vars, Secrets, Creating Apps
2
+
3
+ The app spec is the single source of truth for an App Platform app's configuration (components, env vars, routes, instance sizes). Most config changes are a GET → edit → PUT round-trip.
4
+
5
+ ## Changing Env Vars / Secrets (the standard workflow)
6
+
7
+ ```bash
8
+ doctl apps spec get <app-id> > /tmp/spec.yaml
9
+ # edit /tmp/spec.yaml — add under the relevant service's envs:
10
+ # - key: MY_SECRET
11
+ # scope: RUN_AND_BUILD_TIME
12
+ # type: SECRET
13
+ # value: <plaintext>
14
+ doctl apps update <app-id> --spec /tmp/spec.yaml
15
+ rm /tmp/spec.yaml # the temp file held plaintext secrets
16
+ ```
17
+
18
+ Facts that matter:
19
+
20
+ - **`type: SECRET` values are submitted as plaintext and encrypted on ingest.** They read back as `EV[1:...]` blobs and can never be read back in plaintext via doctl.
21
+ - **Existing `EV[...]` blobs survive the round-trip unchanged** — you do not need to re-supply secret values when editing other parts of the spec.
22
+ - **DO encrypts whatever literal string you submit.** A placeholder like `VALUE_TO_SET` gets encrypted and deployed as the real value. Never put placeholder text in a SECRET value — keep the `EV[...]` blob or paste the real plaintext.
23
+ - **`apps update --spec` triggers a new deployment** (Cause: `app spec updated`). The update command's own output may show a blank `In Progress Deployment ID` even though a deployment was created — confirm with `doctl apps list-deployments <app-id> | head -3`.
24
+ - To verify a secret landed: `doctl apps spec get <app-id> | grep -A3 MY_SECRET` (expect an `EV[...]` value).
25
+ - To inspect env config without the YAML: `doctl apps get <app-id> -o json | jq '.[0].spec.services[0].envs[] | {key, scope, type}'` (note the `.[0]` — json output is an array).
26
+ - The only way to read a runtime env value is a console session into the running container — see "apps console" below.
27
+
28
+ Env `scope` values: `RUN_TIME`, `BUILD_TIME`, `RUN_AND_BUILD_TIME`. Env vars can live at the app level (shared) or per-component.
29
+
30
+ ## Validating Specs: `--schema-only` for Update Specs
31
+
32
+ `doctl apps spec validate spec.yaml` calls the propose endpoint, which simulates app **creation**. A spec pulled from a live app fails validation with:
33
+
34
+ ```
35
+ secret env value must not be encrypted before app is created
36
+ ```
37
+
38
+ This is a false alarm — `apps update` accepts `EV[...]` values fine. To pre-validate a spec destined for `apps update`, use:
39
+
40
+ ```bash
41
+ doctl apps spec validate spec.yaml --schema-only
42
+ ```
43
+
44
+ Full (non-schema-only) validation is still useful for specs that will be passed to `apps create`.
45
+
46
+ ## Creating an App
47
+
48
+ ```bash
49
+ doctl apps create --spec .do/app.yaml --context <ctx> [--project-id <project-uuid>]
50
+ doctl projects list --format ID,Name # to find the project ID
51
+ ```
52
+
53
+ - Convention: keep a sanitized spec in the repo (e.g. `.do/app.yaml`) with SECRET keys listed but values empty; inject real values into a temp copy at create time and delete it after.
54
+ - Specs can also be piped inline: `doctl apps create --spec - <<'EOF' ... EOF` (same for `update`).
55
+ - **GitHub-access 400**: `POST /v2/apps: 400 ... GitHub user does not have access to <org>/<repo>` means the DigitalOcean GitHub App isn't installed/authorized on that org. This is fixed in the browser (GitHub → Settings → Applications), not via doctl — hand it to the user, then retry the create.
56
+ - `DefaultIngress` is empty (`<nil>`) until the first deployment goes ACTIVE. Fetch it afterward: `doctl apps get <app-id> --format DefaultIngress --no-header`.
57
+ - No logs exist until the first deployment starts.
58
+
59
+ ## Instance Sizes / Pricing
60
+
61
+ ```bash
62
+ doctl apps tier instance-size list
63
+ doctl apps tier instance-size list -o json | jq '[.[] | {slug, monthly: .usd_per_month_cost}] | sort_by(.monthly)'
64
+ ```
65
+
66
+ Use the slug in the spec's `instance_size_slug`.
67
+
68
+ ## apps console — Interactive Only
69
+
70
+ `doctl apps console <app-id> <component>` opens an ephemeral shell in a running component — the only way to read live secret values or poke the runtime environment. But:
71
+
72
+ - There is **no `--command` flag**, and piping stdin fails (`error setting terminal to raw mode: inappropriate ioctl for device`). It requires a real TTY.
73
+ - An agent cannot drive it. Hand the user the exact command to run themselves, or reproduce the container environment locally with `docker run` instead.
74
+ - Instances are ephemeral — nothing done in a console session persists.
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "git-github",
3
+ "description": "Git and GitHub (gh CLI) workflows for agents: the branch-to-PR loop, reading PR/CI state, debugging failed Actions runs, repair ladders for stuck git states, gh api recipes, and release flows.",
4
+ "version": "1.0.0",
5
+ "author": {
6
+ "name": "yeedle"
7
+ }
8
+ }
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: git-github
3
+ description: Git and GitHub (gh CLI) workflows for agents - the branch-to-PR loop, reading PR and CI state, debugging failed GitHub Actions runs, getting unstuck from rejected pushes and rebase messes, gh api recipes, and release flows.
4
+ ---
5
+
6
+ # Git + GitHub Workflows
7
+
8
+ Battle-tested git and `gh` patterns for working in repos as an agent: the everyday branch→PR loop, interrogating PR/CI state, and recovering from the states git gets itself into.
9
+
10
+ ## Ground Rules
11
+
12
+ - **Never push to the default branch unless the user explicitly says to.** "Commit and push" means the current branch. If on the default branch, branch first.
13
+ - **Destructive operations require explicit user authorization**: `push --force` (even with lease, outside your own just-rebased branch), deleting remote branches, closing PRs you didn't open, `reset --hard`, `--no-verify`.
14
+ - **Quote pathspecs containing brackets.** zsh globs `[id].get.ts` into `no matches found` — write `git add 'server/api/[id].get.ts'`. This bites on every bracketed-route codebase.
15
+ - **Prefer `git -C <path>`** over `cd <path> && git ...` — compound cd commands trigger permission prompts and reset the shell cwd.
16
+ - **Branch naming**: follow the repo's convention (`feat/`, `fix/`, `chore/`, `ci/`). If an issue tracker (e.g. Linear) suggests a branch name for the ticket, use it verbatim — it powers the tracker↔GitHub integration (auto-close on merge).
17
+ - **Bounded polling, never unbounded watching.** `gh run watch` / `--watch` can die on network timeouts mid-wait; in agent contexts prefer a bounded loop with escalating sleeps (30/60/90s).
18
+
19
+ ## The Branch → PR Loop
20
+
21
+ ```bash
22
+ # 1. Start from fresh main
23
+ git checkout main && git pull --ff-only
24
+ git checkout -b feat/<short-description>
25
+
26
+ # 2. Commit with a heredoc (multi-line messages survive quoting)
27
+ git commit -m "$(cat <<'EOF'
28
+ feat(scope): one-line summary
29
+
30
+ Why this change exists, not just what it does.
31
+ EOF
32
+ )"
33
+
34
+ # 3. Push and open the PR with a structured body
35
+ git push -u origin feat/<short-description>
36
+ gh pr create --title "feat(scope): one-line summary" --body "$(cat <<'EOF'
37
+ ## What
38
+ ...
39
+
40
+ ## Why
41
+ ...
42
+
43
+ ## Notes for reviewers
44
+ ...
45
+ EOF
46
+ )"
47
+ ```
48
+
49
+ - **Keep the PR description current.** After material scope changes, `gh pr edit <n> --body "$(cat <<'EOF' ... EOF)"`.
50
+ - Merge style: `gh pr merge <n> --squash --delete-branch`; verify with `gh pr view <n> --json state,mergedAt`.
51
+ - After merge: `git switch main && git pull --ff-only`, clean up `[gone]` branches, start the next branch from fresh main.
52
+ - One concern per PR — hotfixes and review findings go in separate PRs unless told otherwise.
53
+ - Stacked PRs: `gh pr create --base <parent-branch>`; after the parent merges, retarget with `gh pr edit <n> --base main` (and see [getting-unstuck.md](getting-unstuck.md) for rebasing onto main after the parent was squash-merged).
54
+
55
+ ## Reading PR and CI State
56
+
57
+ ```bash
58
+ gh pr view <n> --json mergeable,mergeStateStatus,reviewDecision,state,mergedAt
59
+ gh pr view <n> --json body -q .body # read the current description
60
+ gh pr diff <n> # the review workhorse; --name-only for the file list
61
+ gh pr checks <n> # CI status table
62
+ gh pr checks <n> --json name,bucket,link --jq '.[] | select(.bucket=="fail")'
63
+ ```
64
+
65
+ - `mergeable: CONFLICTING` / `mergeStateStatus: DIRTY` → branch conflicts with base; `BEHIND` → needs update.
66
+ - Bounded CI wait: `until gh pr checks <n> 2>&1 | grep -qvE 'pending'; do sleep 30; done` — or check, sleep 30/60/90, re-check.
67
+
68
+ ## Pre-push Hook Noise
69
+
70
+ When a push fails inside a compound command (or behind lefthook/husky pre-push hooks), the hook's lint/test output drowns the real git error. Isolate it:
71
+
72
+ ```bash
73
+ git push -u origin <branch> > /tmp/push.log 2>&1; echo "exit=$?"
74
+ grep -E '! \[reject|error:|fatal:' /tmp/push.log
75
+ ```
76
+
77
+ Do not bypass failing hooks with `--no-verify` unless the user says to.
78
+
79
+ ## Further Reading
80
+
81
+ - **Debugging failed Actions runs** (the full playbook): [actions-debugging.md](actions-debugging.md)
82
+ - **Repair ladders** — rejected pushes, blocked checkouts, rebase/conflict recovery, shallow clones, worktrees: [getting-unstuck.md](getting-unstuck.md)
83
+ - **gh api recipes** — PR comments, reading files without checkout, repo settings, PAT gotchas: [gh-api-recipes.md](gh-api-recipes.md)
84
+ - **Releases & publishing** — tags, gh release, npm Trusted Publishing, release-please: [releases.md](releases.md)
85
+ - **External review loop** — using the codex CLI as an adversarial pre-merge reviewer: [external-review.md](external-review.md)
86
+
87
+ ## Contributing Back
88
+
89
+ This skill grows by capturing what it missed. If you just worked through something in this domain that this skill did not cover — an error you had to figure out, a behavior that contradicts what is documented above, a workflow knot — ask the user: **"Want me to contribute this back to the git-github skill?"**
90
+
91
+ If yes, run `/contribute-skill`. If that command is not available, do the equivalent inline: distill the generic lesson (placeholders only — no project names, IDs, domains, or secrets), then branch or fork [gallop-systems/agent-skills](https://github.com/gallop-systems/agent-skills) and open a PR editing this skill.
@@ -0,0 +1,102 @@
1
+ # Debugging Failed GitHub Actions Runs
2
+
3
+ The playbook, in the order that actually works.
4
+
5
+ ## 1. Start from the PR, not the run
6
+
7
+ ```bash
8
+ gh pr checks <n> --watch --interval 20 --fail-fast=false # interactive sessions
9
+ gh pr checks <n> # one-shot snapshot for poll loops
10
+ ```
11
+
12
+ The output includes run/job links with the IDs you need. `--required` limits to required checks.
13
+
14
+ For branch pushes without a PR, find the run:
15
+
16
+ ```bash
17
+ rid=$(gh run list --branch <branch> --limit 1 --json databaseId,status,conclusion --jq '.[0].databaseId')
18
+ ```
19
+
20
+ ## 2. Get the failing-step logs
21
+
22
+ ```bash
23
+ gh run view <run-id> --log-failed 2>&1 | tail -50
24
+ ```
25
+
26
+ This is the first command of every failure investigation. When noisy, narrow it:
27
+
28
+ ```bash
29
+ gh run view <run-id> --log-failed | grep -E 'FAIL|error|✗'
30
+ # aggregate TypeScript errors by code:
31
+ gh run view <run-id> --log-failed | grep -oE 'error TS[0-9]+' | sort | uniq -c | sort -rn
32
+ ```
33
+
34
+ Runner log lines are prefixed with `job\tstep\ttimestamp` — strip before aggregating:
35
+
36
+ ```bash
37
+ sed -E 's/^[^\t]*\t[^\t]*\t[0-9T:.Z-]* //'
38
+ ```
39
+
40
+ and file paths are absolute on the runner — strip `s#^/home/runner/work/<repo>/<repo>/##` to get repo-relative paths.
41
+
42
+ ## 3. Need context before the failure?
43
+
44
+ `--log-failed` shows only the failing step. For surrounding context:
45
+
46
+ ```bash
47
+ gh run view <run-id> --json status,conclusion,jobs --jq '{status, conclusion, jobs: [.jobs[] | {name, status, conclusion}]}'
48
+ gh run view <run-id> --job <job-id> --log | grep -E '<pipeline markers>'
49
+ gh api repos/<owner>/<repo>/actions/jobs/<job-id>/logs | tail -60 # raw dump, last resort
50
+ ```
51
+
52
+ ## 4. Flaky or real? Check main
53
+
54
+ ```bash
55
+ gh run list --branch main --limit 3 --json databaseId,status,conclusion
56
+ ```
57
+
58
+ If main is red with the same failure, the problem isn't your branch. If it looks like a flake:
59
+
60
+ ```bash
61
+ gh run rerun <run-id> --failed # reruns only the failed jobs
62
+ ```
63
+
64
+ Note: `gh run rerun --job <id>` only works on failed jobs within the retention window ("job cannot be rerun" otherwise).
65
+
66
+ ## 5. Reproduce locally before fixing
67
+
68
+ Run the exact failing command from the workflow (`yarn test:run -- <file>`, `yarn fmt:check`, etc.). For environment-dependent failures (Linux vs macOS differences, missing gitignored fixtures, float-precision diffs in generated output), reproduce inside the CI image:
69
+
70
+ ```bash
71
+ docker run --rm -v "$PWD":/work -w /work node:22 bash -c \
72
+ 'yarn install --immutable && <failing command>'
73
+ ```
74
+
75
+ ## 6. Fix → push → re-watch → merge
76
+
77
+ ```bash
78
+ git push
79
+ sleep 30 && gh pr checks <n> # then 60s, 90s — escalating, bounded
80
+ gh pr merge <n> --squash --delete-branch
81
+ gh pr view <n> --json state,mergedAt
82
+ git switch main && git pull --ff-only
83
+ ```
84
+
85
+ ## Watching: bounded polls beat unbounded watches
86
+
87
+ `gh run watch <id> --exit-status` is convenient but long watches can die with a GraphQL network timeout, losing the wait entirely. In agent contexts prefer:
88
+
89
+ ```bash
90
+ for s in 30 60 90 90 90; do
91
+ sleep $s
92
+ state=$(gh run view <run-id> --json status,conclusion --jq '"\(.status)/\(.conclusion)"')
93
+ echo "$state"; [[ "$state" == completed/* ]] && break
94
+ done
95
+ ```
96
+
97
+ ## Common root causes (in observed frequency order)
98
+
99
+ 1. **Formatter/lint check failures** — fix is `yarn fmt` (or the repo's equivalent), commit, push.
100
+ 2. **Test-only bugs** — assumptions that break under the CI harness (e.g. transaction-rollback test isolation).
101
+ 3. **Environment differences** — CI Linux vs local macOS: gitignored fixture files missing in CI, locale/precision output diffs.
102
+ 4. **Genuine flakes** — rerun `--failed`; if it recurs, it's not a flake.
@@ -0,0 +1,39 @@
1
+ # External Review Loop (codex as adversarial reviewer)
2
+
3
+ Use OpenAI's `codex` CLI as an independent reviewer of your own work before a human sees it. The loop: review → triage → fix fair findings → commit → re-review, until clean.
4
+
5
+ ## Invocation
6
+
7
+ ```bash
8
+ codex review --base main 2>&1 | tail -120 # review branch vs base (the default move)
9
+ codex review --base origin/main ... # when local main may be stale
10
+ codex review --uncommitted ... # working-tree changes, pre-commit
11
+ codex review --commit <sha> ... # single commit
12
+ codex review <PR-number> # codex reads the PR description for intent
13
+ ```
14
+
15
+ - Steer with a positional prompt: `codex review --base main "Focus on X, Y. Report only issues genuinely worth fixing."` For long briefs use `"$(cat /tmp/review-prompt.md)"` or stdin via `-` (with `--title` for display context). A good brief states the feature context, prioritized focus areas (security first), what to skip (style/lint), and a mandated output format ("P0/P1/P2 punch list, file:line per finding").
16
+ - Reviews take minutes. Run in the background redirecting to a file (`codex review --base main > /tmp/review-r1.txt 2>&1`), then read the file when the process exits.
17
+ - **Exit code is 0 even with findings** — judge clean/dirty from the text, not `$?`.
18
+ - Print `git branch --show-current` and `git rev-parse --short HEAD` around the review so it's unambiguous which state was reviewed — stale-state false positives (reviewing before a push/amend landed) are the most common confusion.
19
+ - Older CLI versions reject `--base` combined with a prompt (`cannot be used with '[PROMPT]'`); pass the prompt alone, use stdin `-`, or upgrade.
20
+
21
+ ## The loop
22
+
23
+ 1. Commit and push the work, then run the review.
24
+ 2. **Triage every finding before touching code.** Codex emits `[P1]/[P2]/[P3] — file:line` with rationale. Verify each at the cited location, then classify: fair (fix it), stale (already fixed, or presupposes old state — say so), or judgment call (present to the user with a recommendation). Never silently drop a finding — rebut it explicitly.
25
+ 3. Fix the fair ones; keep provenance in the commit message: `(codex review, P2)` or `fix: address codex review round 3`.
26
+ 4. Push and re-review. Small PRs converge in 1–3 rounds; large or security-sensitive features can take 6+.
27
+ 5. **Brief later rounds.** List prior findings and their fixes ("don't re-flag these"), point fresh eyes at not-yet-audited surfaces, and demand a verdict: "P0/P1 only, skip nitpicks — or say plainly: no issues, ship it."
28
+ 6. Once correctness is clean, optionally flip the lens for one final pass: "Do NOT look for bugs — those have been reviewed exhaustively. Review ONLY for over-engineering and simplification opportunities." Present those findings; don't auto-implement them.
29
+
30
+ ## Conventions
31
+
32
+ - Record the outcome in the PR body's verification section: `codex review --base main: clean (after iterating on N findings — ...)`.
33
+ - Findings that arrive after the PR merged go in a **follow-up PR** referencing the original — never amend a merged branch.
34
+ - The user arbitrates dismissals of borderline findings.
35
+ - To run the loop unattended, set a session goal (Stop hook), e.g.: "run `codex review` on this PR and fix any finding you judge important. Repeat until there are no findings that need to be addressed." **Phrase the escape clause carefully** — state explicitly whose judgment ends the loop ("findings *the assistant* deems dismissible"). An ambiguous "or you think they don't need addressing" can wedge the hook: the checker may read "you" as the user, so the agent's own dismissal never satisfies the goal.
36
+
37
+ ## Sibling pattern: plan review
38
+
39
+ The same adversarial-reviewer move works pre-code: pipe a written plan to `codex exec -` with a critique prompt ("review this plan — focus on bloat and YAGNI"). Useful before large implementations; findings adjust the plan, not the code.
@@ -0,0 +1,106 @@
1
+ # Getting Unstuck: Repair Ladders for Common Git Failures
2
+
3
+ Each section is a failure you'll actually hit, with the sequence that resolves it.
4
+
5
+ ## Rejected push (remote has new commits)
6
+
7
+ ```
8
+ ! [rejected] <branch> -> <branch> (fetch first)
9
+ ```
10
+
11
+ The ladder — each step unblocks the next:
12
+
13
+ ```bash
14
+ git stash push -u -m "wip before rebase" # only if the tree is dirty
15
+ git pull --rebase origin <branch>
16
+ git push
17
+ git stash pop
18
+ ```
19
+
20
+ - `git pull --rebase` refuses to run with unstaged changes (`cannot pull with rebase: You have unstaged changes`) — hence stash first, always with `-u` (untracked files) and a descriptive `-m`.
21
+ - If the dirty files are unrelated WIP, scope the stash: `git stash push -u -m "wip" -- <paths>` so the rest of the tree stays put.
22
+ - `fatal: Need to specify how to reconcile divergent branches` → same fix: `git pull --rebase origin <branch>`.
23
+
24
+ ## Checkout/merge blocked by local changes
25
+
26
+ `error: Your local changes to the following files would be overwritten by checkout` — same stash-first pattern: stash, switch/merge, pop.
27
+
28
+ ## Rebasing a stacked branch after its base was squash-merged
29
+
30
+ After the parent PR squash-merges, your stacked branch "contains" commits main already has in squashed form. A plain rebase replays them all and conflicts everywhere. Instead, replay only your own commits:
31
+
32
+ ```bash
33
+ git log --oneline main..HEAD # identify your commits
34
+ git merge-base HEAD origin/main # sanity-check the old fork point
35
+ git rebase --onto origin/main <old-base-sha> # replay only commits after <old-base-sha>
36
+ ```
37
+
38
+ During the rebase:
39
+ - **`--ours`/`--theirs` are inverted during rebase**: `--ours` is the *new base* (main), `--theirs` is *your branch's* change. `git checkout --ours <file> && git add <file>` keeps main's version.
40
+ - Commits that were already squash-merged become empty → `git rebase --skip` (or `git cherry-pick --skip` in cherry-pick flows; `--allow-empty` if you want the empty commit).
41
+ - "dropping <sha> ... patch contents already upstream" is rebase doing its job — verify afterward with `git log origin/main..HEAD` rather than assuming commits vanished.
42
+ - If you rebased a detached `HEAD`, reattach the branch: `git checkout -B <branch>`.
43
+
44
+ Then force-push: `git push --force-with-lease origin <branch>`, and confirm the PR recovered with `gh pr view <n> --json mergeable,mergeStateStatus`.
45
+
46
+ If a rebase goes sideways: `git rebase --abort`, re-inspect with `git log --oneline origin/main..HEAD`, try again with a better plan.
47
+
48
+ ## Lockfile / generated-file conflicts during rebase
49
+
50
+ Don't hand-merge lockfiles. Take one side wholesale and regenerate:
51
+
52
+ ```bash
53
+ git checkout --ours yarn.lock && git add yarn.lock
54
+ git rebase --continue
55
+ yarn install # regenerate to match the merged manifest; commit if it changed
56
+ ```
57
+
58
+ ## `--force-with-lease` rejected as stale
59
+
60
+ A bare `--force-with-lease` compares against your remote-tracking ref. If the branch was fetched into a local ref or `FETCH_HEAD` only (common in CI/sandbox checkouts), every lease push fails. Fix: make sure `refs/remotes/origin/<branch>` exists —
61
+
62
+ ```bash
63
+ git fetch origin '+refs/heads/<branch>:refs/remotes/origin/<branch>'
64
+ ```
65
+
66
+ — or pass an explicit lease: `--force-with-lease=<branch>:<expected-sha>`.
67
+
68
+ ## Shallow clones silently imply single-branch
69
+
70
+ `git clone --depth=N` narrows the fetch refspec to the default branch, so `git fetch origin <other-branch> && git checkout <other-branch>` fails even though the branch exists. Fix with an explicit refspec:
71
+
72
+ ```bash
73
+ git fetch origin '+refs/heads/<branch>:refs/remotes/origin/<branch>'
74
+ git checkout -B <branch> origin/<branch>
75
+ ```
76
+
77
+ ## `fatal: couldn't find remote ref <branch>`
78
+
79
+ You guessed the branch name. `git branch -a` / `git fetch origin` first — or skip the guessing entirely with `gh pr checkout <n>`, which fetches the PR head regardless of branch naming.
80
+
81
+ ## `gh pr create` → "Head sha can't be blank / No commits between X and Y"
82
+
83
+ The branch has no commits ahead of its base (or wasn't pushed). Commit and/or `git push -u` first.
84
+
85
+ ## Migrations vs a moving main
86
+
87
+ When main gained DB migrations while your PR was open: migrate down locally, rebase onto main, **rename your migration files so their timestamps sort after main's**, re-run migrations. Migration order is part of the merge.
88
+
89
+ ## Worktrees: fix CI without disturbing WIP
90
+
91
+ ```bash
92
+ git worktree add ../<repo>-hotfix <branch> # existing branch
93
+ git worktree add -b <new-branch> ../<repo>-hotfix origin/main
94
+ # ... fix, commit, push from the worktree ...
95
+ git worktree remove --force ../<repo>-hotfix && git worktree prune
96
+ ```
97
+
98
+ Caveat: hooks that run package scripts may fail inside a worktree if they resolve modules from the main checkout — run installs in the worktree first.
99
+
100
+ ## `git diff --cached` can't take a range
101
+
102
+ `git diff --stat --cached main..` → usage error (exit 129). The cached diff is against a single commit: `git diff --stat --cached main`.
103
+
104
+ ## Long-diverged automation branches
105
+
106
+ A bot-maintained branch diverged 3-vs-105 commits is not worth merging — `git reset --hard origin/<branch>` (destructive: requires explicit user authorization) and re-apply the local delta on top.
@@ -0,0 +1,73 @@
1
+ # gh api Recipes
2
+
3
+ Read-only `gh api` patterns for inspecting repos and PRs without checking anything out.
4
+
5
+ ## PR feedback lives in TWO places — fetch both
6
+
7
+ Inline review comments and conversation-tab comments are different endpoints. When addressing PR feedback, always check both:
8
+
9
+ ```bash
10
+ # Inline review comments (attached to lines of the diff)
11
+ gh api repos/<owner>/<repo>/pulls/<n>/comments \
12
+ --jq '[.[] | {id, path, line, body, user: .user.login}]'
13
+
14
+ # Conversation-tab comments
15
+ gh api repos/<owner>/<repo>/issues/<n>/comments \
16
+ --jq '[.[] | {id, body, user: .user.login, created_at}]'
17
+
18
+ # Review states/bodies (approve / request-changes verdicts)
19
+ gh api repos/<owner>/<repo>/pulls/<n>/reviews --jq '[.[] | {state, body, user: .user.login}]'
20
+ ```
21
+
22
+ Reply at the conversation level with `gh pr comment <n> --body "..."` (there's no clean CLI path for threaded inline replies).
23
+
24
+ Repo-wide recent PR comments, newest first:
25
+
26
+ ```bash
27
+ gh api 'repos/<owner>/<repo>/issues/comments?sort=created&direction=desc&per_page=30' --paginate \
28
+ --jq '.[] | select(.pull_request_url != null) | {pr: .pull_request_url, body, created_at}'
29
+ ```
30
+
31
+ ## Reading files and history without a checkout
32
+
33
+ ```bash
34
+ # Read one file off any branch (URL-encode brackets in paths: %5Bid%5D)
35
+ gh api 'repos/<owner>/<repo>/contents/<path>?ref=<branch>' --jq '.content' | base64 -d
36
+
37
+ # Full file tree
38
+ gh api 'repos/<owner>/<repo>/git/trees/<branch>?recursive=1' --jq '.tree[].path'
39
+
40
+ # Per-file commit history
41
+ gh api 'repos/<owner>/<repo>/commits?path=<file>&per_page=5' \
42
+ --jq '.[] | {sha: .sha[0:7], msg: .commit.message, date: .commit.author.date}'
43
+
44
+ # Which files a PR touches (with per-file status)
45
+ gh api repos/<owner>/<repo>/pulls/<n>/files --jq '.[] | {filename, status, additions, deletions}'
46
+ ```
47
+
48
+ (`gh pr diff <n>` and `gh pr diff <n> --name-only` cover the common cases without the api call.)
49
+
50
+ ## Repo settings audit
51
+
52
+ ```bash
53
+ # Merge policy
54
+ gh api repos/<owner>/<repo> --jq '{allow_merge_commit, allow_squash_merge, allow_rebase_merge, squash_merge_commit_title, squash_merge_commit_message}'
55
+
56
+ # Branch protection
57
+ gh api repos/<owner>/<repo>/branches/<branch>/protection
58
+ ```
59
+
60
+ ## Deploy keys (server pulls a private repo)
61
+
62
+ ```bash
63
+ # generate the key on the server, then:
64
+ gh repo deploy-key add - --repo <owner>/<repo> --title "<host>" <<< "$PUBKEY"
65
+ gh repo deploy-key list --repo <owner>/<repo>
66
+ ```
67
+
68
+ ## Token and version gotchas
69
+
70
+ - **Fine-grained PATs can't access some endpoints at all** (e.g. `/notifications`): 403 "Resource not accessible by personal access token". The tell: the response **lacks the `x-accepted-github-permissions` header**, meaning no grantable permission fixes it — you need a classic PAT with the right scope for that one call.
71
+ - For scripted clones with a token, the remote form is `https://x-access-token:<TOKEN>@github.com/<owner>/<repo>.git`.
72
+ - **Pushing workflow files** with an OAuth-scoped token fails with "refusing to allow an OAuth App to update workflow". Fix: `gh auth refresh -h github.com -s repo,workflow`.
73
+ - **`--json` field sets vary by gh version** (`Unknown JSON field: "isLatest"`). The error prints the supported field list — re-run with fields from that list rather than guessing.
@@ -0,0 +1,53 @@
1
+ # Releases & Publishing
2
+
3
+ ## Tags and GitHub releases
4
+
5
+ ```bash
6
+ # Latest existing version tag, without a local checkout of all tags
7
+ git ls-remote --tags --refs --sort=-v:refname origin 'v*' | head -1
8
+
9
+ gh release create v<X.Y.Z> --target main --title "v<X.Y.Z>" --notes "$(cat <<'EOF'
10
+ ## Changes
11
+ - ...
12
+ EOF
13
+ )"
14
+ ```
15
+
16
+ ## npm Trusted Publishing (OIDC, no NPM_TOKEN)
17
+
18
+ Publish from GitHub Actions with provenance and zero long-lived secrets:
19
+
20
+ 1. On npmjs.com, configure the package's **Trusted Publisher**: the repo and the **exact workflow filename** (e.g. `release.yml`). The match is on the workflow file path — renaming the workflow breaks publishing.
21
+ 2. The workflow job needs `permissions: id-token: write` and a registry-aware setup:
22
+
23
+ ```yaml
24
+ permissions:
25
+ contents: write
26
+ id-token: write
27
+ steps:
28
+ - uses: actions/checkout@v5
29
+ - uses: actions/setup-node@v5
30
+ with:
31
+ node-version: 24
32
+ registry-url: https://registry.npmjs.org
33
+ - run: npm publish # no NODE_AUTH_TOKEN needed
34
+ ```
35
+
36
+ 3. The published version must be new — Trusted Publishing doesn't bypass the "version already exists" check.
37
+ 4. Verify provenance landed:
38
+
39
+ ```bash
40
+ npm view <pkg> dist.attestations.provenance.predicateType
41
+ ```
42
+
43
+ ## release-please (tag/changelog automation)
44
+
45
+ Conventional commits (`feat:`, `fix:`, `chore(release):` etc.) drive everything: release-please opens/updates a release PR collecting changes; merging that PR creates the tag + GitHub release, which triggers the publish workflow. With this in place, never hand-create tags — just merge the release PR.
46
+
47
+ ## Bootstrapping a repo
48
+
49
+ ```bash
50
+ gh repo create <owner>/<name> --private --source=. --remote=origin --push [--description "..."]
51
+ ```
52
+
53
+ If the push step fails inside this compound command (often a pre-push hook), the repo was still created — push separately and read the real error (see SKILL.md on hook noise).
@@ -1099,3 +1099,9 @@ const result = await db
1099
1099
  - The asserted type must structurally match the actual type (full type safety preserved)
1100
1100
  - Apply to several intermediate `with` clauses in large queries
1101
1101
  - TypeScript cannot automatically simplify these types - explicit assertion is required
1102
+
1103
+ ## Contributing Back
1104
+
1105
+ This skill grows by capturing what it missed. If you just worked through something in this domain that this skill did not cover — an error you had to figure out, a behavior that contradicts what is documented above, a workflow knot — ask the user: **"Want me to contribute this back to the kysely-postgres skill?"**
1106
+
1107
+ If yes, run `/contribute-skill`. If that command is not available, do the equivalent inline: distill the generic lesson (placeholders only — no project names, IDs, domains, or secrets), then branch or fork [gallop-systems/agent-skills](https://github.com/gallop-systems/agent-skills) and open a PR editing this skill.
@@ -1038,3 +1038,9 @@ node linear.mjs rebalance
1038
1038
  4. **Don't overcommit cycles.** Leave ~20% buffer for bugs, client requests, and interruptions.
1039
1039
  5. **Projects identify the client.** No need for client prefixes in issue titles or client labels — the project name (e.g., `[GBX] Portal`) already provides that context.
1040
1040
  6. **Triage first.** New client requests go to Backlog, not straight into the sprint — unless truly urgent.
1041
+
1042
+ ## Contributing Back
1043
+
1044
+ This skill grows by capturing what it missed. If you just worked through something in this domain that this skill did not cover — an error you had to figure out, a behavior that contradicts what is documented above, a workflow knot — ask the user: **"Want me to contribute this back to the linear skill?"**
1045
+
1046
+ If yes, run `/contribute-skill`. If that command is not available, do the equivalent inline: distill the generic lesson (placeholders only — no project names, IDs, domains, or secrets), then branch or fork [gallop-systems/agent-skills](https://github.com/gallop-systems/agent-skills) and open a PR editing this skill.
@@ -495,3 +495,9 @@ it("updates after user interaction", async () => {
495
495
  5. **Await everything** - `mountSuspended`, `trigger()`, `nextTick()` are all async.
496
496
 
497
497
  6. **Separate test configs** - Use `VITEST_ENV` to run frontend and backend tests with different environments.
498
+
499
+ ## Contributing Back
500
+
501
+ This skill grows by capturing what it missed. If you just worked through something in this domain that this skill did not cover — an error you had to figure out, a behavior that contradicts what is documented above, a workflow knot — ask the user: **"Want me to contribute this back to the nitro-testing skill?"**
502
+
503
+ If yes, run `/contribute-skill`. If that command is not available, do the equivalent inline: distill the generic lesson (placeholders only — no project names, IDs, domains, or secrets), then branch or fork [gallop-systems/agent-skills](https://github.com/gallop-systems/agent-skills) and open a PR editing this skill.