flurdy/agent-skills / skills/rebase
rebase
VerifiedRebase feature or stacked branches, or explicitly integrate a fetched upstream into local main/master. Separate trunk mode proves local replay scope and never enters force-push or PR flows; its mutations require fresh confirmation.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.4 KB |
| references/upstream.md | markdown | 10.0 KB |
| scripts/gh-pr-base-branch.shexecutable | script | 70 B |
| scripts/gh-pr-edit-base.shexecutable | script | 80 B |
| scripts/rebase-range.shexecutable | script | 4.9 KB |
| scripts/upstream.py | script | 15.0 KB |
| tests/test-rebase-range.shexecutable | script | 10.9 KB |
| tests/test-skill-contract.shexecutable | script | 5.1 KB |
| tests/test_upstream.py | script | 15.6 KB |
tests/test-skill-contract.sh
View on GitHub#!/usr/bin/env bash
set -euo pipefail
ROOT=$(CDPATH='' cd -- "$(dirname -- "${BASH_SOURCE[0]}")/../../.." && pwd -P)
REBASE="$ROOT/skills/rebase/SKILL.md"
UPSTREAM="$ROOT/skills/rebase/references/upstream.md"
fail() {
printf 'FAIL: %s\n' "$*" >&2
exit 1
}
assert_contains() {
local file=$1 expected=$2
grep -Fq -- "$expected" "$file" || fail "expected '$expected' in $file"
}
assert_not_contains() {
local file=$1 unexpected=$2
if grep -Fq -- "$unexpected" "$file"; then
fail "did not expect '$unexpected' in $file"
fi
}
line_of() {
local file=$1 text=$2
grep -nF -- "$text" "$file" | head -1 | cut -d: -f1
}
assert_order() {
local file=$1
shift
local previous=0 current text
for text in "$@"; do
current=$(line_of "$file" "$text")
[[ -n "$current" ]] || fail "missing '$text' in $file"
((current > previous)) || fail "expected '$text' after prior invariant in $file"
previous=$current
done
}
# One workflow covers all three targets and drives the rebase from the helper.
for mode in 'rebase-range.sh main' 'rebase-range.sh parent {parent-branch}' 'rebase-range.sh merged {old-parent}'; do
assert_contains "$REBASE" "$mode"
done
assert_contains "$REBASE" 'Bash(~/.agents/skills/rebase/scripts/rebase-range.sh:*)'
assert_contains "$REBASE" 'branch.$(git branch --show-current).gh-merge-base'
assert_contains "$REBASE" 'status=up-to-date'
assert_contains "$REBASE" 'status=refuse'
assert_contains "$REBASE" '--old-tip {sha}'
assert_contains "$REBASE" 'headRefOid'
assert_contains "$REBASE" 'never its merge commit'
assert_contains "$REBASE" 'git rebase --onto {target} {upstream} {current-branch}'
assert_not_contains "$REBASE" 'git rebase -i '
assert_not_contains "$REBASE" 'mergeCommit'
assert_not_contains "$REBASE" '$(git merge-base'
# The four gates stay explicit and in order.
assert_contains "$REBASE" 'Working tree gate'
assert_contains "$REBASE" 'Never rebase over uncommitted work'
assert_contains "$REBASE" 'Verify with tests'
assert_contains "$REBASE" 'Do not force-push a broken rebase'
assert_contains "$REBASE" 'Force-push (Recommended)'
assert_contains "$REBASE" 'git push --force-with-lease'
assert_contains "$REBASE" 'Never use bare'
assert_contains "$REBASE" 'PR retarget gate'
assert_contains "$REBASE" 'PR base: unchanged'
assert_contains "$REBASE" 'gh-pr-edit-base.sh {target-branch}'
assert_order "$REBASE" 'Working tree gate' 'Resolve the child-only range' '### 5. Rebase' 'Verify with tests' 'Force-push gate' 'PR retarget gate' '### 10. Report'
# Retired aliases have no source, catalog entry, prompt replacement, or usage promise.
for name in rebase-main rebase-parent rebase-merged-parent; do
[[ ! -e "$ROOT/skills/$name" && ! -L "$ROOT/skills/$name" ]] || fail "retired skill remains: $name"
[[ ! -e "$ROOT/prompts/$name.md" && ! -L "$ROOT/prompts/$name.md" ]] || fail "unexpected replacement prompt: $name"
assert_not_contains "$ROOT/skills/README.md" "| $name |"
assert_not_contains "$REBASE" "/$name"
done
for usage in '/rebase main' '/rebase parent {parent-branch}' '/rebase merged {old-parent} [--old-tip {sha}]'; do
assert_contains "$REBASE" "$usage"
done
# Callers point at the consolidated entry point.
for file in stack-branch pr-status ready-to-merge landscape; do
assert_not_contains "$ROOT/skills/$file/SKILL.md" '/rebase-main'
assert_not_contains "$ROOT/skills/$file/SKILL.md" '/rebase-merged-parent'
assert_not_contains "$ROOT/skills/$file/SKILL.md" '/rebase-parent'
done
assert_contains "$ROOT/skills/stack-branch/SKILL.md" '/rebase merged {parent-branch}'
assert_contains "$ROOT/skills/README.md" '| rebase |'
# Trunk dispatch cannot fall through to the feature publication/PR path.
assert_order "$REBASE" '## Mode boundary' '## Instructions — feature and stacked modes only' 'Force-push gate'
assert_contains "$REBASE" '/rebase upstream'
assert_contains "$REBASE" 'follow only that path, then stop'
assert_contains "$REBASE" 'never switch modes implicitly'
assert_contains "$REBASE" 'Bash(python3 ~/.agents/skills/rebase/scripts/upstream.py:*)'
assert_order "$UPSTREAM" '## 1. Inspect' '## 2. Fresh fetch gate' '## 3. Preview' '## 4. Revalidate' '## 5. Conflicts' '## 6. Optional'
for invariant in \
'one visible fetch invocation' \
'including preflight and verification, go through this route' \
'not an atomic lock' \
'not proof of nonpublication' \
'confirm the range is unshared' \
'For either integration, use `AskUserQuestion` immediately before the command.' \
'Use `AskUserQuestion` for each history-changing recovery' \
'Use `AskUserQuestion` immediately before publication' \
'Approval' \
'next tool call' \
'No helper silently applies' \
'Never substitute `reset --hard`' \
'ordered stable patch-ID equality' \
'range-diff' \
'repository-native tests' \
'git push --no-force --no-follow-tags' \
'a rejected push stops without retry'; do
assert_contains "$UPSTREAM" "$invariant"
done
assert_not_contains "$UPSTREAM" 'git push --force'
assert_not_contains "$UPSTREAM" 'gh-pr-edit-base.sh'
assert_not_contains "$UPSTREAM" 'gh pr '
printf '%s\n' 'rebase skill contract tests passed'
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |