claudeinone-cli 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +16 -1
- package/kit/.claude/.ck.json +9 -0
- package/kit/.claude/.ckignore +12 -0
- package/kit/.claude/agents/accessibility-auditor.md +46 -0
- package/kit/.claude/agents/api-designer.md +43 -0
- package/kit/.claude/agents/backend-developer.md +54 -0
- package/kit/.claude/agents/brainstormer.md +33 -0
- package/kit/.claude/agents/campaign-manager.md +36 -0
- package/kit/.claude/agents/code-reviewer.md +39 -0
- package/kit/.claude/agents/content-creator.md +38 -0
- package/kit/.claude/agents/copywriter.md +42 -0
- package/kit/.claude/agents/database-admin.md +37 -0
- package/kit/.claude/agents/debugger.md +46 -0
- package/kit/.claude/agents/devops-engineer.md +41 -0
- package/kit/.claude/agents/docs-manager.md +33 -0
- package/kit/.claude/agents/email-wizard.md +40 -0
- package/kit/.claude/agents/frontend-developer.md +52 -0
- package/kit/.claude/agents/fullstack-developer.md +55 -0
- package/kit/.claude/agents/git-manager.md +40 -0
- package/kit/.claude/agents/i18n-specialist.md +46 -0
- package/kit/.claude/agents/integration-specialist.md +48 -0
- package/kit/.claude/agents/journal-writer.md +39 -0
- package/kit/.claude/agents/mcp-manager.md +57 -0
- package/kit/.claude/agents/mobile-developer.md +38 -0
- package/kit/.claude/agents/performance-optimizer.md +38 -0
- package/kit/.claude/agents/planner.md +56 -0
- package/kit/.claude/agents/project-manager.md +34 -0
- package/kit/.claude/agents/refactorer.md +43 -0
- package/kit/.claude/agents/researcher.md +45 -0
- package/kit/.claude/agents/risk-analyst.md +33 -0
- package/kit/.claude/agents/scalability-consultant.md +39 -0
- package/kit/.claude/agents/scout.md +25 -0
- package/kit/.claude/agents/security-auditor.md +42 -0
- package/kit/.claude/agents/seo-specialist.md +44 -0
- package/kit/.claude/agents/skill-creator.md +64 -0
- package/kit/.claude/agents/social-media-manager.md +35 -0
- package/kit/.claude/agents/systems-designer.md +35 -0
- package/kit/.claude/agents/technology-strategist.md +43 -0
- package/kit/.claude/agents/tester.md +40 -0
- package/kit/.claude/agents/ui-ux-designer.md +40 -0
- package/kit/.claude/commands/co/ask.md +29 -0
- package/kit/.claude/commands/co/bootstrap-auto-fast.md +28 -0
- package/kit/.claude/commands/co/bootstrap-auto-parallel.md +29 -0
- package/kit/.claude/commands/co/bootstrap-auto.md +30 -0
- package/kit/.claude/commands/co/bootstrap.md +31 -0
- package/kit/.claude/commands/co/brainstorm.md +27 -0
- package/kit/.claude/commands/co/campaign.md +28 -0
- package/kit/.claude/commands/co/changelog.md +25 -0
- package/kit/.claude/commands/co/checkpoint.md +25 -0
- package/kit/.claude/commands/co/ci.md +26 -0
- package/kit/.claude/commands/co/ck-help.md +24 -0
- package/kit/.claude/commands/co/coding-level.md +24 -0
- package/kit/.claude/commands/co/content-cro.md +26 -0
- package/kit/.claude/commands/co/content-enhance.md +26 -0
- package/kit/.claude/commands/co/content-fast.md +24 -0
- package/kit/.claude/commands/co/content-good.md +26 -0
- package/kit/.claude/commands/co/cook.md +33 -0
- package/kit/.claude/commands/co/debug.md +26 -0
- package/kit/.claude/commands/co/deploy.md +25 -0
- package/kit/.claude/commands/co/design-3d.md +27 -0
- package/kit/.claude/commands/co/design-describe.md +25 -0
- package/kit/.claude/commands/co/design-fast.md +25 -0
- package/kit/.claude/commands/co/design-good.md +28 -0
- package/kit/.claude/commands/co/design-screenshot.md +26 -0
- package/kit/.claude/commands/co/design-video.md +26 -0
- package/kit/.claude/commands/co/docker.md +24 -0
- package/kit/.claude/commands/co/docs-api.md +25 -0
- package/kit/.claude/commands/co/docs-init.md +26 -0
- package/kit/.claude/commands/co/docs-readme.md +24 -0
- package/kit/.claude/commands/co/docs-summarize.md +25 -0
- package/kit/.claude/commands/co/docs-update.md +25 -0
- package/kit/.claude/commands/co/env-check.md +25 -0
- package/kit/.claude/commands/co/fix-ci.md +29 -0
- package/kit/.claude/commands/co/fix-fast.md +28 -0
- package/kit/.claude/commands/co/fix-hard.md +33 -0
- package/kit/.claude/commands/co/fix-logs.md +28 -0
- package/kit/.claude/commands/co/fix-types.md +28 -0
- package/kit/.claude/commands/co/fix-ui.md +28 -0
- package/kit/.claude/commands/co/fix.md +27 -0
- package/kit/.claude/commands/co/git-cm.md +26 -0
- package/kit/.claude/commands/co/git-cp.md +26 -0
- package/kit/.claude/commands/co/git-pr.md +26 -0
- package/kit/.claude/commands/co/index.md +24 -0
- package/kit/.claude/commands/co/integrate-polar.md +29 -0
- package/kit/.claude/commands/co/integrate-sepay.md +29 -0
- package/kit/.claude/commands/co/journal.md +27 -0
- package/kit/.claude/commands/co/k8s.md +24 -0
- package/kit/.claude/commands/co/kanban.md +25 -0
- package/kit/.claude/commands/co/lint-fix.md +24 -0
- package/kit/.claude/commands/co/load.md +25 -0
- package/kit/.claude/commands/co/migrate.md +28 -0
- package/kit/.claude/commands/co/mock.md +26 -0
- package/kit/.claude/commands/co/mode.md +24 -0
- package/kit/.claude/commands/co/monitor.md +25 -0
- package/kit/.claude/commands/co/new-feature.md +27 -0
- package/kit/.claude/commands/co/optimize.md +26 -0
- package/kit/.claude/commands/co/plan-archive.md +24 -0
- package/kit/.claude/commands/co/plan-ci.md +28 -0
- package/kit/.claude/commands/co/plan-cro.md +27 -0
- package/kit/.claude/commands/co/plan-fast.md +24 -0
- package/kit/.claude/commands/co/plan-hard.md +27 -0
- package/kit/.claude/commands/co/plan-parallel.md +25 -0
- package/kit/.claude/commands/co/plan-two.md +29 -0
- package/kit/.claude/commands/co/plan-validate.md +27 -0
- package/kit/.claude/commands/co/plan.md +27 -0
- package/kit/.claude/commands/co/pr.md +25 -0
- package/kit/.claude/commands/co/preview.md +26 -0
- package/kit/.claude/commands/co/refactor.md +25 -0
- package/kit/.claude/commands/co/release.md +25 -0
- package/kit/.claude/commands/co/review-a11y.md +24 -0
- package/kit/.claude/commands/co/review-codebase-parallel.md +27 -0
- package/kit/.claude/commands/co/review-codebase.md +27 -0
- package/kit/.claude/commands/co/review-perf.md +24 -0
- package/kit/.claude/commands/co/review-security.md +25 -0
- package/kit/.claude/commands/co/scaffold.md +25 -0
- package/kit/.claude/commands/co/scout.md +26 -0
- package/kit/.claude/commands/co/secure.md +26 -0
- package/kit/.claude/commands/co/seed.md +25 -0
- package/kit/.claude/commands/co/seo-audit.md +24 -0
- package/kit/.claude/commands/co/seo-keywords.md +25 -0
- package/kit/.claude/commands/co/skill-create.md +29 -0
- package/kit/.claude/commands/co/skill-fix-logs.md +28 -0
- package/kit/.claude/commands/co/slide-create.md +24 -0
- package/kit/.claude/commands/co/spawn.md +24 -0
- package/kit/.claude/commands/co/terraform.md +24 -0
- package/kit/.claude/commands/co/test-gen.md +24 -0
- package/kit/.claude/commands/co/test-ui.md +27 -0
- package/kit/.claude/commands/co/test.md +26 -0
- package/kit/.claude/commands/co/use-mcp.md +25 -0
- package/kit/.claude/commands/co/video-script.md +25 -0
- package/kit/.claude/commands/co/watzup.md +25 -0
- package/kit/.claude/commands/co/worktree.md +25 -0
- package/kit/.claude/commands/co/write-blog.md +25 -0
- package/kit/.claude/commands/co/write-copy.md +24 -0
- package/kit/.claude/commands/co/write-email.md +25 -0
- package/kit/.claude/commands/content/content-cro.md +26 -0
- package/kit/.claude/commands/content/content-enhance.md +26 -0
- package/kit/.claude/commands/content/content-fast.md +24 -0
- package/kit/.claude/commands/content/content-good.md +26 -0
- package/kit/.claude/commands/content/enhance.md +26 -0
- package/kit/.claude/commands/content/good.md +26 -0
- package/kit/.claude/commands/core/ask.md +29 -0
- package/kit/.claude/commands/core/bootstrap-auto-fast.md +28 -0
- package/kit/.claude/commands/core/bootstrap-auto-parallel.md +29 -0
- package/kit/.claude/commands/core/bootstrap-auto.md +30 -0
- package/kit/.claude/commands/core/bootstrap.md +31 -0
- package/kit/.claude/commands/core/ck-help.md +24 -0
- package/kit/.claude/commands/core/coding-level.md +24 -0
- package/kit/.claude/commands/core/cook.md +33 -0
- package/kit/.claude/commands/core/debug.md +26 -0
- package/kit/.claude/commands/core/journal.md +27 -0
- package/kit/.claude/commands/core/kanban.md +25 -0
- package/kit/.claude/commands/core/preview.md +26 -0
- package/kit/.claude/commands/core/scout.md +26 -0
- package/kit/.claude/commands/core/test-ui.md +27 -0
- package/kit/.claude/commands/core/test.md +26 -0
- package/kit/.claude/commands/core/use-mcp.md +25 -0
- package/kit/.claude/commands/core/watzup.md +25 -0
- package/kit/.claude/commands/core/worktree.md +25 -0
- package/kit/.claude/commands/design/3d.md +27 -0
- package/kit/.claude/commands/design/design-3d.md +27 -0
- package/kit/.claude/commands/design/design-describe.md +25 -0
- package/kit/.claude/commands/design/design-fast.md +25 -0
- package/kit/.claude/commands/design/design-good.md +28 -0
- package/kit/.claude/commands/design/design-screenshot.md +26 -0
- package/kit/.claude/commands/design/design-video.md +26 -0
- package/kit/.claude/commands/design/good.md +28 -0
- package/kit/.claude/commands/design/video.md +26 -0
- package/kit/.claude/commands/docs/docs-init.md +26 -0
- package/kit/.claude/commands/docs/docs-summarize.md +25 -0
- package/kit/.claude/commands/docs/docs-update.md +25 -0
- package/kit/.claude/commands/docs/init.md +26 -0
- package/kit/.claude/commands/docs/summarize.md +25 -0
- package/kit/.claude/commands/fix/ci.md +29 -0
- package/kit/.claude/commands/fix/fast.md +28 -0
- package/kit/.claude/commands/fix/fix-ci.md +29 -0
- package/kit/.claude/commands/fix/fix-fast.md +28 -0
- package/kit/.claude/commands/fix/fix-hard.md +33 -0
- package/kit/.claude/commands/fix/fix-logs.md +28 -0
- package/kit/.claude/commands/fix/fix-types.md +28 -0
- package/kit/.claude/commands/fix/fix-ui.md +28 -0
- package/kit/.claude/commands/fix/hard.md +33 -0
- package/kit/.claude/commands/fix/logs.md +28 -0
- package/kit/.claude/commands/fix/types.md +28 -0
- package/kit/.claude/commands/fix/ui.md +28 -0
- package/kit/.claude/commands/git/cp.md +26 -0
- package/kit/.claude/commands/git/git-cm.md +26 -0
- package/kit/.claude/commands/git/git-cp.md +26 -0
- package/kit/.claude/commands/git/git-pr.md +26 -0
- package/kit/.claude/commands/integrate/integrate-polar.md +29 -0
- package/kit/.claude/commands/integrate/integrate-sepay.md +29 -0
- package/kit/.claude/commands/integrate/sepay.md +29 -0
- package/kit/.claude/commands/plan/ci.md +28 -0
- package/kit/.claude/commands/plan/cro.md +27 -0
- package/kit/.claude/commands/plan/hard.md +27 -0
- package/kit/.claude/commands/plan/plan-archive.md +24 -0
- package/kit/.claude/commands/plan/plan-ci.md +28 -0
- package/kit/.claude/commands/plan/plan-cro.md +27 -0
- package/kit/.claude/commands/plan/plan-fast.md +24 -0
- package/kit/.claude/commands/plan/plan-hard.md +27 -0
- package/kit/.claude/commands/plan/plan-parallel.md +25 -0
- package/kit/.claude/commands/plan/plan-two.md +29 -0
- package/kit/.claude/commands/plan/plan-validate.md +27 -0
- package/kit/.claude/commands/plan/plan.md +27 -0
- package/kit/.claude/commands/plan/validate.md +27 -0
- package/kit/.claude/commands/skill/fix-logs.md +28 -0
- package/kit/.claude/commands/skill/skill-create.md +29 -0
- package/kit/.claude/commands/skill/skill-fix-logs.md +28 -0
- package/kit/.claude/settings.json +16 -0
- package/kit/.claude/skills/ai-anthropic.md +100 -0
- package/kit/.claude/skills/ai-context-engineering.md +113 -0
- package/kit/.claude/skills/ai-gemini.md +152 -0
- package/kit/.claude/skills/ai-langchain.md +93 -0
- package/kit/.claude/skills/ai-llamaindex.md +179 -0
- package/kit/.claude/skills/ai-mcp-builder.md +101 -0
- package/kit/.claude/skills/ai-openai.md +250 -0
- package/kit/.claude/skills/ai-prompt-engineering.md +173 -0
- package/kit/.claude/skills/ai-rag.md +91 -0
- package/kit/.claude/skills/ai-vectordb.md +215 -0
- package/kit/.claude/skills/analytics-segment.md +161 -0
- package/kit/.claude/skills/api-caching.md +103 -0
- package/kit/.claude/skills/api-documentation.md +50 -0
- package/kit/.claude/skills/api-graphql.md +234 -0
- package/kit/.claude/skills/api-openapi.md +116 -0
- package/kit/.claude/skills/api-pagination-filtering.md +239 -0
- package/kit/.claude/skills/api-rate-limiting.md +179 -0
- package/kit/.claude/skills/api-rest-advanced.md +50 -0
- package/kit/.claude/skills/api-rest.md +217 -0
- package/kit/.claude/skills/api-trpc.md +173 -0
- package/kit/.claude/skills/api-versioning.md +70 -0
- package/kit/.claude/skills/api-webhooks.md +226 -0
- package/kit/.claude/skills/arch-clean-code.md +226 -0
- package/kit/.claude/skills/arch-clean.md +91 -0
- package/kit/.claude/skills/arch-cqrs.md +229 -0
- package/kit/.claude/skills/arch-ddd.md +85 -0
- package/kit/.claude/skills/arch-event-driven.md +189 -0
- package/kit/.claude/skills/arch-microservices.md +80 -0
- package/kit/.claude/skills/arch-monorepo.md +87 -0
- package/kit/.claude/skills/arch-multi-tenant.md +81 -0
- package/kit/.claude/skills/arch-serverless.md +86 -0
- package/kit/.claude/skills/auth-clerk.md +97 -0
- package/kit/.claude/skills/auth-jwt.md +143 -0
- package/kit/.claude/skills/auth-lucia.md +93 -0
- package/kit/.claude/skills/auth-nextauth.md +446 -0
- package/kit/.claude/skills/auth-oauth.md +208 -0
- package/kit/.claude/skills/auth-oauth2.md +110 -0
- package/kit/.claude/skills/auth-passkeys.md +109 -0
- package/kit/.claude/skills/auth-session.md +88 -0
- package/kit/.claude/skills/backend-dotnet.md +414 -0
- package/kit/.claude/skills/backend-express.md +129 -0
- package/kit/.claude/skills/backend-fastify.md +104 -0
- package/kit/.claude/skills/backend-go.md +205 -0
- package/kit/.claude/skills/backend-graphql.md +149 -0
- package/kit/.claude/skills/backend-grpc.md +382 -0
- package/kit/.claude/skills/backend-hono.md +95 -0
- package/kit/.claude/skills/backend-java-spring.md +198 -0
- package/kit/.claude/skills/backend-nodejs-express.md +165 -0
- package/kit/.claude/skills/backend-nodejs.md +143 -0
- package/kit/.claude/skills/backend-php-laravel.md +156 -0
- package/kit/.claude/skills/backend-python-django.md +200 -0
- package/kit/.claude/skills/backend-python-fastapi.md +169 -0
- package/kit/.claude/skills/backend-ruby-rails.md +190 -0
- package/kit/.claude/skills/backend-rust.md +182 -0
- package/kit/.claude/skills/backend-websockets.md +392 -0
- package/kit/.claude/skills/cache-redis.md +195 -0
- package/kit/.claude/skills/caching-strategies.md +100 -0
- package/kit/.claude/skills/cloud-aws.md +165 -0
- package/kit/.claude/skills/cloud-azure.md +187 -0
- package/kit/.claude/skills/cloud-cloudflare.md +74 -0
- package/kit/.claude/skills/cloud-fly.md +94 -0
- package/kit/.claude/skills/cloud-gcp.md +160 -0
- package/kit/.claude/skills/cloud-railway.md +92 -0
- package/kit/.claude/skills/cloud-render.md +70 -0
- package/kit/.claude/skills/cloud-serverless.md +68 -0
- package/kit/.claude/skills/cloud-vercel.md +76 -0
- package/kit/.claude/skills/component-patterns.md +50 -0
- package/kit/.claude/skills/content-management.md +197 -0
- package/kit/.claude/skills/cors-security.md +50 -0
- package/kit/.claude/skills/data-csv-excel.md +210 -0
- package/kit/.claude/skills/database-optimization.md +196 -0
- package/kit/.claude/skills/databases-transactions.md +68 -0
- package/kit/.claude/skills/db-cassandra.md +89 -0
- package/kit/.claude/skills/db-drizzle.md +363 -0
- package/kit/.claude/skills/db-dynamodb.md +83 -0
- package/kit/.claude/skills/db-elasticsearch.md +105 -0
- package/kit/.claude/skills/db-firebase-firestore.md +191 -0
- package/kit/.claude/skills/db-mongodb.md +198 -0
- package/kit/.claude/skills/db-mysql.md +50 -0
- package/kit/.claude/skills/db-neon.md +72 -0
- package/kit/.claude/skills/db-planetscale.md +76 -0
- package/kit/.claude/skills/db-postgresql.md +50 -0
- package/kit/.claude/skills/db-prisma.md +414 -0
- package/kit/.claude/skills/db-redis.md +50 -0
- package/kit/.claude/skills/db-sqlite.md +149 -0
- package/kit/.claude/skills/db-supabase.md +445 -0
- package/kit/.claude/skills/devops-ci-cd.md +271 -0
- package/kit/.claude/skills/devops-database-backup.md +77 -0
- package/kit/.claude/skills/devops-docker.md +93 -0
- package/kit/.claude/skills/devops-github-actions.md +82 -0
- package/kit/.claude/skills/devops-health-checks.md +50 -0
- package/kit/.claude/skills/devops-kubernetes.md +109 -0
- package/kit/.claude/skills/devops-logging.md +163 -0
- package/kit/.claude/skills/devops-monitoring.md +203 -0
- package/kit/.claude/skills/devops-pulumi.md +94 -0
- package/kit/.claude/skills/devops-secrets.md +166 -0
- package/kit/.claude/skills/devops-terraform.md +226 -0
- package/kit/.claude/skills/error-boundaries.md +84 -0
- package/kit/.claude/skills/file-storage.md +50 -0
- package/kit/.claude/skills/frontend-angular.md +104 -0
- package/kit/.claude/skills/frontend-astro.md +94 -0
- package/kit/.claude/skills/frontend-bundle-analysis.md +147 -0
- package/kit/.claude/skills/frontend-forms.md +134 -0
- package/kit/.claude/skills/frontend-htmx.md +86 -0
- package/kit/.claude/skills/frontend-nextjs.md +188 -0
- package/kit/.claude/skills/frontend-pwa.md +105 -0
- package/kit/.claude/skills/frontend-react-hooks.md +238 -0
- package/kit/.claude/skills/frontend-react.md +129 -0
- package/kit/.claude/skills/frontend-remix-advanced.md +106 -0
- package/kit/.claude/skills/frontend-remix.md +101 -0
- package/kit/.claude/skills/frontend-solid.md +99 -0
- package/kit/.claude/skills/frontend-state-management.md +134 -0
- package/kit/.claude/skills/frontend-state.md +106 -0
- package/kit/.claude/skills/frontend-svelte.md +121 -0
- package/kit/.claude/skills/frontend-testing.md +100 -0
- package/kit/.claude/skills/frontend-vite.md +94 -0
- package/kit/.claude/skills/frontend-vue.md +133 -0
- package/kit/.claude/skills/frontend-webpack.md +93 -0
- package/kit/.claude/skills/functional-programming.md +50 -0
- package/kit/.claude/skills/hooks-custom.md +50 -0
- package/kit/.claude/skills/http-server.md +50 -0
- package/kit/.claude/skills/i18n-general.md +89 -0
- package/kit/.claude/skills/i18n-localization.md +191 -0
- package/kit/.claude/skills/i18n-nextjs.md +127 -0
- package/kit/.claude/skills/infrastructure-docker-compose.md +77 -0
- package/kit/.claude/skills/infrastructure-serverless.md +177 -0
- package/kit/.claude/skills/jwt-tokens.md +50 -0
- package/kit/.claude/skills/logging-winston.md +106 -0
- package/kit/.claude/skills/messaging-kafka.md +102 -0
- package/kit/.claude/skills/messaging-rabbitmq.md +50 -0
- package/kit/.claude/skills/mobile-capacitor.md +109 -0
- package/kit/.claude/skills/mobile-expo.md +101 -0
- package/kit/.claude/skills/mobile-flutter.md +259 -0
- package/kit/.claude/skills/mobile-react-native.md +238 -0
- package/kit/.claude/skills/monitoring-apm.md +50 -0
- package/kit/.claude/skills/monitoring-error-tracking.md +217 -0
- package/kit/.claude/skills/nodejs-streams.md +168 -0
- package/kit/.claude/skills/oauth-integration.md +50 -0
- package/kit/.claude/skills/patterns-dependency-injection.md +218 -0
- package/kit/.claude/skills/patterns-factory-singleton.md +209 -0
- package/kit/.claude/skills/patterns-observer-pubsub.md +210 -0
- package/kit/.claude/skills/payment-lemonsqueezy.md +101 -0
- package/kit/.claude/skills/payment-square.md +178 -0
- package/kit/.claude/skills/payment-stripe.md +206 -0
- package/kit/.claude/skills/perf-bundle.md +100 -0
- package/kit/.claude/skills/perf-web-vitals.md +102 -0
- package/kit/.claude/skills/performance-database-connection-pooling.md +67 -0
- package/kit/.claude/skills/performance-metrics.md +73 -0
- package/kit/.claude/skills/performance-optimization.md +208 -0
- package/kit/.claude/skills/performance-web-vitals.md +169 -0
- package/kit/.claude/skills/rate-limiting.md +77 -0
- package/kit/.claude/skills/reactive-programming.md +50 -0
- package/kit/.claude/skills/realtime-database.md +50 -0
- package/kit/.claude/skills/realtime-subscriptions.md +218 -0
- package/kit/.claude/skills/saas-ab-testing.md +90 -0
- package/kit/.claude/skills/saas-analytics.md +113 -0
- package/kit/.claude/skills/saas-billing.md +106 -0
- package/kit/.claude/skills/saas-email.md +88 -0
- package/kit/.claude/skills/saas-feature-flags.md +83 -0
- package/kit/.claude/skills/saas-onboarding.md +96 -0
- package/kit/.claude/skills/saas-user-onboarding.md +207 -0
- package/kit/.claude/skills/security-encryption.md +216 -0
- package/kit/.claude/skills/security-owasp.md +212 -0
- package/kit/.claude/skills/security-secrets-rotation.md +64 -0
- package/kit/.claude/skills/seo-content.md +94 -0
- package/kit/.claude/skills/seo-technical.md +101 -0
- package/kit/.claude/skills/serverless-framework.md +151 -0
- package/kit/.claude/skills/sharding-scaling.md +50 -0
- package/kit/.claude/skills/styling-css-modules.md +219 -0
- package/kit/.claude/skills/styling-styled-components.md +206 -0
- package/kit/.claude/skills/styling-tailwind.md +206 -0
- package/kit/.claude/skills/test-e2e.md +86 -0
- package/kit/.claude/skills/test-integration.md +216 -0
- package/kit/.claude/skills/test-performance.md +162 -0
- package/kit/.claude/skills/test-tdd.md +170 -0
- package/kit/.claude/skills/test-unit.md +301 -0
- package/kit/.claude/skills/testing-accessibility.md +117 -0
- package/kit/.claude/skills/testing-contract.md +75 -0
- package/kit/.claude/skills/testing-e2e-advanced.md +50 -0
- package/kit/.claude/skills/testing-load-stress.md +79 -0
- package/kit/.claude/skills/testing-mutation.md +92 -0
- package/kit/.claude/skills/testing-snapshot.md +50 -0
- package/kit/.claude/skills/testing-vitest.md +172 -0
- package/kit/.claude/skills/tooling-biome.md +91 -0
- package/kit/.claude/skills/tooling-build-tools.md +166 -0
- package/kit/.claude/skills/tooling-bun.md +94 -0
- package/kit/.claude/skills/tooling-eslint.md +103 -0
- package/kit/.claude/skills/tooling-git.md +79 -0
- package/kit/.claude/skills/tooling-monorepo.md +162 -0
- package/kit/.claude/skills/tooling-testing-frameworks.md +207 -0
- package/kit/.claude/skills/tooling-typescript.md +156 -0
- package/kit/.claude/skills/ui-a11y.md +106 -0
- package/kit/.claude/skills/ui-framer.md +106 -0
- package/kit/.claude/skills/ui-gsap.md +102 -0
- package/kit/.claude/skills/ui-radix.md +82 -0
- package/kit/.claude/skills/ui-shadcn.md +463 -0
- package/kit/.claude/skills/ui-tailwind.md +98 -0
- package/kit/.claude/skills/ui-threejs.md +110 -0
- package/kit/.claude/skills/ui-tokens.md +97 -0
- package/kit/.claude/skills/utilities-date-time.md +170 -0
- package/kit/.claude/skills/validation-schemas.md +110 -0
- package/kit/.claude/skills/version-control-git.md +144 -0
- package/kit/.claude/skills/web-accessibility-wcag.md +102 -0
- package/kit/.claude/skills/web-astro.md +197 -0
- package/kit/.claude/skills/web-html-css.md +224 -0
- package/kit/.claude/skills/web-htmx.md +99 -0
- package/kit/.claude/skills/web-nextjs-advanced.md +202 -0
- package/kit/.claude/skills/web-remix.md +194 -0
- package/kit/.claude/skills/web-seo.md +99 -0
- package/kit/.claude/skills/web-svelte.md +234 -0
- package/kit/.claude/skills/websocket-server.md +50 -0
- package/kit/.claude/skills/writing-marketing.md +89 -0
- package/kit/.claude/skills/writing-technical.md +119 -0
- package/kit/CLAUDE.md +206 -0
- package/kit/README.md +150 -0
- package/kit/SKILLS_INDEX.md +188 -0
- package/kit/docs/README.md +3 -0
- package/kit/journals/README.md +3 -0
- package/kit/plans/README.md +3 -0
- package/package.json +3 -1
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# Stripe Payments
|
|
2
|
+
|
|
3
|
+
Payment processing for subscriptions, charges, and invoices.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install stripe @stripe/react-stripe-js
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Server-Side Charge
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import Stripe from 'stripe';
|
|
15
|
+
|
|
16
|
+
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
|
|
17
|
+
|
|
18
|
+
async function createPaymentIntent(amountInCents: number) {
|
|
19
|
+
const paymentIntent = await stripe.paymentIntents.create({
|
|
20
|
+
amount: amountInCents,
|
|
21
|
+
currency: 'usd',
|
|
22
|
+
description: 'Order Payment',
|
|
23
|
+
metadata: { orderId: '123' }
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return paymentIntent;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Express endpoint
|
|
30
|
+
app.post('/api/payment-intent', async (req, res) => {
|
|
31
|
+
const { amount } = req.body;
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
const intent = await createPaymentIntent(amount);
|
|
35
|
+
res.json({ clientSecret: intent.client_secret });
|
|
36
|
+
} catch (error) {
|
|
37
|
+
res.status(400).json({ error: (error as Error).message });
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## React Component
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { Elements, CardElement, useStripe, useElements } from '@stripe/react-stripe-js';
|
|
46
|
+
import { loadStripe } from '@stripe/js';
|
|
47
|
+
|
|
48
|
+
const stripePromise = loadStripe(process.env.REACT_APP_STRIPE_PUBLIC_KEY);
|
|
49
|
+
|
|
50
|
+
function PaymentForm() {
|
|
51
|
+
const stripe = useStripe();
|
|
52
|
+
const elements = useElements();
|
|
53
|
+
const [clientSecret, setClientSecret] = useState('');
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
fetchPaymentIntent();
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
async function fetchPaymentIntent() {
|
|
60
|
+
const response = await fetch('/api/payment-intent', {
|
|
61
|
+
method: 'POST',
|
|
62
|
+
body: JSON.stringify({ amount: 9999 })
|
|
63
|
+
});
|
|
64
|
+
const { clientSecret } = await response.json();
|
|
65
|
+
setClientSecret(clientSecret);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function handleSubmit(e: React.FormEvent) {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
|
|
71
|
+
if (!stripe || !elements) return;
|
|
72
|
+
|
|
73
|
+
const result = await stripe.confirmCardPayment(clientSecret, {
|
|
74
|
+
payment_method: {
|
|
75
|
+
card: elements.getElement(CardElement)!,
|
|
76
|
+
billing_details: { name: 'Customer' }
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
if (result.paymentIntent?.status === 'succeeded') {
|
|
81
|
+
console.log('Payment successful!');
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<form onSubmit={handleSubmit}>
|
|
87
|
+
<CardElement />
|
|
88
|
+
<button type="submit" disabled={!stripe}>
|
|
89
|
+
Pay $99.99
|
|
90
|
+
</button>
|
|
91
|
+
</form>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export function CheckoutPage() {
|
|
96
|
+
return (
|
|
97
|
+
<Elements stripe={stripePromise}>
|
|
98
|
+
<PaymentForm />
|
|
99
|
+
</Elements>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Subscriptions
|
|
105
|
+
|
|
106
|
+
```typescript
|
|
107
|
+
async function createSubscription(customerId: string, priceId: string) {
|
|
108
|
+
const subscription = await stripe.subscriptions.create({
|
|
109
|
+
customer: customerId,
|
|
110
|
+
items: [{ price: priceId }],
|
|
111
|
+
payment_behavior: 'default_incomplete',
|
|
112
|
+
expand: ['latest_invoice.payment_intent']
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
return subscription;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async function cancelSubscription(subscriptionId: string) {
|
|
119
|
+
const deleted = await stripe.subscriptions.del(subscriptionId);
|
|
120
|
+
return deleted;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Webhook handler
|
|
124
|
+
app.post('/webhooks/stripe', express.raw({ type: 'application/json' }), async (req, res) => {
|
|
125
|
+
const sig = req.headers['stripe-signature'] as string;
|
|
126
|
+
const event = stripe.webhooks.constructEvent(
|
|
127
|
+
req.body,
|
|
128
|
+
sig,
|
|
129
|
+
process.env.STRIPE_WEBHOOK_SECRET
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
switch (event.type) {
|
|
133
|
+
case 'customer.subscription.created':
|
|
134
|
+
console.log('Subscription created:', event.data.object);
|
|
135
|
+
break;
|
|
136
|
+
case 'customer.subscription.deleted':
|
|
137
|
+
console.log('Subscription canceled:', event.data.object);
|
|
138
|
+
break;
|
|
139
|
+
case 'invoice.payment_succeeded':
|
|
140
|
+
console.log('Invoice paid:', event.data.object);
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
res.json({ received: true });
|
|
145
|
+
});
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Customer Management
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
async function createCustomer(email: string, name: string) {
|
|
152
|
+
const customer = await stripe.customers.create({
|
|
153
|
+
email,
|
|
154
|
+
name,
|
|
155
|
+
metadata: { userId: '123' }
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
return customer;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async function updateCustomer(customerId: string, updates: any) {
|
|
162
|
+
return await stripe.customers.update(customerId, updates);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
async function getCustomer(customerId: string) {
|
|
166
|
+
return await stripe.customers.retrieve(customerId);
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Invoices
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
async function createInvoice(customerId: string, items: any[]) {
|
|
174
|
+
const invoice = await stripe.invoices.create({
|
|
175
|
+
customer: customerId,
|
|
176
|
+
collection_method: 'charge_automatically',
|
|
177
|
+
auto_advance: false
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
for (const item of items) {
|
|
181
|
+
await stripe.invoiceItems.create({
|
|
182
|
+
invoice: invoice.id,
|
|
183
|
+
customer: customerId,
|
|
184
|
+
price: item.priceId,
|
|
185
|
+
quantity: item.quantity
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
await stripe.invoices.finalize(invoice.id);
|
|
190
|
+
|
|
191
|
+
return invoice;
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Best Practices
|
|
196
|
+
|
|
197
|
+
✅ **Use Webhooks** - Async payment event handling
|
|
198
|
+
✅ **PCI Compliance** - Never handle raw card data
|
|
199
|
+
✅ **Idempotency** - Use idempotency keys for retries
|
|
200
|
+
✅ **Error handling** - Handle network failures gracefully
|
|
201
|
+
✅ **Reconciliation** - Regularly sync with Stripe
|
|
202
|
+
|
|
203
|
+
## Resources
|
|
204
|
+
|
|
205
|
+
- [Stripe Documentation](https://stripe.com/docs)
|
|
206
|
+
- [Stripe API Reference](https://stripe.com/docs/api)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Bundle Optimization
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Reduce JavaScript bundle size with code splitting, tree shaking, lazy loading, and dependency auditing.
|
|
5
|
+
|
|
6
|
+
## Analyze Bundle Size
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
# Vite
|
|
10
|
+
npm install -D rollup-plugin-visualizer
|
|
11
|
+
|
|
12
|
+
# Next.js
|
|
13
|
+
npm install -D @next/bundle-analyzer
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
// next.config.ts
|
|
18
|
+
import bundleAnalyzer from '@next/bundle-analyzer';
|
|
19
|
+
const withBundleAnalyzer = bundleAnalyzer({ enabled: process.env.ANALYZE === 'true' });
|
|
20
|
+
export default withBundleAnalyzer({});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ANALYZE=true npm run build
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Code Splitting with React.lazy
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { lazy, Suspense } from 'react';
|
|
31
|
+
|
|
32
|
+
// Load only when needed
|
|
33
|
+
const Dashboard = lazy(() => import('./Dashboard'));
|
|
34
|
+
const Settings = lazy(() => import('./Settings'));
|
|
35
|
+
|
|
36
|
+
export function App() {
|
|
37
|
+
return (
|
|
38
|
+
<Suspense fallback={<div>Loading...</div>}>
|
|
39
|
+
<Routes>
|
|
40
|
+
<Route path="/dashboard" element={<Dashboard />} />
|
|
41
|
+
<Route path="/settings" element={<Settings />} />
|
|
42
|
+
</Routes>
|
|
43
|
+
</Suspense>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Dynamic Import with Preloading
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
// Preload on hover for faster perceived navigation
|
|
52
|
+
function NavLink({ to, component }: { to: string; component: () => Promise<any> }) {
|
|
53
|
+
return (
|
|
54
|
+
<Link to={to} onMouseEnter={() => component()}>
|
|
55
|
+
{/* ... */}
|
|
56
|
+
</Link>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
<NavLink to="/dashboard" component={() => import('./Dashboard')} />
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Tree Shaking — Named Imports
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
// BAD — imports entire lodash bundle
|
|
67
|
+
import _ from 'lodash';
|
|
68
|
+
_.debounce(fn, 300);
|
|
69
|
+
|
|
70
|
+
// GOOD — only imports debounce
|
|
71
|
+
import debounce from 'lodash/debounce';
|
|
72
|
+
// or
|
|
73
|
+
import { debounce } from 'lodash-es'; // ES module version
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Next.js Dynamic Imports
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import dynamic from 'next/dynamic';
|
|
80
|
+
|
|
81
|
+
// Load heavy component only on client, not in SSR
|
|
82
|
+
const HeavyChart = dynamic(() => import('./HeavyChart'), {
|
|
83
|
+
ssr: false,
|
|
84
|
+
loading: () => <p>Loading chart...</p>
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// Load on user interaction
|
|
88
|
+
const Modal = dynamic(() => import('./Modal'));
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Bundle Size Checklist
|
|
92
|
+
- [ ] `lodash` → `lodash-es` or individual imports
|
|
93
|
+
- [ ] `moment.js` → `date-fns` (60x smaller)
|
|
94
|
+
- [ ] `@mui/material` → import from subpath, not root
|
|
95
|
+
- [ ] Images: use `<Image>` in Next.js with proper sizing
|
|
96
|
+
- [ ] Check `bundlephobia.com` before adding any dependency
|
|
97
|
+
|
|
98
|
+
## Resources
|
|
99
|
+
- [Bundlephobia](https://bundlephobia.com) — check package sizes
|
|
100
|
+
- [Next.js bundle analysis](https://nextjs.org/docs/app/building-your-application/optimizing/bundle-analyzer)
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Web Vitals Optimization
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Core Web Vitals (LCP, INP, CLS) measure real-user experience. Optimize them to improve SEO and conversions.
|
|
5
|
+
|
|
6
|
+
## Measure with web-vitals
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install web-vitals
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { onCLS, onINP, onLCP, onTTFB, type Metric } from 'web-vitals';
|
|
14
|
+
|
|
15
|
+
function sendToAnalytics({ name, value, id }: Metric) {
|
|
16
|
+
fetch('/api/vitals', {
|
|
17
|
+
method: 'POST',
|
|
18
|
+
body: JSON.stringify({ name, value, id, page: location.pathname }),
|
|
19
|
+
keepalive: true,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
onCLS(sendToAnalytics);
|
|
24
|
+
onINP(sendToAnalytics);
|
|
25
|
+
onLCP(sendToAnalytics);
|
|
26
|
+
onTTFB(sendToAnalytics);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## LCP — Largest Contentful Paint (target: < 2.5s)
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<!-- Preload the LCP image -->
|
|
33
|
+
<link rel="preload" as="image" href="/hero.webp" fetchpriority="high" />
|
|
34
|
+
|
|
35
|
+
<!-- Avoid lazy loading above-the-fold images -->
|
|
36
|
+
<img src="/hero.webp" alt="Hero" fetchpriority="high" />
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
// Next.js — mark above-fold images as priority
|
|
41
|
+
import Image from 'next/image';
|
|
42
|
+
<Image src="/hero.webp" alt="Hero" priority width={1200} height={600} />
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## CLS — Cumulative Layout Shift (target: < 0.1)
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
// Always set width/height on images
|
|
49
|
+
<Image src="/photo.jpg" width={400} height={300} alt="" />
|
|
50
|
+
|
|
51
|
+
// Reserve space for dynamic content
|
|
52
|
+
<div style={{ minHeight: '200px' }}>
|
|
53
|
+
{loaded ? <DynamicContent /> : <Skeleton />}
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
// Avoid inserting content above existing content
|
|
57
|
+
// Use fixed headers, not sticky
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## INP — Interaction to Next Paint (target: < 200ms)
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
// Defer non-critical work
|
|
64
|
+
button.addEventListener('click', (e) => {
|
|
65
|
+
// Critical: immediate feedback
|
|
66
|
+
setLoadingState(true);
|
|
67
|
+
|
|
68
|
+
// Defer heavy processing
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
processData(largeDataset);
|
|
71
|
+
setLoadingState(false);
|
|
72
|
+
}, 0);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Use transitions API for non-urgent updates (React 18+)
|
|
76
|
+
import { startTransition } from 'react';
|
|
77
|
+
startTransition(() => { setFilteredResults(heavyFilter(data)); });
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## TTFB — Time to First Byte (target: < 800ms)
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
// Next.js: use ISR or SSG where possible
|
|
84
|
+
export const revalidate = 60; // ISR: regenerate every 60s
|
|
85
|
+
|
|
86
|
+
// Cache expensive DB queries
|
|
87
|
+
const data = await unstable_cache(
|
|
88
|
+
() => prisma.post.findMany({ take: 10 }),
|
|
89
|
+
['homepage-posts'],
|
|
90
|
+
{ revalidate: 60 }
|
|
91
|
+
)();
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Best Practices
|
|
95
|
+
- LCP: Preload hero images, use CDN, avoid render-blocking resources
|
|
96
|
+
- CLS: Always set dimensions on media, avoid dynamic insertions above content
|
|
97
|
+
- INP: Debounce inputs, defer heavy JS, use `startTransition` for state updates
|
|
98
|
+
- TTFB: Use CDN, cache at edge, reduce server processing time
|
|
99
|
+
|
|
100
|
+
## Resources
|
|
101
|
+
- [Core Web Vitals](https://web.dev/articles/vitals)
|
|
102
|
+
- [Lighthouse](https://developer.chrome.com/docs/lighthouse/)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Database Connection Pooling
|
|
2
|
+
|
|
3
|
+
Efficient database connection management.
|
|
4
|
+
|
|
5
|
+
## PostgreSQL Pooling
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { Pool } from 'pg';
|
|
9
|
+
|
|
10
|
+
const pool = new Pool({
|
|
11
|
+
host: 'localhost',
|
|
12
|
+
port: 5432,
|
|
13
|
+
database: 'myapp',
|
|
14
|
+
user: 'user',
|
|
15
|
+
password: 'password',
|
|
16
|
+
max: 20, // Maximum connections
|
|
17
|
+
min: 5, // Minimum connections
|
|
18
|
+
idleTimeoutMillis: 30000,
|
|
19
|
+
connectionTimeoutMillis: 2000
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
pool.on('error', (err) => {
|
|
23
|
+
console.error('Unexpected error on idle client', err);
|
|
24
|
+
process.exit(-1);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export async function query(text: string, values?: any[]) {
|
|
28
|
+
return pool.query(text, values);
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Connection Reuse
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
// Good: Reuse connections
|
|
36
|
+
const result = await pool.query('SELECT * FROM users WHERE id = $1', [1]);
|
|
37
|
+
|
|
38
|
+
// Avoid: Creating new connections
|
|
39
|
+
const client = new Client(); // Don't do this repeatedly
|
|
40
|
+
await client.connect();
|
|
41
|
+
const result = await client.query('...');
|
|
42
|
+
await client.disconnect();
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Monitoring
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
setInterval(() => {
|
|
49
|
+
console.log('Pool stats:', {
|
|
50
|
+
total: pool.totalCount,
|
|
51
|
+
idle: pool.idleCount,
|
|
52
|
+
waiting: pool.waitingCount
|
|
53
|
+
});
|
|
54
|
+
}, 10000);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Best Practices
|
|
58
|
+
|
|
59
|
+
✅ **Size appropriately** - Not too large, not too small
|
|
60
|
+
✅ **Monitor metrics** - Track usage
|
|
61
|
+
✅ **Connection timeouts** - Prevent hangs
|
|
62
|
+
✅ **Error handling** - Graceful degradation
|
|
63
|
+
✅ **Idle timeouts** - Clean up unused connections
|
|
64
|
+
|
|
65
|
+
## Resources
|
|
66
|
+
|
|
67
|
+
- [PG Pool Documentation](https://node-postgres.com/api/pool)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Performance Metrics
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Track Core Web Vitals and custom metrics with real-user monitoring (RUM).
|
|
5
|
+
|
|
6
|
+
## web-vitals Package
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install web-vitals
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import { onCLS, onINP, onLCP, onTTFB, type Metric } from 'web-vitals';
|
|
14
|
+
|
|
15
|
+
function sendToAnalytics(metric: Metric) {
|
|
16
|
+
const body = JSON.stringify({
|
|
17
|
+
name: metric.name,
|
|
18
|
+
value: metric.value,
|
|
19
|
+
page: window.location.pathname,
|
|
20
|
+
});
|
|
21
|
+
navigator.sendBeacon('/api/metrics', body);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
onCLS(sendToAnalytics);
|
|
25
|
+
onLCP(sendToAnalytics);
|
|
26
|
+
onINP(sendToAnalytics);
|
|
27
|
+
onTTFB(sendToAnalytics);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Custom Performance Marks
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
export async function measureAsync<T>(name: string, fn: () => Promise<T>): Promise<T> {
|
|
34
|
+
const start = performance.now();
|
|
35
|
+
const result = await fn();
|
|
36
|
+
const duration = performance.now() - start;
|
|
37
|
+
console.log(`${name}: ${duration.toFixed(2)}ms`);
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Usage
|
|
42
|
+
const user = await measureAsync('fetchUser', () => getUser(id));
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## API Latency Middleware (Express)
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
export function metricsMiddleware(req: Request, res: Response, next: NextFunction) {
|
|
49
|
+
const start = process.hrtime.bigint();
|
|
50
|
+
res.on('finish', () => {
|
|
51
|
+
const ms = Number(process.hrtime.bigint() - start) / 1_000_000;
|
|
52
|
+
console.log({ method: req.method, path: req.path, status: res.statusCode, ms: ms.toFixed(2) });
|
|
53
|
+
});
|
|
54
|
+
next();
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Thresholds (Core Web Vitals)
|
|
59
|
+
| Metric | Good | Poor |
|
|
60
|
+
|--------|------|------|
|
|
61
|
+
| LCP | < 2.5s | > 4s |
|
|
62
|
+
| INP | < 200ms | > 500ms |
|
|
63
|
+
| CLS | < 0.1 | > 0.25 |
|
|
64
|
+
| TTFB | < 800ms | > 1.8s |
|
|
65
|
+
|
|
66
|
+
## Best Practices
|
|
67
|
+
- Measure real users (RUM) not just Lighthouse lab scores
|
|
68
|
+
- Track p75 and p95, not averages
|
|
69
|
+
- Set performance budgets in CI with `bundlesize` or `lighthouse-ci`
|
|
70
|
+
|
|
71
|
+
## Resources
|
|
72
|
+
- [web-vitals library](https://github.com/GoogleChrome/web-vitals)
|
|
73
|
+
- [Core Web Vitals](https://web.dev/explore/metrics)
|