better-t-stack-scaffolder
Scaffold a new TypeScript web, mobile, API, or full-stack project with Better-T-Stack, then harden it with the Pax Fullstack Harness. Use whenever the user wants a new TypeScript app scaffold, mention
SKILL.mdskills/better-t-stack-scaffolder/SKILL.md
GitHubBetter-T-Stack Scaffolder
Purpose
Create a new TypeScript project through Better-T-Stack, then install the v1 harness: short AGENTS.md, operational docs, stable scripts, quality gates, test strategy, runtime support, and entropy audit.
Inspect First
- Read the user's product description and requested stack.
- Check the target directory for existing files before scaffolding.
- If using current Better-T-Stack behavior, prefer official docs: https://www.better-t-stack.dev/docs and https://www.better-t-stack.dev/docs/cli/agent-workflows.
- If the target is not TypeScript, stop and recommend
project-harness-bootstrapinstead.
Stack Policy
Prefer the smallest stack that satisfies the product.
- Default serious web app: Bun, React with TanStack Router, Hono, tRPC or oRPC, PostgreSQL, Drizzle, Better Auth, Tailwind, Biome, Lefthook, Docker for local Postgres, GitHub Actions.
- Use Next.js when SEO, SSR, SSG, or hosting constraints justify it.
- Use Astro when content dominates and interactivity is isolated.
- Use React Native when the product is mobile-first.
- Use no frontend for API-only projects.
- Use REST when non-TypeScript clients or a public stable API are first-class.
- Use SQLite for prototypes, local-first apps, or embedded use.
- Use Prisma when team familiarity matters more than SQL-like schema control.
Procedure
Lock the stack.
- If the user provided choices, use them.
- If choices are missing, infer a minimal stack and state assumptions before scaffolding when the tradeoff is high impact.
- Record decisions in
docs/specs/000-initial-stack-decision.md.
Generate the scaffold command.
- Prefer Better-T-Stack's JSON-first agent workflow when available: inspect
create-better-t-stack schema --name create-json, prepare a JSON payload, run dry-run first, then runcreate-json. - Do not combine
--yesor JSONyes: truewith explicit stack configuration flags; current Better-T-Stack rejects that combination. - Fall back to
bun create better-t-stack@latest,pnpm create better-t-stack@latest, ornpm create better-t-stack@latestwhen JSON creation is unavailable. - Do not manually assemble a Better-T-Stack-equivalent repo unless the CLI cannot support the required combination.
- Known-good explicit full-stack baseline:
bun create better-t-stack@latest <app-name> --frontend tanstack-router --backend hono --runtime bun --database postgres --orm drizzle --api trpc --auth better-auth --payments none --addons biome lefthook --examples none --db-setup docker --web-deploy none --server-deploy none --no-git --package-manager bun --no-install.
- Prefer Better-T-Stack's JSON-first agent workflow when available: inspect
Scaffold the project.
- Run from the chosen parent directory.
- Avoid writing into a non-empty target unless the user explicitly requested it and you inspected contents.
- Preserve the exact command or JSON payload, CLI version, dry-run result, fallback path, and scaffold warnings in the stack decision doc.
Inspect the generated repo.
- Read
package.json, workspace config, generated README, environment files, app directories, database/auth/API config, and generated scripts. - Remove generated examples only when the user asked for a clean scaffold or they conflict with the product.
- Run install and non-mutating checks first. Use project-native autofix commands only when the user requested cleanup or when the scaffold generated files that fail its own formatter.
- Read
Install the harness layer by following these skills in order:
project-harness-bootstrapagents-md-authorrepo-knowledge-base-builderquality-gates-installertesting-strategy-builderarchitecture-boundary-enforcerlocal-runtime-harnessentropy-auditor- For production-bound projects, add
security-baseline,dependency-governance,observability-harness,ci-cd-harness,migration-and-schema-harness, andrelease-readiness-harnessafter the baseline is healthy. - For frontend projects, optionally add
shadcn-ui-integratorafter inspecting generated UI setup. - For formal feature work, optionally add
openspec-sddbefore implementing the first feature. - For browser user workflows, optionally add
tdd-playwright-workflowafter baseline tests exist. - After harness docs, scripts, and state artifacts exist, optionally add
project-local-skill-generatorto create thin.codex/skillswrappers for this specific repo.
Validate.
- Run install, lint, typecheck, test, build, then
./scripts/validate. - Fix baseline failures introduced by the scaffold or harness.
- Treat large bundle/chunk warnings as release-readiness or technical-debt notes unless they break an explicit size budget.
- If a check cannot run, report the exact command, error, and likely cause.
- Run install, lint, typecheck, test, build, then
Files To Create Or Update
AGENTS.mddocs/specs/000-initial-stack-decision.mddocs/00-index.mddocs/architecture/overview.mddocs/architecture/boundaries.mddocs/development/commands.mddocs/development/environment.mddocs/testing/strategy.mddocs/quality/code-style.mdscripts/validateand stable command wrappers.github/workflows/ci.yml
Validation
- Run the package manager install command.
- Run generated lint, typecheck, test, and build commands.
- Run
./scripts/validateafter the harness is installed. - If using Better-T-Stack JSON automation, run the CLI dry-run before project creation when the current CLI supports it.
- If explicit stack options are used, verify the command does not also use
--yes. - Report exact command output for any blocker that prevents baseline validation.
Completion Criteria
- The generated app boots locally or has a documented blocker.
- The selected stack, rejected alternatives, and scaffold command are recorded.
- Stable harness commands exist and are executable.
AGENTS.mdis short and points to docs instead of duplicating them.- Project-local
.codex/skillsare generated only when backed by actual repo artifacts. - Validation has been run or failure evidence is explicit.
Failure Modes
- Unsupported CLI option: inspect the current schema/docs and regenerate the command.
- Existing target directory: inspect and preserve user files; do not overwrite blindly.
- Dependency install failure: capture package manager, version, command, and error.
- Better-T-Stack mismatch: document the actual generated shape before adding harness files.