本文へ移動
cccskills
無料GitHub で公開

test-reporting-triage-skill

Automatically categorizes test failures, suggests responsible owners, and provides common fix checklists. Generates actionable test reports with failure analysis. Use for "test reporting", "failure triage", "test analysis", or "test automation".

インストール方法を見る

含まれるファイル(1)

  • SKILL.md12.9 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Test Reporting & Triage Skill

Automatically triage test failures and suggest next actions.

Failure Categorization

// types/test-failure.ts
export type FailureCategory =
  | "timeout"
  | "assertion"
  | "network"
  | "database"
  | "authentication"
  | "permission"
  | "configuration"
  | "flaky"
  | "infrastructure"
  | "unknown";

export interface TestFailure {
  testName: string;
  category: FailureCategory;
  errorMessage: string;
  stackTrace: string;
  suggestedOwner: string;
  suggestedFixes: string[];
  runId: string;
  timestamp: Date;
}

Failure Analyzer

// analyzers/failure-analyzer.ts
export class FailureAnalyzer {
  categorize(error: Error, testName: string): TestFailure {
    const errorMessage = error.message.toLowerCase();
    const stackTrace = error.stack || "";

    // Timeout detection
    if (errorMessage.includes("timeout") || errorMessage.includes("exceeded")) {
      return {
        testName,
        category: "timeout",
        errorMessage: error.message,
        stackTrace,
        suggestedOwner: "Performance Team",
        suggestedFixes: [
          "Check if API is slow",
          "Increase timeout value",
          "Optimize database query",
          "Check for network issues",
        ],
        runId: process.env.CI_RUN_ID || "local",
        timestamp: new Date(),
      };
    }

    // Network errors
    if (
      errorMessage.includes("econnrefused") ||
      errorMessage.includes("network") ||
      errorMessage.includes("fetch failed")
    ) {
      return {
        testName,
        category: "network",
        errorMessage: error.message,
        stackTrace,
        suggestedOwner: "DevOps Team",
        suggestedFixes: [
          "Check if service is running",
          "Verify network connectivity",
          "Check firewall rules",
          "Verify DNS resolution",
        ],
        runId: process.env.CI_RUN_ID || "local",
        timestamp: new Date(),
      };
    }

    // Database errors
    if (
      errorMessage.includes("database") ||
      errorMessage.includes("prisma") ||
      errorMessage.includes("unique constraint")
    ) {
      return {
        testName,
        category: "database",
        errorMessage: error.message,
        stackTrace,
        suggestedOwner: "Backend Team",
        suggestedFixes: [
          "Check database connection",
          "Verify test data cleanup",
          "Check for race conditions",
          "Review migration status",
        ],
        runId: process.env.CI_RUN_ID || "local",
        timestamp: new Date(),
      };
    }

    // Authentication errors
    if (
      errorMessage.includes("unauthorized") ||
      errorMessage.includes("authentication") ||
      errorMessage.includes("401")
    ) {
      return {
        testName,
        category: "authentication",
        errorMessage: error.message,
        stackTrace,
        suggestedOwner: "Auth Team",
        suggestedFixes: [
          "Check auth token validity",
          "Verify test user credentials",
          "Check session expiration",
          "Review auth middleware",
        ],
        runId: process.env.CI_RUN_ID || "local",
        timestamp: new Date(),
      };
    }

    // Assertion failures
    if (
      errorMessage.includes("expected") &&
      errorMessage.includes("received")
    ) {
      return {
        testName,
        category: "assertion",
        errorMessage: error.message,
        stackTrace,
        suggestedOwner: this.determineOwnerFromPath(stackTrace),
        suggestedFixes: [
          "Review recent code changes",
          "Check if test expectations are correct",
          "Verify test data setup",
          "Check for breaking changes",
        ],
        runId: process.env.CI_RUN_ID || "local",
        timestamp: new Date(),
      };
    }

    // Default: unknown
    return {
      testName,
      category: "unknown",
      errorMessage: error.message,
      stackTrace,
      suggestedOwner: "On-Call Engineer",
      suggestedFixes: [
        "Review error message and stack trace",
        "Check recent commits",
        "Run test locally to reproduce",
        "Add more specific error handling",
      ],
      runId: process.env.CI_RUN_ID || "local",
      timestamp: new Date(),
    };
  }

  private determineOwnerFromPath(stackTrace: string): string {
    if (stackTrace.includes("/frontend/")) return "Frontend Team";
    if (stackTrace.includes("/backend/")) return "Backend Team";
    if (stackTrace.includes("/api/")) return "API Team";
    if (stackTrace.includes("/database/")) return "Database Team";
    return "Development Team";
  }
}

Test Report Generator

// reporters/test-report.ts
import { FailureAnalyzer } from "../analyzers/failure-analyzer";

export class TestReporter {
  private analyzer = new FailureAnalyzer();
  private failures: TestFailure[] = [];

  recordFailure(error: Error, testName: string) {
    const failure = this.analyzer.categorize(error, testName);
    this.failures.push(failure);
  }

  generateReport(): string {
    const grouped = this.groupByCategory();
    const report: string[] = [];

    report.push("# Test Failure Report\n");
    report.push(`Generated: ${new Date().toISOString()}\n`);
    report.push(`Total Failures: ${this.failures.length}\n\n`);

    // Summary by category
    report.push("## Summary by Category\n");
    Object.entries(grouped).forEach(([category, failures]) => {
      report.push(`- ${category}: ${failures.length} failures`);
    });
    report.push("\n");

    // Detailed failures
    report.push("## Detailed Failures\n\n");
    Object.entries(grouped).forEach(([category, failures]) => {
      report.push(`### ${category.toUpperCase()} (${failures.length})\n\n`);

      failures.forEach((failure, i) => {
        report.push(`#### ${i + 1}. ${failure.testName}\n`);
        report.push(`**Owner:** ${failure.suggestedOwner}\n\n`);
        report.push(`**Error:**\n\`\`\`\n${failure.errorMessage}\n\`\`\`\n\n`);
        report.push(`**Suggested Fixes:**\n`);
        failure.suggestedFixes.forEach((fix) => {
          report.push(`- ${fix}\n`);
        });
        report.push("\n");
      });
    });

    return report.join("");
  }

  generateSlackMessage(): string {
    const grouped = this.groupByCategory();
    const messages: string[] = [];

    messages.push("🔴 *Test Failures Detected*\n");
    messages.push(`Total: ${this.failures.length} failures\n`);

    Object.entries(grouped).forEach(([category, failures]) => {
      const icon = this.getCategoryIcon(category);
      messages.push(`${icon} ${category}: ${failures.length}`);
    });

    // Top 3 failures
    messages.push("\n*Top Failures:*");
    this.failures.slice(0, 3).forEach((failure, i) => {
      messages.push(`\n${i + 1}. \`${failure.testName}\``);
      messages.push(`   Owner: @${failure.suggestedOwner}`);
    });

    return messages.join("\n");
  }

  private groupByCategory(): Record<string, TestFailure[]> {
    return this.failures.reduce((acc, failure) => {
      if (!acc[failure.category]) {
        acc[failure.category] = [];
      }
      acc[failure.category].push(failure);
      return acc;
    }, {} as Record<string, TestFailure[]>);
  }

  private getCategoryIcon(category: string): string {
    const icons: Record<string, string> = {
      timeout: "⏱️",
      network: "🌐",
      database: "💾",
      authentication: "🔐",
      assertion: "❌",
      flaky: "🔄",
      infrastructure: "🏗️",
      unknown: "❓",
    };
    return icons[category] || "❓";
  }
}

Common Fix Checklists

// checklists/fix-checklists.ts
export const fixChecklists = {
  timeout: {
    title: "Timeout Failure Checklist",
    steps: [
      "☐ Check if the timeout is too short",
      "☐ Verify API response time in logs",
      "☐ Check database query performance",
      "☐ Look for network latency issues",
      "☐ Verify no infinite loops or deadlocks",
      "☐ Check if external services are slow",
      "☐ Consider increasing timeout temporarily",
      "☐ Optimize slow code path if confirmed slow",
    ],
  },

  flaky: {
    title: "Flaky Test Checklist",
    steps: [
      "☐ Run test 10 times locally",
      "☐ Check for race conditions",
      "☐ Verify proper test cleanup",
      "☐ Look for timing dependencies",
      "☐ Check for shared state between tests",
      "☐ Verify no randomness in test data",
      "☐ Check for network/external dependencies",
      "☐ Add explicit waits where needed",
    ],
  },

  database: {
    title: "Database Error Checklist",
    steps: [
      "☐ Verify database is running",
      "☐ Check connection string",
      "☐ Verify test database cleanup",
      "☐ Check for constraint violations",
      "☐ Look for migration issues",
      "☐ Verify proper transaction handling",
      "☐ Check for concurrent access issues",
      "☐ Review recent schema changes",
    ],
  },

  assertion: {
    title: "Assertion Failure Checklist",
    steps: [
      "☐ Review what changed in recent commits",
      "☐ Verify test expectations are still valid",
      "☐ Check if feature requirements changed",
      "☐ Run test locally to reproduce",
      "☐ Check test data setup",
      "☐ Verify mocks are up to date",
      "☐ Review API contract changes",
      "☐ Update test if behavior change is intentional",
    ],
  },
};

CI Integration

# .github/workflows/test-report.yml
name: Test Report

on:
  workflow_run:
    workflows: ["CI"]
    types: [completed]

jobs:
  report:
    runs-on: ubuntu-latest
    if: ${{ github.event.workflow_run.conclusion == 'failure' }}

    steps:
      - uses: actions/checkout@v4

      - name: Download test results
        uses: actions/download-artifact@v4
        with:
          name: test-results

      - name: Generate report
        run: npm run analyze-failures

      - name: Post to Slack
        uses: slackapi/slack-github-action@v1
        with:
          channel-id: "test-failures"
          payload: ${{ steps.analyze.outputs.slack_message }}
        env:
          SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

      - name: Create GitHub Issue
        uses: actions/github-script@v7
        with:
          script: |
            const report = require('./test-report.json');
            github.rest.issues.create({
              owner: context.repo.owner,
              repo: context.repo.repo,
              title: `Test Failures - ${new Date().toISOString()}`,
              body: report.markdown,
              labels: ['test-failure', 'automated'],
            });

Dashboard Metrics

// dashboard/test-metrics.ts
export interface TestMetrics {
  totalTests: number;
  passed: number;
  failed: number;
  skipped: number;
  duration: number;
  failureRate: number;

  failuresByCategory: Record<FailureCategory, number>;
  failuresByOwner: Record<string, number>;
  flakyTests: string[];
  slowTests: Array<{ name: string; duration: number }>;
}

export function generateMetrics(results: TestResult[]): TestMetrics {
  const failures = results.filter((r) => r.status === "failed");
  const analyzer = new FailureAnalyzer();

  const categorized = failures.map((f) =>
    analyzer.categorize(f.error, f.testName)
  );

  return {
    totalTests: results.length,
    passed: results.filter((r) => r.status === "passed").length,
    failed: failures.length,
    skipped: results.filter((r) => r.status === "skipped").length,
    duration: results.reduce((sum, r) => sum + r.duration, 0),
    failureRate: (failures.length / results.length) * 100,

    failuresByCategory: categorized.reduce((acc, f) => {
      acc[f.category] = (acc[f.category] || 0) + 1;
      return acc;
    }, {} as Record<FailureCategory, number>),

    failuresByOwner: categorized.reduce((acc, f) => {
      acc[f.suggestedOwner] = (acc[f.suggestedOwner] || 0) + 1;
      return acc;
    }, {} as Record<string, number>),

    flakyTests: identifyFlakyTests(results),
    slowTests: results
      .filter((r) => r.duration > 5000)
      .sort((a, b) => b.duration - a.duration)
      .slice(0, 10),
  };
}

Best Practices

  1. Auto-categorize: Classify failures automatically
  2. Suggest owners: Route to right team
  3. Actionable fixes: Provide clear next steps
  4. Track trends: Monitor failure patterns
  5. Notify quickly: Slack/email on failures
  6. Create issues: Auto-file for persistent failures
  7. Dashboard: Visual metrics for team

Output Checklist

  • Failure categorization logic
  • Owner assignment rules
  • Fix checklists per category
  • Report generation (Markdown/Slack)
  • CI integration
  • GitHub issue creation
  • Slack notifications
  • Dashboard metrics
  • Trend analysis
  • Flaky test detection

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Audits and implements web accessibility (a11y) following WCAG 2.1 guidelines with ARIA patterns, keyboard navigation, screen reader support, and contrast checking. Use when users request "accessibility audit", "a11y review", "WCAG compliance", "screen reader support", or "keyboard navigation".

日本語の概要は準備中です。原文の説明を表示しています。

sathishssj3/Stereix-Engine22026年10月4日 更新

Creates Architecture Decision Records documenting key technical decisions with context, alternatives considered, tradeoffs, consequences, and decision owners. Use when documenting "architecture decisions", "technical choices", "design decisions", or "ADRs".

日本語の概要は準備中です。原文の説明を表示しています。

sathishssj3/Stereix-Engine22026年10月4日 更新

Designs multi-step agent workflows with tool usage, retry logic, state management, and budget controls. Provides orchestration diagrams, tool execution order, fallback strategies, and cost limits. Use for "AI agents", "agentic workflows", "multi-step AI", or "autonomous systems".

日本語の概要は準備中です。原文の説明を表示しています。

sathishssj3/Stereix-Engine22026年10月4日 更新

MUST USE when user wants to 调研/research/搜索/search/查/找/look up anything on the internet — e.g. 全网调研 X / 帮我调研一下 X / 查一下 X / 搜搜 X / 看看大家怎么评价 X / X 上有什么讨论 / research this topic。 Also MUST USE when user mentions any platform or shares any URL/链接: 小红书/xiaohongshu/xhs, Twitter/推特/X, B站/bilibili, Reddit, Facebook, Instagram, V2EX, LinkedIn/领英/招聘/求职/jobs, YouTube, GitHub code search, 小宇宙播客, 雪球/股票行情, RSS feeds, or any web URL. 15 platforms, multi-backend routing (OpenCLI / per-platform CLIs / APIs). Zero config for 6 channels. Run `agent-reach doctor --json` to see which backend serves each platform right now. NOT for: 写报告/数据分析/翻译等内容加工(本 skill 只负责从互联网获取内容); 发帖/评论/点赞等写操作;已有专门 skill 的平台(先用专门 skill)。 【路由方式】SKILL.md 包含路由表和常用命令,复杂场景需按需阅读对应分类的 references/*.md。 分类:search / social (小红书/推特/B站/V2EX/Reddit/Facebook/Instagram) / career(LinkedIn) / dev(github) / web(网页/文章/RSS) / video(YouTube/B站/播客) / finance(雪球/股票)。

日本語の概要は準備中です。原文の説明を表示しています。

sathishssj3/Stereix-Engine22026年10月4日 更新

Orchestrates multi-agent AI systems with task delegation, agent communication, shared memory, and workflow coordination. Use when users request "multi-agent system", "agent orchestration", "AI agents", "agent coordination", or "autonomous agents".

日本語の概要は準備中です。原文の説明を表示しています。

sathishssj3/Stereix-Engine22026年10月4日 更新

Creates SLO-based alerts and operational dashboards with key charts, alert thresholds, and runbook links. Use for "alerting", "dashboards", "SLO", or "monitoring".

日本語の概要は準備中です。原文の説明を表示しています。

sathishssj3/Stereix-Engine22026年10月4日 更新

sathishssj3 のスキルをすべて見る

このスキルの問題を報告する