Claude Skills Guide

Claude Code for Statuspage Workflow Tutorial

Status pages are critical for transparent communication with users during incidents and maintenance windows. Managing status pages manually can be time-consuming, especially when you’re dealing with multiple components, scheduled maintenance, and rapid incident updates. This tutorial shows you how to leverage Claude Code to automate your statuspage workflow, from incident creation to automated status updates based on your monitoring systems.

Why Automate Statuspage Workflows?

When an incident occurs, every minute counts. Manual status page updates slow down your incident response and can lead to inconsistent messaging. Automating your statuspage workflow with Claude Code provides several key benefits:

Prerequisites

Before implementing the statuspage workflow, ensure you have:

  1. Claude Code installed - Download from anthropic.com/claude-code
  2. Statuspage account - Create at statuspage.io (or similar service)
  3. API key - Generate from your statuspage admin panel
  4. Optional: Monitoring integration - PagerDuty, Datadog, or similar tools

Setting Up the Statuspage Automation Skill

Create a custom Claude skill that handles statuspage operations. This skill will manage components, incidents, and scheduled maintenance.

Create the Skill Configuration

# Statuspage Automation Skill

## Overview
This skill automates statuspage operations including incident creation, component updates, and maintenance windows.

## Capabilities
- Create and update incidents with proper severity levels
- Manage component statuses (operational, degraded, partial-outage, major-outage)
- Schedule and manage maintenance windows
- Generate status page summaries and reports

## API Integration
- Uses Statuspage API v2
- Requires API_KEY environment variable
- Supports page_id configuration

Environment Setup

Configure your environment variables for secure API access:

# Set your statuspage credentials
export STATUSPAGE_API_KEY="your_api_key_here"
export STATUSPAGE_PAGE_ID="your_page_id"

Automating Incident Creation

The most critical statuspage automation is incident creation. Here’s how to set up Claude Code to automatically create incidents when your monitoring systems detect issues.

Incident Detection Workflow

#!/usr/bin/env python3
"""Automated incident detection and statuspage update script"""

import os
import requests
from datetime import datetime

STATUSPAGE_API_KEY = os.environ.get("STATUSPAGE_API_KEY")
STATUSPAGE_PAGE_ID = os.environ.get("STATUSPAGE_PAGE_ID")
STATUSPAGE_API_URL = "https://api.statuspage.io/v1"

def create_incident(title, status, severity, components):
    """Create a new incident on statuspage"""
    
    headers = {
        "Authorization": f"OAuth {STATUSPAGE_API_KEY}",
        "Content-Type": "application/json"
    }
    
    incident_data = {
        "incident": {
            "name": title,
            "status": status,  # investigating, identified, monitoring, resolved
            "severity": severity,  # critical, major, minor, cosmetic
            "components": components,
            "body": f"## Incident Report\n\n**Detected:** {datetime.now().isoformat()}\n\nWe're investigating issues with the affected components."
        }
    }
    
    response = requests.post(
        f"{STATUSPAGE_API_URL}/pages/{STATUSPAGE_PAGE_ID}/incidents",
        json=incident_data,
        headers=headers
    )
    
    return response.json()

# Example usage
if __name__ == "__main__":
    incident = create_incident(
        title="API Response Time Degradation",
        status="investigating",
        severity="major",
        components=[{"id": "abc123", "status": "partial_outage"}]
    )
    print(f"Created incident: {incident.get('id')}")

Integrating with Monitoring Alerts

Connect Claude Code to your monitoring system for automatic incident creation:

# Example: Alert webhook configuration for automatic incidents
webhook:
  url: "https://your-callback-url.com/webhook"
  events:
    - alert_fired
    - alert_resolved
    
handlers:
  - name: statuspage_incident
    type: webhook
    config:
      endpoint: "/api/incidents"
      severity_mapping:
        critical: critical
        warning: major
        info: minor

Managing Component Statuses

Claude Code can help you maintain accurate component statuses across your infrastructure.

Component Status Update Script

def update_component_status(component_id, new_status):
    """Update individual component status"""
    
    headers = {
        "Authorization": f"OAuth {STATUSPAGE_API_KEY}",
        "Content-Type": "application/json"
    }
    
    component_data = {
        "component": {
            "status": new_status  # operational, degraded_performance, partial_outage, major_outage
        }
    }
    
    response = requests.patch(
        f"{STATUSPAGE_API_URL}/pages/{STATUSPAGE_PAGE_ID}/components/{component_id}",
        json=component_data,
        headers=headers
    )
    
    return response.json()

# Component status constants for clarity
COMPONENT_STATUSES = {
    "operational": "All systems normal",
    "degraded_performance": "Reduced performance",
    "partial_outage": "Partial service disruption",
    "major_outage": "Major service disruption"
}

Bulk Status Checks

Automate regular component health checks:

def check_all_components(monitor_funcs):
    """Check all components and update statuspage accordingly"""
    
    results = {}
    
    for component_id, check_func in monitor_funcs.items():
        try:
            is_healthy = check_func()
            new_status = "operational" if is_healthy else "major_outage"
            results[component_id] = update_component_status(component_id, new_status)
        except Exception as e:
            print(f"Error checking component {component_id}: {e}")
    
    return results

Scheduled Maintenance Automation

Claude Code can manage scheduled maintenance windows, ensuring proper notification to users before and during maintenance.

Creating Maintenance Windows

def schedule_maintenance(component_ids, start_at, end_at, title, description):
    """Schedule a maintenance window"""
    
    headers = {
        "Authorization": f"OAuth {STATUSPAGE_API_KEY}",
        "Content-Type": "application/json"
    }
    
    maintenance_data = {
        "scheduled_maintenance": {
            "name": title,
            "description": description,
            "component_ids": component_ids,
            "scheduled_for": start_at.isoformat() + "Z",
            "scheduled_until": end_at.isoformat() + "Z"
        }
    }
    
    response = requests.post(
        f"{STATUSPAGE_API_URL}/pages/{STATUSPAGE_PAGE_ID}/scheduled_maintenances",
        json=maintenance_data,
        headers=headers
    )
    
    return response.json()

# Example: Schedule weekly database maintenance
from datetime import datetime, timedelta

next_monday = datetime.now() + timedelta(days=7)
maintenance = schedule_maintenance(
    component_ids=["db_cluster_1", "db_cluster_2"],
    start_at=next_monday.replace(hour=2, minute=0),
    end_at=next_monday.replace(hour=4, minute=0),
    title="Weekly Database Maintenance",
    description="Routine database updates and optimizations"
)

Best Practices for Statuspage Automation

When implementing Claude Code for statuspage workflows, follow these best practices:

  1. Always have manual overrides - Some situations require human judgment; ensure you can disable automation when needed
  2. Use descriptive incident titles - Include service name, impact area, and timeframe in incident names
  3. Maintain component hierarchy - Group related components for accurate impact assessment
  4. Test in staging - Verify your automation works correctly before deploying to production
  5. Monitor your automation - Set up alerts for failed API calls or unexpected behavior

Advanced: Multi-Team Coordination

For larger organizations, coordinate status updates across teams:

class StatuspageOrchestrator:
    """Coordinate status updates across multiple teams"""
    
    def __init__(self, teams_config):
        self.teams = teams_config
    
    def create_incident_with_escalation(self, incident_info):
        """Create incident and notify relevant teams"""
        
        # Create incident on statuspage
        incident = create_incident(**incident_info)
        
        # Notify on-call engineers
        for team in incident_info.get("affected_teams", []):
            self.teams[team].notify(
                f"Incident {incident['id']}: {incident_info['title']}",
                severity=incident_info['severity']
            )
        
        # Update Slack channel
        self.post_to_slack(incident, incident_info)
        
        return incident

Conclusion

Automating your statuspage workflow with Claude Code transforms how you communicate with users during incidents. By implementing the workflows in this tutorial, you’ll reduce response times, ensure consistent communication, and free up your team to focus on resolving issues rather than manually updating status pages.

Start with basic incident creation, then gradually add component monitoring and maintenance automation as your workflow matures. The key is to maintain a balance between automation and human oversight—your users will thank you for fast, accurate updates during critical moments.

Built by theluckystrike — More at zovo.one