Skip to content

borghei/Claude-Skills / engineering/git-guardrails

git-guardrails

Verified

Install a hook that blocks destructive git commands before an AI agent runs them. Use when an agent force-pushed or ran reset --hard, when adding git safety hooks, or when protecting main from agent pushes.

FileKindSize
SKILL.mdskill md13.9 KB
assets/git_guardrails_hook.pyexecutablescript17.2 KB
assets/pre-pushexecutablescript2.5 KB
assets/pre-rebaseexecutablescript1.2 KB
assets/sample_command_corpus.jsonconfig8.5 KB
assets/sample_guardrail_policy.jsonconfig236 B
references/hook-mechanics.mdmarkdown7.4 KB
references/rule-catalog.mdmarkdown9.3 KB
scripts/guardrail_test.pyexecutablescript8.9 KB
scripts/install_guardrails.pyexecutablescript10.3 KB

assets/pre-rebase

View on GitHub
#!/usr/bin/env bash
# git-guardrails pre-rebase hook (plain git, works without Claude Code).
#
# git calls this with: $1 = upstream, $2 = branch being rebased (empty means
# the current branch). Rebasing a protected branch rewrites history other
# people have pulled, so it is refused. Exit 0 continues, exit 1 aborts.
# Protected branches come from `git config --get-all guardrails.protected`.
set -euo pipefail

branch="${2:-}"
if [ -z "$branch" ]; then
  branch="$(git symbolic-ref --short -q HEAD || true)"
fi
[ -z "$branch" ] && exit 0   # detached HEAD: nothing shared to protect

protected_patterns=()
while IFS= read -r pattern; do
  [ -n "$pattern" ] && protected_patterns+=("$pattern")
done < <(git config --get-all guardrails.protected || true)
if [ "${#protected_patterns[@]}" -eq 0 ]; then
  protected_patterns=("main" "master" "develop" "production" "release/*")
fi

for pattern in "${protected_patterns[@]}"; do
  # shellcheck disable=SC2053
  if [[ "$branch" == $pattern ]]; then
    printf 'git-guardrails: refusing to rebase protected branch %s\n' "$branch" >&2
    printf '  Rebase your feature branch onto it instead: git rebase %s\n' "$branch" >&2
    exit 1
  fi
done

exit 0
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall