/engineering-advanced-skills:saas-scaffolderfrom engineering-advanced-skills
Scaffolds a Next.js SaaS skeleton with provider-specific dependencies, Drizzle tenancy schema, middleware, and guides for auth, billing, and tenant isolation. Use when starting a SaaS, subscription app, or multi-tenant platform.
Ships in engineering-advanced-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
The agent stands up a Next.js App Router + TypeScript + Tailwind + Drizzle SaaS for the chosen auth, billing and tenancy providers, then implements auth, billing and tenant isolation from the reference code and checks isolation before anything ships.
What the tool writes, and what it does not. saas_scaffolder.py writes the file tree, a package.json whose dependencies follow --auth, --db and --payments, a provider-filtered .env.example, a Drizzle schema shaped by --tenancy, drizzle.config.ts, tsconfig.json, next.config.ts, Tailwind v4 PostCSS config, route protection (proxy.ts for Next.js 16+, which replaces middleware.ts; --next-major 15 writes middleware.ts) and a health route. Every other file is a // STUB that names the reference section to implement it from. It does not write application logic, so the result does not build until the stubs are filled.
tenant_config_validator.py).Before scaffolding, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.
--auth; changes dependencies, env and middleware).--payments; adds or removes billing routes, deps and schema columns).--tenancy; shapes the schema and every query).--db; picks the driver). Only Postgres is supported: the schema uses drizzle-orm/pg-core.Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.
saas_scaffolder.py --name <pkg> --auth ... --payments ... --tenancy ... --output <dir>. It refuses a non-empty --output so it cannot overwrite work. Use --dry-run first to show the plan.next, react and Tailwind get ^ ranges for majors known to be current (Next.js 16, React 19, Tailwind 4); every other dependency uses an npm tag (latest, or beta for next-auth, whose v5 API the references use), because invented version numbers go stale. The lockfile from that first install is what makes later installs reproducible, so review it and commit it.
Auth.js notes it is now part of Better Auth; read its upgrade guide (authjs.dev) before choosing it for a new project. With Auth.js v5, AUTH_URL is optional and AUTH_TRUST_HOST=true is needed behind a reverse proxy.grep -rl "STUB generated" . lists what remains.tenant_config_validator.py --src <app dir>. Fix every critical finding; unscoped queries are cross-tenant data leaks.npm run build passes, no STUB generated files remain, a test checkout updates the subscription row, a replayed webhook is a no-op, and the validator reports no critical findings.# from engineering/saas-scaffolder/; scaffold outside the repo
OUT=$(mktemp -d)
python3 scripts/saas_scaffolder.py --name acme --auth clerk --payments none --tenancy none --output "$OUT/acme"
python3 scripts/saas_scaffolder.py --name acme --dry-run --format json # plan only, nothing written
python3 scripts/tenant_config_validator.py --config assets/sample_tenant_config.json # exit 0
python3 scripts/tenant_config_validator.py --config assets/flawed_tenant_config.json --src assets/flawed_src # exit 1, 5 critical
python3 scripts/feature_flag_manager.py --store "$OUT/flags.json" create --key sso --enabled --allowed-plans pro enterprise
python3 scripts/feature_flag_manager.py --store "$OUT/flags.json" evaluate --key sso --plan free # INACTIVE
| Tool | Purpose | Key flags | Exit codes |
|---|---|---|---|
scripts/saas_scaffolder.py | Tree, provider-specific package.json, .env.example, schema, configs, proxy.ts (or middleware.ts); stubs for the rest | --name, --auth nextauth|clerk|supabase, --db neondb|supabase|postgres, --payments stripe|lemonsqueezy|none, --tenancy workspace|organization|none, --features a,b, --next-major 16, --output, --dry-run, --format json | 0 done; 2 invalid name or non-empty output |
scripts/tenant_config_validator.py | Tenant config (duplicate ids, slugs, domains; isolation settings; plans) and source scan (unscoped db.* queries, global tenant state, route handlers without auth()) | --config FILE, --src DIR (repeatable), --severity, --json | 0 no critical; 1 critical findings; 2 unreadable config, bad JSON or missing --src |
scripts/feature_flag_manager.py | Create, update, list and evaluate plan- and environment-gated flags in a JSON store | --store FILE, create|get|update|delete|list|evaluate | 0 ok; 2 unreadable or malformed store |
The source scan is line-based regex: it catches the common leaks, not every one. A clean result is not proof of isolation; review data access in code review too.
Mistake: Querying tenant-owned tables without the tenant id.
Why it matters: One missing where(eq(t.workspaceId, ...)) returns every customer's rows; it is the most common multi-tenant breach.
Instead: Route all reads and writes through a workspace-scoped helper (see Multi-Tenancy Patterns in the auth reference) and run the validator on every PR.
Mistake: Trusting the client for plan or subscription state. Why it matters: Feature gates checked only in the browser are bypassed by calling the API directly. Instead: Check the plan and current period end on the server, from the webhook-maintained row.
Mistake: A webhook handler without signature verification or idempotency.
Why it matters: Unsigned events can be forged, and providers retry, so duplicates double-apply changes.
Instead: Verify the signature first, record event.id, and make each handler safe to replay.
| File | Purpose |
|---|---|
scripts/saas_scaffolder.py | Skeleton generator (stdlib only) |
scripts/tenant_config_validator.py | Tenant config and source isolation checks |
scripts/feature_flag_manager.py | JSON-store feature flags with plan and environment gating |
assets/sample_tenant_config.json | Sound three-tenant config; validator exits 0 |
assets/flawed_tenant_config.json | Duplicate slug and domain, missing dedicated DB, unknown plan; exits 1 |
assets/flawed_src/projects-route.ts | Unscoped query and global tenant state; critical findings |
Covers: Next.js SaaS skeletons for three auth providers, two billing providers and three tenancy models on Postgres; reference implementations for auth, billing and tenancy; tenant isolation checks; plan-gated feature flags.
Does not cover:
engineering/stripe-integration-expert).engineering/database-schema-designer).engineering/ci-cd-pipeline-builder).engineering/api-design-reviewer) and secrets management (see engineering/env-secrets-manager).assets/flawed_src/projects-route.ts (opens in a new tab)assets/flawed_tenant_config.json (opens in a new tab)assets/sample_tenant_config.json (opens in a new tab)references/auth-billing-and-tenancy.md (opens in a new tab)references/project-structure-and-schema.md (opens in a new tab)references/workflow-and-quality.md (opens in a new tab)scripts/feature_flag_manager.py (opens in a new tab)scripts/saas_scaffolder.py (opens in a new tab)scripts/tenant_config_validator.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub borghei/claude-skills --plugin engineering-advanced-skills100 skills in this plugin
/a11y-auditStatic WCAG scan of HTML files (alt text, headings, labels, ARIA, lang, landmarks) and colour contrast checks for colour pairs or CSS. Use when auditing templates for accessibility, checking contrast, or adding an a11y gate to CI.
/agent-designerDesigns multi-agent system architectures with orchestration patterns, tool schemas, and performance evaluation. Use when building AI agent systems, designing agent workflows, creating tool schemas, or evaluating agent performance.
/agent-harnessTest and evaluation harness for AI agents — scenario suites, deterministic replay, regression diffing, cost and latency budgets. Use when agent quality is vibe-checked, before shipping a prompt or model change, or when evals drift.
/agenthubRuns a multi-agent job as a dependency graph: validates the DAG, tracks each agent's state on a board, then ranks and merges their outputs. Use when spawning parallel agents, monitoring a run, or merging results.
/agentic-evaluation-frameworkBuilds LLM and agent evals: weighted rubrics, LLM-as-judge design, inter-rater agreement and pairwise ranking (Elo, Bradley-Terry) from scores you collect. Use when setting up a judge, scoring outputs, or comparing model or prompt variants.
/agent-protocolDesign AI agent communication protocols: MCP tool schemas, A2A, function calling, and inter- agent messaging. Use when building multi-agent systems, defining tool interfaces, or implementing agent-to-agent communication.
2 plugins ship this exact skill · first indexed Nov 9, 2026
Other plugins' skills for the same job