[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6DSJ58J95EDAA8M3K8JC8GA":3,"skill-same:01M6DSJ58J95EDAA8M3K8JC8GA":109},{"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":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":49,"commitSha":50,"skillDirectory":51,"forksCount":52,"repositoryHtmlUrl":53,"repositoryHomepageUrl":6,"ownerHtmlUrl":54,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":55,"install":56,"resources":69},"01M6DSJ58J95EDAA8M3K8JC8GA","saas-scaffolder",null,"Generates complete, production-ready SaaS project boilerplate including authentication, database schemas, billing integration, API routes, and a working dashboard using Next.js 14+ App Router, TypeScript, Tailwind CSS, shadcn\u002Fui, Drizzle ORM, and Stripe. Use when the user wants to create a new SaaS app, start a subscription-based web project, scaffold a Next.js application, or mentions terms like starter template, boilerplate, new project, or wiring up auth and payments.","zhangzhang-111-i\u002Fclaude-skills111","zhangzhang-111-i","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F251344927?v=4","01M6DRBP4NCM1ZCHTT0FW0SQHD","lixiying","01M6DRBPAMFDJSGQ69XPK9KM9J",4,"MIT","https:\u002F\u002Fgithub.com\u002Fzhangzhang-111-i\u002Fclaude-skills111\u002Fblob\u002Fmain\u002Fproduct-team\u002Fsaas-scaffolder\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"saas scaffolder","saas","Tailwind","app","project","next","up","ready","router","drizzle orm","template","css","api","payments","database","authentication","create","auth","dashboard","typescript","2026-11-10 10:12:30",false,"---\nname: \"saas-scaffolder\"\ndescription: \"Generates complete, production-ready SaaS project boilerplate including authentication, database schemas, billing integration, API routes, and a working dashboard using Next.js 14+ App Router, TypeScript, Tailwind CSS, shadcn\u002Fui, Drizzle ORM, and Stripe. Use when the user wants to create a new SaaS app, start a subscription-based web project, scaffold a Next.js application, or mentions terms like starter template, boilerplate, new project, or wiring up auth and payments.\"\n---\n\n# SaaS Scaffolder\n\n**Tier:** POWERFUL  \n**Category:** Product Team  \n**Domain:** Full-Stack Development \u002F Project Bootstrapping\n\n---\n\n## Input Format\n\n```\nProduct: [name]\nDescription: [1-3 sentences]\nAuth: nextauth | clerk | supabase\nDatabase: neondb | supabase | planetscale\nPayments: stripe | lemonsqueezy | none\nFeatures: [comma-separated list]\n```\n\n---\n\n## File Tree Output\n\n```\nmy-saas\u002F\n├── app\u002F\n│   ├── (auth)\u002F\n│   │   ├── login\u002Fpage.tsx\n│   │   ├── register\u002Fpage.tsx\n│   │   └── layout.tsx\n│   ├── (dashboard)\u002F\n│   │   ├── dashboard\u002Fpage.tsx\n│   │   ├── settings\u002Fpage.tsx\n│   │   ├── billing\u002Fpage.tsx\n│   │   └── layout.tsx\n│   ├── (marketing)\u002F\n│   │   ├── page.tsx\n│   │   ├── pricing\u002Fpage.tsx\n│   │   └── layout.tsx\n│   ├── api\u002F\n│   │   ├── auth\u002F[...nextauth]\u002Froute.ts\n│   │   ├── webhooks\u002Fstripe\u002Froute.ts\n│   │   ├── billing\u002Fcheckout\u002Froute.ts\n│   │   └── billing\u002Fportal\u002Froute.ts\n│   └── layout.tsx\n├── components\u002F\n│   ├── ui\u002F\n│   ├── auth\u002F\n│   │   ├── login-form.tsx\n│   │   └── register-form.tsx\n│   ├── dashboard\u002F\n│   │   ├── sidebar.tsx\n│   │   ├── header.tsx\n│   │   └── stats-card.tsx\n│   ├── marketing\u002F\n│   │   ├── hero.tsx\n│   │   ├── features.tsx\n│   │   ├── pricing.tsx\n│   │   └── footer.tsx\n│   └── billing\u002F\n│       ├── plan-card.tsx\n│       └── usage-meter.tsx\n├── lib\u002F\n│   ├── auth.ts\n│   ├── db.ts\n│   ├── stripe.ts\n│   ├── validations.ts\n│   └── utils.ts\n├── db\u002F\n│   ├── schema.ts\n│   └── migrations\u002F\n├── hooks\u002F\n│   ├── use-subscription.ts\n│   └── use-user.ts\n├── types\u002Findex.ts\n├── middleware.ts\n├── .env.example\n├── drizzle.config.ts\n└── next.config.ts\n```\n\n---\n\n## Key Component Patterns\n\n### Auth Config (NextAuth)\n\n```typescript\n\u002F\u002F lib\u002Fauth.ts\nimport { NextAuthOptions } from \"next-auth\"\nimport GoogleProvider from \"next-auth\u002Fproviders\u002Fgoogle\"\nimport { DrizzleAdapter } from \"@auth\u002Fdrizzle-adapter\"\nimport { db } from \".\u002Fdb\"\n\nexport const authOptions: NextAuthOptions = {\n  adapter: DrizzleAdapter(db),\n  providers: [\n    GoogleProvider({\n      clientId: process.env.GOOGLE_CLIENT_ID!,\n      clientSecret: process.env.GOOGLE_CLIENT_SECRET!,\n    }),\n  ],\n  callbacks: {\n    session: async ({ session, user }) => ({\n      ...session,\n      user: {\n        ...session.user,\n        id: user.id,\n        subscriptionStatus: user.subscriptionStatus,\n      },\n    }),\n  },\n  pages: { signIn: \"\u002Flogin\" },\n}\n```\n\n### Database Schema (Drizzle + NeonDB)\n\n```typescript\n\u002F\u002F db\u002Fschema.ts\nimport { pgTable, text, timestamp, integer } from \"drizzle-orm\u002Fpg-core\"\n\nexport const users = pgTable(\"users\", {\n  id: text(\"id\").primaryKey().$defaultFn(() => crypto.randomUUID()),\n  name: text(\"name\"),\n  email: text(\"email\").notNull().unique(),\n  emailVerified: timestamp(\"emailVerified\"),\n  image: text(\"image\"),\n  stripeCustomerId: text(\"stripe_customer_id\").unique(),\n  stripeSubscriptionId: text(\"stripe_subscription_id\"),\n  stripePriceId: text(\"stripe_price_id\"),\n  stripeCurrentPeriodEnd: timestamp(\"stripe_current_period_end\"),\n  createdAt: timestamp(\"created_at\").defaultNow().notNull(),\n})\n\nexport const accounts = pgTable(\"accounts\", {\n  userId: text(\"user_id\").notNull().references(() => users.id, { onDelete: \"cascade\" }),\n  type: text(\"type\").notNull(),\n  provider: text(\"provider\").notNull(),\n  providerAccountId: text(\"provider_account_id\").notNull(),\n  refresh_token: text(\"refresh_token\"),\n  access_token: text(\"access_token\"),\n  expires_at: integer(\"expires_at\"),\n})\n```\n\n### Stripe Checkout Route\n\n```typescript\n\u002F\u002F app\u002Fapi\u002Fbilling\u002Fcheckout\u002Froute.ts\nimport { NextResponse } from \"next\u002Fserver\"\nimport { getServerSession } from \"next-auth\"\nimport { authOptions } from \"@\u002Flib\u002Fauth\"\nimport { stripe } from \"@\u002Flib\u002Fstripe\"\nimport { db } from \"@\u002Flib\u002Fdb\"\nimport { users } from \"@\u002Fdb\u002Fschema\"\nimport { eq } from \"drizzle-orm\"\n\nexport async function POST(req: Request) {\n  const session = await getServerSession(authOptions)\n  if (!session?.user) return NextResponse.json({ error: \"Unauthorized\" }, { status: 401 })\n\n  const { priceId } = await req.json()\n  const [user] = await db.select().from(users).where(eq(users.id, session.user.id))\n\n  let customerId = user.stripeCustomerId\n  if (!customerId) {\n    const customer = await stripe.customers.create({ email: session.user.email! })\n    customerId = customer.id\n    await db.update(users).set({ stripeCustomerId: customerId }).where(eq(users.id, user.id))\n  }\n\n  const checkoutSession = await stripe.checkout.sessions.create({\n    customer: customerId,\n    mode: \"subscription\",\n    payment_method_types: [\"card\"],\n    line_items: [{ price: priceId, quantity: 1 }],\n    success_url: `${process.env.NEXT_PUBLIC_APP_URL}\u002Fdashboard?upgraded=true`,\n    cancel_url: `${process.env.NEXT_PUBLIC_APP_URL}\u002Fpricing`,\n    subscription_data: { trial_period_days: 14 },\n  })\n\n  return NextResponse.json({ url: checkoutSession.url })\n}\n```\n\n### Middleware\n\n```typescript\n\u002F\u002F middleware.ts\nimport { withAuth } from \"next-auth\u002Fmiddleware\"\nimport { NextResponse } from \"next\u002Fserver\"\n\nexport default withAuth(\n  function middleware(req) {\n    const token = req.nextauth.token\n    if (req.nextUrl.pathname.startsWith(\"\u002Fdashboard\") && !token) {\n      return NextResponse.redirect(new URL(\"\u002Flogin\", req.url))\n    }\n  },\n  { callbacks: { authorized: ({ token }) => !!token } }\n)\n\nexport const config = {\n  matcher: [\"\u002Fdashboard\u002F:path*\", \"\u002Fsettings\u002F:path*\", \"\u002Fbilling\u002F:path*\"],\n}\n```\n\n### Environment Variables Template\n\n```bash\n# .env.example\nNEXT_PUBLIC_APP_URL=http:\u002F\u002Flocalhost:3000\nDATABASE_URL=postgresql:\u002F\u002Fuser:pass@ep-xxx.us-east-1.aws.neon.tech\u002Fneondb?sslmode=require\nNEXTAUTH_SECRET=generate-with-openssl-rand-base64-32\nNEXTAUTH_URL=http:\u002F\u002Flocalhost:3000\nGOOGLE_CLIENT_ID=\nGOOGLE_CLIENT_SECRET=\nSTRIPE_SECRET_KEY=sk_test_...\nSTRIPE_WEBHOOK_SECRET=whsec_...\nNEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...\nSTRIPE_PRO_PRICE_ID=price_...\n```\n\n---\n\n## Scaffold Checklist\n\nThe following phases must be completed in order. **Validate at the end of each phase before proceeding.**\n\n### Phase 1 — Foundation\n- [ ] 1. Next.js initialized with TypeScript and App Router\n- [ ] 2. Tailwind CSS configured with custom theme tokens\n- [ ] 3. shadcn\u002Fui installed and configured\n- [ ] 4. ESLint + Prettier configured\n- [ ] 5. `.env.example` created with all required variables\n\n✅ **Validate:** Run `npm run build` — no TypeScript or lint errors should appear.  \n? **If build fails:** Check `tsconfig.json` paths and that all shadcn\u002Fui peer dependencies are installed.\n\n### Phase 2 — Database\n- [ ] 6. Drizzle ORM installed and configured\n- [ ] 7. Schema written (users, accounts, sessions, verification_tokens)\n- [ ] 8. Initial migration generated and applied\n- [ ] 9. DB client singleton exported from `lib\u002Fdb.ts`\n- [ ] 10. DB connection tested in local environment\n\n✅ **Validate:** Run a simple `db.select().from(users)` in a test script — it should return an empty array without throwing.  \n? **If DB connection fails:** Verify `DATABASE_URL` format includes `?sslmode=require` for NeonDB\u002FSupabase. Check that the migration has been applied with `drizzle-kit push` (dev) or `drizzle-kit migrate` (prod).\n\n### Phase 3 — Authentication\n- [ ] 11. Auth provider installed (NextAuth \u002F Clerk \u002F Supabase)\n- [ ] 12. OAuth provider configured (Google \u002F GitHub)\n- [ ] 13. Auth API route created\n- [ ] 14. Session callback adds user ID and subscription status\n- [ ] 15. Middleware protects dashboard routes\n- [ ] 16. Login and register pages built with error states\n\n✅ **Validate:** Sign in via OAuth, confirm session user has `id` and `subscriptionStatus`. Attempt to access `\u002Fdashboard` without a session — you should be redirected to `\u002Flogin`.  \n? **If sign-out loops occur in production:** Ensure `NEXTAUTH_SECRET` is set and consistent across deployments. Add `declare module \"next-auth\"` to extend session types if TypeScript errors appear.\n\n### Phase 4 — Payments\n- [ ] 17. Stripe client initialized with TypeScript types\n- [ ] 18. Checkout session route created\n- [ ] 19. Customer portal route created\n- [ ] 20. Stripe webhook handler with signature verification\n- [ ] 21. Webhook updates user subscription status in DB idempotently\n\n✅ **Validate:** Complete a Stripe test checkout using a `4242 4242 4242 4242` card. Confirm `stripeSubscriptionId` is written to the DB. Replay the `checkout.session.completed` webhook event and confirm idempotency (no duplicate DB writes).  \n? **If webhook signature fails:** Use `stripe listen --forward-to localhost:3000\u002Fapi\u002Fwebhooks\u002Fstripe` locally — never hardcode the raw webhook secret. Verify `STRIPE_WEBHOOK_SECRET` matches the listener output.\n\n### Phase 5 — UI\n- [ ] 22. Landing page with hero, features, pricing sections\n- [ ] 23. Dashboard layout with sidebar and responsive header\n- [ ] 24. Billing page showing current plan and upgrade options\n- [ ] 25. Settings page with profile update form and success states\n\n✅ **Validate:** Run `npm run build` for a final production build check. Navigate all routes manually and confirm no broken layouts, missing session data, or hydration errors.\n\n---\n\n## Reference Files\n\nFor additional guidance, generate the following companion reference files alongside the scaffold:\n\n- **`CUSTOMIZATION.md`** — Auth providers, database options, ORM alternatives, payment providers, UI themes, and billing models (per-seat, flat-rate, usage-based).\n- **`PITFALLS.md`** — Common failure modes: missing `NEXTAUTH_SECRET`, webhook secret mismatches, Edge runtime conflicts with Drizzle, unextended session types, and migration strategy differences between dev and prod.\n- **`BEST_PRACTICES.md`** — Stripe singleton pattern, server actions for form mutations, idempotent webhook handlers, `Suspense` boundaries for async dashboard data, server-side feature gating via `stripeCurrentPeriodEnd`, and rate limiting on auth routes with Upstash Redis + `@upstash\u002Fratelimit`.\n","# SaaS Scaffolder\n\n**Tier:** POWERFUL  \n**Category:** Product Team  \n**Domain:** Full-Stack Development \u002F Project Bootstrapping\n\n---\n\n## Input Format\n\n```\nProduct: [name]\nDescription: [1-3 sentences]\nAuth: nextauth | clerk | supabase\nDatabase: neondb | supabase | planetscale\nPayments: stripe | lemonsqueezy | none\nFeatures: [comma-separated list]\n```\n\n---\n\n## File Tree Output\n\n```\nmy-saas\u002F\n├── app\u002F\n│   ├── (auth)\u002F\n│   │   ├── login\u002Fpage.tsx\n│   │   ├── register\u002Fpage.tsx\n│   │   └── layout.tsx\n│   ├── (dashboard)\u002F\n│   │   ├── dashboard\u002Fpage.tsx\n│   │   ├── settings\u002Fpage.tsx\n│   │   ├── billing\u002Fpage.tsx\n│   │   └── layout.tsx\n│   ├── (marketing)\u002F\n│   │   ├── page.tsx\n│   │   ├── pricing\u002Fpage.tsx\n│   │   └── layout.tsx\n│   ├── api\u002F\n│   │   ├── auth\u002F[...nextauth]\u002Froute.ts\n│   │   ├── webhooks\u002Fstripe\u002Froute.ts\n│   │   ├── billing\u002Fcheckout\u002Froute.ts\n│   │   └── billing\u002Fportal\u002Froute.ts\n│   └── layout.tsx\n├── components\u002F\n│   ├── ui\u002F\n│   ├── auth\u002F\n│   │   ├── login-form.tsx\n│   │   └── register-form.tsx\n│   ├── dashboard\u002F\n│   │   ├── sidebar.tsx\n│   │   ├── header.tsx\n│   │   └── stats-card.tsx\n│   ├── marketing\u002F\n│   │   ├── hero.tsx\n│   │   ├── features.tsx\n│   │   ├── pricing.tsx\n│   │   └── footer.tsx\n│   └── billing\u002F\n│       ├── plan-card.tsx\n│       └── usage-meter.tsx\n├── lib\u002F\n│   ├── auth.ts\n│   ├── db.ts\n│   ├── stripe.ts\n│   ├── validations.ts\n│   └── utils.ts\n├── db\u002F\n│   ├── schema.ts\n│   └── migrations\u002F\n├── hooks\u002F\n│   ├── use-subscription.ts\n│   └── use-user.ts\n├── types\u002Findex.ts\n├── middleware.ts\n├── .env.example\n├── drizzle.config.ts\n└── next.config.ts\n```\n\n---\n\n## Key Component Patterns\n\n### Auth Config (NextAuth)\n\n```typescript\n\u002F\u002F lib\u002Fauth.ts\nimport { NextAuthOptions } from \"next-auth\"\nimport GoogleProvider from \"next-auth\u002Fproviders\u002Fgoogle\"\nimport { DrizzleAdapter } from \"@auth\u002Fdrizzle-adapter\"\nimport { db } from \".\u002Fdb\"\n\nexport const authOptions: NextAuthOptions = {\n  adapter: DrizzleAdapter(db),\n  providers: [\n    GoogleProvider({\n      clientId: process.env.GOOGLE_CLIENT_ID!,\n      clientSecret: process.env.GOOGLE_CLIENT_SECRET!,\n    }),\n  ],\n  callbacks: {\n    session: async ({ session, user }) => ({\n      ...session,\n      user: {\n        ...session.user,\n        id: user.id,\n        subscriptionStatus: user.subscriptionStatus,\n      },\n    }),\n  },\n  pages: { signIn: \"\u002Flogin\" },\n}\n```\n\n### Database Schema (Drizzle + NeonDB)\n\n```typescript\n\u002F\u002F db\u002Fschema.ts\nimport { pgTable, text, timestamp, integer } from \"drizzle-orm\u002Fpg-core\"\n\nexport const users = pgTable(\"users\", {\n  id: text(\"id\").primaryKey().$defaultFn(() => crypto.randomUUID()),\n  name: text(\"name\"),\n  email: text(\"email\").notNull().unique(),\n  emailVerified: timestamp(\"emailVerified\"),\n  image: text(\"image\"),\n  stripeCustomerId: text(\"stripe_customer_id\").unique(),\n  stripeSubscriptionId: text(\"stripe_subscription_id\"),\n  stripePriceId: text(\"stripe_price_id\"),\n  stripeCurrentPeriodEnd: timestamp(\"stripe_current_period_end\"),\n  createdAt: timestamp(\"created_at\").defaultNow().notNull(),\n})\n\nexport const accounts = pgTable(\"accounts\", {\n  userId: text(\"user_id\").notNull().references(() => users.id, { onDelete: \"cascade\" }),\n  type: text(\"type\").notNull(),\n  provider: text(\"provider\").notNull(),\n  providerAccountId: text(\"provider_account_id\").notNull(),\n  refresh_token: text(\"refresh_token\"),\n  access_token: text(\"access_token\"),\n  expires_at: integer(\"expires_at\"),\n})\n```\n\n### Stripe Checkout Route\n\n```typescript\n\u002F\u002F app\u002Fapi\u002Fbilling\u002Fcheckout\u002Froute.ts\nimport { NextResponse } from \"next\u002Fserver\"\nimport { getServerSession } from \"next-auth\"\nimport { authOptions } from \"@\u002Flib\u002Fauth\"\nimport { stripe } from \"@\u002Flib\u002Fstripe\"\nimport { db } from \"@\u002Flib\u002Fdb\"\nimport { users } from \"@\u002Fdb\u002Fschema\"\nimport { eq } from \"drizzle-orm\"\n\nexport async function POST(req: Request) {\n  const session = await getServerSession(authOptions)\n  if (!session?.user) return NextResponse.json({ error: \"Unauthorized\" }, { status: 401 })\n\n  const { priceId } = await req.json()\n  const [user] = await db.select().from(users).where(eq(users.id, session.user.id))\n\n  let customerId = user.stripeCustomerId\n  if (!customerId) {\n    const customer = await stripe.customers.create({ email: session.user.email! })\n    customerId = customer.id\n    await db.update(users).set({ stripeCustomerId: customerId }).where(eq(users.id, user.id))\n  }\n\n  const checkoutSession = await stripe.checkout.sessions.create({\n    customer: customerId,\n    mode: \"subscription\",\n    payment_method_types: [\"card\"],\n    line_items: [{ price: priceId, quantity: 1 }],\n    success_url: `${process.env.NEXT_PUBLIC_APP_URL}\u002Fdashboard?upgraded=true`,\n    cancel_url: `${process.env.NEXT_PUBLIC_APP_URL}\u002Fpricing`,\n    subscription_data: { trial_period_days: 14 },\n  })\n\n  return NextResponse.json({ url: checkoutSession.url })\n}\n```\n\n### Middleware\n\n```typescript\n\u002F\u002F middleware.ts\nimport { withAuth } from \"next-auth\u002Fmiddleware\"\nimport { NextResponse } from \"next\u002Fserver\"\n\nexport default withAuth(\n  function middleware(req) {\n    const token = req.nextauth.token\n    if (req.nextUrl.pathname.startsWith(\"\u002Fdashboard\") && !token) {\n      return NextResponse.redirect(new URL(\"\u002Flogin\", req.url))\n    }\n  },\n  { callbacks: { authorized: ({ token }) => !!token } }\n)\n\nexport const config = {\n  matcher: [\"\u002Fdashboard\u002F:path*\", \"\u002Fsettings\u002F:path*\", \"\u002Fbilling\u002F:path*\"],\n}\n```\n\n### Environment Variables Template\n\n```bash\n# .env.example\nNEXT_PUBLIC_APP_URL=http:\u002F\u002Flocalhost:3000\nDATABASE_URL=postgresql:\u002F\u002Fuser:pass@ep-xxx.us-east-1.aws.neon.tech\u002Fneondb?sslmode=require\nNEXTAUTH_SECRET=generate-with-openssl-rand-base64-32\nNEXTAUTH_URL=http:\u002F\u002Flocalhost:3000\nGOOGLE_CLIENT_ID=\nGOOGLE_CLIENT_SECRET=\nSTRIPE_SECRET_KEY=sk_test_...\nSTRIPE_WEBHOOK_SECRET=whsec_...\nNEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...\nSTRIPE_PRO_PRICE_ID=price_...\n```\n\n---\n\n## Scaffold Checklist\n\nThe following phases must be completed in order. **Validate at the end of each phase before proceeding.**\n\n### Phase 1 — Foundation\n- [ ] 1. Next.js initialized with TypeScript and App Router\n- [ ] 2. Tailwind CSS configured with custom theme tokens\n- [ ] 3. shadcn\u002Fui installed and configured\n- [ ] 4. ESLint + Prettier configured\n- [ ] 5. `.env.example` created with all required variables\n\n✅ **Validate:** Run `npm run build` — no TypeScript or lint errors should appear.  \n? **If build fails:** Check `tsconfig.json` paths and that all shadcn\u002Fui peer dependencies are installed.\n\n### Phase 2 — Database\n- [ ] 6. Drizzle ORM installed and configured\n- [ ] 7. Schema written (users, accounts, sessions, verification_tokens)\n- [ ] 8. Initial migration generated and applied\n- [ ] 9. DB client singleton exported from `lib\u002Fdb.ts`\n- [ ] 10. DB connection tested in local environment\n\n✅ **Validate:** Run a simple `db.select().from(users)` in a test script — it should return an empty array without throwing.  \n? **If DB connection fails:** Verify `DATABASE_URL` format includes `?sslmode=require` for NeonDB\u002FSupabase. Check that the migration has been applied with `drizzle-kit push` (dev) or `drizzle-kit migrate` (prod).\n\n### Phase 3 — Authentication\n- [ ] 11. Auth provider installed (NextAuth \u002F Clerk \u002F Supabase)\n- [ ] 12. OAuth provider configured (Google \u002F GitHub)\n- [ ] 13. Auth API route created\n- [ ] 14. Session callback adds user ID and subscription status\n- [ ] 15. Middleware protects dashboard routes\n- [ ] 16. Login and register pages built with error states\n\n✅ **Validate:** Sign in via OAuth, confirm session user has `id` and `subscriptionStatus`. Attempt to access `\u002Fdashboard` without a session — you should be redirected to `\u002Flogin`.  \n? **If sign-out loops occur in production:** Ensure `NEXTAUTH_SECRET` is set and consistent across deployments. Add `declare module \"next-auth\"` to extend session types if TypeScript errors appear.\n\n### Phase 4 — Payments\n- [ ] 17. Stripe client initialized with TypeScript types\n- [ ] 18. Checkout session route created\n- [ ] 19. Customer portal route created\n- [ ] 20. Stripe webhook handler with signature verification\n- [ ] 21. Webhook updates user subscription status in DB idempotently\n\n✅ **Validate:** Complete a Stripe test checkout using a `4242 4242 4242 4242` card. Confirm `stripeSubscriptionId` is written to the DB. Replay the `checkout.session.completed` webhook event and confirm idempotency (no duplicate DB writes).  \n? **If webhook signature fails:** Use `stripe listen --forward-to localhost:3000\u002Fapi\u002Fwebhooks\u002Fstripe` locally — never hardcode the raw webhook secret. Verify `STRIPE_WEBHOOK_SECRET` matches the listener output.\n\n### Phase 5 — UI\n- [ ] 22. Landing page with hero, features, pricing sections\n- [ ] 23. Dashboard layout with sidebar and responsive header\n- [ ] 24. Billing page showing current plan and upgrade options\n- [ ] 25. Settings page with profile update form and success states\n\n✅ **Validate:** Run `npm run build` for a final production build check. Navigate all routes manually and confirm no broken layouts, missing session data, or hydration errors.\n\n---\n\n## Reference Files\n\nFor additional guidance, generate the following companion reference files alongside the scaffold:\n\n- **`CUSTOMIZATION.md`** — Auth providers, database options, ORM alternatives, payment providers, UI themes, and billing models (per-seat, flat-rate, usage-based).\n- **`PITFALLS.md`** — Common failure modes: missing `NEXTAUTH_SECRET`, webhook secret mismatches, Edge runtime conflicts with Drizzle, unextended session types, and migration strategy differences between dev and prod.\n- **`BEST_PRACTICES.md`** — Stripe singleton pattern, server actions for form mutations, idempotent webhook handlers, `Suspense` boundaries for async dashboard data, server-side feature gating via `stripeCurrentPeriodEnd`, and rate limiting on auth routes with Upstash Redis + `@upstash\u002Fratelimit`.\n",{"name":5,"description":7},"main","c0a12fc98d85642fa8893e31fc5cf5dfad879de6","product-team\u002Fsaas-scaffolder",0,"https:\u002F\u002Fgithub.com\u002Fzhangzhang-111-i\u002Fclaude-skills111","https:\u002F\u002Fgithub.com\u002Fzhangzhang-111-i","2026-03-13 21:49:18",{"source":8,"skillName":5,"commands":57,"prompt":67,"zipAvailable":68},[58,61,64],{"tool":59,"command":60},"npx","npx skills add zhangzhang-111-i\u002Fclaude-skills111 --skill saas-scaffolder",{"tool":62,"command":63},"bunx","bunx skills add zhangzhang-111-i\u002Fclaude-skills111 --skill saas-scaffolder",{"tool":65,"command":66},"pnpm","pnpm dlx skills add zhangzhang-111-i\u002Fclaude-skills111 --skill saas-scaffolder","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fzhangzhang-111-i\u002Fclaude-skills111\u002Fblob\u002Fmain\u002Fproduct-team\u002Fsaas-scaffolder\u002FSKILL.md",true,[70,75,78,81,84,88,92,96,100,106],{"path":71,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":52,"sourceHtmlUrl":74},"agent-prompt.md","REFERENCE","参考文档","https:\u002F\u002Fgithub.com\u002Fhefarica\u002Farbitragex-v2\u002Fblob\u002Fmain\u002F.claude\u002Fagents\u002Fskills\u002F08-real-time-ui-performance-engineer\u002Fagent-prompt.md",{"path":76,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":52,"sourceHtmlUrl":77},"anti-patterns.md","https:\u002F\u002Fgithub.com\u002Fhefarica\u002Farbitragex-v2\u002Fblob\u002Fmain\u002F.claude\u002Fagents\u002Fskills\u002F08-real-time-ui-performance-engineer\u002Fanti-patterns.md",{"path":79,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":52,"sourceHtmlUrl":80},"checklist.md","https:\u002F\u002Fgithub.com\u002Fhefarica\u002Farbitragex-v2\u002Fblob\u002Fmain\u002F.claude\u002Fagents\u002Fskills\u002F08-real-time-ui-performance-engineer\u002Fchecklist.md",{"path":82,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":52,"sourceHtmlUrl":83},"implementation-patterns.md","https:\u002F\u002Fgithub.com\u002Fhefarica\u002Farbitragex-v2\u002Fblob\u002Fmain\u002F.claude\u002Fagents\u002Fskills\u002F08-real-time-ui-performance-engineer\u002Fimplementation-patterns.md",{"path":85,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":86,"sourceHtmlUrl":87},"references\u002Farchitecture-patterns.md",6727,"https:\u002F\u002Fgithub.com\u002Fzhangzhang-111-i\u002Fclaude-skills111\u002Fblob\u002Fmain\u002Fproduct-team\u002Fsaas-scaffolder\u002Freferences\u002Farchitecture-patterns.md",{"path":89,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":90,"sourceHtmlUrl":91},"references\u002Fauth-billing-guide.md",7143,"https:\u002F\u002Fgithub.com\u002Fzhangzhang-111-i\u002Fclaude-skills111\u002Fblob\u002Fmain\u002Fproduct-team\u002Fsaas-scaffolder\u002Freferences\u002Fauth-billing-guide.md",{"path":93,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":94,"sourceHtmlUrl":95},"references\u002Fsaas-architecture-patterns.md",2764,"https:\u002F\u002Fgithub.com\u002Fzhangzhang-111-i\u002Fclaude-skills111\u002Fblob\u002Fmain\u002Fproduct-team\u002Fsaas-scaffolder\u002Freferences\u002Fsaas-architecture-patterns.md",{"path":97,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":98,"sourceHtmlUrl":99},"references\u002Ftech-stack-comparison.md",9028,"https:\u002F\u002Fgithub.com\u002Fzhangzhang-111-i\u002Fclaude-skills111\u002Fblob\u002Fmain\u002Fproduct-team\u002Fsaas-scaffolder\u002Freferences\u002Ftech-stack-comparison.md",{"path":101,"resourceType":102,"resourceTypeDesc":103,"sizeBytes":104,"sourceHtmlUrl":105},"scripts\u002Fproject_bootstrapper.py","SCRIPT","脚本",14190,"https:\u002F\u002Fgithub.com\u002Fzhangzhang-111-i\u002Fclaude-skills111\u002Fblob\u002Fmain\u002Fproduct-team\u002Fsaas-scaffolder\u002Fscripts\u002Fproject_bootstrapper.py",{"path":107,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":52,"sourceHtmlUrl":108},"validation.md","https:\u002F\u002Fgithub.com\u002Fhefarica\u002Farbitragex-v2\u002Fblob\u002Fmain\u002F.claude\u002Fagents\u002Fskills\u002F08-real-time-ui-performance-engineer\u002Fvalidation.md",[110,137,163,191,211,234],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":44},"01M6DSNYM8PZKEXGYMRX53PVPH","risk-management-specialist","Medical device risk management specialist implementing ISO 14971 throughout product lifecycle. Provides risk analysis, risk evaluation, risk control, and post-production information analysis. Use when user mentions risk management, ISO 14971, risk analysis, FMEA, fault tree analysis, hazard identification, risk control, risk matrix, benefit-risk analysis, residual risk, risk acceptability, or post-market risk.","https:\u002F\u002Fgithub.com\u002Fzhangzhang-111-i\u002Fclaude-skills111\u002Fblob\u002Fmain\u002Fra-qm-team\u002Frisk-management-specialist\u002FSKILL.md",[],[117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136],"risk","risk management specialist","management","risk management","risk analysis","risk evaluation","product","Evaluation","Production","lifecycle","analysis","user","use","risk matrix","Market","device","control","iso","medical","iso 14971",{"skillNo":138,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":143,"publishedAt":44},"01M6DSNSRBGVZWS23TK0ZQ52QC","regulatory-affairs-head","Senior Regulatory Affairs Manager for HealthTech and MedTech companies. Prepares FDA 510(k), De Novo, and PMA submission packages; analyzes regulatory pathways for new medical devices; drafts responses to FDA deficiency letters and Notified Body queries; develops CE marking technical documentation under EU MDR 2017\u002F745; coordinates multi-market approval strategies across FDA, EU, Health Canada, PMDA, and NMPA; and maintains regulatory intelligence on evolving standards. Use when users need to plan or execute FDA submissions, navigate 510(k) or PMA approval processes, achieve CE marking, prepare pre-submission meeting materials, write regulatory strategy documents, respond to agency queries, or manage compliance documentation for medical device market access.","https:\u002F\u002Fgithub.com\u002Fzhangzhang-111-i\u002Fclaude-skills111\u002Fblob\u002Fmain\u002Fra-qm-team\u002Fregulatory-affairs-head\u002FSKILL.md",[],[144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,135,162],"regulatory affairs head","regulatory","head","documentation","documents","packages","planning","devices","plan","access","write","strategy","evidence","standards","manage","intelligence","across","strategies","clinical",{"skillNo":164,"name":165,"nameZh":6,"description":166,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":167,"categories":168,"keywords":177,"publishedAt":44},"01M6DSNN7GNR2HZE66S4D31EP8","quality-manager-qms-iso13485","ISO 13485 Quality Management System implementation and maintenance for medical device organizations. Provides QMS design, documentation control, internal auditing, CAPA management, and certification support. Use when working with medical device quality systems, preparing for ISO 13485 audits, managing regulatory compliance documentation, setting up corrective actions, or building audit preparation programs. Useful for quality management, audit preparation, regulatory compliance, medical device documentation, and corrective action workflows.","https:\u002F\u002Fgithub.com\u002Fzhangzhang-111-i\u002Fclaude-skills111\u002Fblob\u002Fmain\u002Fra-qm-team\u002Fquality-manager-qms-iso13485\u002FSKILL.md",[169,172],{"categoryNo":170,"categoryName":171,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000015","视觉设计",{"categoryNo":173,"categoryName":174,"taxonomyType":175,"taxonomyTypeDesc":176},"01JBSEEDCAT000000000000032","设计师","PROFESSION","适用职业",[178,179,180,181,182,183,147,184,185,186,187,188,129,145,30,189,190,133,134,135],"quality manager qms iso13485","quality","design","review","support","workflows","audit","actions","compliance","system","process","maintenance","document",{"skillNo":192,"name":193,"nameZh":6,"description":194,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":195,"categories":196,"keywords":200,"publishedAt":44},"01M6DSNE5PQM106PM4EDGPBWGZ","quality-manager-qmr","Senior Quality Manager Responsible Person (QMR) for HealthTech and MedTech companies. Provides quality system governance, management review leadership, regulatory compliance oversight, and quality performance monitoring per ISO 13485 Clause 5.5.2.","https:\u002F\u002Fgithub.com\u002Fzhangzhang-111-i\u002Fclaude-skills111\u002Fblob\u002Fmain\u002Fra-qm-team\u002Fquality-manager-qmr\u002FSKILL.md",[197],{"categoryNo":198,"categoryName":199,"taxonomyType":175,"taxonomyTypeDesc":176},"01JBSEEDCAT000000000000037","律师与法务",[201,179,181,202,203,204,205,186,206,187,119,207,145,208,209,210,134],"quality manager qmr","policy","performance","governance","monitoring","regulatory compliance","oversight","cost","culture","leadership",{"skillNo":212,"name":213,"nameZh":6,"description":214,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":215,"categories":216,"keywords":221,"publishedAt":44},"01M6DSN7MYXB6X42TB1GH2TNSB","quality-documentation-manager","Document control system management for medical device QMS. Covers document numbering, version control, change management, and 21 CFR Part 11 compliance. Use for document control procedures, change control workflow, document numbering, version management, electronic signature compliance, or regulatory documentation review.","https:\u002F\u002Fgithub.com\u002Fzhangzhang-111-i\u002Fclaude-skills111\u002Fblob\u002Fmain\u002Fra-qm-team\u002Fquality-documentation-manager\u002FSKILL.md",[217,220],{"categoryNo":218,"categoryName":219,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000002","文档处理",{"categoryNo":198,"categoryName":199,"taxonomyType":175,"taxonomyTypeDesc":176},[147,222,179,181,223,224,184,126,225,187,226,227,129,228,229,230,135,231,232,233],"quality documentation manager","workflow","change","document lifecycle","change management","list","master","system management","documentation review","cfr","21 cfr part 11","change control",{"skillNo":235,"name":236,"nameZh":6,"description":237,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":238,"categories":239,"keywords":240,"publishedAt":44},"01M6DSN3R749H3R20K15QE8X8W","qms-audit-expert","ISO 13485 internal audit expertise for medical device QMS. Covers audit planning, execution, nonconformity classification, and CAPA verification. Use for internal audit planning, audit execution, finding classification, external audit preparation, or audit program management.","https:\u002F\u002Fgithub.com\u002Fzhangzhang-111-i\u002Fclaude-skills111\u002Fblob\u002Fmain\u002Fra-qm-team\u002Fqms-audit-expert\u002FSKILL.md",[],[184,241,242,150,243,244,245,246,119,129,247,132,134,135],"qms audit expert","expert","verification","execution","classification","schedule","checklist"]