add repo-ops skill
Browse files
plugin/skills/github-repo-ops/SKILL.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
name: github-repo-ops
|
| 3 |
+
description: >
|
| 4 |
+
This skill should be used for any direct read or write operation against a GitHub
|
| 5 |
+
repository β when the user asks to "commit this", "push this file", "create a branch",
|
| 6 |
+
"open a PR", "read the repo", "what's in this repo", "update the README", "delete this
|
| 7 |
+
file", "merge that PR", "create a repo", "add a collaborator", "check CI status",
|
| 8 |
+
"list branches", "tag a release", or names a repository and asks for a change to it.
|
| 9 |
+
Also triggers on "github-ops", "repo ops", "full repo access", and any request that
|
| 10 |
+
would modify files, branches, issues, or pull requests on GitHub.
|
| 11 |
+
metadata:
|
| 12 |
+
version: "0.1.0"
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# GitHub Repo Ops
|
| 16 |
+
|
| 17 |
+
Perform read and write operations against GitHub through the `github-ops` MCP server, which is authenticated with a Personal Access Token and therefore has write access β unlike the read-only OAuth GitHub connector.
|
| 18 |
+
|
| 19 |
+
## Before the first operation in a session
|
| 20 |
+
|
| 21 |
+
Confirm which server is answering. Call `get_me` on the `github-ops` server. If it fails with a 401, the `GITHUB_OPS_PAT` environment variable is missing or expired β stop and point the user at `SETUP-PAT.md` rather than silently falling back to the read-only connector.
|
| 22 |
+
|
| 23 |
+
If both the read-only GitHub connector and this plugin's server are active, **always prefer the `github-ops` tools for writes.** The read-only connector returns `403 Resource not accessible by integration` on any mutation.
|
| 24 |
+
|
| 25 |
+
## Resolve the target before acting
|
| 26 |
+
|
| 27 |
+
Never guess an owner/repo pair. Resolve it in this order:
|
| 28 |
+
|
| 29 |
+
1. An explicit `owner/repo` in the user's message.
|
| 30 |
+
2. A repo named in the current session's earlier turns.
|
| 31 |
+
3. `search_repositories` with `user:<login>` or `org:<org>` β note that a bare `MADHAT` style keyword search returns nothing useful; owner-qualified queries do.
|
| 32 |
+
4. Ask, once, if still ambiguous. Do not fan out writes across candidate repos.
|
| 33 |
+
|
| 34 |
+
Confirm the default branch (`default_branch` from the repo object) before any commit. Do not assume `main` β several repos use `master`.
|
| 35 |
+
|
| 36 |
+
## Write operations: the safe sequence
|
| 37 |
+
|
| 38 |
+
Writes are irreversible from this session's perspective (there is no branch-delete or force-push tool). Follow this order every time:
|
| 39 |
+
|
| 40 |
+
1. **Read before write.** `get_file_contents` on the target path. A blind `create_or_update_file` on an existing path without its current SHA fails; with a stale SHA it clobbers.
|
| 41 |
+
2. **Branch, never commit to default.** `create_branch` from the default branch. Name it `<type>/<short-slug>` β `feat/`, `fix/`, `chore/`, `docs/`, `refactor/`.
|
| 42 |
+
3. **Commit.** Use `push_files` for multi-file changes in one commit β it is atomic and produces a clean history. Use `create_or_update_file` only for genuine single-file edits.
|
| 43 |
+
4. **Open a PR** with `create_pull_request`. Search the repo for `.github/pull_request_template.md` or `.github/PULL_REQUEST_TEMPLATE/` first and fill that structure if present.
|
| 44 |
+
5. **Report the URL.** Always hand back the PR or commit URL. The user cannot see the API response.
|
| 45 |
+
|
| 46 |
+
Never `merge_pull_request` without explicit instruction in the current turn. "Open a PR" is not permission to merge it.
|
| 47 |
+
|
| 48 |
+
## Commit message format
|
| 49 |
+
|
| 50 |
+
```
|
| 51 |
+
<type>(<scope>): <imperative summary under 72 chars>
|
| 52 |
+
|
| 53 |
+
<why the change was needed β not what the diff shows>
|
| 54 |
+
|
| 55 |
+
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
Types: `feat`, `fix`, `chore`, `docs`, `refactor`, `test`, `perf`, `build`, `ci`. Scope is the package or contract name.
|
| 59 |
+
|
| 60 |
+
## Reading efficiently
|
| 61 |
+
|
| 62 |
+
Repo reads burn context fast. Discipline:
|
| 63 |
+
|
| 64 |
+
- `get_file_contents` with `path: "/"` to map structure before pulling files.
|
| 65 |
+
- `search_code` with `repo:owner/name` to locate a symbol instead of reading directories.
|
| 66 |
+
- `list_commits` with `perPage: 10` β never the default page size on an active repo.
|
| 67 |
+
- Set `minimal_output: true` on searches unless a specific field is needed.
|
| 68 |
+
- For a broad sweep across many files, stage the repo into the session workspace with `git clone` over HTTPS and grep locally. One clone beats fifty API reads.
|
| 69 |
+
|
| 70 |
+
## Workflow files are a separate permission
|
| 71 |
+
|
| 72 |
+
Any commit touching `.github/workflows/*` requires the `workflow` scope on a classic PAT (or Workflows: write on a fine-grained PAT). `repo`/Contents alone returns 403 with a message about workflow permissions. If that error appears, say so plainly β it is a token scope problem, not a code problem.
|
| 73 |
+
|
| 74 |
+
## Repository creation and settings
|
| 75 |
+
|
| 76 |
+
`create_repository` defaults matter. Set `private: true` unless the user says public. Initialize with a README only when there is no local content to push. For a first push into an empty repo, `push_files` against the auto-created default branch works; `create_branch` does not, because there is no ref to branch from yet.
|
| 77 |
+
|
| 78 |
+
Collaborator and settings changes (`Administration` permission) are not in this token's default scope. If `list_repository_collaborators` returns `403 Resource not accessible by integration`, the PAT lacks admin read β report it rather than retrying.
|
| 79 |
+
|
| 80 |
+
## Project conventions
|
| 81 |
+
|
| 82 |
+
For MAD Gambit repositories, load the `mad-gambit-context` skill before writing anything user-facing. Canonical values that must never be altered in committed content: platform fee 1.88%, community profit share 28.8%, creator revenue share 40%, seed raise $1β2M at $12M pre-money. The platform is "MAD Gambit"; the card game is "MADHAT's Gambit". Never write "MADHATs Gambit" as a platform name.
|
| 83 |
+
|
| 84 |
+
Solidity work: pair with the `solidity-foundry` skill. Never commit contract changes without `forge build` and `forge test` passing locally in the session workspace first β CI catching it after the PR is open wastes a round trip.
|
| 85 |
+
|
| 86 |
+
## Verification step
|
| 87 |
+
|
| 88 |
+
After any write, verify rather than assume:
|
| 89 |
+
|
| 90 |
+
- Commit: `get_commit` on the returned SHA, confirm the file list matches intent.
|
| 91 |
+
- PR: `pull_request_read` to confirm it targets the right base branch.
|
| 92 |
+
- CI: `list_workflow_runs` or the Actions toolset to confirm the run started.
|
| 93 |
+
|
| 94 |
+
Report what was verified, not what was attempted.
|