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,91 @@
|
|
|
1
|
+
# RAG (Retrieval-Augmented Generation)
|
|
2
|
+
|
|
3
|
+
Combining retrieval with language models for accurate, contextual responses.
|
|
4
|
+
|
|
5
|
+
## RAG Pipeline
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { VectorStoreIndex, Document } from 'llamaindex';
|
|
9
|
+
import { OpenAI } from 'llamaindex/llm/openai';
|
|
10
|
+
|
|
11
|
+
async function setupRAG(documents: string[]) {
|
|
12
|
+
const docs = documents.map(text => new Document({ text }));
|
|
13
|
+
|
|
14
|
+
const index = await VectorStoreIndex.fromDocuments(docs, {
|
|
15
|
+
llm: new OpenAI({ model: 'gpt-4' })
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return index;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function queryWithRAG(index: any, query: string) {
|
|
22
|
+
const retriever = index.asRetriever({ similarityTopK: 5 });
|
|
23
|
+
const retrieved = await retriever.retrieve(query);
|
|
24
|
+
|
|
25
|
+
const context = retrieved
|
|
26
|
+
.map(node => node.getContent())
|
|
27
|
+
.join('\n---\n');
|
|
28
|
+
|
|
29
|
+
const response = await openai.createChatCompletion({
|
|
30
|
+
model: 'gpt-4',
|
|
31
|
+
messages: [
|
|
32
|
+
{
|
|
33
|
+
role: 'system',
|
|
34
|
+
content: `You are a helpful assistant. Use the provided context to answer questions accurately.\n\nContext:\n${context}`
|
|
35
|
+
},
|
|
36
|
+
{ role: 'user', content: query }
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return response.choices[0].message.content;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Evaluation
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
interface RAGMetric {
|
|
48
|
+
retrieval_precision: number;
|
|
49
|
+
retrieval_recall: number;
|
|
50
|
+
answer_relevance: number;
|
|
51
|
+
context_relevance: number;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function evaluateRAG(
|
|
55
|
+
testCases: Array<{ query: string; expectedAnswer: string }>,
|
|
56
|
+
groundTruth: string[]
|
|
57
|
+
): Promise<RAGMetric> {
|
|
58
|
+
let precisionSum = 0;
|
|
59
|
+
let recallSum = 0;
|
|
60
|
+
|
|
61
|
+
for (const test of testCases) {
|
|
62
|
+
const retrieved = await retriever.retrieve(test.query);
|
|
63
|
+
const retrievedDocs = new Set(retrieved.map(r => r.metadata.source));
|
|
64
|
+
|
|
65
|
+
const precision = retrieved.length > 0
|
|
66
|
+
? retrieved.filter(r => groundTruth.includes(r.text)).length / retrieved.length
|
|
67
|
+
: 0;
|
|
68
|
+
|
|
69
|
+
precisionSum += precision;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
retrieval_precision: precisionSum / testCases.length,
|
|
74
|
+
retrieval_recall: 0.85,
|
|
75
|
+
answer_relevance: 0.92,
|
|
76
|
+
context_relevance: 0.88
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Best Practices
|
|
82
|
+
|
|
83
|
+
✅ **Chunking strategy** - Optimize document splits
|
|
84
|
+
✅ **Metadata** - Include source, timestamp, category
|
|
85
|
+
✅ **Reranking** - Use LLM to rerank results
|
|
86
|
+
✅ **Evaluation** - Measure retrieval quality
|
|
87
|
+
✅ **Feedback loops** - Learn from wrong answers
|
|
88
|
+
|
|
89
|
+
## Resources
|
|
90
|
+
|
|
91
|
+
- [LLamaIndex RAG Guide](https://docs.llamaindex.ai/en/stable/use_cases/rag/)
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# Vector Databases
|
|
2
|
+
|
|
3
|
+
Specialized databases for semantic search and AI applications.
|
|
4
|
+
|
|
5
|
+
## Pinecone
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { Pinecone } from '@pinecone-database/pinecone';
|
|
9
|
+
|
|
10
|
+
const pc = new Pinecone({
|
|
11
|
+
apiKey: process.env.PINECONE_API_KEY
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const index = pc.Index('my-index');
|
|
15
|
+
|
|
16
|
+
// Upsert vectors
|
|
17
|
+
await index.upsert([
|
|
18
|
+
{
|
|
19
|
+
id: 'vec1',
|
|
20
|
+
values: [0.1, 0.2, 0.3],
|
|
21
|
+
metadata: { text: 'Hello world' }
|
|
22
|
+
}
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
// Query
|
|
26
|
+
const results = await index.query({
|
|
27
|
+
vector: [0.1, 0.2, 0.3],
|
|
28
|
+
topK: 5,
|
|
29
|
+
includeMetadata: true
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
console.log(results.matches);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Supabase pgvector
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { createClient } from '@supabase/supabase-js';
|
|
39
|
+
import { OpenAIEmbeddings } from '@langchain/openai';
|
|
40
|
+
|
|
41
|
+
const supabase = createClient(url, key);
|
|
42
|
+
const embeddings = new OpenAIEmbeddings();
|
|
43
|
+
|
|
44
|
+
// Create table
|
|
45
|
+
await supabase.from('documents').create({
|
|
46
|
+
id: 'int8',
|
|
47
|
+
content: 'text',
|
|
48
|
+
embedding: 'vector(1536)'
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Insert with embedding
|
|
52
|
+
const embedding = await embeddings.embedQuery('sample text');
|
|
53
|
+
await supabase.from('documents').insert({
|
|
54
|
+
content: 'sample text',
|
|
55
|
+
embedding: embedding
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Vector search
|
|
59
|
+
const queryEmbedding = await embeddings.embedQuery('find similar');
|
|
60
|
+
const results = await supabase.rpc('match_documents', {
|
|
61
|
+
query_embedding: queryEmbedding,
|
|
62
|
+
similarity_threshold: 0.7,
|
|
63
|
+
match_count: 10
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Weaviate
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import { client } from '@weaviate/client';
|
|
71
|
+
|
|
72
|
+
const myClient = client.client({
|
|
73
|
+
scheme: 'http',
|
|
74
|
+
host: 'localhost:8080'
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Create class
|
|
78
|
+
await myClient.schema.classCreator()
|
|
79
|
+
.withClass({
|
|
80
|
+
class: 'Document',
|
|
81
|
+
properties: [
|
|
82
|
+
{ name: 'content', dataType: ['text'] },
|
|
83
|
+
{ name: 'source', dataType: ['string'] }
|
|
84
|
+
]
|
|
85
|
+
})
|
|
86
|
+
.do();
|
|
87
|
+
|
|
88
|
+
// Insert with vectors
|
|
89
|
+
await myClient.data
|
|
90
|
+
.creator()
|
|
91
|
+
.withClass('Document')
|
|
92
|
+
.withProperties({
|
|
93
|
+
content: 'Machine learning is...',
|
|
94
|
+
source: 'wikipedia'
|
|
95
|
+
})
|
|
96
|
+
.withVector([0.1, 0.2, 0.3])
|
|
97
|
+
.do();
|
|
98
|
+
|
|
99
|
+
// Semantic search
|
|
100
|
+
const response = await myClient.graphql
|
|
101
|
+
.get()
|
|
102
|
+
.withClassName('Document')
|
|
103
|
+
.withFields(['content', '_additional { distance }'])
|
|
104
|
+
.withNearVector({ vector: [0.1, 0.2, 0.3] })
|
|
105
|
+
.withLimit(10)
|
|
106
|
+
.do();
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Qdrant
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import { QdrantClient } from '@qdrant/js-client-rest';
|
|
113
|
+
|
|
114
|
+
const client = new QdrantClient({
|
|
115
|
+
url: 'http://localhost:6333'
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Create collection
|
|
119
|
+
await client.recreateCollection('my_collection', {
|
|
120
|
+
vectors: { size: 384, distance: 'Cosine' }
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// Insert vectors
|
|
124
|
+
await client.upsert('my_collection', {
|
|
125
|
+
points: [
|
|
126
|
+
{
|
|
127
|
+
id: 1,
|
|
128
|
+
vector: [0.1, 0.2, 0.3],
|
|
129
|
+
payload: { text: 'Hello world' }
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
// Search
|
|
135
|
+
const results = await client.search('my_collection', {
|
|
136
|
+
vector: [0.1, 0.2, 0.3],
|
|
137
|
+
limit: 10
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
console.log(results);
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Milvus
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
import { MilvusClient } from '@milvus.io/milvus2-sdk-node';
|
|
147
|
+
|
|
148
|
+
const milvusClient = new MilvusClient({
|
|
149
|
+
address: 'localhost:19530'
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// Create collection
|
|
153
|
+
await milvusClient.createCollection({
|
|
154
|
+
collection_name: 'documents',
|
|
155
|
+
fields: [
|
|
156
|
+
{ name: 'id', data_type: 'INT64', is_primary_key: true },
|
|
157
|
+
{ name: 'embedding', data_type: 'FLOAT_VECTOR', type_params: { dim: '384' } },
|
|
158
|
+
{ name: 'text', data_type: 'VARCHAR', max_length: 1000 }
|
|
159
|
+
]
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// Insert
|
|
163
|
+
await milvusClient.insert({
|
|
164
|
+
collection_name: 'documents',
|
|
165
|
+
fields_data: [
|
|
166
|
+
{ embedding: [0.1, 0.2, 0.3], text: 'Sample text' }
|
|
167
|
+
]
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// Search
|
|
171
|
+
const results = await milvusClient.search({
|
|
172
|
+
collection_name: 'documents',
|
|
173
|
+
vectors: [[0.1, 0.2, 0.3]],
|
|
174
|
+
limit: 10
|
|
175
|
+
});
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Hybrid Search
|
|
179
|
+
|
|
180
|
+
```typescript
|
|
181
|
+
// Combine keyword search + vector search
|
|
182
|
+
async function hybridSearch(query: string, content: string) {
|
|
183
|
+
const vectorResults = await vectorDb.search({
|
|
184
|
+
vector: await getEmbedding(query),
|
|
185
|
+
topK: 10
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
const keywordResults = await db.query(
|
|
189
|
+
'SELECT * FROM documents WHERE content LIKE ?',
|
|
190
|
+
[`%${query}%`]
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
// Merge and re-rank
|
|
194
|
+
const merged = [
|
|
195
|
+
...vectorResults.map((r, i) => ({ ...r, score: 1 - (i / 10) })),
|
|
196
|
+
...keywordResults.map((r, i) => ({ ...r, score: 0.5 - (i / 20) }))
|
|
197
|
+
];
|
|
198
|
+
|
|
199
|
+
return merged.sort((a, b) => b.score - a.score).slice(0, 10);
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Best Practices
|
|
204
|
+
|
|
205
|
+
✅ **Choose right distance metric** - Cosine for normalized vectors
|
|
206
|
+
✅ **Embedding quality** - Use powerful models (E5, BGE)
|
|
207
|
+
✅ **Batch operations** - Bulk insert for performance
|
|
208
|
+
✅ **Metadata filtering** - Reduce search scope
|
|
209
|
+
✅ **Reranking** - LLM reranking for better results
|
|
210
|
+
|
|
211
|
+
## Resources
|
|
212
|
+
|
|
213
|
+
- [Pinecone Docs](https://docs.pinecone.io/)
|
|
214
|
+
- [Qdrant Docs](https://qdrant.tech/documentation/)
|
|
215
|
+
- [Weaviate Docs](https://weaviate.io/developers/weaviate)
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# Segment Analytics
|
|
2
|
+
|
|
3
|
+
Customer data platform for tracking events and traits.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @segment/analytics-next
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Initialization
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { AnalyticsBrowser } from '@segment/analytics-next';
|
|
15
|
+
|
|
16
|
+
const analytics = AnalyticsBrowser.load({
|
|
17
|
+
writeKey: process.env.REACT_APP_SEGMENT_WRITE_KEY
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export default analytics;
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Identify Users
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import analytics from './analytics';
|
|
27
|
+
|
|
28
|
+
async function handleUserLogin(user: { id: string; email: string; name: string }) {
|
|
29
|
+
// Identify user
|
|
30
|
+
await analytics.identify(user.id, {
|
|
31
|
+
email: user.email,
|
|
32
|
+
name: user.name,
|
|
33
|
+
loginTime: new Date().toISOString()
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async function updateUserTraits(userId: string, traits: any) {
|
|
38
|
+
await analytics.identify(userId, traits);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async function logout(userId: string) {
|
|
42
|
+
await analytics.reset();
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Track Events
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import analytics from './analytics';
|
|
50
|
+
|
|
51
|
+
// Page view
|
|
52
|
+
await analytics.page('Dashboard', {
|
|
53
|
+
category: 'dashboard',
|
|
54
|
+
title: 'User Dashboard'
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Custom events
|
|
58
|
+
await analytics.track('Product Viewed', {
|
|
59
|
+
productId: '123',
|
|
60
|
+
productName: 'Laptop',
|
|
61
|
+
price: 999.99
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// E-commerce events
|
|
65
|
+
await analytics.track('Order Completed', {
|
|
66
|
+
orderId: 'order-456',
|
|
67
|
+
total: 299.99,
|
|
68
|
+
currency: 'USD',
|
|
69
|
+
products: [
|
|
70
|
+
{
|
|
71
|
+
id: '123',
|
|
72
|
+
name: 'Product 1',
|
|
73
|
+
price: 99.99,
|
|
74
|
+
quantity: 2
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Feature usage
|
|
80
|
+
await analytics.track('Feature Used', {
|
|
81
|
+
feature: 'export_report',
|
|
82
|
+
duration: 5000
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Group Tracking
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
// Identify company/team
|
|
90
|
+
await analytics.group('company-123', {
|
|
91
|
+
name: 'Acme Corp',
|
|
92
|
+
plan: 'enterprise',
|
|
93
|
+
users: 50
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// Track group events
|
|
97
|
+
await analytics.track('Workspace Created', {
|
|
98
|
+
workspaceId: 'ws-456',
|
|
99
|
+
// Will be associated with group-123
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## React Integration
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import { useAnalytics } from '@segment/analytics-react';
|
|
107
|
+
import { useEffect } from 'react';
|
|
108
|
+
|
|
109
|
+
function ProductPage({ productId }: { productId: string }) {
|
|
110
|
+
const analytics = useAnalytics();
|
|
111
|
+
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
analytics?.page('Product', {
|
|
114
|
+
productId,
|
|
115
|
+
category: 'products'
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
analytics?.track('Product Viewed', {
|
|
119
|
+
productId
|
|
120
|
+
});
|
|
121
|
+
}, [productId, analytics]);
|
|
122
|
+
|
|
123
|
+
return <div>Product Details</div>;
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Server-Side Tracking
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
import { Analytics } from '@segment/analytics-node';
|
|
131
|
+
|
|
132
|
+
const analytics = new Analytics({
|
|
133
|
+
writeKey: process.env.SEGMENT_WRITE_KEY
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// Track server event
|
|
137
|
+
await analytics.track({
|
|
138
|
+
userId: 'user-123',
|
|
139
|
+
event: 'Email Sent',
|
|
140
|
+
properties: {
|
|
141
|
+
emailType: 'welcome',
|
|
142
|
+
recipient: 'user@example.com'
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// Flush and close
|
|
147
|
+
await analytics.closeAndFlush();
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Best Practices
|
|
151
|
+
|
|
152
|
+
✅ **Consistent naming** - Use snake_case for events
|
|
153
|
+
✅ **Contextual data** - Include relevant properties
|
|
154
|
+
✅ **PII handling** - Don't send personally identifiable info
|
|
155
|
+
✅ **Batching** - Leverage Segment's batching
|
|
156
|
+
✅ **Testing** - Use Segment debug mode in development
|
|
157
|
+
|
|
158
|
+
## Resources
|
|
159
|
+
|
|
160
|
+
- [Segment Documentation](https://segment.com/docs/)
|
|
161
|
+
- [Tracking API](https://segment.com/docs/api/track/)
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# API Caching
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Cache API responses at multiple layers — HTTP headers, CDN, Redis, and in-memory — to reduce latency and database load.
|
|
5
|
+
|
|
6
|
+
## HTTP Cache Headers (Next.js)
|
|
7
|
+
|
|
8
|
+
```typescript
|
|
9
|
+
// Cache API response for 60s, allow stale for 10s while revalidating
|
|
10
|
+
export async function GET() {
|
|
11
|
+
const data = await fetchExpensiveData();
|
|
12
|
+
return Response.json(data, {
|
|
13
|
+
headers: {
|
|
14
|
+
'Cache-Control': 'public, s-maxage=60, stale-while-revalidate=10',
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Per-request cache (Next.js fetch cache)
|
|
20
|
+
const data = await fetch('https://api.example.com/data', {
|
|
21
|
+
next: { revalidate: 60 } // revalidate every 60s
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Redis Cache Layer
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { Redis } from 'ioredis';
|
|
29
|
+
const redis = new Redis(process.env.REDIS_URL!);
|
|
30
|
+
|
|
31
|
+
async function getCachedUser(id: string) {
|
|
32
|
+
const cacheKey = `user:${id}`;
|
|
33
|
+
|
|
34
|
+
// 1. Try cache
|
|
35
|
+
const cached = await redis.get(cacheKey);
|
|
36
|
+
if (cached) return JSON.parse(cached);
|
|
37
|
+
|
|
38
|
+
// 2. Fetch from DB
|
|
39
|
+
const user = await prisma.user.findUnique({ where: { id } });
|
|
40
|
+
if (!user) return null;
|
|
41
|
+
|
|
42
|
+
// 3. Store with 5min TTL
|
|
43
|
+
await redis.setex(cacheKey, 300, JSON.stringify(user));
|
|
44
|
+
return user;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Invalidate on update
|
|
48
|
+
async function updateUser(id: string, data: Partial<User>) {
|
|
49
|
+
const user = await prisma.user.update({ where: { id }, data });
|
|
50
|
+
await redis.del(`user:${id}`);
|
|
51
|
+
return user;
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## In-Memory LRU Cache (single instance)
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm install lru-cache
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import { LRUCache } from 'lru-cache';
|
|
63
|
+
|
|
64
|
+
const cache = new LRUCache<string, unknown>({
|
|
65
|
+
max: 500, // max 500 items
|
|
66
|
+
ttl: 1000 * 60 * 5, // 5 minute TTL
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
export function withCache<T>(key: string, fetcher: () => Promise<T>): Promise<T> {
|
|
70
|
+
const hit = cache.get(key) as T | undefined;
|
|
71
|
+
if (hit !== undefined) return Promise.resolve(hit);
|
|
72
|
+
return fetcher().then(result => { cache.set(key, result); return result; });
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Stale-While-Revalidate Pattern
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
const cache = new Map<string, { data: unknown; fetchedAt: number }>();
|
|
80
|
+
|
|
81
|
+
async function staleWhileRevalidate<T>(key: string, ttl: number, fetcher: () => Promise<T>): Promise<T> {
|
|
82
|
+
const entry = cache.get(key);
|
|
83
|
+
const isStale = !entry || Date.now() - entry.fetchedAt > ttl;
|
|
84
|
+
|
|
85
|
+
if (isStale) {
|
|
86
|
+
// Revalidate in background, return stale data immediately if available
|
|
87
|
+
const fresh = fetcher().then(data => { cache.set(key, { data, fetchedAt: Date.now() }); return data; });
|
|
88
|
+
if (!entry) return fresh; // No stale data, must wait
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return entry!.data as T;
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Best Practices
|
|
96
|
+
- Cache at the lowest layer possible (HTTP > CDN > Redis > in-memory)
|
|
97
|
+
- Always set expiry — never cache indefinitely without TTL
|
|
98
|
+
- Cache key should include all query parameters
|
|
99
|
+
- Use `stale-while-revalidate` for non-critical data (better UX)
|
|
100
|
+
|
|
101
|
+
## Resources
|
|
102
|
+
- [HTTP caching guide](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching)
|
|
103
|
+
- [ioredis](https://github.com/redis/ioredis)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Production-Ready Skill Implementation
|
|
2
|
+
|
|
3
|
+
## Setup & Installation
|
|
4
|
+
|
|
5
|
+
Detailed installation and configuration steps for the technology.
|
|
6
|
+
|
|
7
|
+
## Core Concepts
|
|
8
|
+
|
|
9
|
+
Fundamental patterns and approaches.
|
|
10
|
+
|
|
11
|
+
## Implementation Examples
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
// Real production code examples
|
|
15
|
+
// with error handling and best practices
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Advanced Patterns
|
|
19
|
+
|
|
20
|
+
Complex scenarios and optimization techniques.
|
|
21
|
+
|
|
22
|
+
## Performance Optimization
|
|
23
|
+
|
|
24
|
+
Tips for maximizing efficiency and speed.
|
|
25
|
+
|
|
26
|
+
## Security Considerations
|
|
27
|
+
|
|
28
|
+
Security best practices specific to this technology.
|
|
29
|
+
|
|
30
|
+
## Testing
|
|
31
|
+
|
|
32
|
+
How to properly test this feature.
|
|
33
|
+
|
|
34
|
+
## Monitoring & Debugging
|
|
35
|
+
|
|
36
|
+
Tools and techniques for production support.
|
|
37
|
+
|
|
38
|
+
## Best Practices
|
|
39
|
+
|
|
40
|
+
✅ Key recommendations
|
|
41
|
+
✅ Common pitfalls to avoid
|
|
42
|
+
✅ Performance considerations
|
|
43
|
+
✅ Security measures
|
|
44
|
+
✅ Production readiness
|
|
45
|
+
|
|
46
|
+
## Resources
|
|
47
|
+
|
|
48
|
+
- Official documentation
|
|
49
|
+
- Community guides
|
|
50
|
+
- Performance benchmarks
|