بنقرة واحدة
monitoring
Observability patterns for production - logging, error tracking, analytics. Use when setting up monitoring.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Observability patterns for production - logging, error tracking, analytics. Use when setting up monitoring.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Show token / tool usage stats from the local telemetry log. Use when you want to know "which tools am I burning context on", "which skills are expensive", or "was yesterday's session mostly Read/Grep or actually productive".
Parallel quality audit with 7 specialized agents (Opus). Finds bugs, violations, and quality issues. Use audit for fixes, brainstorm for features.
Manage environment variables with Doppler — auto-install CLI, login, link projects, wrap commands with `doppler run`. Replaces scattered .env files with a hub/spoke architecture.
Scaffolds new projects or onboards existing ones. Detects stack, creates monorepo/single-app, configures strict tooling. Use for greenfield or first-time setup.
Archives completed stories from prd.json to reduce token usage.
Autonomous task execution with testing and security. Works through all tasks without stopping.
| name | monitoring |
| description | Observability patterns for production - logging, error tracking, analytics. Use when setting up monitoring. |
| triggers | ["monitoring","logs"] |
| allowed-tools | Read, Write, Edit, Bash, Grep, Glob |
| model | opus |
| user-invocable | true |
| Say | Action |
|---|---|
add logging | Set up structured logging |
add error tracking | Integrate Sentry/error boundary |
add analytics | Add Vercel Analytics |
// lib/logger.ts
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
interface LogContext {
userId?: string;
action?: string;
[key: string]: unknown;
}
export function log(level: LogLevel, message: string, context?: LogContext) {
const entry = {
timestamp: new Date().toISOString(),
level,
message,
...context
};
if (process.env.NODE_ENV === 'production') {
console[level](JSON.stringify(entry));
} else {
console[level](message, context);
}
}
// components/error-boundary.tsx
'use client';
import { Component, ReactNode } from 'react';
interface Props {
children: ReactNode;
fallback?: ReactNode;
}
interface State {
hasError: boolean;
error?: Error;
}
export class ErrorBoundary extends Component<Props, State> {
state: State = { hasError: false };
static getDerivedStateFromError(error: Error): State {
return { hasError: true, error };
}
componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
// Log to external service
log('error', 'React error boundary caught error', {
error: error.message,
stack: error.stack,
componentStack: errorInfo.componentStack
});
}
render() {
if (this.state.hasError) {
return this.props.fallback ?? <div>Something went wrong</div>;
}
return this.props.children;
}
}
// app/layout.tsx
import { Analytics } from '@vercel/analytics/react';
import { SpeedInsights } from '@vercel/speed-insights/next';
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<Analytics />
<SpeedInsights />
</body>
</html>
);
}
// lib/api-monitor.ts
export function withMonitoring<T>(
handler: () => Promise<T>,
context: { route: string; method: string }
): Promise<T> {
const start = Date.now();
return handler()
.then(result => {
log('info', 'API request completed', {
...context,
duration: Date.now() - start,
status: 'success'
});
return result;
})
.catch(error => {
log('error', 'API request failed', {
...context,
duration: Date.now() - start,
error: error.message
});
throw error;
});
}
// app/api/health/route.ts
import { NextResponse } from 'next/server';
export async function GET() {
const health = {
status: 'ok',
timestamp: new Date().toISOString(),
uptime: process.uptime(),
version: process.env.VERCEL_GIT_COMMIT_SHA?.slice(0, 7) ?? 'dev'
};
return NextResponse.json(health);
}
| Metric | Why |
|---|---|
| Response time (p50, p95, p99) | User experience |
| Error rate | Reliability |
| Request count | Traffic patterns |
| Memory usage | Resource leaks |
| Cold start duration | Serverless performance |
DO:
DON'T: