- Version: 2.0
Executes comprehensive rollback procedure for failed deployments, reverting code, database, and configuration to restore production stability.
/plugin marketplace add ninthspace/claude-code-marketplace/plugin install sdd@ninthspace-marketplacePurpose: Execute comprehensive rollback procedure for a deployed story experiencing critical issues in production. Revert code changes, database migrations, configuration, and restore system stability.
Syntax: /sdd:story-rollback <story_id> [--severity=critical|high|medium] [--rollback-type=full|code|database|config]
| Parameter | Type | Required | Default | Description | Validation |
|---|---|---|---|---|---|
| story_id | string | Yes | - | Story identifier (e.g., "STORY-2025-001") | Must match pattern STORY-\d{4}-\d{3} |
| --severity | enum | No | high | Issue severity level | critical, high, medium, low |
| --rollback-type | enum | No | full | Type of rollback to perform | full, code, database, config, partial |
LOCATE story file:
/docs/stories/completed/[story-id].md first/docs/stories/qa/[story-id].md/docs/stories/review/[story-id].md/docs/stories/development/[story-id].mdREAD story file and extract:
IDENTIFY deployment details:
DISPLAY context:
š ROLLBACK CONTEXT
āāāāāāāāāāāāāāāāāāā
Story: [STORY-ID] - [Title]
Current Location: /docs/stories/[directory]/
Deployed Version: [version]
Previous Version: [previous-version]
Deployment Time: [timestamp]
Time Since Deploy: [duration]
Changes Made:
- Code: [X] files changed
- Database: [Y] migrations applied
- Config: [Z] changes
- Dependencies: [list]
PROMPT user for incident details (if not provided):
ASSESS severity (use --severity if provided):
DETERMINE rollback strategy:
GENERATE assessment report:
šØ ROLLBACK ASSESSMENT
āāāāāāāāāāāāāāāāāāāāāā
Severity: [CRITICAL/HIGH/MEDIUM/LOW]
IMPACT:
- Users affected: [estimate or percentage]
- Features broken: [list of broken features]
- Data corruption risk: [YES/NO - details]
- Revenue impact: [description if applicable]
- SLA breach: [YES/NO]
ROOT CAUSE:
- [Identified or suspected issue]
- [Contributing factors]
ROLLBACK OPTIONS:
1. ā
Full rollback to v[previous] (RECOMMENDED)
- Reverts all changes
- Restores known stable state
- Requires database rollback
- ETA: [X] minutes
2. Code-only rollback
- Keeps database changes
- Faster rollback
- May cause compatibility issues
- ETA: [Y] minutes
3. Hotfix forward
- Fix specific issue
- No rollback needed
- Takes longer to implement
- ETA: [Z] minutes
4. Partial rollback
- Revert specific changes
- Keep working features
- Complex to execute
- ETA: [W] minutes
RECOMMENDATION: [Strategy based on severity and impact]
CONFIRM rollback decision:
CREATE safety backup:
DOCUMENT rollback start:
NOTIFY stakeholders (if configured):
DISPLAY backup confirmation:
š¾ PRE-ROLLBACK BACKUP
āāāāāāāāāāāāāāāāāāāāāā
ā
Database backed up: [location]
ā
Code state saved: [commit-hash]
ā
Configuration saved: [location]
ā
Logs archived: [location]
ā
Metrics captured: [timestamp]
Safe to proceed with rollback.
VERIFY current branch:
IDENTIFY rollback target:
git describe --tags --abbrev=0 [current-tag]^EXECUTE code rollback:
git revert -m 1 [merge-commit]git push origin mainREMOVE problematic release tag:
git tag -d [current-tag]git push origin --delete [current-tag]DISPLAY code rollback status:
ā©ļø CODE ROLLBACK
āāāāāāāāāāāāāāāā
ā
Reverted to: v[previous-version]
ā
Revert commit: [commit-hash]
ā
Tag removed: [current-tag]
ā
Changes pushed to remote
Files reverted: [count]
IDENTIFY migrations to rollback:
WARN about data loss:
EXECUTE database rollback:
php artisan migrate:rollback --step=[count]python manage.py migrate [app] [previous-migration]rails db:rollback STEP=[count]VERIFY database state:
DISPLAY database rollback status:
šļø DATABASE ROLLBACK
āāāāāāāāāāāāāāāāāāā
ā
Migrations rolled back: [count]
ā
Schema restored to: [previous state]
ā
Data integrity: Verified
ā ļø Data loss: [description if any]
Migrations reversed:
- [migration-1]
- [migration-2]
- [migration-3]
IDENTIFY configuration changes:
REVERT configuration:
CLEAR application caches:
php artisan cache:clear && php artisan config:clearpython manage.py clear_cacheRESTART application services:
DISPLAY configuration rollback status:
āļø CONFIGURATION ROLLBACK
āāāāāāāāāāāāāāāāāāāāāāāā
ā
ENV variables: Restored
ā
Config files: Reverted
ā
Feature flags: Disabled
ā
Caches: Cleared
ā
Services: Restarted
Changes reverted:
- [config-change-1]
- [config-change-2]
DETECT deployment system:
/docs/project-context/technical-stack.mdEXECUTE deployment rollback:
VERIFY deployment:
DISPLAY deployment status:
š DEPLOYMENT ROLLBACK
āāāāāāāāāāāāāāāāāāāāāā
ā
Deployed: v[previous-version]
ā
Application: Running
ā
Services: Operational
ā
Endpoints: Responding
Deployment method: [method]
Rollback duration: [X] minutes
RUN smoke tests:
CHECK application health:
VERIFY issue resolved:
MONITOR stability:
DISPLAY verification results:
ā
ROLLBACK VERIFICATION
āāāāāāāāāāāāāāāāāāāāāāāā
Smoke Tests: [X/Y] passed
Health Checks: All operational
Error Rates: Normal (< threshold)
Response Times: Normal
Resource Usage: Normal
Original Issue: ā
RESOLVED
Application Status: ā
STABLE
Safe to restore user access.
COMPLETE post-rollback checklist:
š POST-ROLLBACK CHECKLIST
āāāāāāāāāāāāāāāāāāāāāāāāāā
ā” Production stable and verified
ā” Users notified of restoration
ā” Monitoring shows normal metrics
ā” No data loss confirmed
ā” Incident documented
ā” Team notified
ā” Stakeholders updated
NOTIFY users (if applicable):
UPDATE monitoring:
CREATE incident report:
š INCIDENT REPORT
āāāāāāāāāāāāāāāāāā
Story: [STORY-ID] - [Title]
Incident ID: INC-[YYYY-MM-DD]-[number]
TIMELINE:
- Deployed: [timestamp]
- Issue detected: [timestamp]
- Rollback started: [timestamp]
- Rollback completed: [timestamp]
- Service restored: [timestamp]
- Total duration: [X] minutes
WHAT HAPPENED:
[Detailed description of the issue that occurred]
IMPACT:
- Users affected: [estimate/percentage]
- Features broken: [list]
- Data loss: [YES/NO - details]
- Business impact: [description]
- Revenue impact: [if applicable]
- SLA impact: [if applicable]
ROOT CAUSE:
- Primary: [Technical cause]
- Contributing factors: [list]
- Detection: [How issue was found]
RESOLUTION:
- Action taken: [Rollback strategy used]
- Code: Reverted to v[previous]
- Database: [Migrations rolled back or kept]
- Configuration: [Changes reverted]
- Verification: [How stability confirmed]
LESSONS LEARNED:
- What worked well: [list]
- What didn't work: [list]
- Gaps identified: [list]
- Preventive measures: [list]
ACTION ITEMS:
- [ ] [Preventive measure 1]
- [ ] [Preventive measure 2]
- [ ] [Testing improvement 1]
- [ ] [Monitoring enhancement 1]
- [ ] [Process update 1]
FOLLOW-UP STORY:
Create fix story: /sdd:story-new [story-id-for-fix]
Link to incident: INC-[YYYY-MM-DD]-[number]
ADD incident to story file:
DETERMINE story destination:
/docs/stories/development//docs/stories/qa//docs/stories/review//docs/stories/development/ENSURE target directory exists:
.gitkeep if directory createdMOVE story file:
/docs/stories/completed/)UPDATE story file:
COMMIT story move:
PROMPT user to create fix story:
Do you want to create a fix story now? (y/n)
IF user confirms:
DISPLAY fix story details:
š FIX STORY CREATED
āāāāāāāāāāāāāāāāāāāā
Story ID: [FIX-STORY-ID]
Title: Fix [Original Story] - [Issue Description]
Priority: HIGH
Location: /docs/stories/backlog/[fix-story-id].md
Linked to:
- Original: [STORY-ID]
- Incident: INC-[YYYY-MM-DD]-[number]
Next steps:
1. Review incident report
2. Investigate root cause
3. /sdd:story-start [fix-story-id]
4. Implement fix with additional testing
5. /sdd:story-ship [fix-story-id] (with caution)
ā
ROLLBACK COMPLETE
āāāāāāāāāāāāāāāāāāāā
Story: [STORY-ID] - [Title]
ROLLBACK SUMMARY:
⢠Strategy: [Full/Partial/Code-only/etc.]
⢠Duration: [X] minutes
⢠Version: Reverted from v[current] to v[previous]
⢠Impact: [Users affected during rollback]
ACTIONS TAKEN:
ā
Code reverted to v[previous]
ā
Database rolled back ([X] migrations)
ā
Configuration restored
ā
Application redeployed
ā
Smoke tests passed
ā
Production stable
CURRENT STATE:
⢠Application: ā
Running v[previous]
⢠Health: ā
All systems operational
⢠Users: ā
Full access restored
⢠Monitoring: ā
Normal metrics
⢠Story: Moved to /docs/stories/[directory]/
INCIDENT REPORT:
Created: INC-[YYYY-MM-DD]-[number]
Location: [story-file-path]
FIX STORY:
Created: [FIX-STORY-ID] (if created)
Priority: HIGH
Location: /docs/stories/backlog/[fix-story-id].md
NEXT STEPS:
1. Continue monitoring for 24 hours
2. Review incident report with team
3. Implement action items
4. Start work on fix story: /sdd:story-start [fix-story-id]
5. Add additional testing to prevent recurrence
6. Update rollback procedures if needed
POST-MORTEM:
Schedule incident review meeting within 48 hours
to discuss root cause and preventive measures.
INPUT:
/sdd:story-rollback STORY-2025-003 --severity=critical
PROCESS:
ā Locating story STORY-2025-003...
ā Found in /docs/stories/completed/STORY-2025-003.md
ā Loading rollback plan...
What issue are you experiencing?
> Payment processing completely broken, users cannot checkout
How many users are affected?
> All users attempting to purchase (estimated 100+ in last 10 mins)
ā Assessing situation...
OUTPUT:
šØ ROLLBACK ASSESSMENT
āāāāāāāāāāāāāāāāāāāāāā
Severity: CRITICAL
IMPACT:
- Users affected: All users (100+ in 10 minutes)
- Features broken: Payment processing, checkout flow
- Data corruption risk: NO
- Revenue impact: Blocking all sales
- SLA breach: YES
ROOT CAUSE:
- Payment gateway integration broken
- API credential mismatch suspected
ROLLBACK OPTIONS:
1. ā
Full rollback to v1.2.0 (RECOMMENDED)
- Reverts all payment changes
- Restores working checkout
- Requires 2 migration rollbacks
- ETA: 5 minutes
RECOMMENDATION: Full rollback (critical revenue impact)
Proceed with full rollback? (yes/no)
> yes
ā Creating pre-rollback backup...
š¾ PRE-ROLLBACK BACKUP
ā
Database backed up
ā
Code state saved
ā
Configuration saved
ā
Logs archived
ā Executing code rollback...
ā©ļø CODE ROLLBACK
ā
Reverted to: v1.2.0
ā
Revert commit: def789
ā
Tag removed: v1.3.0
ā Executing database rollback...
šļø DATABASE ROLLBACK
ā
Migrations rolled back: 2
ā
Schema restored
ā Restoring configuration...
āļø CONFIGURATION ROLLBACK
ā
ENV variables restored
ā
Caches cleared
ā
Services restarted
ā Deploying previous version...
š DEPLOYMENT ROLLBACK
ā
Deployed: v1.2.0
ā
Application: Running
ā Verifying rollback...
ā
ROLLBACK VERIFICATION
Smoke Tests: 12/12 passed
Original Issue: ā
RESOLVED
Application Status: ā
STABLE
ā Creating incident report...
ā Moving story to /docs/stories/development/
ā
ROLLBACK COMPLETE
āāāāāāāāāāāāāāāāāāāā
Story: STORY-2025-003 - Payment Integration
ROLLBACK SUMMARY:
⢠Strategy: Full rollback
⢠Duration: 6 minutes
⢠Version: Reverted from v1.3.0 to v1.2.0
⢠Impact: Brief interruption during rollback
ACTIONS TAKEN:
ā
Code reverted to v1.2.0
ā
Database rolled back (2 migrations)
ā
Configuration restored
ā
Payment service restored
CURRENT STATE:
⢠Application: ā
Running v1.2.0
⢠Checkout: ā
Working normally
⢠Users: ā
Can complete purchases
⢠Story: Moved to /docs/stories/development/
INCIDENT REPORT:
Created: INC-2025-03-16-001
Location: /docs/stories/development/STORY-2025-003.md
NEXT STEPS:
1. Monitor payment processing
2. Investigate API credential issue
3. Add payment integration tests
4. Implement with better validation
5. /sdd:story-start STORY-2025-003 when ready
INPUT:
/sdd:story-rollback STORY-2025-004 --rollback-type=code
PROCESS:
ā Locating story...
ā Found in /docs/stories/completed/STORY-2025-004.md
What issue are you experiencing?
> UI rendering broken on mobile devices
ā Assessing situation...
ā Severity: HIGH
ā Rollback type: Code only (database changes OK)
ā Executing code rollback...
ā Keeping database migrations
ā Reverting frontend changes...
OUTPUT:
ā
ROLLBACK COMPLETE
āāāāāāāāāāāāāāāāāāāā
Story: STORY-2025-004 - Mobile UI Update
ROLLBACK SUMMARY:
⢠Strategy: Code-only rollback
⢠Duration: 3 minutes
⢠Database: No changes (migrations kept)
ACTIONS TAKEN:
ā
Code reverted
ā
Frontend assets rebuilt
ā
Application redeployed
ā
Mobile UI: Restored to previous version
Database migrations were not rolled back
as they are compatible with previous code.
INPUT:
/sdd:story-rollback STORY-2025-999
PROCESS:
ā Searching for STORY-2025-999...
ā Not found in /docs/stories/completed/
ā Not found in /docs/stories/qa/
ā Not found in /docs/stories/review/
ā Not found in /docs/stories/development/
OUTPUT:
ā STORY NOT FOUND
āāāāāāāāāāāāāāāāāā
Story ID: STORY-2025-999
The story file was not found in any directory:
- /docs/stories/completed/
- /docs/stories/qa/
- /docs/stories/review/
- /docs/stories/development/
- /docs/stories/backlog/
Please verify the story ID and try again.
To see all stories: /sdd:project-status
/sdd:story-ship - Ship story (the opposite of rollback)/sdd:story-qa - Return story to QA for fixes/sdd:story-new - Create fix story for addressing issues/sdd:project-status - View all project stories