agentleFS
SrejonKhanSrejonKhan/agent-skills/skills/permissioned-github/SKILL.md

permissioned-github

Skill3 starsChanged 2 months agoMITView on GitHub

Guidelines for interacting with GitHub and request permissions from the user when commands fail due to restrictions in the agent environment.

  • Commits and pushes

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 10 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use the gh CLI. Always set the -R ORG/REPO argument.

    line 17
  2. Distinctive:

    Do not use other commmands like curl.

    line 18
  3. Distinctive:

    Do not write scripts to interact with the GitHub API servers directly.

    line 19
  4. Distinctive:

    Use the git command.

    line 23
  5. Very specific:

    read: to view PR details, and to run gh search prs.

    line 41
  6. Distinctive:

    update: to comment, review, edit, close, reopen, etc.

    line 43
  7. Very specific:

    read: to clone, pull, fetch, checkout, and to run gh search commits.

    line 53
  8. Very specific:

    Always set branch to * for read.

    line 54
  9. Distinctive:

    create: to push a new branch.

    line 55
  10. Distinctive:

    update: to push to an existing remote branch (including force-push).

    line 56
  11. Distinctive:

    delete: to delete a remote branch.

    line 57
  12. Distinctive:

    When you have determined that you need permisison:

    line 140
  13. Very specific:

    Call the tool ask_permission:

    line 143
  14. Distinctive:

    Do not set BypassSandbox.

    line 146
  15. Distinctive:

    Run the original command that was denied.

    line 148

≈ “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

GitHub Skill

This skill describes how to interact with GitHub and request the permissions to perform actions that are not authorized by default in the agent environment. This skill is authoritative for the usage of the gh CLI and git command.

By default, the agent is restricted to performing only a subset of actions on GitHub.

How to Interact with GitHub

To perform actions on GitHub:

  • Use the gh CLI. Always set the -R ORG/REPO argument.
  • Do not use other commmands like curl.
  • Do not write scripts to interact with the GitHub API servers directly.

To perform branch operations (e.g., push):

  • Use the git command.

Asking for Permissions

Permission Format

The permission format is as follows:

<command-binary>.<action>(<resource_json>)

resource_json has the following fields:

  • org: Mandatory GitHub organization. Use '*' to indicate all organizations.
  • repo: Mandatory GitHub repository. Use '*' to indicate all repositories.
  • pr: Optional pull request number. Use '*' to indicate all pull requests. Supported actions:
    • read: to view PR details, and to run gh search prs.
    • create
    • update: to comment, review, edit, close, reopen, etc.
    • approve
    • merge
  • issue: Optional issue number. Use '*' to indicate all issues. Supported actions:
    • read
    • create
    • update: to comment, review, edit, close, reopen, etc.
  • branch: Mandatory branch name. Use '*' to indicate all branches. Supported actions:
    • read: to clone, pull, fetch, checkout, and to run gh search commits. Always set branch to * for read.
    • create: to push a new branch.
    • update: to push to an existing remote branch (including force-push).
    • delete: to delete a remote branch.

Other operations are not supported and the corresponding permission will not be granted. If you need support, stop immediately and tell the user you cannot proceed and why.

Examples

Example 1: Creating an Issue

Command: gh issue create --title "Bug report" --body "Description" -R myorg/myrepo Permission: gh.create({"org": "myorg", "repo": "myrepo", "issue": "*"})

Note: keep the permission lean and don't populate empty fields

Example 2: Commenting on a PR

Command: gh pr comment 123 --body "Looks good" -R myorg/myrepo Permission: gh.update({"org": "myorg", "repo": "myrepo", "pr": "123"})

Note: keep the permission lean and don't populate empty fields

Example 3: Closing an Issue

Command: gh issue close 123 --comment "closing issue" -R myorg/myrepo Permission: gh.update({"org": "myorg", "repo": "myrepo", "issue": "123"})

Note: keep the permission lean and don't populate empty fields

Example 4: Approving a PR

Command: gh pr review 123 --approve --body "Looks good" -R myorg/myrepo Permission: gh.approve({"org": "myorg", "repo": "myrepo", "pr": "123"})

Note: keep the permission lean and don't populate empty fields

Example 5: Pushing to an Existing Branch

Command: git push origin feature/my-feature (branch already exists on the remote) Permission: git.update({"org": "myorg", "repo": "myrepo", "branch": "feature/my-feature"})

Note: use update for a force-push too; use create (below) when the branch does not yet exist on the remote.

Example 6: Creating a New Branch

Command: git push origin feature/my-feature (first push of a branch that does not exist on the remote) Permission: git.create({"org": "myorg", "repo": "myrepo", "branch": "feature/my-feature"})

Example 7: Fetching all branches

Command: git fetch --all Permission: git.read({"org": "myorg", "repo": "myrepo", "branch": "*"})

_Note: read cannot be scoped to a single branch; branch must be _.*

Example 8: Cloning a Repository

Command: git clone https://github.com/myorg/myrepo.git Permission: git.read({"org": "myorg", "repo": "myrepo", "branch": "*"})

Example 9: Deleting a Branch

Command: git push origin --delete feature/my-feature Permission: git.delete({"org": "myorg", "repo": "myrepo", "branch": "feature/my-feature"})

Note: keep the permission lean and don't populate empty fields

Example 10: Searching Pull Requests

Command: gh search prs -R myorg/myrepo --author alice Permission: gh.read({"org": "myorg", "repo": "myrepo", "pr": "*"})

_Note: for an organization-wide search, use --owner myorg in the command; the grant then uses repo: "_".*

Example 11: Searching Commits

Command: gh search commits -R myorg/myrepo --author alice Permission: git.read({"org": "myorg", "repo": "myrepo", "branch": "*"})

Note: commit search reuses the git read permission, so request a git._grant, not agh._ grant.

How and When to Ask for Permissions

You should only ask for permissions if the command failed. Each time you ask for a permission, it will prompt the user. Be mindful to only ask when you know the command fails to provide a good user experience.

When you have determined that you need permisison:

  1. Constuct the permission string <permission-string> as per previous section.
  2. Call the tool ask_permission:
  • Set Action="custom", Target=<permission-string>
  • Do not set BypassSandbox.
  1. Run the original command that was denied.

Never try to pipe or redirect output of the gh command, it will not work in your environment

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.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.