Skip to content
Back to skills

Gh Init

ASecurity

Bootstrap a GitHub repo for the slopstop ticket workflow. Creates status labels, writes .project-conf.toml. Invoke as /slopstop:gh-init (or /slopstop-gh-init). Idempotent — safe to re-run.

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 18, 2026
developmentpythongoshellbashgitapibackend

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Scanned November 18, 2026

npx -y skills add iansmith/slopstop --skill gh-init --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Gh Init?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Gh Init
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/iansmith-gh-init/badge)](https://www.skillsdirectory.com/skills/iansmith-gh-init)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: slopstop-gh-init
description: Bootstrap a GitHub repo for the slopstop ticket workflow. Creates status labels, writes .project-conf.toml. Invoke as /slopstop:gh-init (or /slopstop-gh-init). Idempotent — safe to re-run.
---

# /slopstop:gh-init

Bootstrap a GitHub-backed project for the `slopstop` ticket workflow.

**What it does (once):**
- Creates `status:in-progress` (and optionally `status:in-review`) labels on the GitHub repo.
- Writes `.project-conf.toml` in cwd with `system = "github"`, `key`, `prefix`, and `[status_labels]`.
- Seeds the gitignored `scratch/` interchange directory and the `.slopstop/` tracking directory (see `design/slopstop-process.md` §4).

Safe to re-run — all actions are idempotent.

## Autonomous mode

This skill has no interactive prompts that would block an autonomous session. Provide
`--workflow` and `--prefix` to skip the two interactive questions. There is no configuration to
set: the `[autonomous]` table was deleted 2026-08-06, and autonomy is now a `--interactive` flag
on `/slopstop:run` that this skill does not take.

## Arguments

```
/slopstop:gh-init [--workflow {3,4}]
                  [--prefix PREFIX]
                  [--in-progress-label NAME]   (default: status:in-progress)
                  [--in-progress-color HEX]    (default: fbca04)
                  [--in-review-label NAME]     (default: status:in-review)
                  [--in-review-color HEX]      (default: 0e8a16)
```

- `--workflow 3|4` — skip the workflow question (Step 4).
- `--prefix PREFIX` — skip the prefix question (Step 4). Must be 2–8 uppercase chars, filesystem-safe (e.g. `BENCH`, `BILL`).
- Label name/color overrides apply to label creation only; they do not affect what gets written to `[status_labels]` in `.project-conf.toml` unless `--in-progress-label` / `--in-review-label` are provided (in which case those names are used both for creation and for the config file).

## Step 1 — Pre-flight

Run in parallel:

1. `git rev-parse --is-inside-work-tree` — must succeed. If not: stop with `"Run inside a git repository with a GitHub remote."`
2. `git remote get-url origin` — must contain `github.com`. If no remote or non-GitHub host: stop with `"No GitHub remote found at origin. Add one first."`
3. `gh auth status` — must exit 0. If not: stop with `"GitHub CLI not authenticated. Run \`gh auth login\` first."`

## Step 2 — Detect owner/repo

```bash
gh repo view --json nameWithOwner -q .nameWithOwner
```

Save as `$OWNER_REPO` (e.g. `iansmith/slopstop-bench`). Split on `/`: `$OWNER`, `$REPO`.

If this command fails (e.g. repo not yet pushed to GitHub): stop with `"Could not determine GitHub repo. Ensure the repo exists on github.com and 'origin' is set."`

## Step 3 — GitHub backend detection

Run two ToolSearches in parallel to resolve `$GH_BACKEND` and `$GH`:

```
ToolSearch(query="select:mcp__plugin_github_github__issue_write,mcp__plugin_github_github__issue_read", max_results=4)
ToolSearch(query="select:mcp__github__create_issue,mcp__github__update_issue", max_results=4)
```

Resolution:
1. Canonical `mcp__github__*` non-empty → `$GH_BACKEND = "MCP"`, `$GH_MCP_NS = "mcp__github__"`.
2. Plugin search non-empty → `$GH_BACKEND = "MCP"`, `$GH_MCP_NS = "mcp__plugin_github_github__"`.
3. Both empty → `$GH_BACKEND = "CLI"`. Try `/usr/local/bin/gh`, `$HOME/.local/bin/gh`, `/opt/homebrew/bin/gh`, then `command -v gh`. Save as `$GH`. If none found: stop with `"Neither GitHub MCP nor 'gh' CLI found."`.

## Step 4 — Questions (interactive only)

Skip each question if its corresponding flag was supplied.

**Repo confirmation** (always asked unless running in a known-good autonomous context):

```
Confirm repo: iansmith/slopstop-bench  [y/N]
```

If `n` or empty: stop with `"No changes made."`

**Prefix question** (skip if `--prefix` supplied):

```
Ticket prefix (e.g. BILL, BENCH, MAZ)? 
```

Re-ask if empty or contains non-alphanumeric characters. Save as `$PREFIX`. Convert to uppercase.

**Workflow question** (skip if `--workflow` supplied):

```
Choose a workflow:

  3-state: todo → in-progress → done
  4-state: todo → in-progress → in-review → done

In BOTH workflows the PR process includes a pre-merge clean-context review and a
code review. Those are part of in-progress, not what in-review means.

The 4-state workflow adds in-review AFTER the code is complete relative to
its requirements — for shake-down validation: another person reviewing the
working code, OR the author dogfooding it before declaring it done.

Which workflow? [3/4]
```

Accept `3` or `4`. If empty or other: re-ask once, then stop with `"No changes made."`

## Step 5 — Explainer (printed before any action)

```
/slopstop:gh-init will make these changes to <OWNER_REPO>:

  Labels to create (if missing):
    • <IN_PROGRESS_LABEL>   (#<IN_PROGRESS_COLOR>)
    [• <IN_REVIEW_LABEL>    (#<IN_REVIEW_COLOR>)   — 4-state only]
    • slopstop-refactor     — mode label, fixed name
    • slopstop-backfill     — mode label, fixed name

  .project-conf.toml to write in cwd:
    system = "github"
    key    = "<OWNER_REPO>"
    prefix = "<PREFIX>"
    [status_labels]
    in_progress = "<IN_PROGRESS_LABEL>"
    [in_review  = "<IN_REVIEW_LABEL>"   — 4-state only]

  scratch/ interchange dir to seed at the main worktree root:
    • create scratch/ (if missing)
    • append 'scratch/' to .gitignore (skipped when git check-ignore
      says an existing pattern already covers it)

It will NOT modify issues, PRs, branches, or any other repo settings.

Proceed? [y/N]
```

If `n` or empty: stop with `"No changes made."`

## Step 6 — Existing config check

If `.project-conf.toml` already exists in cwd:

1. Parse it (use Python `tomllib` inline or shell line-matching — whatever is available).
2. If `system` is not `"github"`: stop with `"Existing config has system='<value>'. Refusing to overwrite a non-GitHub project."`
3. If `key` does not match `$OWNER_REPO`: stop with `"Existing config points to '<key>'; current repo is '<OWNER_REPO>'. Refusing to overwrite."`
4. Otherwise note "existing config detected — will merge `[status_labels]`."

## Step 7 — Create labels (idempotent)

For each required label — `IN_PROGRESS_LABEL` always; `IN_REVIEW_LABEL` only for 4-state;
and the two **mode** labels `slopstop-refactor` and `slopstop-backfill` always:

**Check existence:**

- **CLI:** `$GH label list --repo $OWNER_REPO --json name -q '.[].name'` — look for exact match.
- **MCP:** `${GH_MCP_NS}issue_read` (or equivalent list call) is not label-aware; fall back to CLI `gh label list` for the existence check even in MCP mode (labels are not in the issue MCP).

**If missing — create:**

```bash
$GH label create "<LABEL_NAME>" \
    --color "<HEX_NO_HASH>" \
    --description "<DESC>" \
    --repo "$OWNER_REPO"
```

Descriptions:
- `status:in-progress` → `"Ticket is actively being worked on"`
- `status:in-review` → `"Code complete; shake-down validation in progress"`
- `slopstop-refactor` → `"slopstop: production code only — no test file may change"`
- `slopstop-backfill` → `"slopstop: tests only — no production file may change"`

**The two mode labels have fixed names and are not configurable** — no `--refactor-label`
flag, no `[status_labels]` entry, nothing written to `.project-conf.toml` about them.
`:run` resolves mode from these exact strings (its invariant-tickets section is the one
definition), so a project that could rename them is a project that can silently get mode
resolution wrong. The status labels are configurable because a project may already have its
own; the mode labels are slopstop's own vocabulary.

**Nothing depends on this step having run** — status labels included. `gh-init` is invoked by
a human and by nothing else, so seeding any of these is a convenience, not a precondition:
every site that *applies* a label ensures it exists first. `create-ticket` does it for the
mode labels (its Step 3a is the one definition), and `:run` does it for the status labels it
swaps at close. A project that skipped `gh-init` is not broken; each label gets created the
first time something needs to apply it.

> **This claim was false when BILL-508 first made it, and BILL-527 made it true.** `:run` was
> told never to create a label *and* told to swap `$IN_PROGRESS_LABEL` at stage 14, so a
> project that skipped `gh-init` merged its code and then failed to advance its ticket — the
> work landed and the board did not move. If you ever narrow the apply-side ensure, this
> sentence goes back to being a lie.

If `gh label create` fails: stop immediately with the error. Do not proceed to the next label or to config write.

**If already present:** print `"  label '<name>' already exists — skipping"` and continue.

## Step 8 — Write .project-conf.toml

Build the TOML content:

```toml
system = "github"
key    = "<OWNER_REPO>"
prefix = "<PREFIX>"

# No tracking_dir / archive_dir keys: Step 8b creates .slopstop/, and a project-local
# .slopstop/ resolves both paths on its own (tier 2). Set a key only to override.

[status_labels]
in_progress = "<IN_PROGRESS_LABEL>"
# in_review = "<IN_REVIEW_LABEL>"   ← include only for 4-state
```

**If file absent:** write it directly using the Write tool (or shell heredoc). Use an atomic write: write to `.project-conf.toml.tmp` then rename to `.project-conf.toml`.

**Also ensure `.gitignore` contains `.project-conf-local.toml`.** Append it if absent, with
a comment saying why. `.project-conf.toml` is meant to be committed and reviewed; the local
file is one developer's overrides and must never be. A project that ignores the tracked
file instead — because it is shared with someone whose settings differ — has the split
backwards, and this is the entry that fixes it.

**If file exists and passed Step 6 checks:** read the existing content, replace or add `[status_labels]` section while preserving all other sections (`[workflow]`, `[tiers]`, `[complexity]`, etc.), and rewrite. Use the same atomic write pattern.

## Step 8b — Seed scratch/ and .slopstop/ (idempotent)

Create both directories and gitignore them **at the main worktree root** — the same
root every skill resolves a relative `tracking_dir` / `archive_dir` from (layout:
`design/slopstop-process.md` §4). Creating `.slopstop/` here is itself what activates
tier-2 resolution for every later skill, which is why Step 8a writes no keys
(→ Read `skills/run/references/tracking-dir-resolution.md`):

```bash
ROOT="$(dirname "$(git rev-parse --git-common-dir)")"
mkdir -p "$ROOT/scratch" "$ROOT/.slopstop/ticket-active" "$ROOT/.slopstop/ticket-archive"
git -C "$ROOT" check-ignore -q scratch/    || echo 'scratch/'    >> "$ROOT/.gitignore"
git -C "$ROOT" check-ignore -q .slopstop/  || echo '.slopstop/'  >> "$ROOT/.gitignore"
```

Both must be ignored **in the same run that creates them** — an un-ignored `.slopstop/`
sits there untracked, and the first staging that is not path-specific sweeps it in.
Creating the directory is what turns
tier-2 resolution on, so the gitignore entry and the directory must land together; that is
why activation belongs to the seeding paths (`:gh-init`, `:design`) rather than to a config
key a user might add without ignoring anything.

`git check-ignore` respects any existing pattern that already covers the path (not just
an exact line), so re-running never duplicates or double-covers the entry. If the repo
has no `.gitignore`, the `echo` creates it. Running from a subdirectory or a linked
worktree still seeds the main root. (The exact-line guard `grep -qxF '.slopstop/'
"$ROOT/.gitignore"` is an acceptable simpler fallback where `git check-ignore` is
unavailable.)

## Step 9 — Output

```
ticket-gh-init complete.

  <result for in-progress label>   (created | already existed)
  <result for in-review label>     (created | already existed | skipped — 3-state)
  slopstop-refactor                (created | already existed)
  slopstop-backfill                (created | already existed)
  .project-conf.toml               (written | updated — merged [status_labels])
  scratch/ + .gitignore entry      (seeded | already present | failed — warned)

Next steps:
  /slopstop-tickets            — cut a ticket tree, or --retrofit an existing ticket
  /slopstop-run <PREFIX>-N     — drive an existing ticket through its whole lifecycle
```

## Error matrix

| Condition | Behavior |
|---|---|
| Not in a git repo | Stop: `"Run inside a git repository with a GitHub remote."` |
| No GitHub remote | Stop: `"No GitHub remote found at origin."` |
| `gh auth status` fails | Stop with auth instructions |
| `gh repo view` fails | Stop: `"Could not determine GitHub repo."` |
| Existing config for wrong system | Stop: `"Existing config has system='<v>'. Refusing to overwrite."` |
| Existing config for wrong repo | Stop: `"Existing config points to '<key>'. Refusing to overwrite."` |
| Label creation fails | Stop with raw API/CLI error; report any labels already created |
| Config write fails | Stop with OS error; temp file + rename prevents partial write |
| scratch/ seeding fails (Step 8b) | Non-fatal — warn and continue; the deliverables (labels, `.project-conf.toml`) are already written |
| User cancels repo confirm | Stop: `"No changes made."` |
| User cancels workflow question | Stop: `"No changes made."` |
| User cancels final proceed | Stop: `"No changes made."` |

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.