@punks/cli 2.1.11 → 2.2.1
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/README.md +15 -1
- package/dist/index.js +0 -0
- package/package.json +1 -1
- package/dist/data/AGENTS.md +0 -119
- package/dist/data/catalog/hooks.ts +0 -26
- package/dist/data/catalog/lint.ts +0 -266
- package/dist/data/catalog/packs.ts +0 -327
- package/dist/data/catalog/skills.ts +0 -449
- package/dist/data/catalog/tools.ts +0 -48
- package/dist/data/control-plane.json +0 -3
- package/dist/data/hooks/format-edited-file.mjs +0 -699
- package/dist/data/hooks/format-edited-file.sh +0 -37
- package/dist/data/hooks/require-tests-for-pr.mjs +0 -206
- package/dist/data/hooks/scaffold-update-check.mjs +0 -181
- package/dist/data/hooks.test.ts +0 -109
- package/dist/data/scripts/sync-subagents.mjs +0 -524
- package/dist/data/subagents/manifest.mjs +0 -487
- package/dist/data/subagents/manifest.test.ts +0 -40
- package/dist/skills/agnostic/backend/backend-domain-structure/SKILL.md +0 -50
- package/dist/skills/agnostic/backend/backend-domain-structure/agents/openai.yaml +0 -4
- package/dist/skills/agnostic/backend/backend-domain-structure/references/layout.md +0 -167
- package/dist/skills/agnostic/backend/backend-recoverable-actions/SKILL.md +0 -49
- package/dist/skills/agnostic/backend/backend-recoverable-actions/agents/openai.yaml +0 -4
- package/dist/skills/agnostic/backend/backend-recoverable-actions/references/strategy-matrix.md +0 -34
- package/dist/skills/agnostic/backend/backend-recoverable-actions/references/test-matrix.md +0 -34
- package/dist/skills/agnostic/backend/logging-best-practices/SKILL.md +0 -127
- package/dist/skills/agnostic/backend/logging-best-practices/rules/context.md +0 -157
- package/dist/skills/agnostic/backend/logging-best-practices/rules/pitfalls.md +0 -118
- package/dist/skills/agnostic/backend/logging-best-practices/rules/structure.md +0 -193
- package/dist/skills/agnostic/backend/logging-best-practices/rules/wide-events.md +0 -113
- package/dist/skills/agnostic/cli/dp-cli/SKILL.md +0 -125
- package/dist/skills/agnostic/cli/dp-cli/references/commands.md +0 -70
- package/dist/skills/agnostic/cli/dp-cli/references/post-command-flow.md +0 -70
- package/dist/skills/agnostic/debug/debug-agent/SKILL.md +0 -184
- package/dist/skills/agnostic/docs/docs-onboarding/SKILL.md +0 -46
- package/dist/skills/agnostic/docs/docs-onboarding/agents/openai.yaml +0 -4
- package/dist/skills/agnostic/docs/docs-onboarding/references/artifact-contract.md +0 -67
- package/dist/skills/agnostic/docs/writing-beats/SKILL.md +0 -69
- package/dist/skills/agnostic/docs/writing-fragments/SKILL.md +0 -76
- package/dist/skills/agnostic/docs/writing-shape/SKILL.md +0 -75
- package/dist/skills/agnostic/frontend/agent-browser/.clawdhub/origin.json +0 -7
- package/dist/skills/agnostic/frontend/agent-browser/SKILL.md +0 -229
- package/dist/skills/agnostic/frontend/agent-browser/references/authentication.md +0 -202
- package/dist/skills/agnostic/frontend/agent-browser/references/commands.md +0 -259
- package/dist/skills/agnostic/frontend/agent-browser/references/proxy-support.md +0 -188
- package/dist/skills/agnostic/frontend/agent-browser/references/session-management.md +0 -193
- package/dist/skills/agnostic/frontend/agent-browser/references/snapshot-refs.md +0 -194
- package/dist/skills/agnostic/frontend/agent-browser/references/video-recording.md +0 -173
- package/dist/skills/agnostic/frontend/agent-browser/templates/authenticated-session.sh +0 -97
- package/dist/skills/agnostic/frontend/agent-browser/templates/capture-workflow.sh +0 -69
- package/dist/skills/agnostic/frontend/agent-browser/templates/form-automation.sh +0 -62
- package/dist/skills/agnostic/frontend/design-taste-frontend/SKILL.md +0 -226
- package/dist/skills/agnostic/frontend/frontend-domain-structure/SKILL.md +0 -55
- package/dist/skills/agnostic/frontend/frontend-domain-structure/agents/openai.yaml +0 -4
- package/dist/skills/agnostic/frontend/frontend-domain-structure/references/react/structure.md +0 -102
- package/dist/skills/agnostic/frontend/frontend-domain-structure/references/structure.md +0 -257
- package/dist/skills/agnostic/frontend/gpt-taste/SKILL.md +0 -74
- package/dist/skills/agnostic/frontend/image-taste-frontend/SKILL.md +0 -1102
- package/dist/skills/agnostic/frontend/redesign-existing-projects/SKILL.md +0 -178
- package/dist/skills/agnostic/generic/handoff/SKILL.md +0 -15
- package/dist/skills/agnostic/planning/create-plan/REFERENCE.md +0 -37
- package/dist/skills/agnostic/planning/create-plan/SKILL.md +0 -88
- package/dist/skills/agnostic/planning/create-plan/references/backlog-sync.md +0 -44
- package/dist/skills/agnostic/planning/create-plan/references/grill-phase.md +0 -87
- package/dist/skills/agnostic/planning/create-plan/references/plan-schema.md +0 -90
- package/dist/skills/agnostic/planning/create-plan/references/planner-phase.md +0 -42
- package/dist/skills/agnostic/planning/create-plan/references/stop-conditions.md +0 -18
- package/dist/skills/agnostic/planning/create-plan/references/tdd-phase.md +0 -48
- package/dist/skills/agnostic/planning/create-spec/SKILL.md +0 -111
- package/dist/skills/agnostic/planning/create-spec/assets/SPEC-TEMPLATE.md +0 -91
- package/dist/skills/agnostic/planning/create-spec/references/backlog-sync.md +0 -49
- package/dist/skills/agnostic/planning/create-spec/references/discovery.md +0 -54
- package/dist/skills/agnostic/planning/create-spec/references/folder-naming.md +0 -33
- package/dist/skills/agnostic/planning/create-spec/references/grill-phase.md +0 -47
- package/dist/skills/agnostic/planning/create-spec/references/handoff.md +0 -47
- package/dist/skills/agnostic/planning/create-spec/references/questioning.md +0 -51
- package/dist/skills/agnostic/planning/create-spec/references/spec-quality-bar.md +0 -58
- package/dist/skills/agnostic/planning/create-spec/references/wiki-bookkeeping.md +0 -50
- package/dist/skills/agnostic/planning/grill-me/SKILL.md +0 -28
- package/dist/skills/agnostic/planning/implement-spec/SKILL.md +0 -99
- package/dist/skills/agnostic/planning/implement-spec/assets/IMPLEMENTATION-NOTES-TEMPLATE.md +0 -53
- package/dist/skills/agnostic/planning/implement-spec/references/lifecycle.md +0 -199
- package/dist/skills/agnostic/planning/implement-spec/references/parallel-orchestration.md +0 -102
- package/dist/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +0 -74
- package/dist/skills/agnostic/planning/implement-spec/references/parallel.md +0 -56
- package/dist/skills/agnostic/planning/implement-spec/references/sequential.md +0 -43
- package/dist/skills/agnostic/planning/stack/SKILL.md +0 -89
- package/dist/skills/agnostic/planning/swarm-planner/SKILL.md +0 -179
- package/dist/skills/agnostic/quality/autoreview/SKILL.md +0 -191
- package/dist/skills/agnostic/quality/autoreview/scripts/autoreview +0 -1176
- package/dist/skills/agnostic/quality/autoreview/scripts/test-review-harness +0 -176
- package/dist/skills/agnostic/quality/simplify/SKILL.md +0 -14
- package/dist/skills/agnostic/quality/tdd/SKILL.md +0 -138
- package/dist/skills/agnostic/quality/tdd/deep-modules.md +0 -33
- package/dist/skills/agnostic/quality/tdd/interface-design.md +0 -31
- package/dist/skills/agnostic/quality/tdd/mocking.md +0 -59
- package/dist/skills/agnostic/quality/tdd/refactoring.md +0 -10
- package/dist/skills/agnostic/quality/tdd/tests.md +0 -61
- package/dist/skills/agnostic/requirements/requirements-grill/SKILL.md +0 -44
- package/dist/skills/agnostic/requirements/requirements-grill/references/artifact-output.md +0 -157
- package/dist/skills/agnostic/requirements/requirements-grill/references/grilling-flow.md +0 -69
- package/dist/skills/agnostic/requirements/requirements-grill/references/wiki-output.md +0 -101
- package/dist/skills/agnostic/requirements/write-backlog/EXAMPLES.md +0 -67
- package/dist/skills/agnostic/requirements/write-backlog/REFERENCE.md +0 -262
- package/dist/skills/agnostic/requirements/write-backlog/SKILL.md +0 -71
- package/dist/skills/agnostic/requirements/write-backlog/assets/concepts/backlog-model.md +0 -69
- package/dist/skills/agnostic/requirements/write-backlog/assets/concepts/story-shape.md +0 -66
- package/dist/skills/agnostic/requirements/write-backlog/assets/providers/azure-devops-create-payload.md +0 -63
- package/dist/skills/agnostic/requirements/write-backlog/assets/providers/github-projects-create-payload.md +0 -224
- package/dist/skills/agnostic/requirements/write-backlog/assets/providers/linear-create-payload.md +0 -76
- package/dist/skills/agnostic/requirements/write-backlog/assets/providers/monday-create-payload.md +0 -146
- package/dist/skills/agnostic/research/improve-codebase-architecture/REFERENCE.md +0 -78
- package/dist/skills/agnostic/research/improve-codebase-architecture/SKILL.md +0 -76
- package/dist/skills/agnostic/research/parallel-research/SKILL.md +0 -68
- package/dist/skills/agnostic/research/parallel-research/agents/openai.yaml +0 -4
- package/dist/skills/agnostic/subagents/swarm-planner/SKILL.md +0 -179
- package/dist/skills/agnostic/write-a-skill/SKILL.md +0 -117
- package/dist/skills/frameworks/better-auth/better-auth-best-practices/SKILL.md +0 -166
- package/dist/skills/frameworks/better-auth/better-auth-security-best-practices/SKILL.MD +0 -432
- package/dist/skills/frameworks/effect/effect-authoring/SKILL.md +0 -116
- package/dist/skills/frameworks/effect/effect-authoring/references/branded-types.md +0 -98
- package/dist/skills/frameworks/effect/effect-authoring/references/effect-atom-patterns.md +0 -257
- package/dist/skills/frameworks/effect/effect-authoring/references/effect-primitives.md +0 -144
- package/dist/skills/frameworks/effect/effect-authoring/references/error-patterns.md +0 -156
- package/dist/skills/frameworks/effect/effect-authoring/references/otel-patterns.md +0 -113
- package/dist/skills/frameworks/effect/effect-authoring/references/test-patterns.md +0 -146
- package/dist/skills/frameworks/effect/effect-backend-structure/SKILL.md +0 -96
- package/dist/skills/frameworks/effect/effect-backend-structure/agents/openai.yaml +0 -4
- package/dist/skills/frameworks/effect/effect-backend-structure/references/layout.md +0 -68
- package/dist/skills/frameworks/effect/effect-best-practices/SKILL.md +0 -517
- package/dist/skills/frameworks/effect/effect-best-practices/references/anti-patterns.md +0 -392
- package/dist/skills/frameworks/effect/effect-best-practices/references/effect-atom-patterns.md +0 -653
- package/dist/skills/frameworks/effect/effect-best-practices/references/error-patterns.md +0 -464
- package/dist/skills/frameworks/effect/effect-best-practices/references/language-server.md +0 -287
- package/dist/skills/frameworks/effect/effect-best-practices/references/layer-patterns.md +0 -495
- package/dist/skills/frameworks/effect/effect-best-practices/references/observability-patterns.md +0 -342
- package/dist/skills/frameworks/effect/effect-best-practices/references/rpc-cluster-patterns.md +0 -418
- package/dist/skills/frameworks/effect/effect-best-practices/references/schema-patterns.md +0 -353
- package/dist/skills/frameworks/effect/effect-best-practices/references/service-patterns.md +0 -299
- package/dist/skills/frameworks/effect/effect-recoverable-actions/SKILL.md +0 -65
- package/dist/skills/frameworks/effect/effect-recoverable-actions/agents/openai.yaml +0 -4
- package/dist/skills/frameworks/effect/effect-recoverable-actions/references/flow-examples.md +0 -154
- package/dist/skills/frameworks/effect/effect-recoverable-actions/references/source-backed-primitives.md +0 -104
- package/dist/skills/frameworks/effect/effect-recoverable-actions/references/strategy-matrix.md +0 -34
- package/dist/skills/frameworks/effect/effect-recoverable-actions/references/test-matrix.md +0 -36
- package/dist/skills/frameworks/elysia/elysiajs/SKILL.md +0 -475
- package/dist/skills/frameworks/elysia/elysiajs/examples/basic.ts +0 -9
- package/dist/skills/frameworks/elysia/elysiajs/examples/body-parser.ts +0 -33
- package/dist/skills/frameworks/elysia/elysiajs/examples/complex.ts +0 -112
- package/dist/skills/frameworks/elysia/elysiajs/examples/cookie.ts +0 -45
- package/dist/skills/frameworks/elysia/elysiajs/examples/error.ts +0 -38
- package/dist/skills/frameworks/elysia/elysiajs/examples/file.ts +0 -10
- package/dist/skills/frameworks/elysia/elysiajs/examples/guard.ts +0 -34
- package/dist/skills/frameworks/elysia/elysiajs/examples/map-response.ts +0 -15
- package/dist/skills/frameworks/elysia/elysiajs/examples/redirect.ts +0 -6
- package/dist/skills/frameworks/elysia/elysiajs/examples/rename.ts +0 -32
- package/dist/skills/frameworks/elysia/elysiajs/examples/schema.ts +0 -61
- package/dist/skills/frameworks/elysia/elysiajs/examples/state.ts +0 -6
- package/dist/skills/frameworks/elysia/elysiajs/examples/upload-file.ts +0 -20
- package/dist/skills/frameworks/elysia/elysiajs/examples/websocket.ts +0 -25
- package/dist/skills/frameworks/elysia/elysiajs/integrations/ai-sdk.md +0 -92
- package/dist/skills/frameworks/elysia/elysiajs/integrations/astro.md +0 -59
- package/dist/skills/frameworks/elysia/elysiajs/integrations/better-auth.md +0 -117
- package/dist/skills/frameworks/elysia/elysiajs/integrations/cloudflare-worker.md +0 -95
- package/dist/skills/frameworks/elysia/elysiajs/integrations/deno.md +0 -34
- package/dist/skills/frameworks/elysia/elysiajs/integrations/drizzle.md +0 -258
- package/dist/skills/frameworks/elysia/elysiajs/integrations/expo.md +0 -95
- package/dist/skills/frameworks/elysia/elysiajs/integrations/nextjs.md +0 -103
- package/dist/skills/frameworks/elysia/elysiajs/integrations/nodejs.md +0 -64
- package/dist/skills/frameworks/elysia/elysiajs/integrations/nuxt.md +0 -67
- package/dist/skills/frameworks/elysia/elysiajs/integrations/prisma.md +0 -93
- package/dist/skills/frameworks/elysia/elysiajs/integrations/react-email.md +0 -134
- package/dist/skills/frameworks/elysia/elysiajs/integrations/sveltekit.md +0 -53
- package/dist/skills/frameworks/elysia/elysiajs/integrations/tanstack-start.md +0 -87
- package/dist/skills/frameworks/elysia/elysiajs/integrations/vercel.md +0 -55
- package/dist/skills/frameworks/elysia/elysiajs/patterns/mvc.md +0 -380
- package/dist/skills/frameworks/elysia/elysiajs/plugins/bearer.md +0 -30
- package/dist/skills/frameworks/elysia/elysiajs/plugins/cors.md +0 -141
- package/dist/skills/frameworks/elysia/elysiajs/plugins/cron.md +0 -265
- package/dist/skills/frameworks/elysia/elysiajs/plugins/graphql-apollo.md +0 -90
- package/dist/skills/frameworks/elysia/elysiajs/plugins/graphql-yoga.md +0 -87
- package/dist/skills/frameworks/elysia/elysiajs/plugins/html.md +0 -188
- package/dist/skills/frameworks/elysia/elysiajs/plugins/jwt.md +0 -197
- package/dist/skills/frameworks/elysia/elysiajs/plugins/openapi.md +0 -246
- package/dist/skills/frameworks/elysia/elysiajs/plugins/opentelemetry.md +0 -167
- package/dist/skills/frameworks/elysia/elysiajs/plugins/server-timing.md +0 -71
- package/dist/skills/frameworks/elysia/elysiajs/plugins/static.md +0 -84
- package/dist/skills/frameworks/elysia/elysiajs/references/bun-fullstack-dev-server.md +0 -129
- package/dist/skills/frameworks/elysia/elysiajs/references/cookie.md +0 -187
- package/dist/skills/frameworks/elysia/elysiajs/references/deployment.md +0 -413
- package/dist/skills/frameworks/elysia/elysiajs/references/eden.md +0 -158
- package/dist/skills/frameworks/elysia/elysiajs/references/lifecycle.md +0 -198
- package/dist/skills/frameworks/elysia/elysiajs/references/macro.md +0 -83
- package/dist/skills/frameworks/elysia/elysiajs/references/plugin.md +0 -207
- package/dist/skills/frameworks/elysia/elysiajs/references/route.md +0 -331
- package/dist/skills/frameworks/elysia/elysiajs/references/testing.md +0 -385
- package/dist/skills/frameworks/elysia/elysiajs/references/validation.md +0 -491
- package/dist/skills/frameworks/elysia/elysiajs/references/websocket.md +0 -250
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/.github/workflows/branch-protection.yml +0 -24
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/.github/workflows/deploy.yml +0 -61
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/AGENTS.md +0 -5958
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/SKILL.md +0 -130
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/api-use-dto-serialization.md +0 -182
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/api-use-interceptors.md +0 -202
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/api-use-pipes.md +0 -205
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/api-versioning.md +0 -191
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/arch-avoid-circular-deps.md +0 -80
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/arch-feature-modules.md +0 -82
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/arch-module-sharing.md +0 -141
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/arch-single-responsibility.md +0 -106
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/arch-use-events.md +0 -108
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/arch-use-repository-pattern.md +0 -97
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/db-avoid-n-plus-one.md +0 -139
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/db-use-migrations.md +0 -129
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/db-use-transactions.md +0 -140
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/devops-graceful-shutdown.md +0 -222
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/devops-use-config-module.md +0 -167
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/devops-use-logging.md +0 -232
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/di-avoid-service-locator.md +0 -104
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/di-interface-segregation.md +0 -165
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/di-liskov-substitution.md +0 -221
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/di-prefer-constructor-injection.md +0 -86
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/di-scope-awareness.md +0 -94
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/di-use-interfaces-tokens.md +0 -101
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/error-handle-async-errors.md +0 -125
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/error-throw-http-exceptions.md +0 -114
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/error-use-exception-filters.md +0 -140
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/micro-use-health-checks.md +0 -226
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/micro-use-patterns.md +0 -167
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/micro-use-queues.md +0 -252
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/perf-async-hooks.md +0 -109
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/perf-lazy-loading.md +0 -121
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/perf-optimize-database.md +0 -131
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/perf-use-caching.md +0 -128
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/security-auth-jwt.md +0 -146
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/security-rate-limiting.md +0 -125
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/security-sanitize-output.md +0 -139
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/security-use-guards.md +0 -135
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/security-validate-all-input.md +0 -150
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/test-e2e-supertest.md +0 -178
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/test-mock-external-services.md +0 -179
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/rules/test-use-testing-module.md +0 -153
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/scripts/build-agents.ts +0 -299
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/scripts/build.sh +0 -16
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/scripts/package-lock.json +0 -237
- package/dist/skills/frameworks/nestjs/nestjs-best-practices/scripts/package.json +0 -15
- package/dist/skills/frameworks/nestjs/nestjs-expert/SKILL.md +0 -208
- package/dist/skills/frameworks/nestjs/nestjs-expert/references/authentication.md +0 -166
- package/dist/skills/frameworks/nestjs/nestjs-expert/references/controllers-routing.md +0 -111
- package/dist/skills/frameworks/nestjs/nestjs-expert/references/dtos-validation.md +0 -153
- package/dist/skills/frameworks/nestjs/nestjs-expert/references/migration-from-express.md +0 -1237
- package/dist/skills/frameworks/nestjs/nestjs-expert/references/services-di.md +0 -140
- package/dist/skills/frameworks/nestjs/nestjs-expert/references/testing-patterns.md +0 -186
- package/dist/skills/frameworks/nextjs/next-best-practices/SKILL.md +0 -153
- package/dist/skills/frameworks/nextjs/next-best-practices/async-patterns.md +0 -87
- package/dist/skills/frameworks/nextjs/next-best-practices/bundling.md +0 -180
- package/dist/skills/frameworks/nextjs/next-best-practices/data-patterns.md +0 -297
- package/dist/skills/frameworks/nextjs/next-best-practices/debug-tricks.md +0 -105
- package/dist/skills/frameworks/nextjs/next-best-practices/directives.md +0 -73
- package/dist/skills/frameworks/nextjs/next-best-practices/error-handling.md +0 -227
- package/dist/skills/frameworks/nextjs/next-best-practices/file-conventions.md +0 -140
- package/dist/skills/frameworks/nextjs/next-best-practices/font.md +0 -245
- package/dist/skills/frameworks/nextjs/next-best-practices/functions.md +0 -108
- package/dist/skills/frameworks/nextjs/next-best-practices/hydration-error.md +0 -91
- package/dist/skills/frameworks/nextjs/next-best-practices/image.md +0 -173
- package/dist/skills/frameworks/nextjs/next-best-practices/metadata.md +0 -301
- package/dist/skills/frameworks/nextjs/next-best-practices/parallel-routes.md +0 -287
- package/dist/skills/frameworks/nextjs/next-best-practices/route-handlers.md +0 -146
- package/dist/skills/frameworks/nextjs/next-best-practices/rsc-boundaries.md +0 -159
- package/dist/skills/frameworks/nextjs/next-best-practices/runtime-selection.md +0 -39
- package/dist/skills/frameworks/nextjs/next-best-practices/scripts.md +0 -141
- package/dist/skills/frameworks/nextjs/next-best-practices/self-hosting.md +0 -371
- package/dist/skills/frameworks/nextjs/next-best-practices/suspense-boundaries.md +0 -67
- package/dist/skills/frameworks/nextjs/next-cache-components/SKILL.md +0 -360
- package/dist/skills/frameworks/react/async-react-patterns/SKILL.md +0 -78
- package/dist/skills/frameworks/react/vercel-composition-patterns/AGENTS.md +0 -946
- package/dist/skills/frameworks/react/vercel-composition-patterns/SKILL.md +0 -89
- package/dist/skills/frameworks/react/vercel-composition-patterns/rules/architecture-avoid-boolean-props.md +0 -100
- package/dist/skills/frameworks/react/vercel-composition-patterns/rules/architecture-compound-components.md +0 -112
- package/dist/skills/frameworks/react/vercel-composition-patterns/rules/patterns-children-over-render-props.md +0 -87
- package/dist/skills/frameworks/react/vercel-composition-patterns/rules/patterns-explicit-variants.md +0 -100
- package/dist/skills/frameworks/react/vercel-composition-patterns/rules/react19-no-forwardref.md +0 -42
- package/dist/skills/frameworks/react/vercel-composition-patterns/rules/state-context-interface.md +0 -191
- package/dist/skills/frameworks/react/vercel-composition-patterns/rules/state-decouple-implementation.md +0 -113
- package/dist/skills/frameworks/react/vercel-composition-patterns/rules/state-lift-state.md +0 -125
- package/dist/skills/frameworks/react/vercel-react-best-practices/AGENTS.md +0 -3750
- package/dist/skills/frameworks/react/vercel-react-best-practices/SKILL.md +0 -148
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/advanced-effect-event-deps.md +0 -56
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/advanced-event-handler-refs.md +0 -55
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/advanced-init-once.md +0 -42
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/advanced-use-latest.md +0 -39
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/async-api-routes.md +0 -38
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/async-cheap-condition-before-await.md +0 -37
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/async-defer-await.md +0 -82
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/async-dependencies.md +0 -51
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/async-parallel.md +0 -28
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/async-suspense-boundaries.md +0 -99
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/bundle-barrel-imports.md +0 -60
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/bundle-conditional.md +0 -31
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/bundle-defer-third-party.md +0 -49
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/bundle-dynamic-imports.md +0 -35
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/bundle-preload.md +0 -50
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/client-event-listeners.md +0 -74
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/client-localstorage-schema.md +0 -71
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/client-passive-event-listeners.md +0 -48
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/client-swr-dedup.md +0 -56
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-batch-dom-css.md +0 -107
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-cache-function-results.md +0 -80
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-cache-property-access.md +0 -28
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-cache-storage.md +0 -70
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-combine-iterations.md +0 -32
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-early-exit.md +0 -50
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-flatmap-filter.md +0 -60
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-hoist-regexp.md +0 -45
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-index-maps.md +0 -37
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-length-check-first.md +0 -49
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-min-max-loop.md +0 -82
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-request-idle-callback.md +0 -105
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-set-map-lookups.md +0 -24
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/js-tosorted-immutable.md +0 -57
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-activity.md +0 -26
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-conditional-render.md +0 -40
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-content-visibility.md +0 -38
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-hoist-jsx.md +0 -46
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +0 -30
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-resource-hints.md +0 -85
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-script-defer-async.md +0 -68
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-svg-precision.md +0 -28
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rendering-usetransition-loading.md +0 -75
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-defer-reads.md +0 -39
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-dependencies.md +0 -45
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +0 -40
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-derived-state.md +0 -29
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-functional-setstate.md +0 -74
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-lazy-state-init.md +0 -58
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +0 -38
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-memo.md +0 -44
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +0 -45
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-no-inline-components.md +0 -82
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +0 -35
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-split-combined-hooks.md +0 -64
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-transitions.md +0 -40
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-use-deferred-value.md +0 -59
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +0 -73
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-after-nonblocking.md +0 -73
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-auth-actions.md +0 -96
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-cache-lru.md +0 -41
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-cache-react.md +0 -76
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-dedup-props.md +0 -65
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-hoist-static-io.md +0 -149
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-no-shared-module-state.md +0 -50
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-parallel-fetching.md +0 -83
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-parallel-nested-fetching.md +0 -34
- package/dist/skills/frameworks/react/vercel-react-best-practices/rules/server-serialization.md +0 -38
- package/dist/skills/frameworks/tanstack-query/tanstack-query/.claude-plugin/plugin.json +0 -12
- package/dist/skills/frameworks/tanstack-query/tanstack-query/SKILL.md +0 -849
- package/dist/skills/frameworks/tanstack-query/tanstack-query/assets/example-template.txt +0 -14
- package/dist/skills/frameworks/tanstack-query/tanstack-query/references/best-practices.md +0 -304
- package/dist/skills/frameworks/tanstack-query/tanstack-query/references/common-patterns.md +0 -271
- package/dist/skills/frameworks/tanstack-query/tanstack-query/references/example-reference.md +0 -26
- package/dist/skills/frameworks/tanstack-query/tanstack-query/references/testing.md +0 -282
- package/dist/skills/frameworks/tanstack-query/tanstack-query/references/top-errors.md +0 -332
- package/dist/skills/frameworks/tanstack-query/tanstack-query/references/typescript-patterns.md +0 -291
- package/dist/skills/frameworks/tanstack-query/tanstack-query/references/v4-to-v5-migration.md +0 -231
- package/dist/skills/frameworks/tanstack-query/tanstack-query/rules/tanstack-query.md +0 -126
- package/dist/skills/frameworks/tanstack-query/tanstack-query/scripts/example-script.sh +0 -15
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/custom-hooks-pattern.tsx +0 -281
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/devtools-setup.tsx +0 -248
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/error-boundary.tsx +0 -243
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/package.json +0 -31
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/provider-setup.tsx +0 -50
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/query-client-config.ts +0 -72
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/use-infinite-query.tsx +0 -214
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/use-mutation-basic.tsx +0 -201
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/use-mutation-optimistic.tsx +0 -234
- package/dist/skills/frameworks/tanstack-query/tanstack-query/templates/use-query-basic.tsx +0 -119
- package/dist/skills/frameworks/tanstack-start/tanstack-start/SKILL.md +0 -250
- package/dist/skills/frameworks/trpc/tanstack-query/.claude-plugin/plugin.json +0 -12
- package/dist/skills/frameworks/trpc/tanstack-query/SKILL.md +0 -1058
- package/dist/skills/frameworks/trpc/tanstack-query/assets/example-template.txt +0 -14
- package/dist/skills/frameworks/trpc/tanstack-query/references/best-practices.md +0 -304
- package/dist/skills/frameworks/trpc/tanstack-query/references/common-patterns.md +0 -271
- package/dist/skills/frameworks/trpc/tanstack-query/references/example-reference.md +0 -26
- package/dist/skills/frameworks/trpc/tanstack-query/references/testing.md +0 -282
- package/dist/skills/frameworks/trpc/tanstack-query/references/top-errors.md +0 -332
- package/dist/skills/frameworks/trpc/tanstack-query/references/typescript-patterns.md +0 -291
- package/dist/skills/frameworks/trpc/tanstack-query/references/v4-to-v5-migration.md +0 -231
- package/dist/skills/frameworks/trpc/tanstack-query/rules/tanstack-query.md +0 -126
- package/dist/skills/frameworks/trpc/tanstack-query/scripts/example-script.sh +0 -15
- package/dist/skills/frameworks/trpc/tanstack-query/templates/custom-hooks-pattern.tsx +0 -281
- package/dist/skills/frameworks/trpc/tanstack-query/templates/devtools-setup.tsx +0 -248
- package/dist/skills/frameworks/trpc/tanstack-query/templates/error-boundary.tsx +0 -243
- package/dist/skills/frameworks/trpc/tanstack-query/templates/package.json +0 -31
- package/dist/skills/frameworks/trpc/tanstack-query/templates/provider-setup.tsx +0 -50
- package/dist/skills/frameworks/trpc/tanstack-query/templates/query-client-config.ts +0 -72
- package/dist/skills/frameworks/trpc/tanstack-query/templates/use-infinite-query.tsx +0 -214
- package/dist/skills/frameworks/trpc/tanstack-query/templates/use-mutation-basic.tsx +0 -201
- package/dist/skills/frameworks/trpc/tanstack-query/templates/use-mutation-optimistic.tsx +0 -234
- package/dist/skills/frameworks/trpc/tanstack-query/templates/use-query-basic.tsx +0 -119
- package/dist/skills/frameworks/turborepo/turborepo/SKILL.md +0 -914
- package/dist/skills/frameworks/turborepo/turborepo/command/turborepo.md +0 -70
- package/dist/skills/frameworks/turborepo/turborepo/references/best-practices/RULE.md +0 -241
- package/dist/skills/frameworks/turborepo/turborepo/references/best-practices/dependencies.md +0 -246
- package/dist/skills/frameworks/turborepo/turborepo/references/best-practices/packages.md +0 -335
- package/dist/skills/frameworks/turborepo/turborepo/references/best-practices/structure.md +0 -270
- package/dist/skills/frameworks/turborepo/turborepo/references/boundaries/RULE.md +0 -126
- package/dist/skills/frameworks/turborepo/turborepo/references/caching/RULE.md +0 -107
- package/dist/skills/frameworks/turborepo/turborepo/references/caching/gotchas.md +0 -169
- package/dist/skills/frameworks/turborepo/turborepo/references/caching/remote-cache.md +0 -127
- package/dist/skills/frameworks/turborepo/turborepo/references/ci/RULE.md +0 -79
- package/dist/skills/frameworks/turborepo/turborepo/references/ci/github-actions.md +0 -162
- package/dist/skills/frameworks/turborepo/turborepo/references/ci/patterns.md +0 -145
- package/dist/skills/frameworks/turborepo/turborepo/references/ci/vercel.md +0 -103
- package/dist/skills/frameworks/turborepo/turborepo/references/cli/RULE.md +0 -100
- package/dist/skills/frameworks/turborepo/turborepo/references/cli/commands.md +0 -297
- package/dist/skills/frameworks/turborepo/turborepo/references/configuration/RULE.md +0 -211
- package/dist/skills/frameworks/turborepo/turborepo/references/configuration/global-options.md +0 -187
- package/dist/skills/frameworks/turborepo/turborepo/references/configuration/gotchas.md +0 -348
- package/dist/skills/frameworks/turborepo/turborepo/references/configuration/tasks.md +0 -285
- package/dist/skills/frameworks/turborepo/turborepo/references/environment/RULE.md +0 -96
- package/dist/skills/frameworks/turborepo/turborepo/references/environment/gotchas.md +0 -141
- package/dist/skills/frameworks/turborepo/turborepo/references/environment/modes.md +0 -101
- package/dist/skills/frameworks/turborepo/turborepo/references/filtering/RULE.md +0 -148
- package/dist/skills/frameworks/turborepo/turborepo/references/filtering/patterns.md +0 -152
- package/dist/skills/frameworks/turborepo/turborepo/references/watch/RULE.md +0 -99
- package/dist/skills/languages/python/async-python-patterns/SKILL.md +0 -735
- package/dist/skills/languages/python/python-code-style/SKILL.md +0 -360
- package/dist/skills/languages/python/python-design-patterns/SKILL.md +0 -433
- package/dist/skills/languages/python/python-project-structure/SKILL.md +0 -252
- package/dist/skills/languages/python/python-testing-patterns/SKILL.md +0 -622
- package/dist/skills/languages/python/python-testing-patterns/references/advanced-patterns.md +0 -411
- package/dist/skills/languages/typescript/quality-types/SKILL.md +0 -93
- package/dist/skills/phases/bug-discovery-phase/REFERENCE.md +0 -170
- package/dist/skills/phases/bug-discovery-phase/SKILL.md +0 -85
- package/dist/skills/phases/bug-resolution-phase/REFERENCE.md +0 -160
- package/dist/skills/phases/bug-resolution-phase/SKILL.md +0 -64
- package/dist/skills/phases/debugging-phase/SKILL.md +0 -88
- package/dist/skills/phases/delivery-phase/SKILL.md +0 -50
- package/dist/skills/phases/delivery-phase/phases/closeout.md +0 -33
- package/dist/skills/phases/delivery-phase/phases/debug.md +0 -30
- package/dist/skills/phases/delivery-phase/phases/docs-ingest.md +0 -27
- package/dist/skills/phases/delivery-phase/phases/implement.md +0 -30
- package/dist/skills/phases/delivery-phase/phases/plan.md +0 -27
- package/dist/skills/phases/delivery-phase/phases/review.md +0 -29
- package/dist/skills/phases/delivery-phase/phases/router.md +0 -46
- package/dist/skills/phases/delivery-phase/phases/spec.md +0 -26
- package/dist/skills/phases/delivery-phase/references/artifact-state.md +0 -42
- package/dist/skills/phases/delivery-phase/references/phase-handoff.md +0 -25
- package/dist/skills/phases/docs-ingest-phase/SKILL.md +0 -46
- package/dist/skills/phases/docs-ingest-phase/agents/openai.yaml +0 -4
- package/dist/skills/phases/docs-ingest-phase/phases/private-internal.md +0 -57
- package/dist/skills/phases/docs-ingest-phase/phases/public-docs.md +0 -52
- package/dist/skills/phases/docs-ingest-phase/phases/router.md +0 -42
- package/dist/skills/phases/docs-ingest-phase/references/concept-pages.md +0 -70
- package/dist/skills/phases/docs-ingest-phase/references/flow-pages.md +0 -56
- package/dist/skills/phases/docs-ingest-phase/references/fumadocs-routing.md +0 -74
- package/dist/skills/phases/docs-ingest-phase/references/learning-artifacts.md +0 -96
- package/dist/skills/phases/docs-ingest-phase/references/public-docs.md +0 -90
- package/dist/skills/phases/docs-ingest-phase/references/repo-docs.md +0 -38
- package/dist/skills/phases/docs-ingest-phase/references/wiki-ingest.md +0 -133
- package/dist/skills/phases/goalify/EXAMPLES.md +0 -78
- package/dist/skills/phases/goalify/SKILL.md +0 -129
- package/dist/skills/phases/requirements-phase/SKILL.md +0 -70
- package/dist/skills/phases/resolve-debt-phase/SKILL.md +0 -87
- package/dist/skills/phases/review-phase/SKILL.md +0 -118
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: better-auth-best-practices
|
|
3
|
-
description: Skill for integrating Better Auth - the comprehensive TypeScript authentication framework.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Better Auth Integration Guide
|
|
7
|
-
|
|
8
|
-
**Always consult [better-auth.com/docs](https://better-auth.com/docs) for code examples and latest API.**
|
|
9
|
-
|
|
10
|
-
Better Auth is a TypeScript-first, framework-agnostic auth framework supporting email/password, OAuth, magic links, passkeys, and more via plugins.
|
|
11
|
-
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
## Quick Reference
|
|
15
|
-
|
|
16
|
-
### Environment Variables
|
|
17
|
-
- `BETTER_AUTH_SECRET` - Encryption secret (min 32 chars). Generate: `openssl rand -base64 32`
|
|
18
|
-
- `BETTER_AUTH_URL` - Base URL (e.g., `https://example.com`)
|
|
19
|
-
|
|
20
|
-
Only define `baseURL`/`secret` in config if env vars are NOT set.
|
|
21
|
-
|
|
22
|
-
### File Location
|
|
23
|
-
CLI looks for `auth.ts` in: `./`, `./lib`, `./utils`, or under `./src`. Use `--config` for custom path.
|
|
24
|
-
|
|
25
|
-
### CLI Commands
|
|
26
|
-
- `npx @better-auth/cli@latest migrate` - Apply schema (built-in adapter)
|
|
27
|
-
- `npx @better-auth/cli@latest generate` - Generate schema for Prisma/Drizzle
|
|
28
|
-
- `npx @better-auth/cli mcp --cursor` - Add MCP to AI tools
|
|
29
|
-
|
|
30
|
-
**Re-run after adding/changing plugins.**
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## Core Config Options
|
|
35
|
-
|
|
36
|
-
| Option | Notes |
|
|
37
|
-
|--------|-------|
|
|
38
|
-
| `appName` | Optional display name |
|
|
39
|
-
| `baseURL` | Only if `BETTER_AUTH_URL` not set |
|
|
40
|
-
| `basePath` | Default `/api/auth`. Set `/` for root. |
|
|
41
|
-
| `secret` | Only if `BETTER_AUTH_SECRET` not set |
|
|
42
|
-
| `database` | Required for most features. See adapters docs. |
|
|
43
|
-
| `secondaryStorage` | Redis/KV for sessions & rate limits |
|
|
44
|
-
| `emailAndPassword` | `{ enabled: true }` to activate |
|
|
45
|
-
| `socialProviders` | `{ google: { clientId, clientSecret }, ... }` |
|
|
46
|
-
| `plugins` | Array of plugins |
|
|
47
|
-
| `trustedOrigins` | CSRF whitelist |
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## Database
|
|
52
|
-
|
|
53
|
-
**Direct connections:** Pass `pg.Pool`, `mysql2` pool, `better-sqlite3`, or `bun:sqlite` instance.
|
|
54
|
-
|
|
55
|
-
**ORM adapters:** Import from `better-auth/adapters/drizzle`, `better-auth/adapters/prisma`, `better-auth/adapters/mongodb`.
|
|
56
|
-
|
|
57
|
-
**Critical:** Better Auth uses adapter model names, NOT underlying table names. If Prisma model is `User` mapping to table `users`, use `modelName: "user"` (Prisma reference), not `"users"`.
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## Session Management
|
|
62
|
-
|
|
63
|
-
**Storage priority:**
|
|
64
|
-
1. If `secondaryStorage` defined → sessions go there (not DB)
|
|
65
|
-
2. Set `session.storeSessionInDatabase: true` to also persist to DB
|
|
66
|
-
3. No database + `cookieCache` → fully stateless mode
|
|
67
|
-
|
|
68
|
-
**Cookie cache strategies:**
|
|
69
|
-
- `compact` (default) - Base64url + HMAC. Smallest.
|
|
70
|
-
- `jwt` - Standard JWT. Readable but signed.
|
|
71
|
-
- `jwe` - Encrypted. Maximum security.
|
|
72
|
-
|
|
73
|
-
**Key options:** `session.expiresIn` (default 7 days), `session.updateAge` (refresh interval), `session.cookieCache.maxAge`, `session.cookieCache.version` (change to invalidate all sessions).
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## User & Account Config
|
|
78
|
-
|
|
79
|
-
**User:** `user.modelName`, `user.fields` (column mapping), `user.additionalFields`, `user.changeEmail.enabled` (disabled by default), `user.deleteUser.enabled` (disabled by default).
|
|
80
|
-
|
|
81
|
-
**Account:** `account.modelName`, `account.accountLinking.enabled`, `account.storeAccountCookie` (for stateless OAuth).
|
|
82
|
-
|
|
83
|
-
**Required for registration:** `email` and `name` fields.
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## Email Flows
|
|
88
|
-
|
|
89
|
-
- `emailVerification.sendVerificationEmail` - Must be defined for verification to work
|
|
90
|
-
- `emailVerification.sendOnSignUp` / `sendOnSignIn` - Auto-send triggers
|
|
91
|
-
- `emailAndPassword.sendResetPassword` - Password reset email handler
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## Security
|
|
96
|
-
|
|
97
|
-
**In `advanced`:**
|
|
98
|
-
- `useSecureCookies` - Force HTTPS cookies
|
|
99
|
-
- `disableCSRFCheck` - ⚠️ Security risk
|
|
100
|
-
- `disableOriginCheck` - ⚠️ Security risk
|
|
101
|
-
- `crossSubDomainCookies.enabled` - Share cookies across subdomains
|
|
102
|
-
- `ipAddress.ipAddressHeaders` - Custom IP headers for proxies
|
|
103
|
-
- `database.generateId` - Custom ID generation or `"serial"`/`"uuid"`/`false`
|
|
104
|
-
|
|
105
|
-
**Rate limiting:** `rateLimit.enabled`, `rateLimit.window`, `rateLimit.max`, `rateLimit.storage` ("memory" | "database" | "secondary-storage").
|
|
106
|
-
|
|
107
|
-
---
|
|
108
|
-
|
|
109
|
-
## Hooks
|
|
110
|
-
|
|
111
|
-
**Endpoint hooks:** `hooks.before` / `hooks.after` - Array of `{ matcher, handler }`. Use `createAuthMiddleware`. Access `ctx.path`, `ctx.context.returned` (after), `ctx.context.session`.
|
|
112
|
-
|
|
113
|
-
**Database hooks:** `databaseHooks.user.create.before/after`, same for `session`, `account`. Useful for adding default values or post-creation actions.
|
|
114
|
-
|
|
115
|
-
**Hook context (`ctx.context`):** `session`, `secret`, `authCookies`, `password.hash()`/`verify()`, `adapter`, `internalAdapter`, `generateId()`, `tables`, `baseURL`.
|
|
116
|
-
|
|
117
|
-
---
|
|
118
|
-
|
|
119
|
-
## Plugins
|
|
120
|
-
|
|
121
|
-
**Import from dedicated paths for tree-shaking:**
|
|
122
|
-
```
|
|
123
|
-
import { twoFactor } from "better-auth/plugins/two-factor"
|
|
124
|
-
```
|
|
125
|
-
NOT `from "better-auth/plugins"`.
|
|
126
|
-
|
|
127
|
-
**Popular plugins:** `twoFactor`, `organization`, `passkey`, `magicLink`, `emailOtp`, `username`, `phoneNumber`, `admin`, `apiKey`, `bearer`, `jwt`, `multiSession`, `sso`, `oauthProvider`, `oidcProvider`, `openAPI`, `genericOAuth`.
|
|
128
|
-
|
|
129
|
-
Client plugins go in `createAuthClient({ plugins: [...] })`.
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## Client
|
|
134
|
-
|
|
135
|
-
Import from: `better-auth/client` (vanilla), `better-auth/react`, `better-auth/vue`, `better-auth/svelte`, `better-auth/solid`.
|
|
136
|
-
|
|
137
|
-
Key methods: `signUp.email()`, `signIn.email()`, `signIn.social()`, `signOut()`, `useSession()`, `getSession()`, `revokeSession()`, `revokeSessions()`.
|
|
138
|
-
|
|
139
|
-
---
|
|
140
|
-
|
|
141
|
-
## Type Safety
|
|
142
|
-
|
|
143
|
-
Infer types: `typeof auth.$Infer.Session`, `typeof auth.$Infer.Session.user`.
|
|
144
|
-
|
|
145
|
-
For separate client/server projects: `createAuthClient<typeof auth>()`.
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
|
|
149
|
-
## Common Gotchas
|
|
150
|
-
|
|
151
|
-
1. **Model vs table name** - Config uses ORM model name, not DB table name
|
|
152
|
-
2. **Plugin schema** - Re-run CLI after adding plugins
|
|
153
|
-
3. **Secondary storage** - Sessions go there by default, not DB
|
|
154
|
-
4. **Cookie cache** - Custom session fields NOT cached, always re-fetched
|
|
155
|
-
5. **Stateless mode** - No DB = session in cookie only, logout on cache expiry
|
|
156
|
-
6. **Change email flow** - Sends to current email first, then new email
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## Resources
|
|
161
|
-
|
|
162
|
-
- [Docs](https://better-auth.com/docs)
|
|
163
|
-
- [Options Reference](https://better-auth.com/docs/reference/options)
|
|
164
|
-
- [LLMs.txt](https://better-auth.com/llms.txt)
|
|
165
|
-
- [GitHub](https://github.com/better-auth/better-auth)
|
|
166
|
-
- [Init Options Source](https://github.com/better-auth/better-auth/blob/main/packages/core/src/types/init-options.ts)
|
|
@@ -1,432 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: better-auth-security-best-practices
|
|
3
|
-
description: Configure rate limiting, manage auth secrets, set up CSRF protection, define trusted origins, secure sessions and cookies, encrypt OAuth tokens, track IP addresses, and implement audit logging for Better Auth. Use when users need to secure their auth setup, prevent brute force attacks, or harden a Better Auth deployment.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## Secret Management
|
|
7
|
-
|
|
8
|
-
### Configuring the Secret
|
|
9
|
-
|
|
10
|
-
```ts
|
|
11
|
-
import { betterAuth } from "better-auth";
|
|
12
|
-
|
|
13
|
-
export const auth = betterAuth({
|
|
14
|
-
secret: process.env.BETTER_AUTH_SECRET, // or via `BETTER_AUTH_SECRET` env
|
|
15
|
-
});
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Better Auth looks for secrets in this order:
|
|
19
|
-
1. `options.secret` in your config
|
|
20
|
-
2. `BETTER_AUTH_SECRET` environment variable
|
|
21
|
-
3. `AUTH_SECRET` environment variable
|
|
22
|
-
|
|
23
|
-
### Secret Requirements
|
|
24
|
-
|
|
25
|
-
- Rejects default/placeholder secrets in production
|
|
26
|
-
- Warns if shorter than 32 characters or entropy below 120 bits
|
|
27
|
-
- Generate: `openssl rand -base64 32`
|
|
28
|
-
- Never commit secrets to version control
|
|
29
|
-
|
|
30
|
-
## Rate Limiting
|
|
31
|
-
|
|
32
|
-
Enabled in production by default. Applies to all endpoints. Plugins can override per-endpoint.
|
|
33
|
-
|
|
34
|
-
### Default Configuration
|
|
35
|
-
|
|
36
|
-
```ts
|
|
37
|
-
import { betterAuth } from "better-auth";
|
|
38
|
-
|
|
39
|
-
export const auth = betterAuth({
|
|
40
|
-
rateLimit: {
|
|
41
|
-
enabled: true, // Default: true in production
|
|
42
|
-
window: 10, // Time window in seconds (default: 10)
|
|
43
|
-
max: 100, // Max requests per window (default: 100)
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Storage Options
|
|
49
|
-
|
|
50
|
-
Options: `"memory"` (resets on restart, avoid on serverless), `"database"` (persistent), `"secondary-storage"` (Redis, default when available).
|
|
51
|
-
|
|
52
|
-
```ts
|
|
53
|
-
rateLimit: {
|
|
54
|
-
storage: "database",
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Custom Storage
|
|
59
|
-
|
|
60
|
-
Implement your own rate limit storage:
|
|
61
|
-
|
|
62
|
-
```ts
|
|
63
|
-
rateLimit: {
|
|
64
|
-
customStorage: {
|
|
65
|
-
get: async (key) => {
|
|
66
|
-
// Return { count: number, expiresAt: number } or null
|
|
67
|
-
},
|
|
68
|
-
set: async (key, data) => {
|
|
69
|
-
// Store the rate limit data
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
}
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Per-Endpoint Rules
|
|
76
|
-
|
|
77
|
-
Sensitive endpoints default to 3 requests per 10 seconds (`/sign-in`, `/sign-up`, `/change-password`, `/change-email`). Override:
|
|
78
|
-
|
|
79
|
-
```ts
|
|
80
|
-
rateLimit: {
|
|
81
|
-
customRules: {
|
|
82
|
-
"/api/auth/sign-in/email": {
|
|
83
|
-
window: 60, // 1 minute window
|
|
84
|
-
max: 5, // 5 attempts
|
|
85
|
-
},
|
|
86
|
-
"/api/auth/some-safe-endpoint": false, // Disable rate limiting
|
|
87
|
-
},
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
## CSRF Protection
|
|
92
|
-
|
|
93
|
-
Multi-layer protection: origin header validation, Fetch Metadata checks, and first-login protection.
|
|
94
|
-
|
|
95
|
-
### Configuration
|
|
96
|
-
|
|
97
|
-
```ts
|
|
98
|
-
import { betterAuth } from "better-auth";
|
|
99
|
-
|
|
100
|
-
export const auth = betterAuth({
|
|
101
|
-
advanced: {
|
|
102
|
-
disableCSRFCheck: false, // Default: false (keep enabled)
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
Only disable for testing or with an alternative CSRF mechanism.
|
|
108
|
-
|
|
109
|
-
## Trusted Origins
|
|
110
|
-
|
|
111
|
-
### Configuring Trusted Origins
|
|
112
|
-
|
|
113
|
-
```ts
|
|
114
|
-
import { betterAuth } from "better-auth";
|
|
115
|
-
|
|
116
|
-
export const auth = betterAuth({
|
|
117
|
-
baseURL: "https://api.example.com",
|
|
118
|
-
trustedOrigins: [
|
|
119
|
-
"https://app.example.com",
|
|
120
|
-
"https://admin.example.com",
|
|
121
|
-
],
|
|
122
|
-
});
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
The `baseURL` origin is automatically trusted. Also configurable via env: `BETTER_AUTH_TRUSTED_ORIGINS=https://app.example.com,https://admin.example.com`
|
|
126
|
-
|
|
127
|
-
### Wildcard Patterns
|
|
128
|
-
|
|
129
|
-
```ts
|
|
130
|
-
trustedOrigins: [
|
|
131
|
-
"*.example.com", // Matches any subdomain
|
|
132
|
-
"https://*.example.com", // Protocol-specific wildcard
|
|
133
|
-
"exp://192.168.*.*:*/*", // Custom schemes (e.g., Expo)
|
|
134
|
-
]
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
### Dynamic Trusted Origins
|
|
138
|
-
|
|
139
|
-
Compute trusted origins based on the request:
|
|
140
|
-
|
|
141
|
-
```ts
|
|
142
|
-
trustedOrigins: async (request) => {
|
|
143
|
-
// Validate against database, header, etc.
|
|
144
|
-
const tenant = getTenantFromRequest(request);
|
|
145
|
-
return [`https://${tenant}.myapp.com`];
|
|
146
|
-
}
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
Validates `callbackURL`, `redirectTo`, `errorCallbackURL`, `newUserCallbackURL`, and `origin` against trusted origins. Invalid URLs receive 403.
|
|
150
|
-
|
|
151
|
-
## Session Security
|
|
152
|
-
|
|
153
|
-
### Session Expiration
|
|
154
|
-
|
|
155
|
-
```ts
|
|
156
|
-
import { betterAuth } from "better-auth";
|
|
157
|
-
|
|
158
|
-
export const auth = betterAuth({
|
|
159
|
-
session: {
|
|
160
|
-
expiresIn: 60 * 60 * 24 * 7, // 7 days (default)
|
|
161
|
-
updateAge: 60 * 60 * 24, // Refresh session every 24 hours (default)
|
|
162
|
-
},
|
|
163
|
-
});
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### Session Caching Strategies
|
|
167
|
-
|
|
168
|
-
Cache session data in cookies to reduce database queries:
|
|
169
|
-
|
|
170
|
-
```ts
|
|
171
|
-
session: {
|
|
172
|
-
cookieCache: {
|
|
173
|
-
enabled: true,
|
|
174
|
-
maxAge: 60 * 5, // 5 minutes
|
|
175
|
-
strategy: "compact", // Options: "compact", "jwt", "jwe"
|
|
176
|
-
},
|
|
177
|
-
}
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
Strategies: `"compact"` (Base64url + HMAC, smallest), `"jwt"` (HS256, standard), `"jwe"` (encrypted, use when session has sensitive data).
|
|
181
|
-
|
|
182
|
-
## Cookie Security
|
|
183
|
-
|
|
184
|
-
Defaults: `secure: true` (HTTPS/production), `sameSite: "lax"`, `httpOnly: true`, `path: "/"`, prefix `__Secure-`.
|
|
185
|
-
|
|
186
|
-
### Custom Cookie Configuration
|
|
187
|
-
|
|
188
|
-
```ts
|
|
189
|
-
import { betterAuth } from "better-auth";
|
|
190
|
-
|
|
191
|
-
export const auth = betterAuth({
|
|
192
|
-
advanced: {
|
|
193
|
-
useSecureCookies: true, // Force secure cookies
|
|
194
|
-
cookiePrefix: "myapp", // Custom prefix (default: "better-auth")
|
|
195
|
-
defaultCookieAttributes: {
|
|
196
|
-
sameSite: "strict", // Stricter CSRF protection
|
|
197
|
-
path: "/auth", // Limit cookie scope
|
|
198
|
-
},
|
|
199
|
-
},
|
|
200
|
-
});
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
### Cross-Subdomain Cookies
|
|
204
|
-
|
|
205
|
-
```ts
|
|
206
|
-
advanced: {
|
|
207
|
-
crossSubDomainCookies: {
|
|
208
|
-
enabled: true,
|
|
209
|
-
domain: ".example.com", // Note the leading dot
|
|
210
|
-
additionalCookies: ["session_token", "session_data"],
|
|
211
|
-
},
|
|
212
|
-
}
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
Only enable if you need authentication sharing and trust all subdomains.
|
|
216
|
-
|
|
217
|
-
## OAuth / Social Provider Security
|
|
218
|
-
|
|
219
|
-
PKCE is automatic for all OAuth flows. State tokens are 32-char random strings expiring after 10 minutes.
|
|
220
|
-
|
|
221
|
-
### State Parameter Storage
|
|
222
|
-
|
|
223
|
-
```ts
|
|
224
|
-
import { betterAuth } from "better-auth";
|
|
225
|
-
|
|
226
|
-
export const auth = betterAuth({
|
|
227
|
-
account: {
|
|
228
|
-
storeStateStrategy: "cookie", // Options: "cookie" (default), "database"
|
|
229
|
-
},
|
|
230
|
-
});
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
### Encrypting OAuth Tokens
|
|
234
|
-
|
|
235
|
-
```ts
|
|
236
|
-
account: {
|
|
237
|
-
encryptOAuthTokens: true, // Uses AES-256-GCM
|
|
238
|
-
}
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
Enable if storing OAuth tokens for API access on behalf of users. Use `skipStateCookieCheck: true` only for mobile apps that cannot maintain cookies.
|
|
242
|
-
|
|
243
|
-
## IP-Based Security
|
|
244
|
-
|
|
245
|
-
### IP Address Configuration
|
|
246
|
-
|
|
247
|
-
```ts
|
|
248
|
-
import { betterAuth } from "better-auth";
|
|
249
|
-
|
|
250
|
-
export const auth = betterAuth({
|
|
251
|
-
advanced: {
|
|
252
|
-
ipAddress: {
|
|
253
|
-
ipAddressHeaders: ["x-forwarded-for", "x-real-ip"], // Headers to check
|
|
254
|
-
disableIpTracking: false, // Keep enabled for rate limiting
|
|
255
|
-
},
|
|
256
|
-
},
|
|
257
|
-
});
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
Set `ipv6Subnet` (128, 64, 48, 32; default 64) to group IPv6 addresses. Enable `trustedProxyHeaders: true` only if behind a trusted reverse proxy.
|
|
261
|
-
|
|
262
|
-
## Database Hooks for Security Auditing
|
|
263
|
-
|
|
264
|
-
```ts
|
|
265
|
-
import { betterAuth } from "better-auth";
|
|
266
|
-
|
|
267
|
-
export const auth = betterAuth({
|
|
268
|
-
databaseHooks: {
|
|
269
|
-
session: {
|
|
270
|
-
create: {
|
|
271
|
-
after: async ({ data, ctx }) => {
|
|
272
|
-
await auditLog("session.created", {
|
|
273
|
-
userId: data.userId,
|
|
274
|
-
ip: ctx?.request?.headers.get("x-forwarded-for"),
|
|
275
|
-
userAgent: ctx?.request?.headers.get("user-agent"),
|
|
276
|
-
});
|
|
277
|
-
},
|
|
278
|
-
},
|
|
279
|
-
delete: {
|
|
280
|
-
before: async ({ data }) => {
|
|
281
|
-
await auditLog("session.revoked", { sessionId: data.id });
|
|
282
|
-
},
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
user: {
|
|
286
|
-
update: {
|
|
287
|
-
after: async ({ data, oldData }) => {
|
|
288
|
-
if (oldData?.email !== data.email) {
|
|
289
|
-
await auditLog("user.email_changed", {
|
|
290
|
-
userId: data.id,
|
|
291
|
-
oldEmail: oldData?.email,
|
|
292
|
-
newEmail: data.email,
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
|
-
},
|
|
297
|
-
},
|
|
298
|
-
account: {
|
|
299
|
-
create: {
|
|
300
|
-
after: async ({ data }) => {
|
|
301
|
-
await auditLog("account.linked", {
|
|
302
|
-
userId: data.userId,
|
|
303
|
-
provider: data.providerId,
|
|
304
|
-
});
|
|
305
|
-
},
|
|
306
|
-
},
|
|
307
|
-
},
|
|
308
|
-
},
|
|
309
|
-
});
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
Return `false` from a `before` hook to prevent an operation.
|
|
313
|
-
|
|
314
|
-
## Background Tasks
|
|
315
|
-
|
|
316
|
-
```ts
|
|
317
|
-
import { betterAuth } from "better-auth";
|
|
318
|
-
|
|
319
|
-
export const auth = betterAuth({
|
|
320
|
-
advanced: {
|
|
321
|
-
backgroundTasks: {
|
|
322
|
-
handler: (promise) => {
|
|
323
|
-
// Platform-specific handler
|
|
324
|
-
// Vercel: waitUntil(promise)
|
|
325
|
-
// Cloudflare: ctx.waitUntil(promise)
|
|
326
|
-
waitUntil(promise);
|
|
327
|
-
},
|
|
328
|
-
},
|
|
329
|
-
},
|
|
330
|
-
});
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
Ensures operations like sending emails don't affect response timing.
|
|
334
|
-
|
|
335
|
-
## Account Enumeration Prevention
|
|
336
|
-
|
|
337
|
-
Built-in: consistent response messages, dummy operations on invalid requests, background email sending. Return generic error messages ("Invalid credentials") rather than specific ones ("User not found").
|
|
338
|
-
|
|
339
|
-
## Complete Security Configuration Example
|
|
340
|
-
|
|
341
|
-
```ts
|
|
342
|
-
import { betterAuth } from "better-auth";
|
|
343
|
-
|
|
344
|
-
export const auth = betterAuth({
|
|
345
|
-
secret: process.env.BETTER_AUTH_SECRET,
|
|
346
|
-
baseURL: "https://api.example.com",
|
|
347
|
-
trustedOrigins: [
|
|
348
|
-
"https://app.example.com",
|
|
349
|
-
"https://*.preview.example.com",
|
|
350
|
-
],
|
|
351
|
-
|
|
352
|
-
// Rate limiting
|
|
353
|
-
rateLimit: {
|
|
354
|
-
enabled: true,
|
|
355
|
-
storage: "secondary-storage",
|
|
356
|
-
customRules: {
|
|
357
|
-
"/api/auth/sign-in/email": { window: 60, max: 5 },
|
|
358
|
-
"/api/auth/sign-up/email": { window: 60, max: 3 },
|
|
359
|
-
},
|
|
360
|
-
},
|
|
361
|
-
|
|
362
|
-
// Session security
|
|
363
|
-
session: {
|
|
364
|
-
expiresIn: 60 * 60 * 24 * 7, // 7 days
|
|
365
|
-
updateAge: 60 * 60 * 24, // 24 hours
|
|
366
|
-
freshAge: 60 * 60, // 1 hour for sensitive actions
|
|
367
|
-
cookieCache: {
|
|
368
|
-
enabled: true,
|
|
369
|
-
maxAge: 300,
|
|
370
|
-
strategy: "jwe", // Encrypted session data
|
|
371
|
-
},
|
|
372
|
-
},
|
|
373
|
-
|
|
374
|
-
// OAuth security
|
|
375
|
-
account: {
|
|
376
|
-
encryptOAuthTokens: true,
|
|
377
|
-
storeStateStrategy: "cookie",
|
|
378
|
-
},
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
// Advanced settings
|
|
382
|
-
advanced: {
|
|
383
|
-
useSecureCookies: true,
|
|
384
|
-
cookiePrefix: "myapp",
|
|
385
|
-
defaultCookieAttributes: {
|
|
386
|
-
sameSite: "lax",
|
|
387
|
-
},
|
|
388
|
-
ipAddress: {
|
|
389
|
-
ipAddressHeaders: ["x-forwarded-for"],
|
|
390
|
-
ipv6Subnet: 64,
|
|
391
|
-
},
|
|
392
|
-
backgroundTasks: {
|
|
393
|
-
handler: (promise) => waitUntil(promise),
|
|
394
|
-
},
|
|
395
|
-
},
|
|
396
|
-
|
|
397
|
-
// Security auditing
|
|
398
|
-
databaseHooks: {
|
|
399
|
-
session: {
|
|
400
|
-
create: {
|
|
401
|
-
after: async ({ data, ctx }) => {
|
|
402
|
-
console.log(`New session for user ${data.userId}`);
|
|
403
|
-
},
|
|
404
|
-
},
|
|
405
|
-
},
|
|
406
|
-
user: {
|
|
407
|
-
update: {
|
|
408
|
-
after: async ({ data, oldData }) => {
|
|
409
|
-
if (oldData?.email !== data.email) {
|
|
410
|
-
console.log(`Email changed for user ${data.id}`);
|
|
411
|
-
}
|
|
412
|
-
},
|
|
413
|
-
},
|
|
414
|
-
},
|
|
415
|
-
},
|
|
416
|
-
});
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
## Security Checklist
|
|
420
|
-
|
|
421
|
-
Before deploying to production:
|
|
422
|
-
|
|
423
|
-
- [ ] **Secret**: Use a strong, unique secret (32+ characters, high entropy)
|
|
424
|
-
- [ ] **HTTPS**: Ensure `baseURL` uses HTTPS
|
|
425
|
-
- [ ] **Trusted Origins**: Configure all valid origins (frontend, mobile apps)
|
|
426
|
-
- [ ] **Rate Limiting**: Keep enabled with appropriate limits
|
|
427
|
-
- [ ] **CSRF Protection**: Keep enabled (`disableCSRFCheck: false`)
|
|
428
|
-
- [ ] **Secure Cookies**: Enabled automatically with HTTPS
|
|
429
|
-
- [ ] **OAuth Tokens**: Consider `encryptOAuthTokens: true` if storing tokens
|
|
430
|
-
- [ ] **Background Tasks**: Configure for serverless platforms
|
|
431
|
-
- [ ] **Audit Logging**: Implement via `databaseHooks` or `hooks`
|
|
432
|
-
- [ ] **IP Tracking**: Configure headers if behind a proxy
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: effect-authoring
|
|
3
|
-
description: >-
|
|
4
|
-
Use when asked to plan, write, build, fix, refactor, or review Effect-TS
|
|
5
|
-
code. Apply before editing so the first implementation follows repo
|
|
6
|
-
conventions for Effect primitives, branded IDs, observability, error design,
|
|
7
|
-
`@effect/vitest`, and Effect-Atom, especially in `packages/api`.
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
# Effect-TS Authoring Guide
|
|
11
|
-
|
|
12
|
-
Use this skill before edits. Optimize for correct code on first pass, not a scorecard after the fact.
|
|
13
|
-
|
|
14
|
-
## Workflow
|
|
15
|
-
|
|
16
|
-
### Step 1: Classify the Task Before Writing
|
|
17
|
-
|
|
18
|
-
Sort the requested change into the smallest relevant set:
|
|
19
|
-
|
|
20
|
-
- **Backend Effect code**: Effect services, procedures, repositories, layers, schemas, domain actions
|
|
21
|
-
- **Test code**: `.test.ts` files, test layers, failure-path coverage
|
|
22
|
-
- **UI / Effect-Atom code**: `.tsx` files using Effect-Atom, RPC, HttpApi clients
|
|
23
|
-
|
|
24
|
-
Skip config/docs unless they change the implementation contract.
|
|
25
|
-
|
|
26
|
-
### Step 2: Load Only the References Needed for the Task
|
|
27
|
-
|
|
28
|
-
Read the minimum reference set before editing:
|
|
29
|
-
|
|
30
|
-
- **Backend Effect code**: `references/effect-primitives.md`, `references/branded-types.md`, `references/otel-patterns.md`, `references/error-patterns.md`
|
|
31
|
-
- **Test code**: `references/test-patterns.md`
|
|
32
|
-
- **UI / Effect-Atom code**: `references/effect-atom-patterns.md`
|
|
33
|
-
|
|
34
|
-
If uncertain about Effect library behavior, run `opensrc path effect` or `opensrc path Effect-TS/effect` to resolve the local checkout path, then inspect there instead of guessing.
|
|
35
|
-
|
|
36
|
-
### Step 3: Build a Pre-Write Checklist
|
|
37
|
-
|
|
38
|
-
Turn the loaded references into a short implementation checklist for the exact files/functions being changed.
|
|
39
|
-
|
|
40
|
-
For backend Effect work, check for these constraints up front:
|
|
41
|
-
|
|
42
|
-
- Make dependencies visible as Effect requirements or `Effect.Service` dependencies; do not hide them behind concrete imports
|
|
43
|
-
- Provide implementations with `Layer`s; avoid call-site `Effect.provide` except at runner/test boundaries
|
|
44
|
-
- Use Effect primitives over native patterns where the repo expects them: `Array`, `Match`, `Option`, `Schema`, `Effect.forEach`, `Layer`
|
|
45
|
-
- Avoid `try/catch`, `async/await`, `console.log`, ad-hoc validation, and plain `Error` classes in Effect code
|
|
46
|
-
- Carry branded IDs through boundaries; do not fall back to raw `string` / `number`
|
|
47
|
-
- Use named `Effect.fn("Service.method")` wrappers for named effectful functions
|
|
48
|
-
- Annotate spans with essential IDs and business context only
|
|
49
|
-
- Prefer `Schema.TaggedError` and `catchTag` with rich context over generic failures
|
|
50
|
-
|
|
51
|
-
For test work, check for these constraints up front:
|
|
52
|
-
|
|
53
|
-
- Use `@effect/vitest`, not plain `vitest`
|
|
54
|
-
- Prefer `it.layer(...)` and `it.scoped(...)`
|
|
55
|
-
- Replace Effect services with test layers, not `vi.mock`
|
|
56
|
-
- Test failures with `Effect.either` / tagged errors, not `try/catch`
|
|
57
|
-
|
|
58
|
-
For UI work, check for these constraints up front:
|
|
59
|
-
|
|
60
|
-
- Prefer Effect-Atom typesafe clients for first-party Effect backends
|
|
61
|
-
- Avoid `useEffect` + `fetch` state machines when an atom/query should own the data flow
|
|
62
|
-
|
|
63
|
-
### Step 4: Inspect Local Patterns Before Editing
|
|
64
|
-
|
|
65
|
-
Read adjacent modules before writing:
|
|
66
|
-
|
|
67
|
-
- existing tagged error names
|
|
68
|
-
- local branded type definitions
|
|
69
|
-
- layer composition style
|
|
70
|
-
- service/action boundaries
|
|
71
|
-
- trace naming conventions
|
|
72
|
-
- nearby test harness patterns
|
|
73
|
-
|
|
74
|
-
Prefer repo-local patterns over generic examples from the references.
|
|
75
|
-
|
|
76
|
-
### Step 5: Write the Code Against the Checklist
|
|
77
|
-
|
|
78
|
-
Implement directly against the pre-write checklist. Treat the references as authoring constraints, not post-hoc review criteria.
|
|
79
|
-
|
|
80
|
-
If a reference conflicts with established local conventions, follow the local convention and call out the mismatch briefly in the final response.
|
|
81
|
-
|
|
82
|
-
Do not start with a review-style `git diff` workflow when the task is code generation or refactoring. Start from the requested change and the target files.
|
|
83
|
-
|
|
84
|
-
### Step 6: Validate Immediately After Editing
|
|
85
|
-
|
|
86
|
-
Run the narrowest useful validation for the touched area:
|
|
87
|
-
|
|
88
|
-
- targeted tests
|
|
89
|
-
- relevant typecheck
|
|
90
|
-
- lint if the changed surface is lint-sensitive
|
|
91
|
-
- any repo-specific command that proves the new behavior
|
|
92
|
-
|
|
93
|
-
If validation fails, fix the code before moving on.
|
|
94
|
-
|
|
95
|
-
### Step 7: Switch to Review Mode Only When Needed
|
|
96
|
-
|
|
97
|
-
Use review-style findings only when:
|
|
98
|
-
|
|
99
|
-
- the user explicitly asks for a review, audit, or score
|
|
100
|
-
- the task is read-only
|
|
101
|
-
- a final spot-check is needed after implementation
|
|
102
|
-
|
|
103
|
-
In review mode, use the same references, but report findings instead of treating them as a pre-write checklist.
|
|
104
|
-
|
|
105
|
-
Do not default to spawning review subagents during authoring. That adds latency and pushes correctness to the end of the workflow.
|
|
106
|
-
|
|
107
|
-
## Reference Files
|
|
108
|
-
|
|
109
|
-
Load on demand:
|
|
110
|
-
|
|
111
|
-
- `references/effect-primitives.md` — Effect Array, Match, Option, Schema, `Effect.forEach`, Layer
|
|
112
|
-
- `references/branded-types.md` — branded IDs and boundary consistency
|
|
113
|
-
- `references/otel-patterns.md` — `Effect.fn`, span annotations, structured logging
|
|
114
|
-
- `references/error-patterns.md` — `Schema.TaggedError`, `catchTag`, error context
|
|
115
|
-
- `references/test-patterns.md` — `@effect/vitest`, `it.layer`, failure-path testing
|
|
116
|
-
- `references/effect-atom-patterns.md` — Effect-Atom queries, mutations, client patterns
|