agentleFS
h2coneh2cone/agent-packs/skills/github-publish/SKILL.md

github-publish

Skill0 starsChanged 24 days agoMITView on GitHub

Publishes a local project to GitHub by generating metadata files, reusing an existing target repository when present, creating the repo when absent, and pushing. Triggers on "publish to GitHub", "push to GitHub", "create a GitHub repo", "push to existing repo", or first-time repository setup.

  • Commits and pushes

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 7 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Create only if absent or empty.

    line 10
  2. Very specific:

    Prefer an explicit user-provided repo or GitHub URL.

    line 18
  3. Very specific:

    If origin already exists:

    line 20
  4. Distinctive:

    Use it when it points at the same GitHub repo target.

    line 22
  5. Distinctive:

    Check whether the target repo already exists before trying to create it:

    line 27
  6. Distinctive:

    If the repo exists:

    line 33
  7. Very specific:

    Do not run gh repo create.

    line 35
  8. Distinctive:

    Treat it as the publish target.

    line 36
  9. Very specific:

    Add origin if missing, using the returned sshUrl when available:

    line 37
  10. Distinctive:

    If the repo does not exist:

    line 43
  11. Very specific:

    Use --private if the user requested it.

    line 49
  12. Very specific:

    If creation reports that the repo already exists, re-run gh repo view <owner>/<repo-name> and reuse it when visible.

    line 50
  13. Distinctive:

    If the push is rejected because the remote has unrelated history or protected branches, stop and report the exact reason.

    line 58
  14. Very specific:

    Before committing, check git config user.name and git config user.email.

    line 63
  15. Very specific:

    If origin remote already exists, warn the user instead of overwriting.

    line 64

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Analyze the project, then create missing metadata files, create or reuse the GitHub repo, and push.

Generate metadata files

Create only if absent or empty. Never overwrite existing files unless the user explicitly asks.

  • README.md — Matched to the actual project.
  • .gitignore — Appropriate for the detected language/framework.
  • LICENSE — MIT by default (current year, username from gh api user -q .login). Ask if the user wants a different license.

Resolve target repo

Prefer an explicit user-provided repo or GitHub URL. Otherwise derive the repo name from the directory (lowercase, hyphens) and the owner from gh api user -q .login. Derive description from README.

If origin already exists:

  • Use it when it points at the same GitHub repo target.
  • Warn and stop if it points somewhere else, unless the user explicitly asks to switch remotes.

Reuse or create repo

Check whether the target repo already exists before trying to create it:

gh repo view <owner>/<repo-name> --json url,sshUrl,nameWithOwner,defaultBranchRef

If the repo exists:

  • Do not run gh repo create.
  • Treat it as the publish target.
  • Add origin if missing, using the returned sshUrl when available:
git remote add origin <ssh-url>

If the repo does not exist:

gh repo create <owner>/<repo-name> --public --description "<description>" --source=. --remote=origin
  • Use --private if the user requested it.
  • If creation reports that the repo already exists, re-run gh repo view <owner>/<repo-name> and reuse it when visible. Stop only when the repo is inaccessible or clearly belongs to a different target.

Push the current branch:

git push -u origin HEAD

If the push is rejected because the remote has unrelated history or protected branches, stop and report the exact reason. Never force-push unless the user explicitly asks.

Edge cases

  • Skip git init if .git already exists.
  • Before committing, check git config user.name and git config user.email. If unset, read from --global config and apply locally.
  • If origin remote already exists, warn the user instead of overwriting.
  • Print the repository URL after a successful push.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.