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,95 @@
|
|
|
1
|
+
# Hono
|
|
2
|
+
|
|
3
|
+
Lightweight, ultra-fast web framework for edge runtimes (Cloudflare Workers, Deno, Node.js).
|
|
4
|
+
|
|
5
|
+
## Hello World
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { Hono } from 'hono';
|
|
9
|
+
|
|
10
|
+
const app = new Hono();
|
|
11
|
+
|
|
12
|
+
app.get('/', (c) => c.text('Hello, World!'));
|
|
13
|
+
|
|
14
|
+
app.post('/users', async (c) => {
|
|
15
|
+
const body = await c.req.json();
|
|
16
|
+
return c.json({ created: body }, 201);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export default app;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Routing
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
const app = new Hono();
|
|
26
|
+
|
|
27
|
+
app.get('/users', async (c) => {
|
|
28
|
+
return c.json(await db.users.list());
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
app.get('/users/:id', async (c) => {
|
|
32
|
+
const id = c.req.param('id');
|
|
33
|
+
const user = await db.users.get(id);
|
|
34
|
+
return c.json(user);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
app.post('/users', async (c) => {
|
|
38
|
+
const body = await c.req.json();
|
|
39
|
+
const user = await db.users.create(body);
|
|
40
|
+
return c.json(user, 201);
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Middleware
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
// Built-in middleware
|
|
48
|
+
app.use(cors());
|
|
49
|
+
app.use(logger());
|
|
50
|
+
|
|
51
|
+
// Custom middleware
|
|
52
|
+
app.use(async (c, next) => {
|
|
53
|
+
const start = Date.now();
|
|
54
|
+
await next();
|
|
55
|
+
console.log(`${Date.now() - start}ms`);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// Route-specific middleware
|
|
59
|
+
app.post('/api/*', authenticate, (c) => {
|
|
60
|
+
return c.json({ user: c.get('user') });
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Parameters & Validation
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
app.post('/items/:id', (c) => {
|
|
68
|
+
const id = c.req.param('id');
|
|
69
|
+
const query = c.req.query('page');
|
|
70
|
+
const body = c.req.json();
|
|
71
|
+
|
|
72
|
+
return c.json({ id, query, body });
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Edge Runtime Support
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
// Works on Cloudflare Workers, Deno, Node.js
|
|
80
|
+
// No environment-specific code needed
|
|
81
|
+
export default app;
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Best Practices
|
|
85
|
+
|
|
86
|
+
1. Leverage edge runtime when possible
|
|
87
|
+
2. Keep middleware focused
|
|
88
|
+
3. Use proper status codes
|
|
89
|
+
4. Return structured responses
|
|
90
|
+
5. Handle errors consistently
|
|
91
|
+
|
|
92
|
+
## Resources
|
|
93
|
+
|
|
94
|
+
- [Hono Documentation](https://hono.dev/)
|
|
95
|
+
- [Edge Runtime Compatibility](https://hono.dev/docs/getting-started/cf-workers)
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# Spring Boot
|
|
2
|
+
|
|
3
|
+
Java framework for building production-grade applications with dependency injection and autoconfiguration.
|
|
4
|
+
|
|
5
|
+
## Basic Setup
|
|
6
|
+
|
|
7
|
+
```java
|
|
8
|
+
package com.example.api;
|
|
9
|
+
|
|
10
|
+
import org.springframework.boot.SpringApplication;
|
|
11
|
+
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
12
|
+
|
|
13
|
+
@SpringBootApplication
|
|
14
|
+
public class Application {
|
|
15
|
+
public static void main(String[] args) {
|
|
16
|
+
SpringApplication.run(Application.class, args);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Controllers & Routing
|
|
22
|
+
|
|
23
|
+
```java
|
|
24
|
+
import org.springframework.web.bind.annotation.*;
|
|
25
|
+
import org.springframework.http.HttpStatus;
|
|
26
|
+
|
|
27
|
+
@RestController
|
|
28
|
+
@RequestMapping("/api/users")
|
|
29
|
+
public class UserController {
|
|
30
|
+
|
|
31
|
+
@GetMapping("/{id}")
|
|
32
|
+
public UserDTO getUser(@PathVariable Long id) {
|
|
33
|
+
return userService.findById(id);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@PostMapping
|
|
37
|
+
@ResponseStatus(HttpStatus.CREATED)
|
|
38
|
+
public UserDTO createUser(@RequestBody CreateUserRequest request) {
|
|
39
|
+
return userService.create(request);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@PutMapping("/{id}")
|
|
43
|
+
public UserDTO updateUser(@PathVariable Long id, @RequestBody UpdateUserRequest request) {
|
|
44
|
+
return userService.update(id, request);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@DeleteMapping("/{id}")
|
|
48
|
+
@ResponseStatus(HttpStatus.NO_CONTENT)
|
|
49
|
+
public void deleteUser(@PathVariable Long id) {
|
|
50
|
+
userService.delete(id);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Data & JPA
|
|
56
|
+
|
|
57
|
+
```java
|
|
58
|
+
import javax.persistence.*;
|
|
59
|
+
|
|
60
|
+
@Entity
|
|
61
|
+
@Table(name = "users")
|
|
62
|
+
public class User {
|
|
63
|
+
@Id
|
|
64
|
+
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
65
|
+
private Long id;
|
|
66
|
+
|
|
67
|
+
@Column(nullable = false)
|
|
68
|
+
private String name;
|
|
69
|
+
|
|
70
|
+
@Column(unique = true, nullable = false)
|
|
71
|
+
private String email;
|
|
72
|
+
|
|
73
|
+
@Temporal(TemporalType.TIMESTAMP)
|
|
74
|
+
@CreationTimestamp
|
|
75
|
+
private LocalDateTime createdAt;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Repository
|
|
79
|
+
import org.springframework.data.jpa.repository.JpaRepository;
|
|
80
|
+
|
|
81
|
+
public interface UserRepository extends JpaRepository<User, Long> {
|
|
82
|
+
Optional<User> findByEmail(String email);
|
|
83
|
+
List<User> findByNameContainingIgnoreCase(String name);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Service
|
|
87
|
+
@Service
|
|
88
|
+
public class UserService {
|
|
89
|
+
private final UserRepository repository;
|
|
90
|
+
|
|
91
|
+
public UserDTO findById(Long id) {
|
|
92
|
+
return repository.findById(id)
|
|
93
|
+
.map(this::toDTO)
|
|
94
|
+
.orElseThrow(() -> new NotFoundException("User not found"));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@Transactional
|
|
98
|
+
public UserDTO create(CreateUserRequest request) {
|
|
99
|
+
User user = new User();
|
|
100
|
+
user.setName(request.getName());
|
|
101
|
+
user.setEmail(request.getEmail());
|
|
102
|
+
return toDTO(repository.save(user));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Dependency Injection
|
|
108
|
+
|
|
109
|
+
```java
|
|
110
|
+
@Component
|
|
111
|
+
public class MyService {
|
|
112
|
+
private final UserRepository userRepository;
|
|
113
|
+
private final EmailService emailService;
|
|
114
|
+
|
|
115
|
+
// Constructor injection (preferred)
|
|
116
|
+
public MyService(UserRepository userRepository, EmailService emailService) {
|
|
117
|
+
this.userRepository = userRepository;
|
|
118
|
+
this.emailService = emailService;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Exception Handling
|
|
124
|
+
|
|
125
|
+
```java
|
|
126
|
+
@RestControllerAdvice
|
|
127
|
+
public class GlobalExceptionHandler {
|
|
128
|
+
|
|
129
|
+
@ExceptionHandler(NotFoundException.class)
|
|
130
|
+
public ResponseEntity<ErrorResponse> handleNotFound(NotFoundException e) {
|
|
131
|
+
return ResponseEntity
|
|
132
|
+
.status(HttpStatus.NOT_FOUND)
|
|
133
|
+
.body(new ErrorResponse("NOT_FOUND", e.getMessage()));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
@ExceptionHandler(Exception.class)
|
|
137
|
+
public ResponseEntity<ErrorResponse> handleGlobal(Exception e) {
|
|
138
|
+
return ResponseEntity
|
|
139
|
+
.status(HttpStatus.INTERNAL_SERVER_ERROR)
|
|
140
|
+
.body(new ErrorResponse("SERVER_ERROR", "Internal server error"));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Testing
|
|
146
|
+
|
|
147
|
+
```java
|
|
148
|
+
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
|
149
|
+
import org.springframework.boot.test.context.SpringBootTest;
|
|
150
|
+
import org.springframework.test.web.servlet.MockMvc;
|
|
151
|
+
|
|
152
|
+
@SpringBootTest
|
|
153
|
+
@AutoConfigureMockMvc
|
|
154
|
+
class UserControllerTests {
|
|
155
|
+
|
|
156
|
+
@Autowired
|
|
157
|
+
private MockMvc mockMvc;
|
|
158
|
+
|
|
159
|
+
@Test
|
|
160
|
+
void testGetUser() throws Exception {
|
|
161
|
+
mockMvc.perform(get("/api/users/1"))
|
|
162
|
+
.andExpect(status().isOk())
|
|
163
|
+
.andExpect(jsonPath("$.name").value("John"));
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Configuration
|
|
169
|
+
|
|
170
|
+
```yaml
|
|
171
|
+
# application.yml
|
|
172
|
+
spring:
|
|
173
|
+
datasource:
|
|
174
|
+
url: jdbc:postgresql://localhost:5432/mydb
|
|
175
|
+
username: user
|
|
176
|
+
password: pass
|
|
177
|
+
jpa:
|
|
178
|
+
hibernate:
|
|
179
|
+
ddl-auto: validate
|
|
180
|
+
server:
|
|
181
|
+
port: 8080
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Best Practices
|
|
185
|
+
|
|
186
|
+
1. **Use constructor injection**
|
|
187
|
+
2. **Keep controllers thin**
|
|
188
|
+
3. **Use services for business logic**
|
|
189
|
+
4. **Implement proper error handling**
|
|
190
|
+
5. **Write comprehensive tests**
|
|
191
|
+
6. **Use transactions for data consistency**
|
|
192
|
+
7. **Monitor application metrics**
|
|
193
|
+
|
|
194
|
+
## Resources
|
|
195
|
+
|
|
196
|
+
- [Spring Boot Docs](https://spring.io/projects/spring-boot)
|
|
197
|
+
- [Spring Data JPA](https://spring.io/projects/spring-data-jpa)
|
|
198
|
+
- [Spring Security](https://spring.io/projects/spring-security)
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Node.js Express Server
|
|
2
|
+
|
|
3
|
+
Fast, unopinionated web application framework.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install express dotenv cors
|
|
9
|
+
npm install -D nodemon
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Basic Server
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import express, { Express, Request, Response } from 'express';
|
|
16
|
+
import cors from 'cors';
|
|
17
|
+
import dotenv from 'dotenv';
|
|
18
|
+
|
|
19
|
+
dotenv.config();
|
|
20
|
+
|
|
21
|
+
const app: Express = express();
|
|
22
|
+
const PORT = process.env.PORT || 3000;
|
|
23
|
+
|
|
24
|
+
// Middleware
|
|
25
|
+
app.use(express.json());
|
|
26
|
+
app.use(express.urlencoded({ extended: true }));
|
|
27
|
+
app.use(cors());
|
|
28
|
+
|
|
29
|
+
// Routes
|
|
30
|
+
app.get('/', (req: Request, res: Response) => {
|
|
31
|
+
res.json({ message: 'Hello World' });
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
app.get('/api/users', async (req: Request, res: Response) => {
|
|
35
|
+
try {
|
|
36
|
+
const users = await db.users.find();
|
|
37
|
+
res.json(users);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
res.status(500).json({ error: 'Internal server error' });
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
app.post('/api/users', async (req: Request, res: Response) => {
|
|
44
|
+
const { email, name } = req.body;
|
|
45
|
+
|
|
46
|
+
if (!email || !name) {
|
|
47
|
+
return res.status(400).json({ error: 'Missing required fields' });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
const user = await db.users.create({ email, name });
|
|
52
|
+
res.status(201).json(user);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
res.status(500).json({ error: 'Failed to create user' });
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// 404 handler
|
|
59
|
+
app.use((req: Request, res: Response) => {
|
|
60
|
+
res.status(404).json({ error: 'Route not found' });
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Error handler
|
|
64
|
+
app.use((err: any, req: Request, res: Response) => {
|
|
65
|
+
console.error(err);
|
|
66
|
+
res.status(err.statusCode || 500).json({
|
|
67
|
+
error: err.message || 'Internal server error'
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
app.listen(PORT, () => {
|
|
72
|
+
console.log(`Server running on port ${PORT}`);
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Routing
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { Router } from 'express';
|
|
80
|
+
|
|
81
|
+
const userRouter = Router();
|
|
82
|
+
|
|
83
|
+
userRouter.get('/', async (req, res) => {
|
|
84
|
+
const users = await db.users.find();
|
|
85
|
+
res.json(users);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
userRouter.get('/:id', async (req, res) => {
|
|
89
|
+
const user = await db.users.findById(req.params.id);
|
|
90
|
+
if (!user) return res.status(404).json({ error: 'Not found' });
|
|
91
|
+
res.json(user);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
userRouter.post('/', async (req, res) => {
|
|
95
|
+
const user = await db.users.create(req.body);
|
|
96
|
+
res.status(201).json(user);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
userRouter.patch('/:id', async (req, res) => {
|
|
100
|
+
const user = await db.users.update(req.params.id, req.body);
|
|
101
|
+
res.json(user);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
userRouter.delete('/:id', async (req, res) => {
|
|
105
|
+
await db.users.delete(req.params.id);
|
|
106
|
+
res.status(204).send();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
app.use('/api/users', userRouter);
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Middleware
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
// Authentication middleware
|
|
116
|
+
const authenticate = (req: any, res: Response, next: Function) => {
|
|
117
|
+
const token = req.headers.authorization?.split(' ')[1];
|
|
118
|
+
|
|
119
|
+
if (!token) {
|
|
120
|
+
return res.status(401).json({ error: 'Unauthorized' });
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
try {
|
|
124
|
+
const decoded = jwt.verify(token, process.env.JWT_SECRET!);
|
|
125
|
+
req.user = decoded;
|
|
126
|
+
next();
|
|
127
|
+
} catch (error) {
|
|
128
|
+
res.status(401).json({ error: 'Invalid token' });
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// Logging middleware
|
|
133
|
+
app.use((req, res, next) => {
|
|
134
|
+
console.log(`${req.method} ${req.path}`);
|
|
135
|
+
next();
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// Rate limiting
|
|
139
|
+
import rateLimit from 'express-rate-limit';
|
|
140
|
+
|
|
141
|
+
const limiter = rateLimit({
|
|
142
|
+
windowMs: 15 * 60 * 1000,
|
|
143
|
+
max: 100
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
app.use('/api/', limiter);
|
|
147
|
+
|
|
148
|
+
// Protected route
|
|
149
|
+
app.get('/api/protected', authenticate, (req: any, res) => {
|
|
150
|
+
res.json({ message: 'Protected data', user: req.user });
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Best Practices
|
|
155
|
+
|
|
156
|
+
✅ **Structure** - Separate routes, controllers, services
|
|
157
|
+
✅ **Error handling** - Global error handler
|
|
158
|
+
✅ **Validation** - Validate input data
|
|
159
|
+
✅ **Logging** - Log requests and errors
|
|
160
|
+
✅ **Security** - CORS, rate limiting, input sanitization
|
|
161
|
+
|
|
162
|
+
## Resources
|
|
163
|
+
|
|
164
|
+
- [Express Documentation](https://expressjs.com/)
|
|
165
|
+
- [Express Best Practices](https://expressjs.com/en/advanced/best-practice-security.html)
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Node.js
|
|
2
|
+
|
|
3
|
+
JavaScript runtime for building scalable backend services with async/await and event-driven architecture.
|
|
4
|
+
|
|
5
|
+
## Event Loop & Async Model
|
|
6
|
+
|
|
7
|
+
Node.js uses a non-blocking, event-driven architecture:
|
|
8
|
+
- **Single-threaded**: Executes JavaScript in a single thread
|
|
9
|
+
- **Non-blocking I/O**: File/network operations don't block execution
|
|
10
|
+
- **Callbacks/Promises/Async-Await**: Handle asynchronous operations
|
|
11
|
+
- **libuv**: Handles actual async work with thread pool
|
|
12
|
+
|
|
13
|
+
### Async Patterns
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
// Callbacks (avoid - callback hell)
|
|
17
|
+
fs.readFile('file.txt', (err, data) => {
|
|
18
|
+
if (err) throw err;
|
|
19
|
+
console.log(data);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
// Promises (better)
|
|
23
|
+
fs.promises.readFile('file.txt')
|
|
24
|
+
.then(data => console.log(data))
|
|
25
|
+
.catch(err => console.error(err));
|
|
26
|
+
|
|
27
|
+
// Async-Await (best - looks synchronous)
|
|
28
|
+
async function readFile() {
|
|
29
|
+
try {
|
|
30
|
+
const data = await fs.promises.readFile('file.txt');
|
|
31
|
+
console.log(data);
|
|
32
|
+
} catch (err) {
|
|
33
|
+
console.error(err);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Core Modules
|
|
39
|
+
|
|
40
|
+
### HTTP Server
|
|
41
|
+
```javascript
|
|
42
|
+
const http = require('http');
|
|
43
|
+
|
|
44
|
+
const server = http.createServer((req, res) => {
|
|
45
|
+
if (req.url === '/' && req.method === 'GET') {
|
|
46
|
+
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
|
47
|
+
res.end('Hello, World!');
|
|
48
|
+
} else {
|
|
49
|
+
res.writeHead(404);
|
|
50
|
+
res.end();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
server.listen(3000);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### File System
|
|
58
|
+
```javascript
|
|
59
|
+
const fs = require('fs').promises;
|
|
60
|
+
|
|
61
|
+
// Read file
|
|
62
|
+
const content = await fs.readFile('file.txt', 'utf-8');
|
|
63
|
+
|
|
64
|
+
// Write file
|
|
65
|
+
await fs.writeFile('file.txt', 'content');
|
|
66
|
+
|
|
67
|
+
// List files
|
|
68
|
+
const files = await fs.readdir('.');
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Streams (for large data)
|
|
72
|
+
```javascript
|
|
73
|
+
// Read file in chunks
|
|
74
|
+
const readStream = fs.createReadStream('large-file.txt');
|
|
75
|
+
readStream.on('data', chunk => {
|
|
76
|
+
console.log(`Chunk size: ${chunk.length}`);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
// Pipe (chain streams)
|
|
80
|
+
fs.createReadStream('input.txt')
|
|
81
|
+
.pipe(zlib.createGzip())
|
|
82
|
+
.pipe(fs.createWriteStream('input.txt.gz'));
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Best Practices
|
|
86
|
+
|
|
87
|
+
1. **Error Handling**
|
|
88
|
+
- Always catch promise rejections
|
|
89
|
+
- Use try-catch in async functions
|
|
90
|
+
- Handle uncaught exceptions at app level
|
|
91
|
+
|
|
92
|
+
2. **Performance**
|
|
93
|
+
- Use async operations, never block event loop
|
|
94
|
+
- Cache expensive operations
|
|
95
|
+
- Use clustering for CPU-bound work
|
|
96
|
+
- Monitor event loop lag
|
|
97
|
+
|
|
98
|
+
3. **Security**
|
|
99
|
+
- Validate all input
|
|
100
|
+
- Use environment variables for secrets
|
|
101
|
+
- Implement rate limiting
|
|
102
|
+
- Use HTTPS in production
|
|
103
|
+
- Keep dependencies updated
|
|
104
|
+
|
|
105
|
+
4. **Memory Management**
|
|
106
|
+
- Avoid memory leaks (remove event listeners)
|
|
107
|
+
- Monitor heap usage
|
|
108
|
+
- Use streams for large files/data
|
|
109
|
+
- Be careful with circular references
|
|
110
|
+
|
|
111
|
+
## Environment
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
// Access environment variables
|
|
115
|
+
const port = process.env.PORT || 3000;
|
|
116
|
+
const nodeEnv = process.env.NODE_ENV || 'development';
|
|
117
|
+
|
|
118
|
+
// .env file (use dotenv package)
|
|
119
|
+
require('dotenv').config();
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Clustering
|
|
123
|
+
|
|
124
|
+
```javascript
|
|
125
|
+
const cluster = require('cluster');
|
|
126
|
+
const os = require('os');
|
|
127
|
+
|
|
128
|
+
if (cluster.isMaster) {
|
|
129
|
+
// Fork worker processes
|
|
130
|
+
for (let i = 0; i < os.cpus().length; i++) {
|
|
131
|
+
cluster.fork();
|
|
132
|
+
}
|
|
133
|
+
} else {
|
|
134
|
+
// Worker process
|
|
135
|
+
require('./server.js').start();
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Resources
|
|
140
|
+
|
|
141
|
+
- [Node.js Official Docs](https://nodejs.org/docs)
|
|
142
|
+
- [Event Loop Guide](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/)
|
|
143
|
+
- [Streams Documentation](https://nodejs.org/api/stream.html)
|