npx claudepluginhub cameronsjo/workbench --plugin git-guardrailsWant just this skill?
Add to a custom plugin, then install with one command.
Configure git-guardrails with your GitHub identity. Self-destructs after setup so it reappears when the plugin updates.
This skill uses the workspace's default tool permissions.
Configure git-guardrails by detecting the user's GitHub identity and writing the required environment variables to ~/.claude/settings.json.
Steps
-
Check current state - Read
~/.claude/settings.jsonand check ifGIT_GUARDRAILS_ALLOWED_OWNERSalready exists in theenvblock. If configured, show current values and ask if the user wants to reconfigure or exit. -
Detect GitHub identity - Run
gh api user --jq .loginto get the authenticated GitHub username. Ifghis not installed or not authenticated, ask the user to provide their GitHub username manually via AskUserQuestion. -
Ask for additional owners - Use AskUserQuestion:
- Pre-fill the detected username as the primary owner
- Ask: "Any additional GitHub orgs or users to allow?" with options:
- "Just my account (Recommended)" — use only the detected username
- "Add orgs/users" — prompt for space-separated list to append
- If the user chooses to add more, ask for the list as free text
-
Ask for allowed repos - Use AskUserQuestion:
- "Any specific repos from other owners you need write access to?" with options:
- "None (Recommended)" — leave
GIT_GUARDRAILS_ALLOWED_REPOSempty - "Add repos" — prompt for space-separated
owner/repolist
- "None (Recommended)" — leave
- These are repos you don't own but have write access to (collaborator repos, org repos)
- "Any specific repos from other owners you need write access to?" with options:
-
Write to settings.json - Read
~/.claude/settings.json, add/update these keys in theenvblock:GIT_GUARDRAILS_ALLOWED_OWNERS— space-separated list of GitHub users/orgsGIT_GUARDRAILS_ALLOWED_REPOS— space-separated list ofowner/repopairs (only if the user provided any)- Preserve all existing env vars. Do not modify anything else in settings.json.
-
Verify - Read back the settings.json and confirm the values were written correctly. Show the user what was set.
-
Self-destruct - After successful configuration:
- Find this plugin's cache directory:
~/.claude/plugins/cache/*/git-guardrails/commands/guardrails-init.md - Delete ONLY this command file from the cached copy
- Tell the user: "The /guardrails-init command has been removed from your local cache. It will reappear next time the git-guardrails plugin updates."
- Find this plugin's cache directory:
-
Summary - Show what was configured and remind the user:
- Restart Claude Code for the env vars to take effect
- The hooks will now guard
git pushandghwrite operations against repos outside the allowed list - To reconfigure later: reinstall the plugin or manually edit
~/.claude/settings.jsonenv block
Important
- The env vars go in
~/.claude/settings.jsonunder theenvkey, NOT as shell exports GIT_GUARDRAILS_ALLOWED_OWNERSis REQUIRED — hooks block all pushes/writes if unsetGIT_GUARDRAILS_ALLOWED_REPOSis OPTIONAL — only needed for collaborator/org repos- The self-destruct targets the CACHE copy, not the source repo
- If
ghCLI is unavailable, fall back to manual input — don't fail