Create or induct GitHub repositories with the preferred settings, licence, watching, CI and a Development ruleset. Use for gh repo create, dot repo induct, repository defaults or first-push setup.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Github Repository Setup?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/timmo001-github-repository-setup)
---
name: github-repository-setup
license: Apache-2.0
description: Create or induct GitHub repositories with the preferred settings, licence, watching, CI and a Development ruleset. Use for gh repo create, dot repo induct, repository defaults or first-push setup.
compatibility: Requires authenticated GitHub CLI, Git, jq, repository creation or settings write access, and the shared-workflows and github-development-rulesets skills for their setup steps.
---
# GitHub Repository Setup
Use these defaults for personal repositories. Resolve the authenticated account and destination owner at runtime. For organisation repositories, follow the owner's policy rather than automatically imposing personal settings.
For induction of an existing GitHub repository, resolve its actual host and owner/name from the selected remote, check **Choose and create the licence**, and complete **Watch the repository** after induction succeeds. Induction alone does not request the creation, settings, CI or ruleset steps below.
## Workflow
1. **Resolve the destination and visibility before creation.** Establish the host, owner, repository name and local source. Use an explicitly requested public/private choice, or infer it only from unambiguous task context such as a stated private project. An account's other repositories, a local directory, or GitHub's defaults do not establish visibility. If visibility is unspecified and cannot be inferred, ask public or private before creating anything (see `asking-questions`). Record the chosen visibility and its basis. Complete **Choose and create the licence** before creation or the first authorised push.
2. **Create the repository and apply the defaults.** Check current `gh repo create --help` and `gh repo edit --help`. Pass the resolved owner/name and an explicit visibility flag to creation, with `--disable-wiki`. For an existing local repository, use its actual source and selected remote without overwriting another remote. A creation request alone does not authorise committing or pushing: use `--push` only when a push was explicitly requested. Apply the settings below as part of the requested setup and read them back. Complete **Watch the repository** once the repository exists, even if the first push is deferred. Report unsupported settings or policy/plan restrictions rather than claiming success.
3. **Offer missing workflows using relevant evidence.** Inspect the destination's workflows, language, package manager, build/test commands, deployment targets and Renovate configuration. If CI is missing, offer to set it up. Base the recommendation on a small sample of related or heavily used repositories in the user's personal account: prefer matching stacks and release/deployment needs, recent successful runs and sustained maintenance. Show the source repositories, workflow paths and why they fit. A recent timestamp or high star count alone is not evidence of personal use. Resolve candidates dynamically rather than maintaining a hardcoded repository list. Keep private repository details and configuration out of public files.
- Apply `shared-workflows` for reusable workflow selection and caller setup. Inspect the selected contracts at their pinned revisions and adapt to the destination's real commands. Offer relevant lint, build, test and release/deployment workflows, without copying unrelated jobs or inventing required secrets. Implement the accepted selection and validate it locally.
- Inspect existing automerge workflows by behaviour, including `.github/workflows/renovate-automerge.yml`, reusable workflow calls and other workflows using `gh pr merge --auto --squash`. If missing, offer the matching automation. For personal setup using `timmo001/workflows`, source Renovate automation from its maintained [reusable Renovate automerge workflow](https://github.com/timmo001/workflows/blob/master/.github/workflows/renovate-automerge.yml). Resolve the current default-branch SHA, inspect the contract at that exact revision and create a minimal job-level `uses:` caller pinned to it. Do not bundle a snapshot of its implementation in this skill. Confirm Renovate is configured or include its setup in the offer. Other automerge workflows should follow the owner-selected shared source's eligibility rules, triggers and token requirements. Reuse an existing shared caller; migrate an inline equivalent when replacing it is in scope.
4. **Complete the first push and Development ruleset in order.** When a push is authorised, push the initial code and selected CI workflows, then establish successful CI on the pushed revision. Apply `github-development-rulesets` for ruleset selection, permissions, observed required-check identities and verification. If the first push already happened, resume here using the latest pushed revision. If CI is absent, make the workflow offer first; defer CI-backed enforcement until real checks exist. Keep test-check selection and policy decisions with the ruleset skill. Do not copy required-check names from another repository.
5. **Activate and verify selected automerge automation.** The repository's auto-merge switch enables the capability; workflows opt eligible PRs into it. Put required checks and the Development ruleset in place before activating a new automerge workflow. `--auto` waits for merge requirements, not every workflow merely present in the repository. Preserve squash merging, bot/PR eligibility checks and required permissions. For the reusable Renovate workflow, use a `pull_request_target` caller with `contents: write` and `pull-requests: write`; its current contract needs no inputs or extra secrets. Let the shared workflow own bot filtering, merge commands and concurrency. Verify these details against the selected revision. Keep this privileged workflow metadata-only: no checkout or execution of PR code. Validate the selected workflows and confirm their behaviour on the next eligible PR when one is available; do not create or merge a PR just to test setup.
6. **Report the result.** Include repository URL and visibility, licence choice and source, verified settings and watching status with the authenticated account, workflows added or retained with source refs, first-push/CI evidence, ruleset result, and any declined or deferred setup. If no push was authorised, clearly identify the post-push steps still pending.
## Choose And Create The Licence
- Inspect existing `LICENSE*`, `COPYING*` and package licence metadata first. Preserve an existing licence and its notices; do not replace it with the default. Ask about conflicting declarations before changing them.
- When no licence exists, ask which licence to use (see `asking-questions`). For public repositories, offer **Apache 2.0** first as the recommendation, another licence, or no licence. Apache 2.0 is the proposed default, not permission to apply it without an answer. For private repositories, ask whether to add a licence without assuming the public default. An explicit licence choice in the current request already answers the question.
- Source the selected text from GitHub's licence templates, available through the Licenses API. Discover keys with `gh repo license list` or `GET /licenses`; Apache 2.0 uses `apache-2.0`. Retrieve the template body, for example:
```bash
gh api --hostname "$HOST" licenses/apache-2.0 --jq .body
```
Use the selected key for other licences. Fetch successfully before writing the root `LICENSE` file. Do not bundle internal template copies, reconstruct legal text from memory, or shorten it.
- A licence from a known existing repository is also an acceptable source. Inspect its full text, verify the chosen licence and record the source path and commit. Account for project-specific notices rather than blindly copying another project's owner or year. If the source cannot be verified, report that and leave creation pending.
- Fill project-specific template fields from the actual copyright holder and year, asking when unclear. Preserve legal terms and instructional examples. For an existing local source, add `LICENSE` locally and keep package licence metadata consistent with the selected SPDX identifier. Leave committing and pushing to explicit authorisation. For remote-only creation, GitHub can generate the file with `gh repo create --license <key>` when its initial commit is authorised; do not initialise a separate remote history for an existing local repository.
- Verify the final file against the retrieved source, allowing only the intended project-specific substitutions, and report the licence and source URL or repository ref. If the user chose no licence, record that choice without creating a file.
- The licence lives in `LICENSE` and package metadata only. Don't add a licence section, line or badge to the README; GitHub shows the licence from the file.
## Kind And Labels
Every personal repository has a kind and takes its labels from the Groundwork manifest. During creation or induction, apply `groundwork-conventions`: add the repository's file with the kind Personal unless the user chooses another, then create its labels from the manifest in place of GitHub's defaults. Organisation repositories and forks keep their owner's labels.
## Watch The Repository
Watching is part of creation and induction by default. Resolve the authenticated user on the selected `HOST`; the subscription belongs to that account, not the repository owner. Enable watching with notifications unignored, then read the subscription back:
```bash
gh api --hostname "$HOST" user --jq .login
gh api --hostname "$HOST" --method PUT "repos/$REPO/subscription" \
-F subscribed=true -F ignored=false
gh api --hostname "$HOST" "repos/$REPO/subscription" \
--jq '{subscribed, ignored}'
```
Require `subscribed: true` and `ignored: false` before reporting the repository as watched. Report authentication or API failures as incomplete setup. Honour an explicit request not to watch; do not assume repository ownership or creation automatically subscribes the user.
## Repository Defaults
These are the requested baseline, so do not ask the user to reconfirm each switch.
| Setting | Value |
| --- | --- |
| Wikis | Disabled |
| Projects | Disabled |
| Discussions | Disabled, unless the repository's conventions file sets `discussions: true` |
| Allow merge commits | Disabled |
| Allow rebase merging | Disabled |
| Allow squash merging | Enabled |
| Squash default commit message | Pull request title and commit details |
| Always suggest updating pull request branches | Enabled |
| Allow auto-merge | Enabled, supporting the selected automerge workflows |
| Automatically delete head branches | Enabled |
Apply to the explicitly resolved repository URL (`REPO_URL`), with `DISCUSSIONS` set to `true` only when the repository's conventions file says so and `false` otherwise:
```bash
gh repo edit "$REPO_URL" \
--enable-wiki=false \
--enable-projects=false \
--enable-discussions="$DISCUSSIONS" \
--enable-merge-commit=false \
--enable-rebase-merge=false \
--enable-squash-merge \
--squash-merge-commit-message=pr-title-commits \
--allow-update-branch \
--enable-auto-merge \
--delete-branch-on-merge
```
Read back from the selected `HOST` and `OWNER/REPO`:
```bash
gh api --hostname "$HOST" "repos/$REPO" --jq '{
full_name, visibility, has_wiki, has_projects, has_discussions,
allow_merge_commit, allow_rebase_merge, allow_squash_merge,
squash_merge_commit_title, squash_merge_commit_message,
allow_update_branch, allow_auto_merge, delete_branch_on_merge
}'
```
Compare every field with the table. The squash setting must read back as `squash_merge_commit_title: "PR_TITLE"` and `squash_merge_commit_message: "COMMIT_MESSAGES"`. Missing fields are unverified, not false. Scope the edit to these settings; repository visibility is resolved separately before creation.
## Sources
- [GitHub CLI repository creation](https://cli.github.com/manual/gh_repo_create)
- [GitHub CLI repository settings](https://cli.github.com/manual/gh_repo_edit)
- [GitHub repository API](https://docs.github.com/en/rest/repos/repos#update-a-repository)
- [GitHub licence templates API](https://docs.github.com/en/rest/licenses/licenses)
- [GitHub repository licensing](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/licensing-a-repository)
- [GitHub repository watching API](https://docs.github.com/en/rest/activity/watching)
- [GitHub CLI PR merging](https://cli.github.com/manual/gh_pr_merge)