Skip to content
Development
Command

/publish

Publish repository to GitHub with full setup.

shell
$ npx -y skills add DefaultPerson/agent-setup --agent claude-code

Ships with agent-setup. Installing the plugin gets this command.

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/publish

Context preview

What this command does when you run it.

Publish repository to GitHub with full setup.

Command definition

publish.md
allowed-tools: Bash(git *), Bash(gh *), Bash(mkdir *)
description: Publish repository to GitHub with full setup.

Context

  • Remote: !`git remote -v 2>/dev/null || echo "No remote"`
  • Branch: !`git branch --show-current 2>/dev/null || echo "Not a git repo"`
  • GitHub repo: !`gh repo view --json nameWithOwner,visibility,description --jq '"\(.nameWithOwner) (\(.visibility)) — \(.description)"' 2>/dev/null || echo "Not on GitHub yet"`

Interactive repo publication workflow. Uses `gh` CLI for everything.

Algorithm

1. **Detect state**: `git remote -v` — check if `origin` points to GitHub.

  • **New repo** (no origin): full creation flow (steps 2-13).
  • **Existing repo** (origin exists): update flow — go to step 2 to review/update settings.
  • **No git repo**: `git init` first.

2. **Ask questions** (AskUserQuestion, single batch — all repos):

  • **Owner**: personal account or organization? List available with `gh api user/orgs --jq '.[].login'` + personal account from `gh api user --jq .login`.
  • **Visibility**: public / private / Keep current (existing repos only)
  • **Description**: show auto-detected (from README.md or CLAUDE.md), ask to use or enter custom
  • **License**: MIT (Recommended for public) / Apache-2.0 / GPL-3.0 / Keep current / None
  • **GitHub Pages**: Yes (MkDocs Material) / No / Keep current
  • **Dependabot**: Enable dependency updates? Yes / No / Keep current
  • **CI workflow**: Set up GitHub Actions CI? Yes (auto-detect stack) / No / Keep current
  • **`.gitignore`**: Generate smart .gitignore? Yes (auto-detect stack + scan repo) / No / Keep current
  • **README.md**: Scaffold README if missing? Yes / No

3. **Auto-detect** (no user input needed):

  • **Repo name**: from current directory name
  • **Topics**: detect from stack files:
  • `package.json` → nodejs, javascript/typescript
  • `pyproject.toml` / `requirements.txt` → python
  • `go.mod` → golang
  • `Cargo.toml` → rust
  • `Dockerfile` → docker
  • Also infer from README content (keywords, frameworks)
  • For existing repos: fetch current values with `gh repo view --json description,repositoryTopics,visibility` and show diff

4. **Create or update repo**:

  • New: `gh repo create <owner>/<name> --public|--private --description "<desc>" --source . --push`
  • Existing: `gh repo edit --description "<desc>" --visibility public|private` (only if changed)

5. **Set topics**:

   gh repo edit --add-topic <tag1> --add-topic <tag2> ...

6. **License** (if selected/changed):

  • Fetch license text: `gh api licenses/<spdx-id> --jq .body > LICENSE`
  • Replace `[year]` and `[fullname]` placeholders
  • Commit and push

7. **GitHub Pages** (if selected/changed):

  • Create `mkdocs.yml` with Material theme, `docs/index.md` from README
  • Add GitHub Actions workflow `.github/workflows/docs.yml` for auto-deploy
  • Commit and push

8. **Dependabot** (if selected):

  • Create `.github/dependabot.yml` with update schedules based on detected ecosystem:
  • `npm` for package.json projects
  • `pip` for Python projects
  • `gomod` for Go projects
  • `cargo` for Rust projects
  • `github-actions` always included
  • Weekly schedule, auto-rebase, max 10 open PRs
  • Commit and push

9. **CI workflow** (if selected):

  • Create `.github/workflows/ci.yml` based on detected stack:
  • Node.js: install deps, lint, test, build
  • Python: install deps (uv/pip), lint (ruff), test (pytest)
  • Go: build, test, vet
  • Rust: check, test, clippy
  • Trigger on push to main and PRs
  • Use latest stable language versions
  • Commit and push

10. **`.gitignore`** (if selected):

  • **A) Stack-based templates** — reuse stack detection from step 3, fetch from GitHub API:
  • `package.json` → `Node`
  • `pyproject.toml` / `requirements.txt` / `setup.py` → `Python`
  • `go.mod` → `Go`
  • `Cargo.toml` → `Rust`
  • `composer.json` → `Composer`
  • `Gemfile` → `Ruby`
  • `*.sln` / `*.csproj` → `VisualStudio`
  • `build.gradle` / `pom.xml` → `Gradle` / `Maven`
      gh api gitignore/templates/Node --jq .source
      gh api gitignore/templates/Python --jq .source
  • **B) Common block** (always prepend — not available via API):
      # OS & Editor
      .DS_Store
      Thumbs.db
      *.swp
      *.swo
      *~
      .idea/
      .vscode/
      *.sublime-project
      *.sublime-workspace

      # Environment
      .env
      .env.*
      !.env.example

      # Build artifacts
      dist/
      build/
      out/
  • **C) Repo scan** — analyze actual repo contents for things that should be ignored:
  • Run `git ls-files --others --directory` to find untracked files/dirs
  • Check tracked files with `git ls-files` for items that shouldn't be in VCS
  • Look for: `node_modules/`, `__pycache__/`, `.venv/`, `venv/`, `.tox/`, `*.egg-info/`, `target/` (Rust), `vendor/` (Go), `.terraform/`, `*.sqlite3`, `coverage/`, `.nyc_output/`, `.pytest_cache/`, `.mypy_cache/`, `.ruff_cache/`, `.next/`, `.nuxt/`, `.output/`, secrets (`*.key`, `*.pem`, `credentials.*`), heavy binaries, DB dumps
  • Show user what was found and confirm before adding
  • **D) Merge logic**:
  • No `.gitignore` exists → create from A + B + C
  • `.gitignore` exists → AskUserQuestion: Overwrite / Merge (append only new patterns) / Skip
  • Commit and push

11. **README.md** (if selected and missing or empty):

  • Generate from project metadata:
      # {repo-name}

      {description from step 2}

      ## Installation

      {based on detected stack:}
      - Node.js: `npm install`
      - Python: `pip install -e .` / `uv pip install -e .`
      - Go: `go install ./...`
      - Rust: `cargo build`
      - Generic: manual instructions placeholder

      ## Usage

      <!-- TODO: Add usage examples -->

      ## License

      {license name,
Read more
Read it on GitHub ↗

Showing the first part of this file.

Ships withagent-setup

Universal setup for Claude Code and OpenAI Codex CLI — security hooks, notifications, status line, and productivity commands.

Get the whole plugin, auto-invoked
Stats
11
Stars
0
Views
1
Forks
Active
Maintenance
Python
Language
MIT
License
28d ago
Last commit
8mo ago
Created

Repo: DefaultPerson/agent-setup