# Deploy Pr

> Deploy merged changes to the target environment, run smoke tests, and verify the rollback plan.

- **Type:** Skill
- **Install:** `agentstack add skill-tomzx-agents-deploy-pr`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [tomzx](https://agentstack.voostack.com/s/tomzx)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [tomzx](https://github.com/tomzx)
- **Source:** https://github.com/tomzx/agents/tree/main/skills/deploy-pr

## Install

```sh
agentstack add skill-tomzx-agents-deploy-pr
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Deploy PR

Deploys a merged pull request to the target environment, runs smoke tests to verify the deployment, and confirms a rollback plan exists. Bridges the gap between merging code and having it running in production.

## Prerequisites

- Apply the shared SDLC conventions in `skills/sdlc/references/shared.md`.
- If no argument is provided, target the pull request from `$PR_NUMBER` (and `$REPO`).
- `gh` CLI authenticated with write access to the target repository
- A merged PR number or merge SHA provided as `$1`
- Deployment tooling available (CI/CD pipeline, container registry, or manual deployment scripts)
- Read any files present under `.sdlc/context/` for project-level context, especially `architecture.md` for deployment topology

## Workflow

```
Fetch merged PR details ($1)
        |
        v
  Identify target environment
        |
        v
  Confirm rollback plan exists
     /         \
   Yes          No
    |            |
    v            v
  Execute     Document rollback
  deployment  procedure first,
    |         then proceed
    v
  Run smoke tests
     /         \
   Pass         Fail
    |            |
    v            v
  Verify      Execute rollback
  health      Report failure
    |            |
    v            v
  Report      Stop, investigate
  success
```

## Steps

1. Fetch the merged PR details:
   ```
   gh pr view $1 --json title,body,mergeCommit,headRefName,closingIssuesReferences
   ```

2. Identify the target environment(s) from the PR labels, branch name, or project configuration. Common targets:
   - `staging` for non-production validation
   - `production` for user-facing releases
   - Feature-specific environments (e.g., `preview`, `canary`)
   If uncertain, ask the user which environment to deploy to.

3. Check for a rollback plan. Look for:
   - A documented rollback procedure in the PR description or `.sdlc/` artifacts
   - Previous deployment version or tag to roll back to
   - Database migration rollback if applicable
   If no rollback plan exists, document one before proceeding.

4. Execute the deployment using the project's CI/CD pipeline or deployment scripts:
   ```
   gh workflow run deploy.yml --ref main -f environment=
   ```
   Or, if deployment is manual, follow the project's deployment procedure from `architecture.md`.

5. Wait for deployment to complete. Monitor:
   ```
   gh run watch 
   ```

6. Run smoke tests against the deployed environment:
   - Health check endpoints return 200
   - Key user flows are accessible
   - No increase in error rates
   - Database connectivity is intact
   Use the project's existing smoke test suite if available, otherwise test the critical path manually.

7. If smoke tests pass, verify overall system health:
   - Check monitoring dashboards for anomalies
   - Confirm no new alerts fired
   - Verify key metrics (latency, error rate, throughput) are within normal ranges

8. If smoke tests fail, execute the rollback plan:
   - Redeploy the previous version
   - Run any database rollback migrations
   - Confirm the system is healthy on the previous version
   - Report the failure with details for investigation

9. Report deployment status:
   - Environment deployed to
   - Version or commit SHA deployed
   - Smoke test results
   - Rollback plan location
   - Any issues encountered

## Output Format

```markdown
## Deployment Report

- **PR:** # — 
- **Commit:** 
- **Environment:** 
- **Deployed at:** 
- **Smoke tests:** Pass / Fail ()
- **Rollback plan:** 
- **Status:** Success / Rolled back / Failed
```

## Example Usage

**Scenario 1: Standard production deploy**
```
/deploy-pr 42
```
PR #42 was merged to main. Deploy to production via CI/CD pipeline, run smoke tests, confirm healthy.

**Scenario 2: Staging deploy first**
```
/deploy-pr 88
```
Deploy PR #88 to staging first, run smoke tests, then promote to production if all checks pass.

**Scenario 3: Rollback needed**
```
/deploy-pr 55
```
Smoke tests reveal a 500 error on the checkout flow. Roll back to the previous deployment, confirm system health, report the failure.

## Next Step

Once deployment is successful, continue with `/create-learnings` to capture a retrospective on the feature.
If the feature is now running in production, consider running `/observe-production` to establish a baseline for monitoring.

## Useful Commands Reference

| Command | Description |
|---|---|
| `gh pr view  --json title,body,mergeCommit` | Fetch merged PR details |
| `gh workflow run deploy.yml --ref main -f environment=` | Trigger deployment workflow |
| `gh run watch ` | Watch CI/CD run until completion |
| `gh run list --workflow=deploy.yml --limit=5` | List recent deployment runs |

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [tomzx](https://github.com/tomzx)
- **Source:** [tomzx/agents](https://github.com/tomzx/agents)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-tomzx-agents-deploy-pr
- Seller: https://agentstack.voostack.com/s/tomzx
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
