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,156 @@
|
|
|
1
|
+
# Laravel
|
|
2
|
+
|
|
3
|
+
PHP framework with elegant syntax for rapid web application development.
|
|
4
|
+
|
|
5
|
+
## Routes & Controllers
|
|
6
|
+
|
|
7
|
+
```php
|
|
8
|
+
// routes/web.php
|
|
9
|
+
Route::get('/users/{id}', [UserController::class, 'show']);
|
|
10
|
+
Route::post('/users', [UserController::class, 'store']);
|
|
11
|
+
Route::resource('posts', PostController::class); // RESTful routes
|
|
12
|
+
|
|
13
|
+
// app/Http/Controllers/UserController.php
|
|
14
|
+
class UserController extends Controller {
|
|
15
|
+
public function show($id) {
|
|
16
|
+
$user = User::findOrFail($id);
|
|
17
|
+
return view('users.show', ['user' => $user]);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public function store(Request $request) {
|
|
21
|
+
$validated = $request->validate([
|
|
22
|
+
'name' => 'required|string',
|
|
23
|
+
'email' => 'required|email|unique:users',
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
$user = User::create($validated);
|
|
27
|
+
return redirect('/users/' . $user->id);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Eloquent ORM
|
|
33
|
+
|
|
34
|
+
```php
|
|
35
|
+
// app/Models/User.php
|
|
36
|
+
class User extends Model {
|
|
37
|
+
protected $fillable = ['name', 'email', 'password'];
|
|
38
|
+
protected $hidden = ['password'];
|
|
39
|
+
|
|
40
|
+
public function posts() {
|
|
41
|
+
return $this->hasMany(Post::class);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Queries
|
|
46
|
+
$user = User::find(1);
|
|
47
|
+
$user = User::where('email', 'john@example.com')->first();
|
|
48
|
+
$users = User::where('age', '>', 18)->get();
|
|
49
|
+
|
|
50
|
+
// Relationships
|
|
51
|
+
$user = User::with('posts')->find(1);
|
|
52
|
+
$posts = $user->posts;
|
|
53
|
+
|
|
54
|
+
// Create/Update
|
|
55
|
+
$user = User::create(['name' => 'John', 'email' => 'john@example.com']);
|
|
56
|
+
$user->update(['name' => 'Jane']);
|
|
57
|
+
$user->delete();
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Migrations & Schema
|
|
61
|
+
|
|
62
|
+
```php
|
|
63
|
+
// database/migrations/2023_10_01_create_users_table.php
|
|
64
|
+
Schema::create('users', function (Blueprint $table) {
|
|
65
|
+
$table->id();
|
|
66
|
+
$table->string('name');
|
|
67
|
+
$table->string('email')->unique();
|
|
68
|
+
$table->timestamp('email_verified_at')->nullable();
|
|
69
|
+
$table->timestamps();
|
|
70
|
+
$table->index('email');
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Views (Blade)
|
|
75
|
+
|
|
76
|
+
```blade
|
|
77
|
+
<!-- resources/views/users/show.blade.php -->
|
|
78
|
+
@extends('layouts.app')
|
|
79
|
+
|
|
80
|
+
@section('content')
|
|
81
|
+
<h1>{{ $user->name }}</h1>
|
|
82
|
+
<p>{{ $user->email }}</p>
|
|
83
|
+
|
|
84
|
+
@if($user->posts->count())
|
|
85
|
+
<ul>
|
|
86
|
+
@foreach($user->posts as $post)
|
|
87
|
+
<li>{{ $post->title }}</li>
|
|
88
|
+
@endforeach
|
|
89
|
+
</ul>
|
|
90
|
+
@else
|
|
91
|
+
<p>No posts yet</p>
|
|
92
|
+
@endif
|
|
93
|
+
@endsection
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Middleware & Authentication
|
|
97
|
+
|
|
98
|
+
```php
|
|
99
|
+
// app/Http/Middleware/CheckAdmin.php
|
|
100
|
+
class CheckAdmin {
|
|
101
|
+
public function handle(Request $request, Closure $next) {
|
|
102
|
+
if (!auth()->user()?->isAdmin()) {
|
|
103
|
+
abort(403);
|
|
104
|
+
}
|
|
105
|
+
return $next($request);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// routes/web.php
|
|
110
|
+
Route::middleware('auth', 'admin')->group(function () {
|
|
111
|
+
Route::delete('/users/{id}', [UserController::class, 'destroy']);
|
|
112
|
+
});
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Validation
|
|
116
|
+
|
|
117
|
+
```php
|
|
118
|
+
$validated = $request->validate([
|
|
119
|
+
'name' => 'required|string|max:255',
|
|
120
|
+
'email' => 'required|email|unique:users',
|
|
121
|
+
'password' => 'required|confirmed|min:8',
|
|
122
|
+
'age' => 'integer|min:18',
|
|
123
|
+
]);
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Testing
|
|
127
|
+
|
|
128
|
+
```php
|
|
129
|
+
class UserTest extends TestCase {
|
|
130
|
+
public function test_can_create_user() {
|
|
131
|
+
$response = $this->post('/users', [
|
|
132
|
+
'name' => 'John',
|
|
133
|
+
'email' => 'john@example.com',
|
|
134
|
+
]);
|
|
135
|
+
|
|
136
|
+
$this->assertDatabaseHas('users', [
|
|
137
|
+
'email' => 'john@example.com'
|
|
138
|
+
]);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Best Practices
|
|
144
|
+
|
|
145
|
+
1. **Use artisan commands**
|
|
146
|
+
2. **Leverage Eloquent relationships**
|
|
147
|
+
3. **Keep controllers clean**
|
|
148
|
+
4. **Use middleware for cross-cutting concerns**
|
|
149
|
+
5. **Write comprehensive tests**
|
|
150
|
+
6. **Use queues for long operations**
|
|
151
|
+
|
|
152
|
+
## Resources
|
|
153
|
+
|
|
154
|
+
- [Laravel Documentation](https://laravel.com/docs)
|
|
155
|
+
- [Eloquent ORM](https://laravel.com/docs/eloquent)
|
|
156
|
+
- [Laravel Testing](https://laravel.com/docs/testing)
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# Django
|
|
2
|
+
|
|
3
|
+
Batteries-included Python web framework with ORM, admin, and built-in security.
|
|
4
|
+
|
|
5
|
+
## Models & ORM
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from django.db import models
|
|
9
|
+
|
|
10
|
+
class User(models.Model):
|
|
11
|
+
name = models.CharField(max_length=100)
|
|
12
|
+
email = models.EmailField(unique=True)
|
|
13
|
+
created_at = models.DateTimeField(auto_now_add=True)
|
|
14
|
+
|
|
15
|
+
class Meta:
|
|
16
|
+
ordering = ['-created_at']
|
|
17
|
+
|
|
18
|
+
# Queries
|
|
19
|
+
users = User.objects.filter(name__icontains='john')
|
|
20
|
+
user = User.objects.get(id=1)
|
|
21
|
+
User.objects.create(name='Jane', email='jane@example.com')
|
|
22
|
+
user.delete()
|
|
23
|
+
|
|
24
|
+
# Relations
|
|
25
|
+
class Post(models.Model):
|
|
26
|
+
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
|
27
|
+
title = models.CharField(max_length=200)
|
|
28
|
+
|
|
29
|
+
posts = User.objects.filter(id=1).prefetch_related('post_set')
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Views & URLs
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from django.views import View
|
|
36
|
+
from django.http import JsonResponse
|
|
37
|
+
from django.views.decorators.http import require_http_methods
|
|
38
|
+
|
|
39
|
+
class UserView(View):
|
|
40
|
+
def get(self, request, user_id):
|
|
41
|
+
user = User.objects.get(id=user_id)
|
|
42
|
+
return JsonResponse({'id': user.id, 'name': user.name})
|
|
43
|
+
|
|
44
|
+
def post(self, request):
|
|
45
|
+
data = json.loads(request.body)
|
|
46
|
+
user = User.objects.create(**data)
|
|
47
|
+
return JsonResponse({'id': user.id}, status=201)
|
|
48
|
+
|
|
49
|
+
# Function-based views
|
|
50
|
+
@require_http_methods(['GET', 'POST'])
|
|
51
|
+
def user_list(request):
|
|
52
|
+
if request.method == 'GET':
|
|
53
|
+
users = User.objects.all()
|
|
54
|
+
return JsonResponse(list(users.values()), safe=False)
|
|
55
|
+
else:
|
|
56
|
+
data = json.loads(request.body)
|
|
57
|
+
user = User.objects.create(**data)
|
|
58
|
+
return JsonResponse({'id': user.id}, status=201)
|
|
59
|
+
|
|
60
|
+
# URLs
|
|
61
|
+
from django.urls import path
|
|
62
|
+
urlpatterns = [
|
|
63
|
+
path('users/<int:user_id>/', UserView.as_view()),
|
|
64
|
+
path('users/', user_list),
|
|
65
|
+
]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Forms & Validation
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from django import forms
|
|
72
|
+
|
|
73
|
+
class UserForm(forms.ModelForm):
|
|
74
|
+
class Meta:
|
|
75
|
+
model = User
|
|
76
|
+
fields = ['name', 'email']
|
|
77
|
+
|
|
78
|
+
def clean_email(self):
|
|
79
|
+
email = self.cleaned_data['email']
|
|
80
|
+
if User.objects.filter(email=email).exists():
|
|
81
|
+
raise forms.ValidationError('Email already exists')
|
|
82
|
+
return email
|
|
83
|
+
|
|
84
|
+
# In view
|
|
85
|
+
form = UserForm(request.POST)
|
|
86
|
+
if form.is_valid():
|
|
87
|
+
form.save()
|
|
88
|
+
else:
|
|
89
|
+
return JsonResponse(form.errors, status=400)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Admin Interface
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from django.contrib import admin
|
|
96
|
+
|
|
97
|
+
@admin.register(User)
|
|
98
|
+
class UserAdmin(admin.ModelAdmin):
|
|
99
|
+
list_display = ['name', 'email', 'created_at']
|
|
100
|
+
list_filter = ['created_at']
|
|
101
|
+
search_fields = ['name', 'email']
|
|
102
|
+
readonly_fields = ['created_at']
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Middleware & Authentication
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from django.contrib.auth.decorators import login_required
|
|
109
|
+
from django.views.decorators.csrf import csrf_exempt
|
|
110
|
+
|
|
111
|
+
@login_required
|
|
112
|
+
def protected_view(request):
|
|
113
|
+
return JsonResponse({'user': request.user.username})
|
|
114
|
+
|
|
115
|
+
# Middleware
|
|
116
|
+
from django.utils.deprecation import MiddlewareMixin
|
|
117
|
+
|
|
118
|
+
class CustomMiddleware(MiddlewareMixin):
|
|
119
|
+
def process_request(self, request):
|
|
120
|
+
request.custom_data = 'value'
|
|
121
|
+
return None
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Django REST Framework
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
from rest_framework import serializers, viewsets
|
|
128
|
+
from rest_framework.decorators import action
|
|
129
|
+
|
|
130
|
+
class UserSerializer(serializers.ModelSerializer):
|
|
131
|
+
class Meta:
|
|
132
|
+
model = User
|
|
133
|
+
fields = ['id', 'name', 'email']
|
|
134
|
+
|
|
135
|
+
class UserViewSet(viewsets.ModelViewSet):
|
|
136
|
+
queryset = User.objects.all()
|
|
137
|
+
serializer_class = UserSerializer
|
|
138
|
+
|
|
139
|
+
@action(detail=True, methods=['get'])
|
|
140
|
+
def recent_posts(self, request, pk=None):
|
|
141
|
+
user = self.get_object()
|
|
142
|
+
posts = user.post_set.all()[:5]
|
|
143
|
+
return Response(PostSerializer(posts, many=True).data)
|
|
144
|
+
|
|
145
|
+
# Router
|
|
146
|
+
from rest_framework.routers import DefaultRouter
|
|
147
|
+
router = DefaultRouter()
|
|
148
|
+
router.register(r'users', UserViewSet)
|
|
149
|
+
urlpatterns = router.urls
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Database Migrations
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Create migration
|
|
156
|
+
python manage.py makemigrations
|
|
157
|
+
|
|
158
|
+
# Apply migration
|
|
159
|
+
python manage.py migrate
|
|
160
|
+
|
|
161
|
+
# Show migrations
|
|
162
|
+
python manage.py showmigrations
|
|
163
|
+
|
|
164
|
+
# Rollback
|
|
165
|
+
python manage.py migrate app 0001
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Testing
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
from django.test import TestCase, Client
|
|
172
|
+
|
|
173
|
+
class UserTests(TestCase):
|
|
174
|
+
def setUp(self):
|
|
175
|
+
self.user = User.objects.create(name='John', email='john@example.com')
|
|
176
|
+
|
|
177
|
+
def test_user_creation(self):
|
|
178
|
+
self.assertEqual(self.user.name, 'John')
|
|
179
|
+
|
|
180
|
+
def test_api_get(self):
|
|
181
|
+
client = Client()
|
|
182
|
+
response = client.get(f'/users/{self.user.id}/')
|
|
183
|
+
self.assertEqual(response.status_code, 200)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Performance & Best Practices
|
|
187
|
+
|
|
188
|
+
1. **Use select_related/prefetch_related** for joins
|
|
189
|
+
2. **Index frequently queried fields**
|
|
190
|
+
3. **Use Django ORM, avoid raw SQL**
|
|
191
|
+
4. **Implement proper caching**
|
|
192
|
+
5. **Use Celery for async tasks**
|
|
193
|
+
6. **Implement proper error handling**
|
|
194
|
+
7. **Use middleware for cross-cutting concerns**
|
|
195
|
+
|
|
196
|
+
## Resources
|
|
197
|
+
|
|
198
|
+
- [Django Official Docs](https://docs.djangoproject.com/)
|
|
199
|
+
- [Django REST Framework](https://www.django-rest-framework.org/)
|
|
200
|
+
- [Two Scoops of Django](https://www.feldroy.com/books/two-scoops-of-django)
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# FastAPI
|
|
2
|
+
|
|
3
|
+
Modern, fast Python web framework for building APIs with automatic documentation and type validation.
|
|
4
|
+
|
|
5
|
+
## Hello World
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
from fastapi import FastAPI
|
|
9
|
+
from typing import Optional
|
|
10
|
+
|
|
11
|
+
app = FastAPI()
|
|
12
|
+
|
|
13
|
+
@app.get("/")
|
|
14
|
+
async def read_root():
|
|
15
|
+
return {"message": "Hello, World!"}
|
|
16
|
+
|
|
17
|
+
@app.get("/items/{item_id}")
|
|
18
|
+
async def read_item(item_id: int, q: Optional[str] = None):
|
|
19
|
+
return {"item_id": item_id, "q": q}
|
|
20
|
+
|
|
21
|
+
# Run: uvicorn main:app --reload
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Request/Response Models (Pydantic)
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from pydantic import BaseModel
|
|
28
|
+
|
|
29
|
+
class User(BaseModel):
|
|
30
|
+
id: int
|
|
31
|
+
name: str
|
|
32
|
+
email: str
|
|
33
|
+
age: Optional[int] = None
|
|
34
|
+
|
|
35
|
+
@app.post("/users/")
|
|
36
|
+
async def create_user(user: User):
|
|
37
|
+
return {"created": user}
|
|
38
|
+
|
|
39
|
+
# Validation happens automatically
|
|
40
|
+
# POST /users/ with invalid data returns 422 error
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Path Parameters, Query Parameters
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
@app.get("/users/{user_id}")
|
|
47
|
+
async def read_user(
|
|
48
|
+
user_id: int, # Path parameter
|
|
49
|
+
skip: int = 0, # Query parameter with default
|
|
50
|
+
limit: int = 10,
|
|
51
|
+
search: Optional[str] = None
|
|
52
|
+
):
|
|
53
|
+
return {"user_id": user_id, "skip": skip, "limit": limit}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Request Body
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
@app.post("/users/")
|
|
60
|
+
async def create_user(user: User):
|
|
61
|
+
# user is automatically parsed and validated
|
|
62
|
+
# Returns 422 if validation fails
|
|
63
|
+
return user
|
|
64
|
+
|
|
65
|
+
# With multiple body parameters
|
|
66
|
+
class Item(BaseModel):
|
|
67
|
+
name: str
|
|
68
|
+
price: float
|
|
69
|
+
|
|
70
|
+
@app.post("/purchases/")
|
|
71
|
+
async def create_purchase(user: User, item: Item):
|
|
72
|
+
return {"user": user, "item": item}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Status Codes & Headers
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
from fastapi import status
|
|
79
|
+
|
|
80
|
+
@app.post("/users/", status_code=status.HTTP_201_CREATED)
|
|
81
|
+
async def create_user(user: User):
|
|
82
|
+
return user
|
|
83
|
+
|
|
84
|
+
@app.get("/items/", response_model=List[Item])
|
|
85
|
+
async def list_items():
|
|
86
|
+
return [Item(name="item1", price=10)]
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Dependencies & Middleware
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from fastapi import Depends, Header
|
|
93
|
+
|
|
94
|
+
async def verify_token(token: str = Header(...)):
|
|
95
|
+
if token != "secret":
|
|
96
|
+
raise Exception("Invalid token")
|
|
97
|
+
return token
|
|
98
|
+
|
|
99
|
+
@app.get("/protected")
|
|
100
|
+
async def protected_route(token: str = Depends(verify_token)):
|
|
101
|
+
return {"token": token}
|
|
102
|
+
|
|
103
|
+
# Database dependency
|
|
104
|
+
async def get_db():
|
|
105
|
+
db = Database()
|
|
106
|
+
try:
|
|
107
|
+
yield db
|
|
108
|
+
finally:
|
|
109
|
+
await db.close()
|
|
110
|
+
|
|
111
|
+
@app.get("/users")
|
|
112
|
+
async def list_users(db = Depends(get_db)):
|
|
113
|
+
return await db.users.all()
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Exception Handling
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
from fastapi import HTTPException
|
|
120
|
+
|
|
121
|
+
@app.get("/users/{user_id}")
|
|
122
|
+
async def read_user(user_id: int):
|
|
123
|
+
user = await db.users.get(user_id)
|
|
124
|
+
if not user:
|
|
125
|
+
raise HTTPException(status_code=404, detail="User not found")
|
|
126
|
+
return user
|
|
127
|
+
|
|
128
|
+
@app.exception_handler(ValueError)
|
|
129
|
+
async def value_error_handler(request, exc):
|
|
130
|
+
return JSONResponse(
|
|
131
|
+
status_code=400,
|
|
132
|
+
content={"detail": str(exc)},
|
|
133
|
+
)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Automatic Documentation
|
|
137
|
+
|
|
138
|
+
FastAPI automatically generates OpenAPI docs:
|
|
139
|
+
- **Swagger UI**: http://localhost:8000/docs
|
|
140
|
+
- **ReDoc**: http://localhost:8000/redoc
|
|
141
|
+
- **OpenAPI JSON**: http://localhost:8000/openapi.json
|
|
142
|
+
|
|
143
|
+
## Best Practices
|
|
144
|
+
|
|
145
|
+
1. **Use type hints**: Enables validation and docs
|
|
146
|
+
2. **Async by default**: Use async functions for better performance
|
|
147
|
+
3. **Pydantic models**: For request/response validation
|
|
148
|
+
4. **Dependencies**: For reusable logic (auth, DB access)
|
|
149
|
+
5. **Logging**: Use Python's logging module
|
|
150
|
+
6. **Testing**: pytest with TestClient
|
|
151
|
+
|
|
152
|
+
## Testing
|
|
153
|
+
|
|
154
|
+
```python
|
|
155
|
+
from fastapi.testclient import TestClient
|
|
156
|
+
|
|
157
|
+
client = TestClient(app)
|
|
158
|
+
|
|
159
|
+
def test_read_root():
|
|
160
|
+
response = client.get("/")
|
|
161
|
+
assert response.status_code == 200
|
|
162
|
+
assert response.json() == {"message": "Hello, World!"}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Resources
|
|
166
|
+
|
|
167
|
+
- [FastAPI Docs](https://fastapi.tiangolo.com/)
|
|
168
|
+
- [Pydantic Validation](https://docs.pydantic.dev/)
|
|
169
|
+
- [Async Python](https://docs.python.org/3/library/asyncio.html)
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# Ruby on Rails
|
|
2
|
+
|
|
3
|
+
Convention-over-configuration framework for rapid web application development.
|
|
4
|
+
|
|
5
|
+
## Scaffolding & Models
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
rails generate scaffold User name:string email:string age:integer
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
# app/models/user.rb
|
|
13
|
+
class User < ApplicationRecord
|
|
14
|
+
has_many :posts
|
|
15
|
+
validates :name, :email, presence: true
|
|
16
|
+
validates :email, uniqueness: true
|
|
17
|
+
|
|
18
|
+
before_save :downcase_email
|
|
19
|
+
|
|
20
|
+
def full_email
|
|
21
|
+
"#{name} <#{email}>"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def downcase_email
|
|
27
|
+
self.email = email.downcase
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Routes & Controllers
|
|
33
|
+
|
|
34
|
+
```ruby
|
|
35
|
+
# config/routes.rb
|
|
36
|
+
Rails.application.routes.draw do
|
|
37
|
+
resources :users
|
|
38
|
+
resources :posts do
|
|
39
|
+
resources :comments
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
get 'dashboard', to: 'dashboard#index'
|
|
43
|
+
post 'login', to: 'sessions#create'
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# app/controllers/users_controller.rb
|
|
47
|
+
class UsersController < ApplicationController
|
|
48
|
+
before_action :set_user, only: [:show, :edit, :update, :destroy]
|
|
49
|
+
|
|
50
|
+
def index
|
|
51
|
+
@users = User.all
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def show
|
|
55
|
+
@posts = @user.posts
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def create
|
|
59
|
+
@user = User.new(user_params)
|
|
60
|
+
if @user.save
|
|
61
|
+
redirect_to @user, notice: 'User created'
|
|
62
|
+
else
|
|
63
|
+
render :new, status: :unprocessable_entity
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
private
|
|
68
|
+
|
|
69
|
+
def set_user
|
|
70
|
+
@user = User.find(params[:id])
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def user_params
|
|
74
|
+
params.require(:user).permit(:name, :email, :age)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Views (ERB)
|
|
80
|
+
|
|
81
|
+
```erb
|
|
82
|
+
<!-- app/views/users/show.html.erb -->
|
|
83
|
+
<h1><%= @user.name %></h1>
|
|
84
|
+
<p><%= @user.email %></p>
|
|
85
|
+
|
|
86
|
+
<h2>Posts</h2>
|
|
87
|
+
<% if @user.posts.any? %>
|
|
88
|
+
<ul>
|
|
89
|
+
<% @user.posts.each do |post| %>
|
|
90
|
+
<li><%= link_to post.title, post %></li>
|
|
91
|
+
<% end %>
|
|
92
|
+
</ul>
|
|
93
|
+
<% else %>
|
|
94
|
+
<p>No posts yet</p>
|
|
95
|
+
<% end %>
|
|
96
|
+
|
|
97
|
+
<%= link_to 'Edit', edit_user_path(@user) %>
|
|
98
|
+
<%= link_to 'Delete', user_path(@user), method: :delete, data: { confirm: 'Are you sure?' } %>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## ActiveRecord Queries
|
|
102
|
+
|
|
103
|
+
```ruby
|
|
104
|
+
# Find
|
|
105
|
+
user = User.find(1)
|
|
106
|
+
user = User.find_by(email: 'john@example.com')
|
|
107
|
+
users = User.where(age: 18..65)
|
|
108
|
+
|
|
109
|
+
# Create
|
|
110
|
+
user = User.create(name: 'John', email: 'john@example.com')
|
|
111
|
+
user = User.new(name: 'Jane')
|
|
112
|
+
user.save
|
|
113
|
+
|
|
114
|
+
# Update
|
|
115
|
+
user.update(name: 'Jane')
|
|
116
|
+
User.update_all(verified: true)
|
|
117
|
+
|
|
118
|
+
# Delete
|
|
119
|
+
user.destroy
|
|
120
|
+
User.delete_all
|
|
121
|
+
|
|
122
|
+
# Eager loading
|
|
123
|
+
users = User.includes(:posts)
|
|
124
|
+
users = User.preload(:posts)
|
|
125
|
+
|
|
126
|
+
# Aggregation
|
|
127
|
+
User.count
|
|
128
|
+
User.group(:age).count
|
|
129
|
+
User.where('age > ?', 18).average(:age)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Background Jobs (Active Job)
|
|
133
|
+
|
|
134
|
+
```ruby
|
|
135
|
+
class WelcomeEmailJob < ApplicationJob
|
|
136
|
+
queue_as :default
|
|
137
|
+
|
|
138
|
+
def perform(user)
|
|
139
|
+
UserMailer.welcome(user).deliver_later
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Queue the job
|
|
144
|
+
WelcomeEmailJob.perform_later(user)
|
|
145
|
+
WelcomeEmailJob.set(wait: 1.hour).perform_later(user)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Testing with RSpec
|
|
149
|
+
|
|
150
|
+
```ruby
|
|
151
|
+
require 'rails_helper'
|
|
152
|
+
|
|
153
|
+
RSpec.describe User, type: :model do
|
|
154
|
+
it { should validate_presence_of(:name) }
|
|
155
|
+
it { should validate_uniqueness_of(:email) }
|
|
156
|
+
|
|
157
|
+
describe '#full_email' do
|
|
158
|
+
it 'returns formatted email' do
|
|
159
|
+
user = User.create(name: 'John', email: 'john@example.com')
|
|
160
|
+
expect(user.full_email).to eq('John <john@example.com>')
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
RSpec.describe UsersController, type: :controller do
|
|
166
|
+
describe 'GET #show' do
|
|
167
|
+
it 'returns the user' do
|
|
168
|
+
user = User.create(name: 'John', email: 'john@example.com')
|
|
169
|
+
get :show, params: { id: user.id }
|
|
170
|
+
expect(response).to be_successful
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Best Practices
|
|
177
|
+
|
|
178
|
+
1. **Use generators for scaffolding**
|
|
179
|
+
2. **Keep models fat, controllers thin**
|
|
180
|
+
3. **Use scopes for common queries**
|
|
181
|
+
4. **Implement proper validations**
|
|
182
|
+
5. **Use background jobs for heavy operations**
|
|
183
|
+
6. **Write comprehensive tests**
|
|
184
|
+
7. **Use migrations for schema changes**
|
|
185
|
+
|
|
186
|
+
## Resources
|
|
187
|
+
|
|
188
|
+
- [Rails Guides](https://guides.rubyonrails.org/)
|
|
189
|
+
- [Active Record Documentation](https://guides.rubyonrails.org/active_record_basics.html)
|
|
190
|
+
- [Rails Testing Guide](https://guides.rubyonrails.org/testing.html)
|