[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CSJ6STA1MKQ4W96GAFY9J1":3,"skill-same:01M7CSJ6STA1MKQ4W96GAFY9J1":46},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":30,"updatedAt":31,"install":32,"resources":45},"01M7CSJ6STA1MKQ4W96GAFY9J1","email-and-password-best-practices",null,"Configure email verification, implement password reset flows, set password policies, and customise hashing algorithms for Better Auth email\u002Fpassword authentication. Use when users need to set up login, sign-in, sign-up, credential authentication, or password security with Better Auth.","Henrique1601\u002FSkiilsToIAs","Henrique1601","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F92006691?v=4","01M7CRXVT0GVXVK80JT1GR687S","Henrique Bezerra Dos Santos","01M7CRXVTN5Y8TMWJ1MDSKCQ1T",0,"MIT","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Fbackend-database\u002Femail-and-password-best-practices\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: email-and-password-best-practices\ndescription: Configure email verification, implement password reset flows, set password policies, and customise hashing algorithms for Better Auth email\u002Fpassword authentication. Use when users need to set up login, sign-in, sign-up, credential authentication, or password security with Better Auth.\n---\n\n## Quick Start\n\n1. Enable email\u002Fpassword: `emailAndPassword: { enabled: true }`\n2. Configure `emailVerification.sendVerificationEmail`\n3. Add `sendResetPassword` for password reset flows\n4. Run `npx auth@latest migrate`\n5. Verify: attempt sign-up and confirm verification email triggers\n\n---\n\n## Email Verification Setup\n\nConfigure `emailVerification.sendVerificationEmail` to verify user email addresses.\n\n```ts\nimport { betterAuth } from \"better-auth\";\nimport { sendEmail } from \".\u002Femail\"; \u002F\u002F your email sending function\n\nexport const auth = betterAuth({\n  emailVerification: {\n    sendVerificationEmail: async ({ user, url, token }, request) => {\n      await sendEmail({\n        to: user.email,\n        subject: \"Verify your email address\",\n        text: `Click the link to verify your email: ${url}`,\n      });\n    },\n  },\n});\n```\n\n**Note**: The `url` parameter contains the full verification link. The `token` is available if you need to build a custom verification URL.\n\n### Requiring Email Verification\n\nFor stricter security, enable `emailAndPassword.requireEmailVerification` to block sign-in until the user verifies their email. When enabled, unverified users will receive a new verification email on each sign-in attempt.\n\n```ts\nexport const auth = betterAuth({\n  emailAndPassword: {\n    requireEmailVerification: true,\n  },\n});\n```\n\n**Note**: This requires `sendVerificationEmail` to be configured and only applies to email\u002Fpassword sign-ins.\n\n## Client Side Validation\n\nImplement client-side validation for immediate user feedback and reduced server load.\n\n## Callback URLs\n\nAlways use absolute URLs (including the origin) for callback URLs in sign-up and sign-in requests. This prevents Better Auth from needing to infer the origin, which can cause issues when your backend and frontend are on different domains.\n\n```ts\nconst { data, error } = await authClient.signUp.email({\n  callbackURL: \"https:\u002F\u002Fexample.com\u002Fcallback\", \u002F\u002F absolute URL with origin\n});\n```\n\n## Password Reset Flows\n\nProvide `sendResetPassword` in the email and password config to enable password resets.\n\n```ts\nimport { betterAuth } from \"better-auth\";\nimport { sendEmail } from \".\u002Femail\"; \u002F\u002F your email sending function\n\nexport const auth = betterAuth({\n  emailAndPassword: {\n    enabled: true,\n    \u002F\u002F Custom email sending function to send reset-password email\n    sendResetPassword: async ({ user, url, token }, request) => {\n      void sendEmail({\n        to: user.email,\n        subject: \"Reset your password\",\n        text: `Click the link to reset your password: ${url}`,\n      });\n    },\n    \u002F\u002F Optional event hook\n    onPasswordReset: async ({ user }, request) => {\n      \u002F\u002F your logic here\n      console.log(`Password for user ${user.email} has been reset.`);\n    },\n  },\n});\n```\n\n### Security Considerations\n\nBuilt-in protections: background email sending (timing attack prevention), dummy operations on invalid requests, constant response messages regardless of user existence.\n\nOn serverless platforms, configure a background task handler:\n\n```ts\nexport const auth = betterAuth({\n  advanced: {\n    backgroundTasks: {\n      handler: (promise) => {\n        \u002F\u002F Use platform-specific methods like waitUntil\n        waitUntil(promise);\n      },\n    },\n  },\n});\n```\n\n#### Token Security\n\nTokens expire after 1 hour by default. Configure with `resetPasswordTokenExpiresIn` (in seconds):\n\n```ts\nexport const auth = betterAuth({\n  emailAndPassword: {\n    enabled: true,\n    resetPasswordTokenExpiresIn: 60 * 30, \u002F\u002F 30 minutes\n  },\n});\n```\n\nTokens are single-use — deleted immediately after successful reset.\n\n#### Session Revocation\n\nEnable `revokeSessionsOnPasswordReset` to invalidate all existing sessions on password reset:\n\n```ts\nexport const auth = betterAuth({\n  emailAndPassword: {\n    enabled: true,\n    revokeSessionsOnPasswordReset: true,\n  },\n});\n```\n\n#### Password Requirements\n\nPassword length limits (configurable):\n\n```ts\nexport const auth = betterAuth({\n  emailAndPassword: {\n    enabled: true,\n    minPasswordLength: 12,\n    maxPasswordLength: 256,\n  },\n});\n```\n\n### Sending the Password Reset\n\nCall `requestPasswordReset` to send the reset link. Triggers the `sendResetPassword` function from your config.\n\n```ts\nconst data = await auth.api.requestPasswordReset({\n  body: {\n    email: \"john.doe@example.com\", \u002F\u002F required\n    redirectTo: \"https:\u002F\u002Fexample.com\u002Freset-password\",\n  },\n});\n```\n\nOr authClient:\n\n```ts\nconst { data, error } = await authClient.requestPasswordReset({\n  email: \"john.doe@example.com\", \u002F\u002F required\n  redirectTo: \"https:\u002F\u002Fexample.com\u002Freset-password\",\n});\n```\n\n**Note**: While the `email` is required, we also recommend configuring the `redirectTo` for a smoother user experience.\n\n## Password Hashing\n\nDefault: `scrypt` (Node.js native, no external dependencies).\n\n### Custom Hashing Algorithm\n\nTo use Argon2id or another algorithm, provide custom `hash` and `verify` functions:\n\n```ts\nimport { betterAuth } from \"better-auth\";\nimport { hash, verify, type Options } from \"@node-rs\u002Fargon2\";\n\nconst argon2Options: Options = {\n  memoryCost: 65536, \u002F\u002F 64 MiB\n  timeCost: 3, \u002F\u002F 3 iterations\n  parallelism: 4, \u002F\u002F 4 parallel lanes\n  outputLen: 32, \u002F\u002F 32 byte output\n  algorithm: 2, \u002F\u002F Argon2id variant\n};\n\nexport const auth = betterAuth({\n  emailAndPassword: {\n    enabled: true,\n    password: {\n      hash: (password) => hash(password, argon2Options),\n      verify: ({ password, hash: storedHash }) =>\n        verify(storedHash, password, argon2Options),\n    },\n  },\n});\n```\n\n**Note**: If you switch hashing algorithms on an existing system, users with passwords hashed using the old algorithm won't be able to sign in. Plan a migration strategy if needed.\n","## Quick Start\n\n1. Enable email\u002Fpassword: `emailAndPassword: { enabled: true }`\n2. Configure `emailVerification.sendVerificationEmail`\n3. Add `sendResetPassword` for password reset flows\n4. Run `npx auth@latest migrate`\n5. Verify: attempt sign-up and confirm verification email triggers\n\n---\n\n## Email Verification Setup\n\nConfigure `emailVerification.sendVerificationEmail` to verify user email addresses.\n\n```ts\nimport { betterAuth } from \"better-auth\";\nimport { sendEmail } from \".\u002Femail\"; \u002F\u002F your email sending function\n\nexport const auth = betterAuth({\n  emailVerification: {\n    sendVerificationEmail: async ({ user, url, token }, request) => {\n      await sendEmail({\n        to: user.email,\n        subject: \"Verify your email address\",\n        text: `Click the link to verify your email: ${url}`,\n      });\n    },\n  },\n});\n```\n\n**Note**: The `url` parameter contains the full verification link. The `token` is available if you need to build a custom verification URL.\n\n### Requiring Email Verification\n\nFor stricter security, enable `emailAndPassword.requireEmailVerification` to block sign-in until the user verifies their email. When enabled, unverified users will receive a new verification email on each sign-in attempt.\n\n```ts\nexport const auth = betterAuth({\n  emailAndPassword: {\n    requireEmailVerification: true,\n  },\n});\n```\n\n**Note**: This requires `sendVerificationEmail` to be configured and only applies to email\u002Fpassword sign-ins.\n\n## Client Side Validation\n\nImplement client-side validation for immediate user feedback and reduced server load.\n\n## Callback URLs\n\nAlways use absolute URLs (including the origin) for callback URLs in sign-up and sign-in requests. This prevents Better Auth from needing to infer the origin, which can cause issues when your backend and frontend are on different domains.\n\n```ts\nconst { data, error } = await authClient.signUp.email({\n  callbackURL: \"https:\u002F\u002Fexample.com\u002Fcallback\", \u002F\u002F absolute URL with origin\n});\n```\n\n## Password Reset Flows\n\nProvide `sendResetPassword` in the email and password config to enable password resets.\n\n```ts\nimport { betterAuth } from \"better-auth\";\nimport { sendEmail } from \".\u002Femail\"; \u002F\u002F your email sending function\n\nexport const auth = betterAuth({\n  emailAndPassword: {\n    enabled: true,\n    \u002F\u002F Custom email sending function to send reset-password email\n    sendResetPassword: async ({ user, url, token }, request) => {\n      void sendEmail({\n        to: user.email,\n        subject: \"Reset your password\",\n        text: `Click the link to reset your password: ${url}`,\n      });\n    },\n    \u002F\u002F Optional event hook\n    onPasswordReset: async ({ user }, request) => {\n      \u002F\u002F your logic here\n      console.log(`Password for user ${user.email} has been reset.`);\n    },\n  },\n});\n```\n\n### Security Considerations\n\nBuilt-in protections: background email sending (timing attack prevention), dummy operations on invalid requests, constant response messages regardless of user existence.\n\nOn serverless platforms, configure a background task handler:\n\n```ts\nexport const auth = betterAuth({\n  advanced: {\n    backgroundTasks: {\n      handler: (promise) => {\n        \u002F\u002F Use platform-specific methods like waitUntil\n        waitUntil(promise);\n      },\n    },\n  },\n});\n```\n\n#### Token Security\n\nTokens expire after 1 hour by default. Configure with `resetPasswordTokenExpiresIn` (in seconds):\n\n```ts\nexport const auth = betterAuth({\n  emailAndPassword: {\n    enabled: true,\n    resetPasswordTokenExpiresIn: 60 * 30, \u002F\u002F 30 minutes\n  },\n});\n```\n\nTokens are single-use — deleted immediately after successful reset.\n\n#### Session Revocation\n\nEnable `revokeSessionsOnPasswordReset` to invalidate all existing sessions on password reset:\n\n```ts\nexport const auth = betterAuth({\n  emailAndPassword: {\n    enabled: true,\n    revokeSessionsOnPasswordReset: true,\n  },\n});\n```\n\n#### Password Requirements\n\nPassword length limits (configurable):\n\n```ts\nexport const auth = betterAuth({\n  emailAndPassword: {\n    enabled: true,\n    minPasswordLength: 12,\n    maxPasswordLength: 256,\n  },\n});\n```\n\n### Sending the Password Reset\n\nCall `requestPasswordReset` to send the reset link. Triggers the `sendResetPassword` function from your config.\n\n```ts\nconst data = await auth.api.requestPasswordReset({\n  body: {\n    email: \"john.doe@example.com\", \u002F\u002F required\n    redirectTo: \"https:\u002F\u002Fexample.com\u002Freset-password\",\n  },\n});\n```\n\nOr authClient:\n\n```ts\nconst { data, error } = await authClient.requestPasswordReset({\n  email: \"john.doe@example.com\", \u002F\u002F required\n  redirectTo: \"https:\u002F\u002Fexample.com\u002Freset-password\",\n});\n```\n\n**Note**: While the `email` is required, we also recommend configuring the `redirectTo` for a smoother user experience.\n\n## Password Hashing\n\nDefault: `scrypt` (Node.js native, no external dependencies).\n\n### Custom Hashing Algorithm\n\nTo use Argon2id or another algorithm, provide custom `hash` and `verify` functions:\n\n```ts\nimport { betterAuth } from \"better-auth\";\nimport { hash, verify, type Options } from \"@node-rs\u002Fargon2\";\n\nconst argon2Options: Options = {\n  memoryCost: 65536, \u002F\u002F 64 MiB\n  timeCost: 3, \u002F\u002F 3 iterations\n  parallelism: 4, \u002F\u002F 4 parallel lanes\n  outputLen: 32, \u002F\u002F 32 byte output\n  algorithm: 2, \u002F\u002F Argon2id variant\n};\n\nexport const auth = betterAuth({\n  emailAndPassword: {\n    enabled: true,\n    password: {\n      hash: (password) => hash(password, argon2Options),\n      verify: ({ password, hash: storedHash }) =>\n        verify(storedHash, password, argon2Options),\n    },\n  },\n});\n```\n\n**Note**: If you switch hashing algorithms on an existing system, users with passwords hashed using the old algorithm won't be able to sign in. Plan a migration strategy if needed.\n",{"name":5,"description":7},"main","a73152352c0612252131e5cf84e91312a6cf17dc","backend-database\u002Femail-and-password-best-practices","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs","https:\u002F\u002Fgithub.com\u002FHenrique1601","https:\u002F\u002Fbezerraportifolio.netlify.app\u002F","Full Stack Developer | React, Next.js, TypeScript, Node.js & IA | Construindo produtos digitais e soluções SaaS","2026-11-15 02:56:04",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add Henrique1601\u002FSkiilsToIAs --skill email-and-password-best-practices",{"tool":38,"command":39},"bunx","bunx skills add Henrique1601\u002FSkiilsToIAs --skill email-and-password-best-practices",{"tool":41,"command":42},"pnpm","pnpm dlx skills add Henrique1601\u002FSkiilsToIAs --skill email-and-password-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Fbackend-database\u002Femail-and-password-best-practices\u002FSKILL.md",true,[],[47,54,61,69,76,83],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":19},"01M7E2ANBW9V6AVX5JXNCEAWF8","rag-architect-agent","Agente Arquiteto de RAG, Embeddings & Busca Vetorial. Especialista em design e implementação de pipelines de Retrieval-Augmented Generation de alta fidelidade: chunking semântico, modelagem pgvector no PostgreSQL (Neon\u002FSupabase), busca híbrida (cosseno + BM25), reranking, validação via TypeSafe AI e filosofia Ponytail (anti-overengineering).","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Fcustom-agents\u002Frag-architect-agent\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M7E29KKF8R02ZRGYE2MJM67G","rag-architecture-patterns","Padrões arquiteturais e implementação de pipelines RAG (Retrieval-Augmented Generation) de alta fidelidade para qualquer projeto ou sistema. Cobre chunking semântico, embeddings, busca híbrida (pgvector + BM25), reranking, validação via TypeSafe AI e filosofia Ponytail (anti-overengineering).","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Fai-agents\u002Frag-architecture-patterns\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":65,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7CWRA8E3BJ7CPY8N8EG28J1","skill-repair","Use this to fix and re-install agent skills that have failed installation.\nThis skill provides the necessary context and permissions to surgically update\nthe `manifest.json` after a fix has been applied.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Futilities\u002Fskill-repair\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7CWR66FZP8FA47WVZ4Z2EXC","security-scan","Scan your Claude Code configuration (.claude\u002F directory) for security vulnerabilities, misconfigurations, and injection risks using AgentShield. Checks CLAUDE.md, settings.json, MCP servers, hooks, and agent definitions.","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Futilities\u002Fsecurity-scan\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7CWR0QPY58QPTR1P759TFNG","security-review","Use this skill when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment\u002Fsensitive features. Provides comprehensive security checklist and patterns.","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Futilities\u002Fsecurity-review\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7CWQXCE40XWT4FZ3VWZFGDP","security-bounty-hunter","Hunt for exploitable, bounty-worthy security issues in repositories. Focuses on remotely reachable vulnerabilities that qualify for real reports instead of noisy local-only findings.","https:\u002F\u002Fgithub.com\u002FHenrique1601\u002FSkiilsToIAs\u002Fblob\u002Fmain\u002Futilities\u002Fsecurity-bounty-hunter\u002FSKILL.md",[],[]]