Skip to main content 홈 크리에이터 jeremylongshore claude-code-plugins-plus-skills posthog-prod-checklist
posthog-prod-checklist Production readiness checklist for PostHog integrations: SDK configuration,
graceful degradation, health checks, shutdown hooks, and rollback procedures.
Trigger: "posthog production", "deploy posthog", "posthog go-live",
"posthog launch checklist", "posthog production ready".
설치로 이동 Skills Marketplace 커뮤니티가 만든 AI 스킬을 발견하고 탐색하세요.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/jeremylongshore/claude-code-plugins-plus-skills --skill posthog-prod-checklist명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
Zip 다운로드 다운로드 중... 이 저장소의 다른 Skills Implement user sign-up and sign-in flows with Clerk.
Use when building authentication UI, customizing sign-in experience,
or implementing OAuth social login.
Trigger with phrases like "clerk sign-in", "clerk sign-up",
"clerk login flow", "clerk OAuth", "clerk social login".
Implement session management and middleware with Clerk.
Use when managing user sessions, configuring route protection,
or implementing token refresh and custom JWT templates.
Trigger with phrases like "clerk session", "clerk middleware",
"clerk route protection", "clerk token", "clerk JWT".
Configure enterprise SSO, role-based access control, and organization management.
Use when implementing SSO integration, configuring role-based permissions,
or setting up organization-level controls.
Trigger with phrases like "clerk SSO", "clerk RBAC",
"clerk enterprise", "clerk roles", "clerk permissions", "clerk organizations".
jeremylongshore
jeremylongshore/claude-code-plugins-plus-skills
GitHub 저장소 열기 name posthog-prod-checklist description Production readiness checklist for PostHog integrations: SDK configuration,
graceful degradation, health checks, shutdown hooks, and rollback procedures.
Trigger: "posthog production", "deploy posthog", "posthog go-live",
"posthog launch checklist", "posthog production ready".
allowed-tools Read, Bash(kubectl:*), Bash(curl:*), Grep version 1.12.0 license MIT author Jeremy Longshore <jeremy@intentsolutions.io> tags ["saas","posthog","deployment"] compatibility Designed for Claude Code, also compatible with Codex and OpenClaw
PostHog Production Checklist
Overview
Production readiness verification for PostHog integrations. Covers SDK configuration hardening, graceful degradation when PostHog is unavailable, health check endpoints, proper shutdown hooks for serverless, and rollback procedures.
Prerequisites
PostHog integration tested in staging
Production PostHog project with phc_ key
Personal API key (phx_) for server-side features
Deployment pipeline configured
Instructions
Pre-Deployment Checklist
SDK Configuration:
Server-Side:
Security:
Separate PostHog project per environment
Step 1: Production SDK Configuration
import { PostHog } from 'posthog-node' ;
const posthog = new PostHog (process.env .NEXT_PUBLIC_POSTHOG_KEY !, {
host : process.env .POSTHOG_HOST || 'https://us.i.posthog.com' ,
personalApiKey : process.env .POSTHOG_PERSONAL_API_KEY ,
flushAt : 20 ,
flushInterval : 10000 ,
requestTimeout : 10000 ,
maxRetries : 3 ,
});
async function shutdown ( ) {
await posthog.shutdown ();
process.exit (0 );
}
process.on ('SIGTERM' , shutdown);
process.on ('SIGINT' , shutdown);
Step 2: Graceful Degradation
function safeCapture (distinctId : string , event : string , properties ?: Record <string , any > ) {
try {
posthog.capture ({ distinctId, event, properties });
} catch (error) {
console .error ('[PostHog] Capture failed:' , (error as Error ).message );
}
}
async function safeGetFlag (flagKey : string , userId : string , defaultValue : boolean = false ): Promise <boolean > {
try {
const result = await posthog.isFeatureEnabled (flagKey, userId);
return result ?? defaultValue;
} catch (error) {
console .error ('[PostHog] Flag evaluation failed:' , (error as Error ).message );
return defaultValue;
}
}
Step 3: Health Check Endpoint
export async function GET ( ) {
const checks : Record <string , { status : string ; latencyMs ?: number }> = {};
const captureStart = performance.now ();
try {
posthog.capture ({
distinctId : 'healthcheck' ,
event : '$healthcheck' ,
properties : { test : true },
});
await posthog.flush ();
checks.posthog_capture = {
status : 'ok' ,
latencyMs : Math .round (performance.now () - captureStart),
};
} catch {
checks.posthog_capture = { status : 'degraded' };
}
const flagStart = performance.now ();
try {
await posthog.getAllFlags ('healthcheck' );
checks.posthog_flags = {
status : 'ok' ,
latencyMs : Math .round (performance.now () - flagStart),
};
} catch {
checks.posthog_flags = { status : 'degraded' };
}
const overall = Object .values (checks).every (c => c.status === 'ok' ) ? 'healthy' : 'degraded' ;
return Response .json ({ status : overall, checks }, { status : overall === 'healthy' ? 200 : 503 });
}
Step 4: Serverless Function Pattern
import { PostHog } from 'posthog-node' ;
export async function handler (request : Request ) {
const posthog = new PostHog (process.env .NEXT_PUBLIC_POSTHOG_KEY !, {
host : 'https://us.i.posthog.com' ,
flushAt : 1 ,
flushInterval : 0 ,
});
try {
posthog.capture ({
distinctId : getUserId (request),
event : 'api_called' ,
properties : { endpoint : new URL (request.url ).pathname },
});
const result = await doWork (request);
return Response .json (result);
} finally {
await posthog.shutdown ();
}
}
Step 5: Pre-Flight Verification set -euo pipefail
curl -sf "https://us.i.posthog.com/healthz" && echo "PostHog: OK" || echo "PostHog: UNREACHABLE"
curl -s -X POST 'https://us.i.posthog.com/capture/' \
-H 'Content-Type: application/json' \
-d "{\"api_key\":\"$NEXT_PUBLIC_POSTHOG_KEY \",\"event\":\"deploy_preflight\",\"distinct_id\":\"deploy\"}" | jq .
curl -s -X POST 'https://us.i.posthog.com/decide/?v=3' \
-H 'Content-Type: application/json' \
-d "{\"api_key\":\"$NEXT_PUBLIC_POSTHOG_KEY \",\"distinct_id\":\"deploy-check\"}" | \
jq '{flags_count: (.featureFlags | length), session_recording: (.sessionRecording != false)}'
curl -sf "https://app.posthog.com/api/projects/$POSTHOG_PROJECT_ID /" \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY " | jq '.name' && echo "Admin API: OK"
Error Handling Alert Trigger Severity Action PostHog capture failing Error rate > 1% P3 Check API host, verify key Flag evaluation slow p95 > 500ms P2 Enable local evaluation with personalApiKey Events not appearing Zero events for 30min P2 Check shutdown() is called, verify flush Admin API 401 Personal key rejected P1 Rotate key in PostHog settings
Rollback Procedure set -euo pipefail
kubectl set env deployment/app POSTHOG_ENABLED=false
kubectl rollout restart deployment/app
kubectl rollout undo deployment/app
kubectl rollout status deployment/app
Output
Production-hardened PostHog SDK configuration
Graceful degradation wrappers (never crash on analytics failure)
Health check endpoint verifying capture and flag evaluation
Serverless shutdown pattern
Pre-flight verification commands
Resources
Next Steps For version upgrades, see posthog-upgrade-migration.