본문으로 건너뛰기
cccskills
무료GitHub에 공개

self-healing-system

Autonomous system health monitoring, self-healing, resource optimization, and self-improvement workflows. Use when the user wants to implement automatic system health checks, auto-fix issues, optimize resources, reduce costs, schedule daily maintenance, or create a self-managing application. Triggers on: "self-healing", "auto-fix", "system health", "resource optimization", "cost reduction", "automated maintenance", "system monitoring", "self-improving", "auto-optimization", "daily workflow", "resource analysis", "load balancing".

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ProjectZeroDays/FreeAI_AI_Inference_Workstation스타 5(GitHub 5 + cccskills 0)
연동 도구Vercel

실행 점수 미검증

설치 방법 보기

포함된 파일(1)

  • SKILL.md12.6 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Self-Healing System

This skill provides workflows for implementing autonomous system health monitoring, self-healing capabilities, resource optimization, and AI-powered recommendations.

System Health API

Create src/app/api/system/health/route.ts:

import { NextResponse } from 'next/server';
import { prisma } from '@/lib/prisma';

export const runtime = 'nodejs';
export const dynamic = 'force-dynamic';

export async function GET() {
  const now = new Date();
  const dayAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000);
  const weekAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);

  const [
    totalUsers, activeUsers, newUsersToday, newUsersWeek,
    totalTherapists, approvedTherapists, activeSubscriptions,
    totalBookings, bookingsToday, bookingsWeek,
    totalRevenue, revenueToday, revenueWeek, revenueMonth,
    pendingVerifications, rejectedPhotos, activeReviews,
    subscriptionCount,
  ] = await Promise.all([
    prisma.user.count(),
    prisma.user.count({ where: { isVerified: true } }),
    prisma.user.count({ where: { createdAt: { gte: dayAgo } } }),
    prisma.user.count({ where: { createdAt: { gte: weekAgo } } }),
    prisma.therapistProfile.count(),
    prisma.therapistProfile.count({ where: { isApproved: true } }),
    prisma.therapistProfile.count({ where: { subscriptionActive: true } }),
    prisma.booking.count(),
    prisma.booking.count({ where: { createdAt: { gte: dayAgo } } }),
    prisma.booking.count({ where: { createdAt: { gte: weekAgo } } }),
    prisma.payment.aggregate({ _sum: { amount: true }, where: { status: 'COMPLETED' } }),
    prisma.payment.aggregate({ _sum: { amount: true }, where: { status: 'COMPLETED', createdAt: { gte: dayAgo } } }),
    prisma.payment.aggregate({ _sum: { amount: true }, where: { status: 'COMPLETED', createdAt: { gte: weekAgo } } }),
    prisma.payment.aggregate({ _sum: { amount: true }, where: { status: 'COMPLETED', createdAt: { gte: monthAgo } } }),
    prisma.verificationDoc.count({ where: { status: 'PENDING' } }),
    prisma.photo.count({ where: { status: 'REJECTED' } }),
    prisma.review.count({ where: { status: 'APPROVED' } }),
    prisma.subscription.count({ where: { status: 'ACTIVE' } }),
  ]);

  const recommendations: string[] = [];
  if (pendingVerifications > 20) recommendations.push('High verification backlog. Prioritize admin review.');
  if (rejectedPhotos > 50) recommendations.push('High photo rejection rate. Update upload guidelines.');
  if (newUsersToday === 0) recommendations.push('No new users today. Check marketing channels.');
  if (activeSubscriptions < totalTherapists * 0.3) recommendations.push('Low subscription adoption. Consider promotions.');
  if (bookingsToday === 0 && approvedTherapists > 0) recommendations.push('No bookings despite active therapists. Check search visibility.');

  return NextResponse.json({
    success: true,
    timestamp: now.toISOString(),
    resourceUsage: {
      cpu: process.cpuUsage(),
      memory: process.memoryUsage(),
      uptime: process.uptime(),
    },
    dbHealth: {
      totalUsers, activeUsers, newUsersToday, newUsersWeek,
      totalTherapists, approvedTherapists, activeSubscriptions,
      totalBookings, bookingsToday, bookingsWeek,
      totalRevenue: totalRevenue._sum.amount || 0,
      revenueToday: revenueToday._sum.amount || 0,
      revenueWeek: revenueWeek._sum.amount || 0,
      revenueMonth: revenueMonth._sum.amount || 0,
      pendingVerifications, rejectedPhotos, activeReviews, subscriptionCount,
    },
    recommendations,
  });
}

Self-Healing/Optimization API

Create src/app/api/system/optimize/route.ts:

import { NextRequest, NextResponse } from 'next/server';
import { prisma } from '@/lib/prisma';

export const runtime = 'nodejs';
export const dynamic = 'force-dynamic';

export async function POST(request: NextRequest) {
  const body = await request.json();
  const { action } = body;

  if (action === 'optimize') {
    const result = await runOptimization();
    return NextResponse.json({ success: true, result });
  }

  if (action === 'analyze') {
    const analysis = await runAnalysis();
    return NextResponse.json({ success: true, analysis });
  }

  return NextResponse.json({ error: 'Unknown action' }, { status: 400 });
}

async function runOptimization() {
  const now = new Date();
  const weekAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);

  const [bookings, notifications, sessions, photos] = await Promise.all([
    prisma.booking.deleteMany({
      where: {
        status: { in: ['PENDING', 'THERAPIST_PENDING'] },
        startTime: { lt: now },
        createdAt: { lt: weekAgo },
      },
    }),
    prisma.notification.deleteMany({
      where: {
        read: true,
        createdAt: { lt: new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000) },
      },
    }),
    prisma.session.deleteMany({
      where: { expiresAt: { lt: now } },
    }),
    prisma.photo.deleteMany({
      where: {
        status: 'REJECTED',
        createdAt: { lt: new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000) },
      },
    }),
  ]);

  return {
    cleanedBookings: bookings.count,
    cleanedNotifications: notifications.count,
    cleanedSessions: sessions.count,
    cleanedPhotos: photos.count,
  };
}

async function runAnalysis() {
  const now = new Date();
  const weekAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);

  const [newUsers, bookings, revenue, pendingVerifications, inactiveTherapists] = await Promise.all([
    prisma.user.count({ where: { createdAt: { gte: weekAgo } } }),
    prisma.booking.count({ where: { createdAt: { gte: weekAgo } } }),
    prisma.payment.aggregate({ _sum: { amount: true }, where: { status: 'COMPLETED', createdAt: { gte: weekAgo } } }),
    prisma.verificationDoc.count({ where: { status: 'PENDING' } }),
    prisma.therapistProfile.count({ where: { subscriptionActive: false, isApproved: true } }),
  ]);

  const recommendations: string[] = [];
  if (pendingVerifications > 10) recommendations.push(`High backlog: ${pendingVerifications} pending verifications.`);
  if (inactiveTherapists > 0) recommendations.push(`${inactiveTherapists} therapists with inactive subscriptions.`);
  if (newUsers < 5) recommendations.push('Low new user growth this week.');

  return {
    weekStats: { newUsers, bookings, revenue: revenue._sum.amount || 0 },
    pendingVerifications,
    inactiveTherapists,
    recommendations,
    lastRun: now.toISOString(),
  };
}

Daily Cron Job

Create src/app/api/system/cron/route.ts:

import { NextResponse } from 'next/server';
import { prisma } from '@/lib/prisma';

export const runtime = 'nodejs';
export const dynamic = 'force-dynamic';

export async function POST() {
  const now = new Date();
  const dayAgo = new Date(now.getTime() - 24 * 60 * 60 * 1000);
  const weekAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000);

  try {
    // Cleanup
    const [staleBookings, staleNotifications, staleSessions] = await Promise.all([
      prisma.booking.deleteMany({
        where: {
          status: { in: ['PENDING', 'THERAPIST_PENDING'] },
          startTime: { lt: now },
          createdAt: { lt: weekAgo },
        },
      }),
      prisma.notification.deleteMany({
        where: {
          read: true,
          createdAt: { lt: new Date(now.getTime() - 30 * 24 * 60 * 60 * 1000) },
        },
      }),
      prisma.session.deleteMany({ where: { expiresAt: { lt: now } } }),
    ]);

    // Analytics
    const [newUsers, bookings, revenue, pendingVerifications, activeSubscriptions, errorReports] = await Promise.all([
      prisma.user.count({ where: { createdAt: { gte: dayAgo } } }),
      prisma.booking.count({ where: { createdAt: { gte: dayAgo } } }),
      prisma.payment.aggregate({ _sum: { amount: true }, where: { status: 'COMPLETED', createdAt: { gte: dayAgo } } }),
      prisma.verificationDoc.count({ where: { status: 'PENDING' } }),
      prisma.therapistProfile.count({ where: { subscriptionActive: true } }),
      prisma.bugReport.count({ where: { createdAt: { gte: dayAgo } } }),
    ]);

    // Generate recommendations
    const recommendations: string[] = [];
    if (pendingVerifications > 20) recommendations.push('High verification backlog');
    if (newUsers === 0) recommendations.push('No new users today');
    if (activeSubscriptions === 0) recommendations.push('No active subscriptions');

    // Store daily report
    await prisma.$executeRaw`
      INSERT INTO daily_reports (new_users, bookings, revenue, recommendations, generated_at)
      VALUES (${newUsers}, ${bookings}, ${revenue._sum.amount || 0}, ${JSON.stringify(recommendations)}, ${now.toISOString()})
    `;

    return NextResponse.json({
      success: true,
      dailyReport: {
        newUsers,
        bookings,
        revenue: revenue._sum.amount || 0,
        pendingVerifications,
        activeSubscriptions,
        errorReports,
      },
      cleanup: { staleBookings: staleBookings.count, staleNotifications: staleNotifications.count, staleSessions: staleSessions.count },
      timestamp: now.toISOString(),
    });
  } catch (error: any) {
    return NextResponse.json({ success: false, error: error.message }, { status: 500 });
  }
}

Vercel Cron Configuration

Add to vercel.json:

{
  "crons": [
    {
      "path": "/api/system/cron",
      "schedule": "0 2 * * *"
    }
  ]
}

Self-Healing Script

Create scripts/self-healing.js:

const { execSync } = require('child_process');

class SelfHealingSystem {
  async healthCheck() {
    const checks = { database: false, api: false, build: false, tests: false };
    
    try {
      const res = await fetch('http://localhost:3000/api/health');
      checks.api = res.ok;
    } catch { checks.api = false; }

    try {
      execSync('npm test', { stdio: 'pipe' });
      checks.tests = true;
    } catch { checks.tests = false; }

    try {
      execSync('npm run build', { stdio: 'pipe' });
      checks.build = true;
    } catch { checks.build = false; }

    return checks;
  }

  async runOptimization() {
    try {
      const res = await fetch('http://localhost:3000/api/system/optimize', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ action: 'optimize' }),
      });
      return await res.json();
    } catch (error) {
      console.error('Optimization failed:', error);
      return null;
    }
  }

  async analyze() {
    try {
      const res = await fetch('http://localhost:3000/api/system/health');
      return await res.json();
    } catch (error) {
      console.error('Analysis failed:', error);
      return null;
    }
  }

  async runCycle() {
    console.log('[Self-Healing] Starting maintenance cycle...');
    
    const health = await this.healthCheck();
    if (!Object.values(health).every(v => v)) {
      console.log('[Self-Healing] Issues detected, running optimization...');
      const result = await this.runOptimization();
      console.log('[Self-Healing] Cleanup result:', result);
    }

    const analysis = await this.analyze();
    if (analysis?.recommendations?.length > 0) {
      console.log('[Self-Healing] Recommendations:', analysis.recommendations);
    }
  }
}

// Run on schedule
const system = new SelfHealingSystem();
system.runCycle().catch(console.error);
setInterval(() => system.runCycle().catch(console.error), 3600000); // Every hour

Cost Optimization Recommendations

Add to src/app/api/system/health/route.ts:

const costRecommendations: string[] = [];

// Database optimization
const dbSize = await prisma.$queryRaw`SELECT pg_database_size('your_database')`;
if (dbSize[0].pg_database_size > 1073741824) { // 1GB
  costRecommendations.push('Database exceeds 1GB. Consider archiving old data.');
}

// Storage optimization
const expiredSessions = await prisma.session.count({ where: { expiresAt: { lt: now } } });
if (expiredSessions > 10000) {
  costRecommendations.push(`${expiredSessions} expired sessions to clean up.`);
}

// API cost optimization
const apiCalls = await prisma.apiCallLog.count({ where: { createdAt: { gte: dayAgo } } });
if (apiCalls > 100000) {
  costRecommendations.push('High API call volume. Consider caching.');
}

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

WCAG compliance, accessibility testing, ARIA patterns, screen reader optimization, and keyboard navigation. Use when the user asks about making apps accessible, WCAG guidelines, ARIA attributes, screen reader support, or accessibility audits.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ProjectZeroDays/FreeAI_AI_Inference_Workstation52026년 9월 4일 업데이트

ace-music

무료

Generate AI music using ACE-Step 1.5 via ACE Music's free API. Use when the user asks to create, generate, or compose music, songs, beats, instrumentals, or audio tracks. Supports lyrics, style prompts, covers, and repainting. Free API, no cost.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ProjectZeroDays/FreeAI_AI_Inference_Workstation52026년 9월 4일 업데이트

A continuously adaptive skill suite that empowers Clawdbot to act as a versatile coder, business analyst, project manager, web developer, data analyst, and NAS metadata scraper. It intelligently discovers free resources, adapts to user context, and ensures reliable, proven guidance across multiple domains.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ProjectZeroDays/FreeAI_AI_Inference_Workstation52026년 9월 4일 업데이트

High-fidelity intelligence gathering and data assimilation. Focuses on synthesizing fragmented data into a comprehensive target operational picture.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ProjectZeroDays/FreeAI_AI_Inference_Workstation52026년 9월 4일 업데이트

Use when Codex needs proactive task queues, heartbeat routines, scheduled follow-up, or continuous work loops instead of waiting for prompts.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ProjectZeroDays/FreeAI_AI_Inference_Workstation52026년 9월 4일 업데이트

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ProjectZeroDays/FreeAI_AI_Inference_Workstation52026년 9월 4일 업데이트

ProjectZeroDays의 스킬 모두 보기

이 스킬의 문제 신고