new-service
Use when scaffolding a new SPA + Hono Worker + D1 service, with or without a Tauri native shell.
- License 许可
- MIT
- 最近更新
- 2026-08-31
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- new-service
- description
- Use when scaffolding a new SPA + Hono Worker + D1 service, with or without a Tauri native shell.
03 SKILL.md 正文
New service
Follow specs/README.md and AGENTS.md. If no service name was supplied, ask for it.
Required template choice
Before copying anything, ask the user to choose exactly one template and wait for the answer:
- Web only (recommended and default): after this answer, copy
services/example_service. - Web + Tauri: after this answer, copy
services/example_tauri_service.
Do not copy either template before the user answers. Do not infer Tauri from the product idea or silently keep/remove native assets after copying. If the answer is ambiguous, ask again. Confirm the implementation plan before large changes (absolute rule #10: no unapproved architecture or library decisions).
Web only branch
- Copy tracked source from
services/example_servicetoservices/<service-name>, excludingdist,node_modules,.wrangler,worker-configuration.d.ts, generated coverage/Playwright output, local.dev.vars, andmigrations/*. - Rename the package to
@app/<service-name>, the D1database_nameto the underscored service name, the Wrangler Workernameto its hyphenated DNS-label form, storage keys, and dev/E2E ports. Keep same-origin browser transport and session storage. The generated service must not containsrc-tauri,@tauri-apps/*dependencies, ortauri/tauri:*/*:tauriscripts. - Register the service in root
service-catalog.jsonwith its directory/package,templateKind: "web", and explicit deployable/native flags. Worker-only entries stay outside the SPA array and use normalized{ directory, package, deployable }objects inworkerOnlyServices. Runnode scripts/service-catalog.mjs validateso the workspace and catalog cannot drift. - Verify this branch with:
pnpm --filter @app/<service-name> test:allpnpm --filter @app/<service-name> typecheckpnpm --filter @app/<service-name> e2enode scripts/check-tauri-boundary.mjs
Web + Tauri branch
- Copy tracked source from
services/example_tauri_servicetoservices/<service-name>, excludingdist,node_modules,.wrangler,worker-configuration.d.ts, generated coverage/Playwright output, local.dev.vars,migrations/*,src-tauri/gen, andsrc-tauri/target. - Rename every Web and native identity: package, D1, hyphenated Worker name, dev/E2E ports, Tauri
productNameandidentifier, Rust crate/library, fixedTAURI_<SERVICE>_API_ORIGINbuild variable and release allowlist, navigation guard, native/browser storage keys, capability description, and Android/iOS/macOS overlays. Copy and renametauri-boundary.json; explicitly review itsreleaseOriginand every browser storagepath,tokenKey, optionalorganizationKey/logoutIntentKey, and service-specificreason. Do not leave template keys/reasons, invent an implicit empty allowlist, or broaden the release-origin allowlist. Keep VitestrictPort: true;TAURI_DEV_HOSTmay affect development HMR only. - Register the service in root
service-catalog.jsonwith its directory/package,templateKind: "tauri",native: true, the reviewed deployable flag, and a uniquenativeWorkflow. Copy and rename the example Tauri manual artifact workflow to that exact path. Runnode scripts/service-catalog.mjs validateandnode --test scripts/check-deploy-boundary.test.mjsto prove CI Rust manifests, generic Make native targets, and artifact workflows match the validated catalog native set. - Verify this branch with:
pnpm --filter @app/<service-name> test:allpnpm --filter @app/<service-name> typecheckpnpm --filter @app/<service-name> e2ecargo fmt --check --manifest-path services/<service-name>/src-tauri/Cargo.tomlcargo test --locked --manifest-path services/<service-name>/src-tauri/Cargo.tomlcargo clippy --all-targets --manifest-path services/<service-name>/src-tauri/Cargo.toml -- -D warningsmake build/<service-name>/taurinode scripts/check-tauri-boundary.mjs
Common service work
- Specify first: copy
specs/_service-templatetospecs/<service-name>and fill in00_service-spec.md(boundary, entity, API surface, owned D1). - Contract: add and export
packages/contracts/src/<service-name>.tsusing Zod as the single source. - Domain implementation: replace the example item routes, Drizzle schema, and UI. Write tests first. A production domain receives
JWT_PUBLIC_KEYonly; admin retainsJWT_PRIVATE_KEY. KeepAUTH_DEV_PRIVATE_KEY/AUTH_DEV_GRANTlocal-only. - Local wiring: add the service to
DEV_ALL_SERVICES; retaindevand a regular.dev.vars.example; runmake dev-vars,make -n dev/<service-name>, andmake -n dev/all.make dev-varsdiscovers the new SPA from the validated catalog and distributes the admin-generated local RSA pair automatically; do not add a second hard-coded service list or copy keys by hand. - DB and UI: generate/apply local migrations, add Terraform D1/output, and follow
docs/frontend/DESIGN_RULE.mdbefore writing JSX. - Platform services: register ops monitoring/backups and add the admin production identity only for a catalog
deployable: truedomain. The identity follows one strict convention: catalog directorybooking_service, Worker servicebooking-service, admin bindingBOOKING_SERVICE, caller secretADMIN_TO_BOOKING_SERVICE_KEY, and the matching{directory,binding,secret}entry inADMIN_DOMAIN_IDENTITIES. Add the binding and secret to generatedEnvwithcf-typegen. The non-deployable scaffold binding/key stay dev/test-only; when the catalog has no deployable domain, the production binding/secret sets and identity array stay empty. - Repository wiring: every SPA service goes in the root combined
test:allchain and CI manual E2E matrix; every worker-only service uses the roottestchain. Ifdeployable: true,node scripts/service-catalog.mjs require-deployable <service-name>must pass before any bootstrap package selection or credential, and the service must appear exactly once in every ordered protected-main build, artifact verifier/tar/install, config, migration (D1 services), deploy, D1/service-binding/health/backup, remote-secret, and bootstrap surface. Ifdeployable: false, keep it out of all production surfaces. Never add a local production deploy or remote-migration entry point. Runnode scripts/service-catalog.mjs validate-repository; it parses actual workflow nodes and rejects omissions, extras, duplicates, comments used as registrations, and identity drift. - Final verification: run
pnpm install, the selected branch verification above,node scripts/service-catalog.mjs validate-repository, andpnpm check.
04 同仓库更多 Skills
design-select
Use when creating a new screen or significantly changing a UI's look. Presents 2-3 design candidates as clickable HTML mockups in the user's browser (local preview server), lets the user pick one, then implements the winner per DESIGN_RULE.
check
Run the full check (lint + typecheck + test with coverage) and fix failures until green.