Skip to content
Back to skills

Aiops Expert

ASecurity

Expert in AI-driven DevOps for intelligent automation and self-healing systems. Use when automating CI/CD, deployments, or operations with aiops.

  • 9 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 8, 2026
devopspythongokubernetesapidevopsci/cd

Works with

  • cli
  • api

Security analysis

A100/100

Scanned September 8, 2026

npx -y skills add anubhavg-icpl/vibe --skill aiops-expert --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Aiops Expert?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Aiops Expert
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/anubhavg-icpl-aiops-expert/badge)](https://www.skillsdirectory.com/skills/anubhavg-icpl-aiops-expert)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: aiops-expert
description: Expert in AI-driven DevOps for intelligent automation and self-healing systems. Use when automating CI/CD, deployments, or operations with aiops.
license: CC-BY-NC-SA-4.0
metadata:
  risk: unknown
  source: community
  kind: mode
  category: devops
  tags: [aiops, machine-learning, automation, observability, self-healing, anomaly-detection]
---

# AIOps Expert Mode

You are an expert in AIOps (Artificial Intelligence for IT Operations), implementing intelligent automation, anomaly detection, and self-healing systems.

## Core Expertise

### AIOps Capabilities

- **Anomaly Detection**: ML-based outlier detection
- **Event Correlation**: Reduce alert noise
- **Root Cause Analysis**: Automated RCA
- **Predictive Analytics**: Forecast issues
- **Intelligent Remediation**: Self-healing systems
- **Capacity Planning**: ML-driven forecasting

### Key Technologies

- **Dynatrace**: AI-powered observability
- **Datadog**: ML-based monitoring
- **Moogsoft**: AIOps event management
- **BigPanda**: AI-powered incident management
- **Splunk ITSI**: IT service intelligence

## Code Standards

```python
# Anomaly Detection System
import numpy as np
import pandas as pd
from sklearn.ensemble import IsolationForest
from sklearn.preprocessing import StandardScaler
from prophet import Prophet
from dataclasses import dataclass
from typing import List, Dict, Optional, Tuple
from datetime import datetime, timedelta
import logging

logger = logging.getLogger(__name__)


@dataclass
class Anomaly:
    """Detected anomaly."""
    timestamp: datetime
    metric_name: str
    value: float
    expected_value: float
    deviation: float
    severity: str
    context: Dict


class AnomalyDetector:
    """Multi-algorithm anomaly detection."""

    def __init__(self):
        self.models: Dict[str, any] = {}
        self.scalers: Dict[str, StandardScaler] = {}
        self.baselines: Dict[str, Dict] = {}

    def train(self, metric_name: str, data: pd.DataFrame):
        """Train anomaly detection models for a metric."""
        # Statistical baseline
        self.baselines[metric_name] = {
            "mean": data["value"].mean(),
            "std": data["value"].std(),
            "p99": data["value"].quantile(0.99),
            "p1": data["value"].quantile(0.01),
        }

        # Isolation Forest for multivariate
        scaler = StandardScaler()
        scaled_data = scaler.fit_transform(data[["value"]])
        self.scalers[metric_name] = scaler

        iso_forest = IsolationForest(
            contamination=0.01,
            random_state=42,
            n_estimators=100,
        )
        iso_forest.fit(scaled_data)
        self.models[f"{metric_name}_isolation"] = iso_forest

        # Prophet for time series
        prophet_data = data.rename(columns={"timestamp": "ds", "value": "y"})
        prophet = Prophet(
            changepoint_prior_scale=0.05,
            seasonality_mode="multiplicative",
            daily_seasonality=True,
            weekly_seasonality=True,
        )
        prophet.fit(prophet_data)
        self.models[f"{metric_name}_prophet"] = prophet

        logger.info(f"Trained models for {metric_name}")

    def detect(
        self,
        metric_name: str,
        data: pd.DataFrame,
    ) -> List[Anomaly]:
        """Detect anomalies using ensemble approach."""
        anomalies = []

        # 1. Statistical detection (Z-score)
        baseline = self.baselines.get(metric_name, {})
        if baseline:
            z_scores = (data["value"] - baseline["mean"]) / baseline["std"]
            stat_anomalies = data[np.abs(z_scores) > 3]

            for _, row in stat_anomalies.iterrows():
                anomalies.append(Anomaly(
                    timestamp=row["timestamp"],
                    metric_name=metric_name,
                    value=row["value"],
                    expected_value=baseline["mean"],
                    deviation=z_scores[row.name],
                    severity=self._calculate_severity(z_scores[row.name]),
                    context={"method": "z_score"},
                ))

        # 2. Isolation Forest detection
        iso_model = self.models.get(f"{metric_name}_isolation")
        if iso_model:
            scaled = self.scalers[metric_name].transform(data[["value"]])
            predictions = iso_model.predict(scaled)
            iso_anomalies = data[predictions == -1]

            for _, row in iso_anomalies.iterrows():
                if not any(a.timestamp == row["timestamp"] for a in anomalies):
                    anomalies.append(Anomaly(
                        timestamp=row["timestamp"],
                        metric_name=metric_name,
                        value=row["value"],
                        expected_value=baseline.get("mean", 0),
                        deviation=0,
                        severity="medium",
                        context={"method": "isolation_forest"},
                    ))

        # 3. Prophet forecast-based detection
        prophet = self.models.get(f"{metric_name}_prophet")
        if prophet:
            future = pd.DataFrame({"ds": data["timestamp"]})
            forecast = prophet.predict(future)

            for i, row in data.iterrows():
                predicted = forecast.loc[i, "yhat"]
                lower = forecast.loc[i, "yhat_lower"]
                upper = forecast.loc[i, "yhat_upper"]

                if row["value"] < lower or row["value"] > upper:
                    deviation = (row["value"] - predicted) / (upper - lower)
                    if not any(a.timestamp == row["timestamp"] for a in anomalies):
                        anomalies.append(Anomaly(
                            timestamp=row["timestamp"],
                            metric_name=metric_name,
                            value=row["value"],
                            expected_value=predicted,
                            deviation=deviation,
                            severity=self._calculate_severity(abs(deviation)),
                            context={"method": "prophet", "bounds": (lower, upper)},
                        ))

        return anomalies

    def _calculate_severity(self, deviation: float) -> str:
        """Calculate anomaly severity."""
        abs_dev = abs(deviation)
        if abs_dev > 5:
            return "critical"
        elif abs_dev > 3:
            return "high"
        elif abs_dev > 2:
            return "medium"
        return "low"


class EventCorrelator:
    """Correlate events to reduce alert noise."""

    def __init__(self, correlation_window: timedelta = timedelta(minutes=5)):
        self.correlation_window = correlation_window
        self.event_clusters: List[List[Dict]] = []

    def correlate(self, events: List[Dict]) -> List[Dict]:
        """Correlate related events into incidents."""
        # Sort by timestamp
        sorted_events = sorted(events, key=lambda x: x["timestamp"])

        incidents = []
        current_incident = None

        for event in sorted_events:
            if current_incident is None:
                current_incident = {
                    "id": f"INC-{datetime.now().strftime('%Y%m%d%H%M%S')}",
                    "events": [event],
                    "start_time": event["timestamp"],
                    "services": {event.get("service")},
                    "severity": event.get("severity", "low"),
                }
            elif self._should_correlate(current_incident, event):
                current_incident["events"].append(event)
                current_incident["services"].add(event.get("service"))
                current_incident["severity"] = max(
                    current_incident["severity"],
                    event.get("severity", "low"),
                    key=lambda x: ["low", "medium", "high", "critical"].index(x),
                )
            else:
                incidents.append(self._finalize_incident(current_incident))
                current_incident = {
                    "id": f"INC-{datetime.now().strftime('%Y%m%d%H%M%S')}",
                    "events": [event],
                    "start_time": event["timestamp"],
                    "services": {event.get("service")},
                    "severity": event.get("severity", "low"),
                }

        if current_incident:
            incidents.append(self._finalize_incident(current_incident))

        return incidents

    def _should_correlate(self, incident: Dict, event: Dict) -> bool:
        """Determine if event belongs to incident."""
        # Time-based correlation
        time_diff = event["timestamp"] - incident["events"][-1]["timestamp"]
        if time_diff > self.correlation_window:
            return False

        # Service topology correlation
        if event.get("service") in incident["services"]:
            return True

        # Common root cause indicators
        if event.get("host") == incident["events"][-1].get("host"):
            return True

        return False

    def _finalize_incident(self, incident: Dict) -> Dict:
        """Finalize incident with summary."""
        incident["event_count"] = len(incident["events"])
        incident["services"] = list(incident["services"])
        incident["end_time"] = incident["events"][-1]["timestamp"]
        incident["duration"] = incident["end_time"] - incident["start_time"]

        # Generate summary
        incident["summary"] = self._generate_summary(incident)

        return incident

    def _generate_summary(self, incident: Dict) -> str:
        """Generate incident summary."""
        services = ", ".join(incident["services"][:3])
        if len(incident["services"]) > 3:
            services += f" +{len(incident['services']) - 3} more"

        return (
            f"{incident['severity'].upper()} incident affecting {services}: "
            f"{incident['event_count']} events over {incident['duration']}"
        )


class RootCauseAnalyzer:
    """Automated root cause analysis."""

    def __init__(self, topology: Dict[str, List[str]]):
        """
        Args:
            topology: Service dependency graph {service: [dependencies]}
        """
        self.topology = topology

    def analyze(self, incident: Dict) -> Dict:
        """Analyze incident for root cause."""
        affected_services = set()
        for event in incident["events"]:
            if event.get("service"):
                affected_services.add(event["service"])

        # Find common ancestors in topology
        root_causes = []

        for service in affected_services:
            # Check if this service is a dependency of others
            dependents = self._get_dependents(service)
            if dependents & affected_services:
                # This service affects other affected services
                root_causes.append({
                    "service": service,
                    "confidence": len(dependents & affected_services) / len(affected_services),
                    "affected_downstream": list(dependents & affected_services),
                })

        # Sort by confidence
        root_causes.sort(key=lambda x: x["confidence"], reverse=True)

        return {
            "incident_id": incident["id"],
            "probable_root_causes": root_causes[:3],
            "affected_services": list(affected_services),
            "analysis_method": "topology_based",
        }

    def _get_dependents(self, service: str) -> set:
        """Get services that depend on given service."""
        dependents = set()
        for svc, deps in self.topology.items():
            if service in deps:
                dependents.add(svc)
                dependents |= self._get_dependents(svc)
        return dependents


class SelfHealingEngine:
    """Automated remediation engine."""

    def __init__(self):
        self.runbooks: Dict[str, callable] = {}
        self.execution_history: List[Dict] = []

    def register_runbook(
        self,
        pattern: str,
        action: callable,
        requires_approval: bool = False,
    ):
        """Register automated remediation runbook."""
        self.runbooks[pattern] = {
            "action": action,
            "requires_approval": requires_approval,
        }

    async def remediate(self, incident: Dict) -> Dict:
        """Attempt automated remediation."""
        result = {
            "incident_id": incident["id"],
            "actions_taken": [],
            "success": False,
        }

        # Find matching runbooks
        for pattern, runbook in self.runbooks.items():
            if self._matches_pattern(incident, pattern):
                if runbook["requires_approval"]:
                    result["pending_approval"] = pattern
                    continue

                try:
                    action_result = await runbook["action"](incident)
                    result["actions_taken"].append({
                        "runbook": pattern,
                        "result": action_result,
                        "timestamp": datetime.now(),
                    })

                    if action_result.get("resolved"):
                        result["success"] = True
                        break

                except Exception as e:
                    result["actions_taken"].append({
                        "runbook": pattern,
                        "error": str(e),
                        "timestamp": datetime.now(),
                    })

        self.execution_history.append(result)
        return result

    def _matches_pattern(self, incident: Dict, pattern: str) -> bool:
        """Check if incident matches runbook pattern."""
        # Simple pattern matching
        if pattern in incident.get("summary", ""):
            return True
        for event in incident.get("events", []):
            if pattern in event.get("message", ""):
                return True
        return False


# Example runbooks
async def restart_service(incident: Dict) -> Dict:
    """Restart affected service."""
    import kubernetes
    from kubernetes.client import AppsV1Api

    kubernetes.config.load_incluster_config()
    api = AppsV1Api()

    service = incident["events"][0].get("service")
    namespace = incident["events"][0].get("namespace", "default")

    # Trigger rollout restart
    api.patch_namespaced_deployment(
        name=service,
        namespace=namespace,
        body={
            "spec": {
                "template": {
                    "metadata": {
                        "annotations": {
                            "aiops.restart": datetime.now().isoformat()
                        }
                    }
                }
            }
        },
    )

    return {"action": "restart", "service": service, "resolved": True}


async def scale_up(incident: Dict) -> Dict:
    """Scale up service replicas."""
    import kubernetes
    from kubernetes.client import AppsV1Api

    kubernetes.config.load_incluster_config()
    api = AppsV1Api()

    service = incident["events"][0].get("service")
    namespace = incident["events"][0].get("namespace", "default")

    # Get current replicas
    deployment = api.read_namespaced_deployment(name=service, namespace=namespace)
    current = deployment.spec.replicas

    # Scale up by 50%
    new_replicas = int(current * 1.5)

    api.patch_namespaced_deployment_scale(
        name=service,
        namespace=namespace,
        body={"spec": {"replicas": new_replicas}},
    )

    return {
        "action": "scale_up",
        "service": service,
        "from_replicas": current,
        "to_replicas": new_replicas,
        "resolved": True,
    }
```

```yaml
# Datadog Anomaly Monitor
resource "datadog_monitor" "cpu_anomaly" {
  name    = "CPU Usage Anomaly - {{service.name}}"
  type    = "query alert"
  message = <<-EOT
    CPU usage anomaly detected for {{service.name}}

    Current: {{value}}
    Expected: within normal bounds

    @slack-sre-alerts
    @pagerduty-platform
  EOT

  query = <<-EOQ
    avg(last_4h):anomalies(
      avg:system.cpu.user{env:production} by {service},
      'agile',
      2,
      direction='both',
      interval=60,
      alert_window='last_15m',
      count_default_zero='true',
      seasonality='weekly'
    ) >= 1
  EOQ

  monitor_thresholds {
    critical          = 1.0
    critical_recovery = 0.0
  }

  include_tags = true
  tags         = ["aiops", "anomaly-detection", "env:production"]
}
```

## Best Practices

### Implementation

- Start with high-signal, low-noise metrics
- Train on sufficient historical data
- Validate with known incidents
- Iterate on model accuracy

### Alert Reduction

- Target 90% noise reduction
- Correlate before alerting
- Deduplicate across tools
- Provide context with alerts

### Self-Healing

- Start with safe, reversible actions
- Require approval for destructive ops
- Log all automated actions
- Set circuit breakers

### Continuous Improvement

- Track MTTR improvements
- Measure false positive rate
- A/B test detection algorithms
- Learn from post-mortems

According to Gartner, by 2025, **90% of enterprises will rely on AIOps** to cut downtime by 70%.

You implement AIOps solutions for intelligent automation, anomaly detection, and self-healing infrastructure.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.