claudeinone-cli 1.0.2 → 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/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,106 @@
|
|
|
1
|
+
# Remix Advanced Patterns
|
|
2
|
+
|
|
3
|
+
Production patterns for Remix applications.
|
|
4
|
+
|
|
5
|
+
## Loader Data Caching
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { json } from '@remix-run/node';
|
|
9
|
+
import { useLoaderData } from '@remix-run/react';
|
|
10
|
+
|
|
11
|
+
export async function loader({ params }: LoaderFunctionArgs) {
|
|
12
|
+
const cacheKey = `product:${params.id}`;
|
|
13
|
+
|
|
14
|
+
// Check cache
|
|
15
|
+
let product = await cache.get(cacheKey);
|
|
16
|
+
|
|
17
|
+
if (!product) {
|
|
18
|
+
product = await db.products.findById(params.id);
|
|
19
|
+
// Cache for 1 hour
|
|
20
|
+
await cache.set(cacheKey, product, 3600);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return json({ product });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default function ProductPage() {
|
|
27
|
+
const { product } = useLoaderData<typeof loader>();
|
|
28
|
+
|
|
29
|
+
return <div>{product.name}</div>;
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Optimistic UI
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
export async function action({ request, params }: ActionFunctionArgs) {
|
|
37
|
+
if (request.method === 'POST') {
|
|
38
|
+
const formData = await request.formData();
|
|
39
|
+
const title = formData.get('title');
|
|
40
|
+
|
|
41
|
+
await db.posts.update(params.id, { title });
|
|
42
|
+
|
|
43
|
+
return redirect(`/posts/${params.id}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default function EditPost() {
|
|
48
|
+
const fetcher = useFetcher();
|
|
49
|
+
const post = useLoaderData();
|
|
50
|
+
|
|
51
|
+
const optimisticData = fetcher.formData
|
|
52
|
+
? { ...post, title: fetcher.formData.get('title') }
|
|
53
|
+
: post;
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<fetcher.Form method="post">
|
|
57
|
+
<input
|
|
58
|
+
name="title"
|
|
59
|
+
defaultValue={optimisticData.title}
|
|
60
|
+
/>
|
|
61
|
+
<button type="submit">Update</button>
|
|
62
|
+
</fetcher.Form>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Streaming
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
export async function loader() {
|
|
71
|
+
return defer({
|
|
72
|
+
analytics: getAnalytics(),
|
|
73
|
+
posts: getPosts()
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default function Dashboard() {
|
|
78
|
+
const { analytics, posts } = useLoaderData<typeof loader>();
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<Suspense fallback={<div>Loading...</div>}>
|
|
82
|
+
<Await resolve={analytics}>
|
|
83
|
+
{(data) => <AnalyticsWidget data={data} />}
|
|
84
|
+
</Await>
|
|
85
|
+
|
|
86
|
+
<Suspense fallback={<div>Loading posts...</div>}>
|
|
87
|
+
<Await resolve={posts}>
|
|
88
|
+
{(data) => <PostList posts={data} />}
|
|
89
|
+
</Await>
|
|
90
|
+
</Suspense>
|
|
91
|
+
</Suspense>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Best Practices
|
|
97
|
+
|
|
98
|
+
✅ **Server-side rendering** - Default behavior
|
|
99
|
+
✅ **Streaming** - Progressive rendering
|
|
100
|
+
✅ **Data fetching** - Loaders vs Actions
|
|
101
|
+
✅ **Caching** - Strategic use
|
|
102
|
+
✅ **Error boundaries** - Graceful degradation
|
|
103
|
+
|
|
104
|
+
## Resources
|
|
105
|
+
|
|
106
|
+
- [Remix Documentation](https://remix.run/docs)
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Remix
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Remix is a full-stack React framework focused on web standards, nested routing, and server-side rendering.
|
|
5
|
+
|
|
6
|
+
## Setup
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npx create-remix@latest my-app
|
|
10
|
+
cd my-app
|
|
11
|
+
npm run dev
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Route with Loader and Action
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
// app/routes/users._index.tsx
|
|
18
|
+
import { json, type LoaderFunctionArgs, type ActionFunctionArgs } from '@remix-run/node';
|
|
19
|
+
import { useLoaderData, Form, useActionData } from '@remix-run/react';
|
|
20
|
+
import { prisma } from '~/lib/db.server';
|
|
21
|
+
|
|
22
|
+
export async function loader({ request }: LoaderFunctionArgs) {
|
|
23
|
+
const users = await prisma.user.findMany({ take: 20, orderBy: { createdAt: 'desc' } });
|
|
24
|
+
return json({ users });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function action({ request }: ActionFunctionArgs) {
|
|
28
|
+
const formData = await request.formData();
|
|
29
|
+
const email = String(formData.get('email'));
|
|
30
|
+
const name = String(formData.get('name'));
|
|
31
|
+
|
|
32
|
+
if (!email.includes('@')) return json({ error: 'Invalid email' }, { status: 400 });
|
|
33
|
+
|
|
34
|
+
await prisma.user.create({ data: { email, name } });
|
|
35
|
+
return json({ success: true });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default function UsersPage() {
|
|
39
|
+
const { users } = useLoaderData<typeof loader>();
|
|
40
|
+
const actionData = useActionData<typeof action>();
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<div>
|
|
44
|
+
<Form method="post">
|
|
45
|
+
<input name="email" type="email" required />
|
|
46
|
+
<input name="name" required />
|
|
47
|
+
<button type="submit">Add User</button>
|
|
48
|
+
{actionData?.error && <p className="text-red-500">{actionData.error}</p>}
|
|
49
|
+
</Form>
|
|
50
|
+
<ul>{users.map(u => <li key={u.id}>{u.name}</li>)}</ul>
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Error Boundary
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
// app/routes/users.$id.tsx
|
|
60
|
+
export function ErrorBoundary() {
|
|
61
|
+
const error = useRouteError();
|
|
62
|
+
if (isRouteErrorResponse(error)) {
|
|
63
|
+
return <h2>{error.status}: {error.statusText}</h2>;
|
|
64
|
+
}
|
|
65
|
+
return <h2>Unknown error</h2>;
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Auth with Session
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
// app/lib/session.server.ts
|
|
73
|
+
import { createCookieSessionStorage, redirect } from '@remix-run/node';
|
|
74
|
+
|
|
75
|
+
const { getSession, commitSession, destroySession } = createCookieSessionStorage({
|
|
76
|
+
cookie: {
|
|
77
|
+
name: '__session',
|
|
78
|
+
httpOnly: true,
|
|
79
|
+
secure: process.env.NODE_ENV === 'production',
|
|
80
|
+
secrets: [process.env.SESSION_SECRET!],
|
|
81
|
+
sameSite: 'lax',
|
|
82
|
+
maxAge: 60 * 60 * 24 * 7,
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export async function requireUser(request: Request) {
|
|
87
|
+
const session = await getSession(request.headers.get('Cookie'));
|
|
88
|
+
const userId = session.get('userId');
|
|
89
|
+
if (!userId) throw redirect('/login');
|
|
90
|
+
return userId;
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Best Practices
|
|
95
|
+
- Use `loader` for data fetching (server-side only)
|
|
96
|
+
- Use `action` for mutations (form submissions, API calls)
|
|
97
|
+
- Loaders run in parallel for nested routes — use this for performance
|
|
98
|
+
- Use `defer()` with `<Await>` for streaming slow data
|
|
99
|
+
|
|
100
|
+
## Resources
|
|
101
|
+
- [Remix docs](https://remix.run/docs)
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# SolidJS
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
SolidJS is a reactive UI library with no virtual DOM — updates are compiled to precise DOM operations for maximum performance.
|
|
5
|
+
|
|
6
|
+
## Setup
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npx degit solidjs/templates/ts my-app
|
|
10
|
+
cd my-app && npm install && npm run dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Signals (Reactive Primitives)
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { createSignal, createEffect, createMemo, Show, For } from 'solid-js';
|
|
17
|
+
|
|
18
|
+
function Counter() {
|
|
19
|
+
const [count, setCount] = createSignal(0);
|
|
20
|
+
const doubled = createMemo(() => count() * 2);
|
|
21
|
+
|
|
22
|
+
createEffect(() => {
|
|
23
|
+
console.log('Count changed:', count());
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<div>
|
|
28
|
+
<p>Count: {count()}, Doubled: {doubled()}</p>
|
|
29
|
+
<button onClick={() => setCount(c => c + 1)}>Increment</button>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Stores (Complex State)
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { createStore } from 'solid-js/store';
|
|
39
|
+
|
|
40
|
+
interface Todo { id: number; text: string; done: boolean; }
|
|
41
|
+
|
|
42
|
+
function TodoApp() {
|
|
43
|
+
const [todos, setTodos] = createStore<Todo[]>([]);
|
|
44
|
+
|
|
45
|
+
const addTodo = (text: string) => {
|
|
46
|
+
setTodos(todos.length, { id: Date.now(), text, done: false });
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const toggleTodo = (id: number) => {
|
|
50
|
+
setTodos(t => t.id === id, 'done', d => !d);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<div>
|
|
55
|
+
<button onClick={() => addTodo('New todo')}>Add</button>
|
|
56
|
+
<For each={todos}>
|
|
57
|
+
{(todo) => (
|
|
58
|
+
<div onClick={() => toggleTodo(todo.id)}
|
|
59
|
+
style={{ 'text-decoration': todo.done ? 'line-through' : 'none' }}>
|
|
60
|
+
{todo.text}
|
|
61
|
+
</div>
|
|
62
|
+
)}
|
|
63
|
+
</For>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Async Data with createResource
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { createResource, Suspense } from 'solid-js';
|
|
73
|
+
|
|
74
|
+
async function fetchUser(id: string) {
|
|
75
|
+
const res = await fetch(`/api/users/${id}`);
|
|
76
|
+
return res.json();
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function UserProfile(props: { id: string }) {
|
|
80
|
+
const [user] = createResource(() => props.id, fetchUser);
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<Suspense fallback={<p>Loading...</p>}>
|
|
84
|
+
<Show when={user()} keyed>
|
|
85
|
+
{(u) => <h1>{u.name}</h1>}
|
|
86
|
+
</Show>
|
|
87
|
+
</Suspense>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Best Practices
|
|
93
|
+
- Signals are functions — call them `count()` to read, `setCount(n)` to write
|
|
94
|
+
- Use `<For>` not `.map()` — it's keyed and efficient
|
|
95
|
+
- Use `createMemo` for derived values (like `useMemo` in React)
|
|
96
|
+
- Never destructure props — SolidJS tracks property access reactively
|
|
97
|
+
|
|
98
|
+
## Resources
|
|
99
|
+
- [SolidJS docs](https://docs.solidjs.com)
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# State Management Patterns
|
|
2
|
+
|
|
3
|
+
Managing state across components.
|
|
4
|
+
|
|
5
|
+
## Context API + useReducer
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
interface AppState {
|
|
9
|
+
user: { id: string; name: string } | null;
|
|
10
|
+
theme: 'light' | 'dark';
|
|
11
|
+
notifications: Array<{ id: string; message: string }>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type AppAction =
|
|
15
|
+
| { type: 'SET_USER'; payload: AppState['user'] }
|
|
16
|
+
| { type: 'SET_THEME'; payload: AppState['theme'] }
|
|
17
|
+
| { type: 'ADD_NOTIFICATION'; payload: { id: string; message: string } }
|
|
18
|
+
| { type: 'REMOVE_NOTIFICATION'; payload: string };
|
|
19
|
+
|
|
20
|
+
const initialState: AppState = {
|
|
21
|
+
user: null,
|
|
22
|
+
theme: 'light',
|
|
23
|
+
notifications: []
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function appReducer(state: AppState, action: AppAction): AppState {
|
|
27
|
+
switch (action.type) {
|
|
28
|
+
case 'SET_USER':
|
|
29
|
+
return { ...state, user: action.payload };
|
|
30
|
+
case 'SET_THEME':
|
|
31
|
+
return { ...state, theme: action.payload };
|
|
32
|
+
case 'ADD_NOTIFICATION':
|
|
33
|
+
return {
|
|
34
|
+
...state,
|
|
35
|
+
notifications: [...state.notifications, action.payload]
|
|
36
|
+
};
|
|
37
|
+
case 'REMOVE_NOTIFICATION':
|
|
38
|
+
return {
|
|
39
|
+
...state,
|
|
40
|
+
notifications: state.notifications.filter(n => n.id !== action.payload)
|
|
41
|
+
};
|
|
42
|
+
default:
|
|
43
|
+
return state;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const AppContext = createContext<{
|
|
48
|
+
state: AppState;
|
|
49
|
+
dispatch: Dispatch<AppAction>;
|
|
50
|
+
} | undefined>(undefined);
|
|
51
|
+
|
|
52
|
+
export function AppProvider({ children }: { children: ReactNode }) {
|
|
53
|
+
const [state, dispatch] = useReducer(appReducer, initialState);
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<AppContext.Provider value={{ state, dispatch }}>
|
|
57
|
+
{children}
|
|
58
|
+
</AppContext.Provider>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function useAppContext() {
|
|
63
|
+
const context = useContext(AppContext);
|
|
64
|
+
if (!context) {
|
|
65
|
+
throw new Error('useAppContext must be within AppProvider');
|
|
66
|
+
}
|
|
67
|
+
return context;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Usage
|
|
71
|
+
export function Profile() {
|
|
72
|
+
const { state, dispatch } = useAppContext();
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<div>
|
|
76
|
+
{state.user && <h1>{state.user.name}</h1>}
|
|
77
|
+
<button onClick={() => dispatch({ type: 'SET_THEME', payload: 'dark' })}>
|
|
78
|
+
Change theme
|
|
79
|
+
</button>
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Zustand (Lightweight)
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
import { create } from 'zustand';
|
|
89
|
+
|
|
90
|
+
interface Store {
|
|
91
|
+
user: { id: string; name: string } | null;
|
|
92
|
+
setUser: (user: Store['user']) => void;
|
|
93
|
+
theme: 'light' | 'dark';
|
|
94
|
+
setTheme: (theme: Store['theme']) => void;
|
|
95
|
+
clear: () => void;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export const useStore = create<Store>((set) => ({
|
|
99
|
+
user: null,
|
|
100
|
+
setUser: (user) => set({ user }),
|
|
101
|
+
theme: 'light',
|
|
102
|
+
setTheme: (theme) => set({ theme }),
|
|
103
|
+
clear: () => set({ user: null, theme: 'light' })
|
|
104
|
+
}));
|
|
105
|
+
|
|
106
|
+
// Usage
|
|
107
|
+
export function Profile() {
|
|
108
|
+
const user = useStore((state) => state.user);
|
|
109
|
+
const setUser = useStore((state) => state.setUser);
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<div>
|
|
113
|
+
{user && <h1>{user.name}</h1>}
|
|
114
|
+
<button onClick={() => setUser({ id: '1', name: 'John' })}>
|
|
115
|
+
Set user
|
|
116
|
+
</button>
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Best Practices
|
|
123
|
+
|
|
124
|
+
✅ **Normalize state** - Flatten nested structures
|
|
125
|
+
✅ **Separate concerns** - UI state vs app state
|
|
126
|
+
✅ **Avoid prop drilling** - Use context for deep trees
|
|
127
|
+
✅ **Memoization** - Prevent unnecessary re-renders
|
|
128
|
+
✅ **Persistence** - Save critical state
|
|
129
|
+
|
|
130
|
+
## Resources
|
|
131
|
+
|
|
132
|
+
- [React Context](https://react.dev/reference/react/useContext)
|
|
133
|
+
- [Zustand](https://github.com/pmndrs/zustand)
|
|
134
|
+
- [Jotai](https://jotai.org/)
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Frontend State Management
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Patterns for managing client-side state: React Context for simple cases, Zustand for complex shared state.
|
|
5
|
+
|
|
6
|
+
## React Context + useReducer
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
import { createContext, useContext, useReducer, ReactNode } from 'react';
|
|
10
|
+
|
|
11
|
+
interface State { user: User | null; theme: 'light' | 'dark'; }
|
|
12
|
+
type Action = { type: 'SET_USER'; user: User } | { type: 'TOGGLE_THEME' } | { type: 'LOGOUT' };
|
|
13
|
+
|
|
14
|
+
function reducer(state: State, action: Action): State {
|
|
15
|
+
switch (action.type) {
|
|
16
|
+
case 'SET_USER': return { ...state, user: action.user };
|
|
17
|
+
case 'TOGGLE_THEME': return { ...state, theme: state.theme === 'light' ? 'dark' : 'light' };
|
|
18
|
+
case 'LOGOUT': return { ...state, user: null };
|
|
19
|
+
default: return state;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const AppContext = createContext<{ state: State; dispatch: React.Dispatch<Action> } | null>(null);
|
|
24
|
+
|
|
25
|
+
export function AppProvider({ children }: { children: ReactNode }) {
|
|
26
|
+
const [state, dispatch] = useReducer(reducer, { user: null, theme: 'light' });
|
|
27
|
+
return <AppContext.Provider value={{ state, dispatch }}>{children}</AppContext.Provider>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function useApp() {
|
|
31
|
+
const ctx = useContext(AppContext);
|
|
32
|
+
if (!ctx) throw new Error('useApp must be used within AppProvider');
|
|
33
|
+
return ctx;
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Zustand
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install zustand
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { create } from 'zustand';
|
|
45
|
+
import { persist } from 'zustand/middleware';
|
|
46
|
+
|
|
47
|
+
interface AppStore {
|
|
48
|
+
user: User | null;
|
|
49
|
+
theme: 'light' | 'dark';
|
|
50
|
+
setUser: (user: User | null) => void;
|
|
51
|
+
toggleTheme: () => void;
|
|
52
|
+
logout: () => void;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const useAppStore = create<AppStore>()(
|
|
56
|
+
persist(
|
|
57
|
+
(set) => ({
|
|
58
|
+
user: null,
|
|
59
|
+
theme: 'light',
|
|
60
|
+
setUser: (user) => set({ user }),
|
|
61
|
+
toggleTheme: () => set((s) => ({ theme: s.theme === 'light' ? 'dark' : 'light' })),
|
|
62
|
+
logout: () => set({ user: null }),
|
|
63
|
+
}),
|
|
64
|
+
{ name: 'app-store' }
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
// Usage in component
|
|
69
|
+
function Navbar() {
|
|
70
|
+
const { user, logout } = useAppStore();
|
|
71
|
+
return user ? <button onClick={logout}>Logout {user.name}</button> : null;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## React Query for Server State
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm install @tanstack/react-query
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
83
|
+
|
|
84
|
+
function useUsers() {
|
|
85
|
+
return useQuery({ queryKey: ['users'], queryFn: () => fetch('/api/users').then(r => r.json()) });
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function useCreateUser() {
|
|
89
|
+
const qc = useQueryClient();
|
|
90
|
+
return useMutation({
|
|
91
|
+
mutationFn: (data: CreateUserInput) =>
|
|
92
|
+
fetch('/api/users', { method: 'POST', body: JSON.stringify(data), headers: { 'Content-Type': 'application/json' } }).then(r => r.json()),
|
|
93
|
+
onSuccess: () => qc.invalidateQueries({ queryKey: ['users'] }),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Best Practices
|
|
99
|
+
- Server state (API data) → React Query or SWR
|
|
100
|
+
- Client-only UI state (modals, theme) → Zustand or Context
|
|
101
|
+
- Avoid putting server responses in Context/Zustand
|
|
102
|
+
- Use Zustand `persist` middleware for theme/preferences only
|
|
103
|
+
|
|
104
|
+
## Resources
|
|
105
|
+
- [Zustand docs](https://zustand.docs.pmnd.rs)
|
|
106
|
+
- [TanStack Query](https://tanstack.com/query/latest)
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# SvelteKit
|
|
2
|
+
|
|
3
|
+
Compiler-based framework that writes less code with true reactivity.
|
|
4
|
+
|
|
5
|
+
## Reactive Variables
|
|
6
|
+
|
|
7
|
+
```svelte
|
|
8
|
+
<script>
|
|
9
|
+
let count = 0;
|
|
10
|
+
|
|
11
|
+
// Reactive assignment (compiler magic)
|
|
12
|
+
$: doubled = count * 2;
|
|
13
|
+
|
|
14
|
+
// Reactive statement
|
|
15
|
+
$: if (count > 5) {
|
|
16
|
+
console.log('Count is high!');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function increment() {
|
|
20
|
+
count++; // Direct mutation, triggers reactivity
|
|
21
|
+
}
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<button on:click={increment}>
|
|
25
|
+
Clicks: {count}, Doubled: {doubled}
|
|
26
|
+
</button>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Component Props
|
|
30
|
+
|
|
31
|
+
```svelte
|
|
32
|
+
<script>
|
|
33
|
+
export let user;
|
|
34
|
+
export let age = 18; // Default value
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<p>{user}, age {age}</p>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Stores (Reactive)
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
// stores.js
|
|
44
|
+
import { writable, derived } from 'svelte/store';
|
|
45
|
+
|
|
46
|
+
export const count = writable(0);
|
|
47
|
+
export const doubled = derived(count, $count => $count * 2);
|
|
48
|
+
|
|
49
|
+
// In component
|
|
50
|
+
<script>
|
|
51
|
+
import { count, doubled } from './stores';
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<p>{$count}</p>
|
|
55
|
+
<p>{$doubled}</p>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## SvelteKit Routing
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
src/routes/
|
|
62
|
+
├── +page.svelte # /
|
|
63
|
+
├── about/
|
|
64
|
+
│ └── +page.svelte # /about
|
|
65
|
+
├── posts/
|
|
66
|
+
│ ├── +page.svelte # /posts
|
|
67
|
+
│ └── [id]/
|
|
68
|
+
│ └── +page.svelte # /posts/[id]
|
|
69
|
+
└── api/
|
|
70
|
+
└── users/
|
|
71
|
+
└── +server.js # API route
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Form Actions
|
|
75
|
+
|
|
76
|
+
```svelte
|
|
77
|
+
<!-- +page.svelte -->
|
|
78
|
+
<form method="POST">
|
|
79
|
+
<input name="title" required />
|
|
80
|
+
<button>Submit</button>
|
|
81
|
+
</form>
|
|
82
|
+
|
|
83
|
+
<!-- +page.server.js -->
|
|
84
|
+
export const actions = {
|
|
85
|
+
default: async ({ request }) => {
|
|
86
|
+
const formData = await request.formData();
|
|
87
|
+
const title = formData.get('title');
|
|
88
|
+
// Process data
|
|
89
|
+
return { success: true };
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Animations & Transitions
|
|
95
|
+
|
|
96
|
+
```svelte
|
|
97
|
+
<script>
|
|
98
|
+
import { fade, slide } from 'svelte/transition';
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
<div transition:fade={{ duration: 300 }}>
|
|
102
|
+
Fading in/out
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<div transition:slide={{ duration: 400 }}>
|
|
106
|
+
Sliding in/out
|
|
107
|
+
</div>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Best Practices
|
|
111
|
+
|
|
112
|
+
1. Embrace compiler reactivity
|
|
113
|
+
2. Use stores for shared state
|
|
114
|
+
3. Keep components simple
|
|
115
|
+
4. Leverage TypeScript
|
|
116
|
+
5. Use +server.js for API routes
|
|
117
|
+
|
|
118
|
+
## Resources
|
|
119
|
+
|
|
120
|
+
- [SvelteKit Docs](https://kit.svelte.dev/)
|
|
121
|
+
- [Svelte Tutorial](https://svelte.dev/tutorial)
|