add-customer-onboarding
Skill1 starsChanged 47 days agoMITView on GitHub
Let strangers sign up, verify their email, create their own customer and land in it, on an Engine project with Customer_Tenants and Self-onboarding on.
- Reads credentials
In this repository71 other files it gives its agents.
- add-ai-chatSkill
- add-buildpadSkill
- add-commentsSkill
- add-cronSkill
- add-external-oauthSkill
- add-filesSkill
- add-i18nSkill
- add-keyboard-shortcutsSkill
- add-mcp-serverSkill
- add-microappSkill
- add-microfrontendSkill
- add-microfrontend-zonesSkill
- add-mobile-appSkill
- add-multitenancySkill
- add-notificationsSkill
- add-usersSkill
- add-workflowsSkill
- amplify-env-varsSkill
- atomic-writesSkill
- authentication-proxySkill
- buildpad-debugSkill
- buildpad-discoverySkill
- buildpad-implSkill
- buildpad-referenceSkill
- buildpad-reviewSkill
- buildpad-spec-batchSkill
- buildpad-spec-designSkill
- buildpad-spec-initSkill
- buildpad-spec-quickSkill
- buildpad-spec-requirementsSkill
- buildpad-spec-statusSkill
- buildpad-spec-tasksSkill
- buildpad-steering-customSkill
- buildpad-steeringSkill
- buildpad-validate-designSkill
- buildpad-validate-gapSkill
- buildpad-validate-implSkill
- buildpad-verify-completionSkill
- code-simplificationSkill
- context-engineeringSkill
- create-api-routeSkill
- create-collectionSkill
- create-componentSkill
- create-cronSkill
- create-featureSkill
- create-form-builderSkill
- create-migrationSkill
- create-projectSkill
- create-rbacSkill
- create-serviceSkill
- create-testsSkill
- create-workflowSkill
- daas-platformSkill
- debugging-and-error-recoverySkill
- generate-docsSkill
- git-workflow-and-versioningSkill
- grant-module-accessSkill
- hooks-extensionsSkill
- idea-refineSkill
- incremental-implementationSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 9 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Read .buildpad/project.json at the project root.
- Very specific: line 18
If a folder named supabase at the project root holds a file named config.toml, or holds a folder named migrations that holds a file whose …
- Very specific: line 63
Read .buildpad/project.json.
- Distinctive: line 74
Do not open an environment file to find it, and do not call a tool that returns project credentials.
- Very specific: line 77
Write .buildpad/onboarding-answer.json exactly as shown, UTF-8, with a trailing newline.
- Very specific: line 92
If the app has no lib/auth/tenants.ts with settleTenant, build the sign-in of the mode customer-tenants first, with the add-multitenancy …
- Very specific: line 99
Look for a server function that sends one message (sendMail, sendEmail, a provider SDK client under lib/).
- Distinctive: line 103
Not found: ask: "Which mail provider sends this app's email (for example Amazon SES, Resend, Postmark, SendGrid, or an SMTP server)?
- Distinctive: line 113
Found: use the app's existing captcha.
- Distinctive: line 114
Not found: ask which one the developer uses (for example Cloudflare Turnstile, hCaptcha, reCAPTCHA).
- Distinctive: line 118
No captcha: stop with "The sign-up page needs a bot check.
- Distinctive: line 135
Never open an environment file to check that it is set.
- Very specific: line 139
If the repository has an amplify.yml whose build commands lack BUILDPAD_ONBOARDING_KEY, add the Platform's exact line before the build …
- Very specific: line 147
Add one line of the same form for each other server-only variable the flow reads: the mail provider's credentials, the bot check's secret …
- Distinctive: line 158
No customer can be created until the project has a published Release.
- Distinctive: line 167
Read neither fact. The Refusals table maps the Engine's answers when either is missing.
- Distinctive: line 172
Ask the developer for the app's name as people see it.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add Customer Onboarding
<!-- backend-gate:begin v1 -->Establish the backend first. A Buildpad project's backend is either the Buildpad Engine or Supabase, and some parts of this file hold for one of them only. Before you act on anything in this file, find the backend with these steps, in order, and stop at the first step that answers:
- Read
.buildpad/project.jsonat the project root. If it is JSON and its fieldbackendis"engine"or"supabase", that is the backend. If.buildpad/backend-answer.jsonnames the other backend, tell the developer the two files disagree, and follow.buildpad/project.json. - Otherwise read
.buildpad/backend-answer.jsonin the same way; if itsbackendis"engine"or"supabase", that is the backend. - If a folder named
supabaseat the project root holds a file namedconfig.toml, or holds a folder namedmigrationsthat holds a file whose name ends in.sql, the backend is Supabase. - Otherwise ask the developer once: "Is this project's backend the Buildpad Engine or
Supabase?" Write the answer to
.buildpad/backend-answer.jsonas{"buildpadBackendAnswer": 1, "backend": "engine"}or{"buildpadBackendAnswer": 1, "backend": "supabase"}, and ask the developer to commit that file. Do not add it to.gitignore. Never write.buildpad/project.json.
To find the backend, do not open an environment file (.env, .env.*) or an MCP configuration
file, and do not call a tool that returns project credentials.
Then follow only the parts for that backend. A part starts at a line that holds only a comment
whose text is buildpad + -backend: engine or buildpad + -backend: supabase, and ends at the
next line that holds only a comment whose text is /buildpad + -backend. A comment that merely
mentions a backend is not a part. A file whose first line, after any front matter, holds only a
comment whose text is buildpad + -backend-file: engine (or supabase) holds for that backend
only, and so does every file in a folder named engine-only or supabase-only. Skip the other
backend's parts and copy no code from them; everything else holds for both. On an Engine project, when this file says that
something is not available, tell the developer so and stop: do not build a substitute.
<!-- backend-gate:end -->On a Supabase project. Customers that sign themselves up need a Buildpad Engine project with Customer tenants. Tell the developer so and stop.
<!-- buildpad-backend: engine -->Step 1. The backend
The backend is the Buildpad Engine (the procedure above). Go on to step 2.
On an Engine project with Customer_Tenants each customer of the application is a tenant of its own, and the project's tenant is the Blueprint every customer is copied from. Establish the tenancy mode as the add-multitenancy skill says: from the field tenancy of .buildpad/project.json, else from .buildpad/tenancy-answer.json. In the mode customer-tenants that skill's guide engine-customer-tenants replaces what ES-3, ES-4, ES-5, ES-7 and ES-9 say about the project's tenant; in the mode scope they hold as written.
Step 2. The tenancy mode
Establish the tenancy mode with the add-multitenancy skill's Tenancy check.
In the mode scope:
On an Engine project in the mode scope a workspace that a person creates for themselves, as a scope node they own in the project's one tenant, is not available: no route lets a person who is not an administrator create a scope node or give roles at one. Tell the developer so and stop: build no substitute, and never give the application an administrator's credential to create one. Customers that sign themselves up, each a tenant of its own, are available in the mode customer-tenants, with the add-customer-onboarding skill.
In the mode customer-tenants, go on to step 3.
Step 3. Whether customers may sign themselves up
Establish whether customers may sign themselves up. Find it with these steps, in order, and stop at the first step that answers:
- Read
.buildpad/project.json. If its fieldselfOnboardingistrueorfalse, that is the answer. If.buildpad/onboarding-answer.jsonsays otherwise, tell the developer the two files disagree and follow.buildpad/project.json: a kit downloaded before sign-up was turned on saysfalse, and the developer downloads the kit again or sets the field. - Otherwise read
.buildpad/onboarding-answer.jsonin the same way. - Otherwise ask the developer once: "Has a project Admin turned on customer sign-up (Self-onboarding)
for this project on the Buildpad platform's Customers page?" Write the answer to
.buildpad/onboarding-answer.jsonas{"buildpadOnboardingAnswer": 1, "selfOnboarding": true}or{"buildpadOnboardingAnswer": 1, "selfOnboarding": false}, and ask the developer to commit that file. Never write.buildpad/project.json.
Do not open an environment file to find it, and do not call a tool that returns project credentials.
A file that is not JSON, or whose selfOnboarding is missing or not a boolean, gives no answer.
Write .buildpad/onboarding-answer.json exactly as shown, UTF-8, with a trailing newline.
On an Engine project with Customer_Tenants customers sign themselves up only while the project's Self_Onboarding is on, which selfOnboarding in .buildpad/project.json says. While it is off, tell the developer that a project Admin turns it on from the Platform's Customers page, and stop. While it is on, build it with the add-customer-onboarding skill: the application's own server routes call the Engine's sign-up, verification and customer routes with BUILDPAD_ONBOARDING_KEY, read on the server only and never sent to a browser. Never put the host administrator's credential or a call to /api/tenants in the application.
The answer false stops here, as the paragraph above says. A project Admin can turn sign-up on
only once a host administrator has turned on the premium flag Customer self-onboarding for the
project. With the answer true, go on with steps 4 to 11.
Self-onboarding is Development's only. Where the project also has customers in Production, a
Platform member creates each of them on the Customers page, and Production's application offers no
sign-up: the Platform sets the key to off on the production branch (step 7). The same code serves
both, so build the flow once.
Step 4. Sign-in comes first
If the app has no lib/auth/tenants.ts with settleTenant, build the sign-in of the mode
customer-tenants first, with the add-multitenancy skill's guide engine-customer-tenants
(section 5), then come back. This flow changes two things in that sign-in (the reference file,
section 8).
Step 5. Mail_Sender
Look for a server function that sends one message (sendMail, sendEmail, a provider SDK client
under lib/).
- Found: wrap it as
sendMail({to, subject, text, html})inlib/mail/send.ts. - Not found: ask: "Which mail provider sends this app's email (for example Amazon SES, Resend,
Postmark, SendGrid, or an SMTP server)? It needs a verified sending domain, and its credentials (an
API key, or the SMTP host, port, user and password) set in the app's server environment." With an
answer, write
lib/mail/send.tsfor that provider withimport "server-only", reading its credentials from server variables the developer names. - No provider: say "Verification mail needs a mail provider; this flow cannot be built without one" and stop.
Step 6. Bot check
- Found: use the app's existing captcha.
- Not found: ask which one the developer uses (for example Cloudflare Turnstile, hCaptcha,
reCAPTCHA). Then write
lib/onboarding/human-check.ts(import "server-only") withverifyHuman(token, address): Promise<boolean>against that vendor's verify endpoint. Its secret goes in a server variable; its public site key may carryNEXT_PUBLIC_. - No captcha: stop with "The sign-up page needs a bot check; without one a script spends the project's sign-up budget and your mail provider's reputation."
Step 7. The key
The Buildpad platform sets BUILDPAD_ONBOARDING_KEY in the app's hosting when a project Admin
turns sign-up on, or shows it once on the Customers page for another host. It is a server
variable: never give it a NEXT_PUBLIC_ prefix and never read it in a client component.
The value off, in any case, means no key, as an unset or empty value does. The Platform sets it on
the production branch, because Amplify drops an empty value. With no key the app offers no
sign-up: the sign-in page shows no link to it, its pages are not found, and its routes answer 404
before anything else (the reference file, sections 2 and 10).
The Platform manages this variable, and BUILDPAD_SIGNUP_MAIL beside it: never set, change or remove
either with amplify_set_env_vars, which refuses them.
Never open an environment file to check that it is set.
Step 8. amplify.yml
If the repository has an amplify.yml whose build commands lack BUILDPAD_ONBOARDING_KEY, add the
Platform's exact line before the build command:
# Self-onboarding: the app's server reads the onboarding key at run time. Server only; never NEXT_PUBLIC_.
- '[ -z "$BUILDPAD_ONBOARDING_KEY" ] || echo "BUILDPAD_ONBOARDING_KEY=$BUILDPAD_ONBOARDING_KEY" >> .env.production'Add one line of the same form for each other server-only variable the flow reads: the mail
provider's credentials, the bot check's secret and HOST_ORIGIN (the reference file, section 10,
lists them). Tell the developer to set those variables, and the bot check's public site key, on the
Amplify app before the next deployment (the amplify-env-vars
skill). The app reads them only after that deployment. On another host, tell the developer to set
each there, the secrets as server-only variables. amplify.yml is not an environment file, so you
may open it. Leave a BUILDPAD_SIGNUP_MAIL line as it is: it belongs to mail the Engine sends,
which this flow does not use.
Step 9. The Release and the Engine version
No customer can be created until the project has a published Release; the Engine answers 409 until then. Turning sign-up on publishes Release 1, and from then on every new customer is created from the latest published Release, not from the Blueprint as it is. A change made in the Blueprint after that reaches no customer until a later Release is published, and the Platform offers later Releases only once Releases are available. Tell the developer so, and that the structure new customers need is built in the Blueprint before sign-up is turned on. Sign-up also needs the Engine release the Platform names on the Customers page; the Platform turns sign-up on only for a project that runs it.
Read neither fact. The Refusals table maps the Engine's answers when either is missing.
Step 10. Build
Ask the developer for the app's name as people see it; the pages and the mail use it.
Build the flow as the reference file
says: the module that holds the key, the client address, the four routes, the three pages, and the
four changes to the sign-in of step 4 (the login route, the sign-in page, settleTenant and the
middleware). Build the pages' forms with the app's own form components, as the project's rules
require; the reference shows plain elements only to keep the logic visible.
Step 11. Review
Review against the security-and-hardening skill's checks.
For this flow they are:
BUILDPAD_ONBOARDING_KEYis read only in one server-only module (lib/onboarding/engine.ts), never with aNEXT_PUBLIC_prefix and never in a client component; no client component imports anything underlib/onboarding/.- The sign-up route checks the bot-check token before it calls the Engine.
- The sign-up page shows the same text for a new and an existing address.
Refusals
Keyed by the Engine's status and code. The person-facing text never repeats the Engine's message.
| Route | Engine answer | Cause | The page says | Next |
| any | 401 TOKEN_INVALID | The key is missing, unknown or revoked (on the create route it may also be an expired session: the route refreshes the session once and retries before treating it as the key) | "Sign-up is not available right now." | Log onboarding.key_invalid for the developer; no retry |
| any | 403 FORBIDDEN on sign-up, resend or verify | Sign-ups are turned off (Stop sign-ups or turned off) | "Sign-ups are closed right now." | No retry |
| any | 404 | The project's Engine is older than the release that serves sign-up | "Sign-up is not available right now." | Log onboarding.engine_too_old; the developer asks the project Admin |
| any | 429 REQUESTS_EXCEEDED | A budget: per key, per address, resend per person, or verify failures | "Too many attempts. Try again in N minutes." (from Retry-After) | After Retry-After |
| signup, resend | 400 INVALID_PAYLOAD | A malformed address or a password over 72 bytes | "Enter a valid email address." / "Use a shorter password." | The person corrects it |
| verify | 400 INVALID_TOKEN | The code is unknown, used or expired | "This link has expired or was already used." | Resend |
| login | GoTrue email_not_confirmed | Not yet verified | "Confirm your email first." | Resend |
| customers | 401 UNAUTHENTICATED | No session | (redirect) | Sign in |
| customers | 403 FORBIDDEN | Sign-ups are off (or, rarely, the person is not verified) | "Creating companies is closed right now." | No retry |
| customers | 403 QUOTA_EXCEEDED | The project's customer limit is reached | "Sign-ups are full right now. Contact <app>'s team." | No retry |
| customers | 409 CONFLICT, message MsgOnboardingNoRelease | No published Release yet | "Companies cannot be created yet. Try again later." | Log onboarding.no_release |
| customers | 409 CONFLICT, message MsgOnboardingPerIdentity | The person's company limit (per_identity), or a same-id request that raced the first | "You have reached the number of companies you can create." | The route first looks for its own id among the person's tenants and lands there when it is found; otherwise no retry |
| customers | 409 CONFLICT, message MsgOnboardingIDTaken | The id belongs to another tenant | (never seen by a person: the form makes a new id and resubmits once) | New id, once |
| customers | 503 SERVICE_UNAVAILABLE | The template-copy lock's deadline | "Creating your company is taking longer than usual…" | Same id: 2 s (route), 5 s, 10 s (form) |
| any | (none: the app's own setup; 404) | No key in the running app: BUILDPAD_ONBOARDING_KEY is unset, empty or off (Production's branch) | "Sign-up is not available right now." (the pages are not found, and the sign-in page shows no link) | Log onboarding.not_configured; on Development, the amplify.yml line and a new deployment; on Production, expected |
| any | 5xx other, or no answer | The Engine is down | "Something went wrong. Try again." | The person retries |
The three 409s on the create route share the code CONFLICT and carry no extensions. The module
tells them apart by a fixed prefix of the Engine's message:
- "This project has no published release yet" → no Release (
MsgOnboardingNoRelease); - "You have reached the limit of" → the company limit (
MsgOnboardingPerIdentity); - "Another customer already has that id." → the id (
MsgOnboardingIDTaken).
Any other 409 shows "We could not create your company. Try again later." The message is never shown to the person. This is the one place the flow reads an Engine message: until the Engine gives each of these refusals a code of its own, the prefix is the only way to tell them apart.
Reference
- Customer self-onboarding: the flow: the
files, the module that holds the key, the client address, the routes and pages, the changes to
sign-in, and the
amplify.ymlline.
<!-- /buildpad-backend -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

