AGENT SKILL

csat-sentiment-triage-automation

Automate customer service ticket sentiment analysis, churn risk detection, and intelligent escalation using LLM embeddings and classification pipelines. Extract customer emotional valence, urgency scores, dissatisfaction root causes, and trigger automated manager escalations or CSAT recovery playbooks. Trigger when building sentiment triage, churn prevention, or automated customer support feedback loops.

License 许可
MIT
最近更新
2026-10-17
Stars
★ 8
Forks
1

01 前言 Front Matter

name
csat-sentiment-triage-automation
metadata
{ "category": "Customer Support and Service Automation" }
description
Automate customer service ticket sentiment analysis, churn risk detection, and intelligent escalation using LLM embeddings and classification pipelines. Extract customer emotional valence, urgency scores, dissatisfaction root causes, and trigger automated manager escalations or CSAT recovery playbooks. Trigger when building sentiment triage, churn prevention, or automated customer support feedback loops.
compatibility
Python 3.10+, OpenAI / Anthropic / Gemini API, HuggingFace Transformers

03 SKILL.md 正文

CSAT & Sentiment Triage Automation Skill Guide

This skill governs the integration of machine learning and LLM-driven sentiment evaluation to prioritize frustrated customers, flag churn indicators, and trigger automated escalations.


1. Sentiment & Churn Triage Architecture

[ Incoming Customer Message / Survey ]
                  |
                  v
[ Fast Sentiment & Intent Classifier ]
  |-- Valence: Negative / Neutral / Positive
  |-- Urgency Score (1 - 10)
  |-- Churn Risk Triggers: "cancel", "refund", "unacceptable", "lawyer"
                  |
                  +---> High Urgency / Severe Negative (Score >= 8)
                  |       |
                  |       v
                  |     [ Immediate Manager Slack Alert & P1 Queue Boost ]
                  |
                  +---> Mild / Standard Query
                          |
                          v
                        [ Normal Agent Assignment / AI Auto-Draft ]

2. Production Implementation (Python & Pydantic)

import json
from typing import Literal
from pydantic import BaseModel, Field


class SentimentTriageResult(BaseModel):
    sentiment: Literal["VERY_NEGATIVE", "NEGATIVE", "NEUTRAL", "POSITIVE"]
    urgency_score: int = Field(ge=1, le=10, description="1=low, 10=immediate crisis")
    churn_risk: bool
    detected_issues: list[str]
    suggested_action: Literal["ESCALATE_TO_MANAGER", "PRIORITY_SUPPORT", "STANDARD_QUEUE", "OFFER_RETENTION"]
    executive_summary: str


def build_triage_prompt(customer_message: str, account_tier: str) -> str:
    return f"""You are an expert customer experience triage intelligence agent.
Analyze the following customer message and account context:

Customer Account Tier: {account_tier}
Message Content:
\"\"\"{customer_message}\"\"\"

Provide an objective assessment in JSON matching the schema:
- sentiment: VERY_NEGATIVE | NEGATIVE | NEUTRAL | POSITIVE
- urgency_score: 1 to 10
- churn_risk: true if the customer expresses intent to leave, cancel, or switch competitors
- detected_issues: list of core issues (e.g., "downtime", "billing error", "rude support")
- suggested_action: ESCALATE_TO_MANAGER | PRIORITY_SUPPORT | STANDARD_QUEUE | OFFER_RETENTION
- executive_summary: 1-sentence summary for the receiving agent
"""


def process_sentiment_webhook(triage_data: SentimentTriageResult, ticket_id: str):
    """Executes action based on structured sentiment classification."""
    if triage_data.urgency_score >= 8 or triage_data.churn_risk:
        # Boost ticket priority and notify escalation Slack channel
        print(f"[URGENT ESCALATION] Ticket {ticket_id}: {triage_data.executive_summary}")
        # Integration logic: emit webhook / update CRM

3. Best Practices & Guardrails

  1. VIP Bias Adjustment: Automatically add +2 to urgency score for enterprise/VIP contract accounts to ensure SLA compliance.
  2. Defamation & Legal Watchwords: Configure zero-latency regex filters for keywords like "attorney", "subpoena", or "regulator" to route directly to legal/compliance queues.
  3. Continuous CSAT Closed-Loop: When a customer rates a resolved ticket 1 or 2 stars, trigger an automatic follow-up ticket assigned to an operations team lead.

04 同仓库更多 Skills

hamzabellouch
hamzabellouch/agent-skills

security-audit

Comprehensive security guidance, source code audit, vulnerability assessment, and penetration test review for codebases, APIs, microservices, CLI tools, libraries, and LLM-backed applications. Triggers on requests to audit a codebase, conduct security reviews, find vulnerabilities or flaws, pen-test source code, or when the user asks in Arabic (فحص أمني، تدقيق الكود أمنياً، مراجعة الثغرات، فحص أمان المشروع). Supports Guidance mode (focused review) and Full Audit mode (deterministic 6-phase harness).

★ 8
hamzabellouch
hamzabellouch/agent-skills

malware-analysis-reversing

Production malware analysis workflows, reverse engineering methodologies, isolated sandbox triage, static/dynamic binary analysis, memory forensics, and YARA detection rule authoring.

★ 8
hamzabellouch
hamzabellouch/agent-skills

application-security-pentesting

Production Application Security (AppSec) standards, OWASP Top 10 vulnerability remediation, SAST/DAST pipeline integration, secure code review, threat modeling, and defensive security posture.

★ 8
hamzabellouch
hamzabellouch/agent-skills

oauth2-oidc-security-flows

Implement enterprise OAuth 2.1 and OpenID Connect (OIDC) authorization code flow with Proof Key for Code Exchange (PKCE), state and nonce verification, refresh token rotation, token revocation, and centralized IdP federation (Keycloak, Auth0, Okta). Trigger when building secure authentication, single sign-on (SSO), or third-party delegated authorization.

★ 8
hamzabellouch
hamzabellouch/agent-skills

jwt-session-management-hardening

Harden JWT-based authentication and session lifecycles using asymmetric signing (RS256/EdDSA), JWKS rotation, strict claims validation, Redis-backed sliding window sessions, revocation lists, and secure HttpOnly cookie storage. Trigger when implementing token validation, session revocation, or hardening API authentication.

★ 8
hamzabellouch
hamzabellouch/agent-skills

soc2-compliance-automation

Best practices for implementing SOC 2 Type II compliance controls, continuous evidence collection, infrastructure policy-as-code, and automated security monitoring. Use when automating Trust Services Criteria (Security, Availability, Confidentiality, Processing Integrity, Privacy), audit logging, IAM least privilege, or CI/CD security gates.

★ 8