deploy-to-production

ErikM1974's avatarfrom ErikM1974

Deploy current develop branch to production. Use when user says /deploy, "deploy to production", "push to heroku", "release to production", "deploy changes", "ship it", or "release changes". Commits changes, pushes develop, merges to main, creates version tag, pushes to GitHub and Heroku, then returns to develop branch.

⭐0stars🔀0forks📁View on GitHub🕐Updated Jan 1, 2026

When & Why to Use This Skill

This Claude skill automates the end-to-end deployment pipeline, transitioning code from a development branch to a production environment. It streamlines complex Git workflows by handling commits, branch merging, standardized version tagging, and multi-platform pushing (GitHub and Heroku), ensuring a consistent, error-free, and documented release process.

Use Cases

  • Automating the transition of verified features from a 'develop' branch to a 'main' production branch with automated versioning.
  • Deploying web applications directly to Heroku while ensuring remote GitHub repositories remain synchronized.
  • Enforcing a standardized release checklist that includes pre-deployment status checks, mandatory user confirmation, and graceful error handling for merge conflicts.
  • Maintaining a project 'Lessons Learned' log by automatically prompting developers to document bug fixes and insights immediately after a successful production push.
nameDeploy to Production
descriptionDeploy current develop branch to production. Use when user says /deploy, "deploy to production", "push to heroku", "release to production", "deploy changes", "ship it", or "release changes". Commits changes, pushes develop, merges to main, creates version tag, pushes to GitHub and Heroku, then returns to develop branch.

Deploy to Production Skill

This skill automates the full deployment workflow for Northwest Custom Apparel's Pricing Index project.

What This Skill Does

Executes a complete deployment pipeline:

  1. Commits any uncommitted changes (auto-generated message)
  2. Pushes develop branch to GitHub
  3. Merges develop into main
  4. Creates a version tag (e.g., v2025.12.23.1)
  5. Pushes main to GitHub and Heroku
  6. Returns to develop branch

When to Use This Skill

Use this skill when the user says:

  • "/deploy"
  • "deploy to production"
  • "push to heroku"
  • "release to production"
  • "deploy changes"
  • "ship it"
  • "release changes"

Implementation

Execute these steps in order. Stop immediately if any step fails.

Step 1: Check Current Branch and Status

# Verify we're on develop branch
git branch --show-current

If not on develop, inform the user and stop.

# Check for uncommitted changes
git status --porcelain

Step 2: Commit Changes (if any)

Only run if there are uncommitted changes from Step 1:

# Stage all changes
git add -A

# Get list of changed files for commit message
git diff --cached --name-only

Generate commit message based on changed files:

  • Format: Deploy: updated X files (file1.js, file2.css, ...)
  • If more than 3 files, show first 3 with "... and X more"
# Create commit with auto-generated message
git commit -m "Deploy: updated X files (file1, file2, ...)"

Step 3: Push Develop to GitHub

git push origin develop

Step 4: ASK FOR CONFIRMATION (REQUIRED)

CRITICAL: You MUST ask the user for confirmation before proceeding to production.

Display a summary and ask:

READY TO DEPLOY TO PRODUCTION?

Summary so far:
- Branch: develop
- Committed: X files
- Pushed to: GitHub (develop branch)

Next steps will:
- Merge develop → main
- Create version tag
- Push to GitHub (main) and Heroku (PRODUCTION)

Are you ready to proceed?

Use the AskUserQuestion tool to get explicit confirmation. DO NOT proceed without user approval.

If user says no or wants to stop, return to develop branch and stop.

Step 5: Switch to Main Branch

git checkout main

Step 6: Pull Latest Main (Safety Check)

git pull origin main

Step 7: Merge Develop into Main

git merge develop --no-edit

CRITICAL: If merge fails due to conflict:

  1. Run git merge --abort
  2. Run git checkout develop
  3. Display error message to user:
    DEPLOY ABORTED: Merge conflict detected!
    
    Please resolve conflicts manually:
    1. git checkout main
    2. git merge develop
    3. Resolve conflicts in your editor
    4. git add . && git commit
    5. Run /deploy again
    
    You are back on develop branch.
    
  4. STOP - do not continue with remaining steps

Step 8: Create Version Tag

Generate tag in format: vYYYY.MM.DD.N where N is sequence number for the day.

# Get today's date
date +%Y.%m.%d

# Check for existing tags today to determine sequence number
git tag -l "v$(date +%Y.%m.%d).*"

If no tags exist for today, use .1. Otherwise increment the last sequence number.

# Create annotated tag
git tag -a v2025.12.23.1 -m "Production deploy"

Step 9: Push Main to GitHub (with tags)

git push origin main --tags

Step 10: Push Main to Heroku

git push heroku main

Step 11: Return to Develop Branch

git checkout develop

Step 12: Display Success Message

DEPLOY SUCCESSFUL!

Summary:
- Committed: X files
- Version tag: v2025.12.23.1
- Pushed to: GitHub (develop + main) and Heroku

Main branch is now live at:
https://sanmar-inventory-app-4cd7b252508d.herokuapp.com/

Step 13: Ask About Lessons Learned (REQUIRED)

After successful deploy, ask:

Any bugs fixed this session to log to LESSONS_LEARNED.md?

Use AskUserQuestion with options:

  • "Yes, log a bug fix" → Ask for details, then add entry to /memory/LESSONS_LEARNED.md
  • "No, nothing to log" → Done

If user wants to log, collect:

  • Problem description
  • Symptoms
  • Root cause
  • Solution
  • Prevention (optional)

Then add the entry at the top of LESSONS_LEARNED.md (below the header, above existing entries).

Error Handling

Error Action
Not on develop branch Stop, inform user
Merge conflict Abort merge, return to develop, show manual resolution steps
Push fails Show error, suggest git pull first
Heroku push fails Show error, suggest checking Heroku login status

Example Output

Starting deployment...

[1/12] Checking branch... develop
[2/12] Committing changes... 3 files staged
       Commit: "Deploy: updated 3 files (calculator.js, styles.css, index.html)"
[3/12] Pushing develop to GitHub... done

[4/12] CONFIRMATION REQUIRED...

       READY TO DEPLOY TO PRODUCTION?

       Summary so far:
       - Branch: develop
       - Committed: 3 files
       - Pushed to: GitHub (develop branch)

       Next steps will:
       - Merge develop → main
       - Create version tag
       - Push to GitHub (main) and Heroku (PRODUCTION)

       [User confirms: Yes, proceed]

[5/12] Switching to main... done
[6/12] Pulling latest main... already up to date
[7/12] Merging develop into main... done
[8/12] Creating version tag... v2025.12.23.1
[9/12] Pushing main to GitHub... done
[10/12] Pushing to Heroku... done
[11/12] Returning to develop... done

DEPLOY SUCCESSFUL! Version v2025.12.23.1 is now live.

Important Notes

  • Always verify you're on develop branch before starting
  • Never force push - if push fails, investigate why
  • Version tags provide rollback points: git checkout v2025.12.23.1
  • If Heroku fails but GitHub succeeds, you can manually run git push heroku main