agentleFS
markmhendricksonmarkmhendrickson/neotoma/.claude/skills/push/SKILL.md

push

Skill38 starsChanged 2 months agoMITView on GitHub

push

  • Commits and pushes

50 other projects use a version of this, 1 of them edited.

Adopted by

Most recently taken up by

Used with

Projects with it also use get-pr-reviews, push-everything and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • saffron-healthSkill

    get-pr-reviews

    Get nicely formatted output of the last review comments on a PR. Used internally by other skills.

    Also in 3 projects that use this

  • saffron-healthSkill

    push-everything

    Stage ALL changes in the repository (not just session changes), commit, and push. Use when you need to commit all pending changes.

    Also in 3 projects that use this

  • NVIDIASkill

    generate-spec

    Produce a feature specification covering API changes, backward compatibility, cross-language impact, performance, and a file-level change plan. Use when designing a new feature, planning a significant change, or the user asks to spec something out.

    Also in 3 projects that use this

  • ddehartSkill

    knowledge-graph

    Search, capture, and query the claude-code-plugins knowledge graph. Use when asked to "capture this", "add this to the graph", "what do we know about X", "update the graph", "check the graph for X", or when a decision, pattern, or non-obvious fact surfaces mid-session that's worth recording. Also: "log an observation", "what patterns do we have about skill triggering", "any decisions on the knowledge-commons plugin", "what do we know about the commit-creator agent".

    Also in 3 projects that use this

  • anombyte93Skill

    discover

    Phase 1 of the prd-taskmaster pipeline: brainstorm-driven discovery. Delegates to superpowers:brainstorming in Interactive Mode (one adaptive question at a time), or self-brainstorms in Autonomous Mode when no user is present. Intercepts before the brainstorming chain hands off to writing-plans — this skill owns the exit. Extracts constraints, calibrates scale (Solo / Team / Enterprise), and advances the pipeline to GENERATE.

    Also in 4 projects that use this

  • MicrosoftSkill

    merge

    Merge changes from the topic branch to the merge base branch. Use when the user wants to merge their session's work back to the base branch.

    Also in 3 projects that use this

  • +2 more from saffron-health

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 0 are common, 13 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 43 edited versions we read keep these.

  • 13

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

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

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

    SUBMODULE MODE: If a submodule name is provided (e.g., /push foundation), scope operations to that submodule only, not the main repository.

    line 20
  2. Distinctive:

    If submodule name provided:

    line 24
  3. Very specific:

    Check if submodule exists: git submodule status <submodule-name>

    line 25
  4. Distinctive:

    Run push workflow in submodule context

    line 27
  5. Distinctive:

    If no submodule name provided, proceed with main repository push workflow below.

    line 30
  6. Distinctive:

    Check if origin remote exists

    line 34
  7. Distinctive:

    Check for unpushed commits

    line 36
  8. Distinctive:

    Update scope context (all subsequent operations in submodule)

    line 59
  9. Distinctive:

    If no submodule name provided, proceed with main repository context.

    line 61
  10. Distinctive:

    If submodule name was provided:

    line 219
  11. Distinctive:

    If no remote exists: Exit with error and instructions to add remote

    line 243
  12. Distinctive:

    If origin doesn't exist: Exit with error showing available remotes

    line 244
  13. Distinctive:

    If detached HEAD: Exit with error and instructions

    line 245
  14. Distinctive:

    If push fails: Exit with error and troubleshooting tips

    line 246
  15. Distinctive:

    If local is behind remote: Warn but allow push attempt (may fail)

    line 247

“Common” is measured: kept by at least 6 in 10 of the 43 edited versions of this file we could read. “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
<!-- Source: foundation/.cursor/skills/push/SKILL.md -->

name: push description: Push current branch to origin; supports /push <submodule>. triggers:

  • push
  • /push

push

Push current branch to origin remote, checking if remote exists first.

SUBMODULE MODE: If a submodule name is provided (e.g., /push foundation), scope operations to that submodule only, not the main repository.

Configuration is read from foundation-config.yaml.

If submodule name provided:

  1. Check if submodule exists: git submodule status <submodule-name>
  2. Change to submodule directory: cd <submodule-name>
  3. Run push workflow in submodule context
  4. Exit after submodule push (do NOT push main repository)

If no submodule name provided, proceed with main repository push workflow below.

Workflow Overview

  1. Check if origin remote exists
  2. Verify current branch
  3. Check for unpushed commits
  4. Push to origin
  5. Handle errors appropriately

Tasks

Step 1: Determine Scope

If submodule name provided:

  1. Verify submodule exists:
    if ! git submodule status <submodule-name> >/dev/null 2>&1; then
      echo "❌ Submodule not found: <submodule-name>"
      exit 1
    fi
  2. Save parent directory and change to submodule directory:
    ORIGINAL_DIR=$(pwd)  # Save parent directory before cd
    cd <submodule-name> || exit 1
  3. Update scope context (all subsequent operations in submodule)

If no submodule name provided, proceed with main repository context.

Step 2: Check if Origin Remote Exists

echo "🔍 Checking for origin remote..."

# Check if any remotes exist
if ! git remote | grep -q .; then
  echo "❌ Error: No git remotes configured"
  echo ""
  echo "To add a remote, run:"
  echo "  git remote add origin <remote-url>"
  echo "  git push -u origin <branch-name>"
  exit 1
fi

# Check specifically for origin remote
if ! git remote | grep -q "^origin$"; then
  echo "❌ Error: 'origin' remote not found"
  echo ""
  echo "Available remotes:"
  git remote -v
  echo ""
  echo "To add origin remote, run:"
  echo "  git remote add origin <remote-url>"
  echo "  git push -u origin <branch-name>"
  exit 1
fi

# Display origin URL
ORIGIN_URL=$(git remote get-url origin 2>/dev/null || echo "unknown")
echo "✅ Origin remote found: $ORIGIN_URL"

Step 3: Check Current Branch

echo "📍 Checking current branch..."

CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)

if [ -z "$CURRENT_BRANCH" ]; then
  echo "❌ Error: Detached HEAD state - cannot push"
  echo "Current commit: $(git rev-parse HEAD)"
  echo ""
  echo "To push, checkout a branch first:"
  echo "  git checkout -b <branch-name>"
  exit 1
fi

echo "✅ Current branch: $CURRENT_BRANCH"

Step 4: Check for Unpushed Commits

echo "🔍 Checking for unpushed commits..."

# Fetch latest from origin to compare
git fetch origin --quiet 2>/dev/null || {
  echo "⚠️  Warning: Could not fetch from origin (remote may not exist yet)"
  echo "Will attempt to push anyway..."
}

# Check if branch has upstream set
UPSTREAM=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null || echo "")

if [ -z "$UPSTREAM" ]; then
  echo "ℹ️  No upstream branch set for $CURRENT_BRANCH"
  echo "Will push and set upstream on first push"
  HAS_UPSTREAM=false
else
  echo "✅ Upstream branch: $UPSTREAM"
  HAS_UPSTREAM=true
  
  # Check if local is ahead of remote
  LOCAL=$(git rev-parse @)
  REMOTE=$(git rev-parse @{u} 2>/dev/null || echo "")
  BASE=$(git merge-base @ @{u} 2>/dev/null || echo "")
  
  if [ -n "$REMOTE" ] && [ -n "$BASE" ]; then
    if [ "$LOCAL" = "$REMOTE" ]; then
      echo "✅ Branch is up to date with $UPSTREAM"
      echo "No commits to push"
      exit 0
    elif [ "$LOCAL" = "$BASE" ]; then
      echo "⚠️  Local branch is behind $UPSTREAM"
      echo "Consider pulling first with: git pull origin $CURRENT_BRANCH"
    elif [ "$REMOTE" = "$BASE" ]; then
      COMMITS_AHEAD=$(git rev-list --count @{u}..@)
      echo "⬆️  Local branch is $COMMITS_AHEAD commit(s) ahead of $UPSTREAM"
    else
      echo "🔀 Local and remote branches have diverged"
      echo "Consider pulling and merging first"
    fi
  fi
fi

Step 5: Push to Origin

echo "📤 Pushing to origin..."

if [ "$HAS_UPSTREAM" = "false" ]; then
  # First push - set upstream
  echo "Setting upstream to origin/$CURRENT_BRANCH..."
  git push -u origin "$CURRENT_BRANCH" || {
    PUSH_EXIT_CODE=$?
    echo "❌ Error: Push failed (exit code: $PUSH_EXIT_CODE)"
    echo ""
    echo "Common issues:"
    echo "  - Remote repository doesn't exist or is inaccessible"
    echo "  - Authentication required (check credentials)"
    echo "  - Branch name conflicts with remote branch"
    echo ""
    echo "To troubleshoot:"
    echo "  git remote -v  # Check remote URL"
    echo "  git status     # Check repository state"
    exit 1
  }
else
  # Subsequent push
  git push origin "$CURRENT_BRANCH" || {
    PUSH_EXIT_CODE=$?
    echo "❌ Error: Push failed (exit code: $PUSH_EXIT_CODE)"
    echo ""
    echo "Common issues:"
    echo "  - Remote has commits you don't have (pull first)"
    echo "  - Authentication required (check credentials)"
    echo "  - Permission denied (check repository access)"
    echo ""
    echo "To troubleshoot:"
    echo "  git pull origin $CURRENT_BRANCH  # Pull latest first"
    echo "  git status                        # Check repository state"
    exit 1
  }
fi

echo "✅ Successfully pushed to origin/$CURRENT_BRANCH"

Step 6: Summary

echo ""
echo "✅ Push workflow completed"
echo ""
echo "Summary:"
echo "  - Branch: $CURRENT_BRANCH"
echo "  - Remote: origin"
echo "  - Upstream: ${UPSTREAM:-origin/$CURRENT_BRANCH (newly set)}"
echo "  - Latest commit: $(git rev-parse --short HEAD)"

Step 7: Return to Original Directory (if in submodule mode)

If submodule name was provided:

if [ -n "$ORIGINAL_DIR" ] && [ "$(pwd)" != "$ORIGINAL_DIR" ]; then
  cd "$ORIGINAL_DIR" || exit 1
  echo "✅ Returned to main repository directory"
fi

Configuration

Optional configuration in foundation-config.yaml:

development:
  push:
    check_remote: true  # Check if origin exists before pushing
    set_upstream: true   # Set upstream on first push
    force_push: false    # Allow force push (use with caution)
    push_tags: false     # Also push tags

Error Handling

  • If no remote exists: Exit with error and instructions to add remote
  • If origin doesn't exist: Exit with error showing available remotes
  • If detached HEAD: Exit with error and instructions
  • If push fails: Exit with error and troubleshooting tips
  • If local is behind remote: Warn but allow push attempt (may fail)

Inputs

  • submodule_name (optional string): Submodule name to scope operations to (e.g., "foundation")

Examples

# Push main repository
/push

# Push foundation submodule
/push foundation

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.