cfsa-antigravity 2.12.0 → 2.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cfsa-antigravity",
3
- "version": "2.12.0",
3
+ "version": "2.13.1",
4
4
  "description": "CFSA Pipeline — Constraint-First Specification Architecture for AI agents. Production-grade from line one.",
5
5
  "scripts": {
6
6
  "changeset": "changeset",
@@ -1,6 +1,6 @@
1
1
  # Kit Sync State
2
2
 
3
3
  upstream: https://github.com/RepairYourTech/cfsa-antigravity
4
- last_synced_commit: bf1e196564da7c037996f8e3422994f36dbc014e
5
- last_synced_at: 2026-03-20T00:52:40Z
6
- kit_version: 2.12.0
4
+ last_synced_commit: bd3ea759c6b6a80b74dcb9b5b55ab2cfbb314221
5
+ last_synced_at: 2026-03-20T01:37:39Z
6
+ kit_version: 2.13.1
@@ -24,6 +24,10 @@ Standard procedure for loading skills from the surface stack map before beginnin
24
24
  | `write-be-spec-classify` | Languages, Databases, Auth, BE Frameworks, ORMs, Unit Tests |
25
25
  | `write-fe-spec-classify` | Languages, FE Frameworks, FE Design, Accessibility, State Mgmt |
26
26
  | `write-architecture-spec-design` | Databases, Security, API Design |
27
+ | `setup-workspace-scaffold` | Languages, BE Frameworks, FE Frameworks |
28
+ | `setup-workspace-cicd` | CI/CD, Languages |
29
+ | `setup-workspace-hosting` | Hosting, CI/CD |
30
+ | `setup-workspace-data` | Databases, ORMs |
27
31
  | `implement-slice-tdd` | Languages, Unit Tests, E2E Tests |
28
32
  | `validate-phase` | Unit Tests, E2E Tests, CI/CD, Hosting, Accessibility, Security |
29
33
 
@@ -76,6 +76,13 @@ Read `.agent/skills/brainstorming/SKILL.md` and follow its methodology.
76
76
 
77
77
  **Persona completeness gate**: Read `.agent/skills/prd-templates/references/persona-completeness-gate.md`. Verify all 6 fields for every persona. If any field absent → probe before proceeding.
78
78
 
79
+ **Meta files gate**: After completing problem exploration, verify ALL of the following files exist and are non-empty:
80
+ - `docs/plans/ideation/meta/problem-statement.md` (must contain a "Why Now" section)
81
+ - `docs/plans/ideation/meta/personas.md`
82
+ - `docs/plans/ideation/meta/competitive-landscape.md`
83
+
84
+ If ANY file is missing or empty → **STOP**: "Meta file `[filename]` was not written during problem exploration. Write it now before proceeding to feature inventory."
85
+
79
86
  ---
80
87
 
81
88
  ## 5. Feature inventory — deep exploration
@@ -153,6 +160,8 @@ After all features are deepened, systematically identify emergent capabilities t
153
160
 
154
161
  > **Minimum coverage**: The sweep must evaluate at least every Must Have × Must Have pair and every Must Have × Should Have pair. Should Have × Should Have pairs are optional but recommended for complex products.
155
162
 
163
+ **CX coverage check**: Count the total CX entries across all domain CX files (`*-cx.md`). If the total is **0** and there are **2 or more domains** with Must Have features → **STOP**: "Zero CX entries found despite multiple active domains. This indicates the CX Decision Gate was not applied during exploration. Review each domain pair for cross-cutting concerns before proceeding."
164
+
156
165
  ---
157
166
 
158
167
  ### Next step
@@ -48,6 +48,8 @@ Wait for user decision. If pivot → update problem statement and loop back to r
48
48
 
49
49
  If the surface classification changed during constraint exploration, update `ideation-index.md` `## Structural Classification` section.
50
50
 
51
+ **Constraint file gate**: Verify `docs/plans/ideation/meta/constraints.md` exists and contains at least one constraint entry (technical, regulatory, business, or accepted risk). If empty or missing → **STOP**: "Constraint file not written. Constraints are required input for `/create-prd-stack`. Complete constraint exploration before proceeding."
52
+
51
53
  ---
52
54
 
53
55
  ## 9. Domain exhaustion check
@@ -82,10 +82,14 @@ Sort slices so each builds on the last:
82
82
 
83
83
  **Phase 1 special rule**: Before applying this rule, read the surface stack map from `.agent/instructions/tech-stack.md` and verify that the **CI/CD** and **Hosting** cross-cutting categories have filled values. If empty, emit a **HARD STOP**: these are filled by `/create-prd-stack` — run it first.
84
84
 
85
- The `00-infrastructure` shard is always the first slice. Verify it covers: (1) CI/CD pipeline setup read the CI/CD skill(s) from the cross-cutting section of the surface stack map, (2) environment configuration (`.env.example`), (3) deployment pipeline read the Hosting skill(s) from the cross-cutting section of the surface stack map, (4) project scaffolding from `.agent/instructions/structure.md` (directories, `README.md` files, base configs), (5) database initialization. Add missing items before proceeding.
85
+ The `00-infrastructure` shard is always the first slice. It covers only **TDD-able application code**: (1) health check endpoint, (2) error handling middleware with structured error responses, (3) logging middleware, (4) structured response envelope, (5) auth middleware stubs (BOUNDARY if auth spec not yet written). Operational setup (CI/CD, hosting, database provisioning, project scaffolding) is handled by `/setup-workspace` which runs before any `/implement-slice`.
86
+
87
+ > [!IMPORTANT]
88
+ > `/setup-workspace` MUST be run and pass `/verify-infrastructure` BEFORE the first `/implement-slice`. If the workspace has not been set up, emit a **HARD STOP**: "Run `/setup-workspace` first — operational infrastructure must be in place before any TDD slice."
86
89
 
87
90
  **Verification gates** (hard gates — add explicitly to the phase plan):
88
- - `/verify-infrastructure` MUST pass after the infrastructure slice, before any feature slice.
91
+ - `/verify-infrastructure` MUST pass after `/setup-workspace`, before any implementation slice.
92
+ - `/verify-infrastructure` MUST pass after the infrastructure code slice, before any feature slice.
89
93
  - `/verify-infrastructure` MUST pass again after the auth slice (with auth smoke test), before any auth-dependent feature slice.
90
94
 
91
95
  - Core entity CRUD second
@@ -0,0 +1,137 @@
1
+ ---
2
+ description: CI/CD pipeline configuration, stages, secrets, and multi-service matrix builds for the setup-workspace workflow
3
+ parent: setup-workspace
4
+ shard: cicd
5
+ standalone: true
6
+ position: 2
7
+ pipeline:
8
+ position: 8.52
9
+ stage: setup
10
+ predecessors: [setup-workspace-scaffold]
11
+ successors: [setup-workspace-hosting]
12
+ skills: [git-workflow, workflow-automation]
13
+ calls-bootstrap: false
14
+ ---
15
+
16
+ // turbo-all
17
+
18
+ # Setup Workspace — CI/CD
19
+
20
+ Create the CI/CD pipeline configuration with lint, type-check, test, and build stages. Gate: pipeline runs to completion (tests may fail — no application code exists yet, but the pipeline itself must execute).
21
+
22
+ **Prerequisite**: Project scaffolded (dev server starts). Surface stack map CI/CD cell populated.
23
+
24
+ ---
25
+
26
+ ## 1. Load CI/CD skill
27
+
28
+ Read `.agent/skills/prd-templates/references/skill-loading-protocol.md`.
29
+
30
+ Load the CI/CD skill from the cross-cutting section of the surface stack map (`.agent/instructions/tech-stack.md`).
31
+
32
+ Read the loaded skill's `SKILL.md` (e.g., `.agent/skills/github-actions/SKILL.md`).
33
+
34
+ If the skill is not installed, check `.agent/skill-library/MANIFEST.md` and provision it. If not in the library, read `.agent/skills/find-skills/SKILL.md` for discovery.
35
+
36
+ ---
37
+
38
+ ## 2. Determine pipeline architecture
39
+
40
+ Read `docs/plans/*-architecture-design.md` for the architecture pattern.
41
+
42
+ | Pattern | Pipeline Strategy |
43
+ |---------|------------------|
44
+ | **Monolith** | Single pipeline, all stages sequential |
45
+ | **Monorepo** | Matrix or multi-job: each workspace gets lint/test/build; shared deploy stage |
46
+ | **Multi-repo** | Each repo has its own pipeline (scaffold shard already created separate repos) |
47
+
48
+ For **monorepo**, determine the CI/CD platform's workspace detection mechanism:
49
+ - GitHub Actions: `paths` filter per workspace, or matrix with `workspace` variable
50
+ - GitLab CI: `rules: changes` per directory
51
+ - Other: consult the loaded CI/CD skill
52
+
53
+ ---
54
+
55
+ ## 3. Create pipeline configuration
56
+
57
+ Using the CI/CD skill's patterns, create the pipeline config file:
58
+
59
+ ### Required stages (in order)
60
+
61
+ | Stage | What | Fails On |
62
+ |-------|------|----------|
63
+ | **Install** | Install dependencies | Dependency resolution failure |
64
+ | **Lint** | Run linter | Any lint violation |
65
+ | **Type Check** | Run type checker (if applicable) | Any type error |
66
+ | **Test** | Run test suite | Any test failure |
67
+ | **Build** | Production build | Build failure |
68
+
69
+ Read `.agent/instructions/commands.md` for the exact commands for each stage.
70
+
71
+ ### Pipeline config requirements
72
+
73
+ 1. **Trigger**: Push to main + pull request to main
74
+ 2. **Caching**: Cache dependency directories (e.g., `node_modules`, `.cargo`, `__pycache__`) — follow CI/CD skill caching patterns
75
+ 3. **Runtime version**: Pin the language runtime version (from surface stack map Languages row)
76
+ 4. **Timeout**: Set reasonable timeouts per stage (5 min lint, 10 min test, 10 min build)
77
+ 5. **Artifact upload**: Upload build artifacts for deployment stages
78
+
79
+ For **monorepo** with matrix strategy, add a `strategy.matrix` (or equivalent) that iterates over workspaces.
80
+
81
+ ---
82
+
83
+ ## 4. Configure CI/CD secrets
84
+
85
+ Enumerate all secrets needed by the pipeline:
86
+
87
+ 1. Read `.env.example` — identify variables that are secrets (API keys, tokens, connection strings)
88
+ 2. Read `docs/plans/*-architecture-design.md` integration section — identify external service credentials
89
+ 3. Read the Hosting skill — identify deployment credentials
90
+
91
+ For each secret:
92
+ - Document it in the pipeline config as a required secret/variable
93
+ - Add a comment explaining where to obtain the value
94
+ - **Do NOT hardcode any secret values** — reference platform secret storage only
95
+
96
+ Present the secrets list to user: "These CI/CD secrets need to be configured in [platform]: [list with descriptions]. Please add them now or after this workflow completes."
97
+
98
+ > [!CAUTION]
99
+ > Never write actual secret values into any file. Only reference secret names using the CI/CD platform's secret syntax (e.g., `${{ secrets.DATABASE_URL }}` for GitHub Actions).
100
+
101
+ ---
102
+
103
+ ## 5. Multi-service pipeline specialization
104
+
105
+ For **monorepo** projects, ensure the pipeline handles:
106
+
107
+ 1. **Change detection**: Only run stages for workspaces with changed files
108
+ 2. **Dependency order**: If service A depends on service B, build B first
109
+ 3. **Shared libraries**: If a shared library changes, rebuild all dependent services
110
+ 4. **Independent deploy**: Each service can deploy independently
111
+
112
+ For **multi-repo** projects: this step is N/A — each repo has its own pipeline created during scaffold.
113
+
114
+ ---
115
+
116
+ ## 6. Verification gate
117
+
118
+ 1. Commit the pipeline configuration: `chore: add CI/CD pipeline configuration`
119
+ 2. Push to trigger the pipeline
120
+ 3. Wait for the pipeline to start executing
121
+ 4. Verify all stages **execute** (not necessarily pass — tests will fail because no test files exist yet, but lint, type-check, and build should pass on the scaffolded project)
122
+
123
+ **Expected results for a freshly scaffolded project:**
124
+
125
+ | Stage | Expected |
126
+ |-------|----------|
127
+ | Install | ✅ Pass |
128
+ | Lint | ✅ Pass (no source files to lint, or default files pass) |
129
+ | Type Check | ✅ Pass |
130
+ | Test | ⚠️ May fail (no tests exist yet) or ✅ pass (0 tests) |
131
+ | Build | ✅ Pass |
132
+
133
+ **If Install, Lint, Type Check, or Build fail** → **STOP.** Debug the pipeline config before proceeding.
134
+
135
+ **Pass criteria**: Pipeline executes all stages. Install, Lint, Type Check, and Build pass. Test stage exits (pass or "no tests found" is acceptable).
136
+
137
+ > Present result to user: "✅ CI/CD pipeline running. [N] stages executing. Proceeding to hosting setup." or "❌ Pipeline failed at [stage]: [error]. Fix required."
@@ -0,0 +1,169 @@
1
+ ---
2
+ description: Database provisioning, migration framework initialization, connection configuration, and seed data setup for the setup-workspace workflow
3
+ parent: setup-workspace
4
+ shard: data
5
+ standalone: true
6
+ position: 4
7
+ pipeline:
8
+ position: 8.54
9
+ stage: setup
10
+ predecessors: [setup-workspace-hosting]
11
+ successors: [verify-infrastructure]
12
+ skills: [database-schema-design, deployment-procedures]
13
+ calls-bootstrap: false
14
+ requires_placeholders: [ORM_SKILL]
15
+ ---
16
+
17
+ // turbo-all
18
+
19
+ # Setup Workspace — Data
20
+
21
+ Provision database instances, initialize the migration framework, configure connection strings, and verify database connectivity. Gate: database connectable and migration framework initialized.
22
+
23
+ **Prerequisite**: Hosting configured (from `/setup-workspace-hosting`). Surface stack map Databases and ORMs cells populated.
24
+
25
+ ---
26
+
27
+ ## 1. Load database and ORM skills
28
+
29
+ Read `.agent/skills/prd-templates/references/skill-loading-protocol.md`.
30
+
31
+ Load from the surface stack map (`.agent/instructions/tech-stack.md`):
32
+ - **Databases** skill (e.g., PostgreSQL, MongoDB, SurrealDB)
33
+ - **ORMs** skill (e.g., Prisma, Drizzle, SQLAlchemy)
34
+
35
+ Read each loaded skill's `SKILL.md`.
36
+
37
+ Also read `.agent/skills/database-schema-design/SKILL.md` for schema design principles.
38
+
39
+ If a migration-management skill exists, load it too (check `.agent/skills/migration-management/SKILL.md`).
40
+
41
+ ---
42
+
43
+ ## 2. Determine database architecture
44
+
45
+ Read `docs/plans/*-architecture-design.md` for the data strategy:
46
+
47
+ 1. **How many database instances?** Monolith typically has 1; multi-service may have per-service databases or a shared database with per-service schemas
48
+ 2. **Database engine per instance** (from architecture doc + surface stack map)
49
+ 3. **Managed vs self-hosted** — affects provisioning steps
50
+ 4. **Read replicas needed?** — typically not at setup, but note for later
51
+ 5. **Data placement strategy** — read `docs/plans/data-placement-strategy.md` if it exists
52
+
53
+ | Pattern | Database Strategy |
54
+ |---------|------------------|
55
+ | **Monolith** | Single database instance |
56
+ | **Monorepo shared DB** | One instance, per-service schemas or prefixed tables |
57
+ | **Monorepo per-service DB** | One instance per service |
58
+ | **Multi-repo** | Fully independent database per repo |
59
+
60
+ ---
61
+
62
+ ## 3. Provision database instance(s)
63
+
64
+ For each required database instance:
65
+
66
+ ### 3a. Managed database (cloud-hosted)
67
+
68
+ If using a managed service (Supabase, PlanetScale, Neon, AWS RDS, etc.):
69
+
70
+ 1. Create the database instance through the platform's dashboard, CLI, or API
71
+ 2. Record the connection string components:
72
+ - Host
73
+ - Port
74
+ - Database name
75
+ - Username (non-root, application-specific)
76
+ - Password (generated, stored in platform secrets)
77
+ 3. Configure network access rules (allow from hosting platform's IP range)
78
+ 4. Enable SSL/TLS for connections
79
+
80
+ ### 3b. Self-hosted database
81
+
82
+ If running the database locally or on a VPS:
83
+
84
+ 1. Verify the database engine is installed or create a Docker Compose service
85
+ 2. Create the application database
86
+ 3. Create the application user with minimum required privileges
87
+ 4. Record the connection string
88
+ 5. Configure network access (bind address, firewall rules)
89
+
90
+ > [!IMPORTANT]
91
+ > The database user for the application should have ONLY the privileges it needs — not root/superuser access. Create a dedicated user with table-level permissions. Document the user's privileges.
92
+
93
+ ---
94
+
95
+ ## 4. Configure connection strings
96
+
97
+ 1. **Local development**: Add the connection string to `.env.example` with a placeholder:
98
+ ```
99
+ DATABASE_URL="postgresql://user:password@localhost:5432/myapp_dev"
100
+ ```
101
+
102
+ 2. **CI/CD**: Add the test database connection string to CI/CD secrets (from previous shard). If the CI/CD platform supports service containers (e.g., GitHub Actions services), configure a test database instance in the pipeline config.
103
+
104
+ 3. **Staging**: Set the connection string in the hosting platform's environment variables (from previous shard's hosting config).
105
+
106
+ 4. **Production**: Document the production connection string as a required secret — do not set it yet.
107
+
108
+ Verify that the connection string variable name matches what the ORM/framework expects (e.g., `DATABASE_URL` for Prisma, `SQLALCHEMY_DATABASE_URL` for SQLAlchemy).
109
+
110
+ ---
111
+
112
+ ## 5. Initialize migration framework
113
+
114
+ Using the loaded ORM skill:
115
+
116
+ 1. **Initialize the ORM/migration tool**:
117
+ - Prisma: `npx prisma init`
118
+ - Drizzle: create `drizzle.config.ts`
119
+ - Alembic: `alembic init`
120
+ - SurrealDB: create migration directory structure
121
+
122
+ 2. **Configure the migration tool** to read the connection string from the environment variable
123
+
124
+ 3. **Create the initial schema** based on `docs/plans/data-placement-strategy.md`:
125
+ - Create only the base tables/collections specified in the strategy
126
+ - Include audit fields (created_at, updated_at) as specified in `ENGINEERING-STANDARDS.md`
127
+ - Set up indexes for primary keys and documented unique constraints
128
+
129
+ 4. **Generate and run the initial migration**:
130
+ - Generate: `prisma migrate dev`, `alembic revision`, etc.
131
+ - Apply: run the migration against the local development database
132
+ - Verify: check migration status shows "up to date"
133
+
134
+ > [!CAUTION]
135
+ > The initial schema should reflect what's in the data placement strategy, not what you think the app needs. If the data placement strategy is incomplete, note the gap but do not invent tables.
136
+
137
+ ---
138
+
139
+ ## 6. Configure test database
140
+
141
+ For CI/CD and local test runs:
142
+
143
+ 1. Create a separate test database (or configure the test runner to use an in-memory/ephemeral database)
144
+ 2. Configure the test environment to use the test database connection string
145
+ 3. Set up migration auto-run in test setup (so tests always run against the latest schema)
146
+ 4. Verify the test database is isolated from development data
147
+
148
+ ---
149
+
150
+ ## 7. Verification gate
151
+
152
+ 1. **Local connectivity**: Connect to the development database and run a simple query (e.g., `SELECT 1` or equivalent)
153
+ 2. **Migration status**: Verify migrations are applied and "up to date"
154
+ 3. **ORM connectivity**: Run the ORM's built-in connection test if available
155
+ 4. **Staging connectivity** (if staging DB is provisioned): Verify staging database is connectable from the staging environment
156
+
157
+ Commit changes: `chore: configure database and migration framework`
158
+
159
+ **Pass criteria:**
160
+
161
+ - [ ] Database instance(s) provisioned
162
+ - [ ] Connection strings configured for local, CI/CD, and staging
163
+ - [ ] Migration framework initialized
164
+ - [ ] Initial migration created and applied
165
+ - [ ] Test database configured
166
+ - [ ] Local database connectable
167
+ - [ ] Migration status clean
168
+
169
+ > Present result to user: "✅ Database configured. [engine] at [host]. Migrations initialized. Proceeding to infrastructure verification." or "❌ Database setup failed: [error]. Fix required."
@@ -0,0 +1,170 @@
1
+ ---
2
+ description: Hosting platform provisioning, domain configuration, deployment pipeline, and first staging deploy for the setup-workspace workflow
3
+ parent: setup-workspace
4
+ shard: hosting
5
+ standalone: true
6
+ position: 3
7
+ pipeline:
8
+ position: 8.53
9
+ stage: setup
10
+ predecessors: [setup-workspace-cicd]
11
+ successors: [setup-workspace-data]
12
+ skills: [deployment-procedures, workflow-automation]
13
+ calls-bootstrap: false
14
+ ---
15
+
16
+ // turbo-all
17
+
18
+ # Setup Workspace — Hosting
19
+
20
+ Provision the hosting platform, configure domains, set up the deployment pipeline, and execute the first staging deploy. Gate: staging URL accessible with HTTP 200.
21
+
22
+ **Prerequisite**: CI/CD pipeline configured (from `/setup-workspace-cicd`). Surface stack map Hosting cell populated.
23
+
24
+ ---
25
+
26
+ ## 1. Load hosting skill
27
+
28
+ Read `.agent/skills/prd-templates/references/skill-loading-protocol.md`.
29
+
30
+ Load the Hosting skill from the cross-cutting section of the surface stack map (`.agent/instructions/tech-stack.md`).
31
+
32
+ Read the loaded skill's `SKILL.md` (e.g., `.agent/skills/vercel/SKILL.md`, `.agent/skills/aws/SKILL.md`, `.agent/skills/cloudflare/SKILL.md`).
33
+
34
+ Also read `.agent/skills/deployment-procedures/SKILL.md` for deployment principles.
35
+
36
+ ---
37
+
38
+ ## 2. Determine hosting architecture
39
+
40
+ Read `docs/plans/*-architecture-design.md` for deployment topology.
41
+
42
+ | Pattern | Hosting Strategy |
43
+ |---------|-----------------|
44
+ | **Monolith** | Single deployment target (one app, one URL) |
45
+ | **Monorepo** | Per-service deploy targets OR single deployment with routing |
46
+ | **Multi-repo** | Each repo deploys independently to its own target |
47
+ | **Hub-and-spoke** | Hub service + spoke services with service discovery / API gateway |
48
+
49
+ For **hub-and-spoke** or **microservices**, determine:
50
+ - Which services are public-facing vs internal-only
51
+ - Inter-service communication method (HTTP, message queue, gRPC)
52
+ - Whether an API gateway / reverse proxy is needed
53
+ - Load balancing requirements
54
+
55
+ ---
56
+
57
+ ## 3. Provision hosting platform
58
+
59
+ Using the Hosting skill's patterns:
60
+
61
+ ### 3a. Create project(s) on the hosting platform
62
+
63
+ For each deployable service:
64
+
65
+ 1. Create the project/app on the hosting platform (e.g., `vercel project create`, Terraform apply, AWS CDK deploy)
66
+ 2. Configure the build settings:
67
+ - Build command (from `.agent/instructions/commands.md`)
68
+ - Output directory
69
+ - Install command
70
+ - Runtime version
71
+ 3. Link to the git repository (for auto-deploy on push, if the platform supports it)
72
+
73
+ ### 3b. Configure environments
74
+
75
+ Each project needs at minimum:
76
+
77
+ | Environment | Purpose | Branch |
78
+ |-------------|---------|--------|
79
+ | **Staging** | Pre-production testing | `main` or `staging` branch |
80
+ | **Production** | Live traffic | `main` or release tags |
81
+
82
+ If the architecture doc specifies additional environments (preview, canary), configure those too.
83
+
84
+ ### 3c. Set environment variables
85
+
86
+ For each environment on the hosting platform:
87
+
88
+ 1. Read `.env.example` for the full variable list
89
+ 2. Set non-secret variables directly (e.g., `NODE_ENV=production`, `LOG_LEVEL=info`)
90
+ 3. For secrets: configure through the platform's secret management (not hardcoded)
91
+ 4. For database connection strings: these will be set after `/setup-workspace-data` — leave a placeholder comment noting this
92
+
93
+ > [!IMPORTANT]
94
+ > All secrets must go through the hosting platform's secret management system. Never hardcode secrets in build configs, environment files committed to git, or CI/CD pipeline files.
95
+
96
+ ---
97
+
98
+ ## 4. Configure domains and DNS
99
+
100
+ Read `docs/plans/*-architecture-design.md` for domain requirements.
101
+
102
+ If custom domains are specified:
103
+
104
+ 1. Configure domain on the hosting platform
105
+ 2. Set up DNS records (CNAME, A, or AAAA as required)
106
+ 3. Configure SSL/TLS (automatic via platform, or Let's Encrypt, or custom cert)
107
+ 4. Verify domain propagation
108
+
109
+ If no custom domain specified: use the platform's default domain (e.g., `*.vercel.app`, `*.fly.dev`).
110
+
111
+ For **multi-service**: configure subdomains or path-based routing as specified in the architecture doc.
112
+
113
+ ---
114
+
115
+ ## 5. Create deployment pipeline
116
+
117
+ Integrate the hosting platform with the CI/CD pipeline created in the previous shard:
118
+
119
+ 1. **Add deploy stage** to the CI/CD config (after build):
120
+ - Staging: auto-deploy on push to main (or staging branch)
121
+ - Production: manual approval gate or tag-based trigger
122
+ 2. **Configure deploy credentials** in CI/CD secrets
123
+ 3. **Add health check** post-deploy step:
124
+ - Hit staging URL after deploy
125
+ - Verify HTTP 200 response
126
+ - If health check fails: trigger rollback
127
+
128
+ Read `.agent/skills/deployment-procedures/SKILL.md` for rollback strategy patterns. Document the rollback procedure in the project's README or deployment docs.
129
+
130
+ ---
131
+
132
+ ## 6. Execute first staging deploy
133
+
134
+ 1. Commit deployment config changes: `chore: configure hosting and deployment pipeline`
135
+ 2. Push to trigger the CI/CD pipeline + deployment
136
+ 3. Wait for deployment to complete
137
+ 4. Verify the staging URL is accessible:
138
+ - HTTP GET to staging URL → expect 200
139
+ - Verify the response is from the scaffolded app (not a platform error page)
140
+
141
+ **If deployment fails** → **STOP.** Debug using:
142
+ 1. CI/CD logs (deploy stage)
143
+ 2. Hosting platform logs
144
+ 3. Build output
145
+ 4. Environment variable configuration
146
+
147
+ Common first-deploy failures:
148
+
149
+ | Symptom | Likely Cause |
150
+ |---------|-------------|
151
+ | Build fails on platform | Missing env var, wrong build command, wrong output dir |
152
+ | 404 on staging URL | Routing misconfiguration, wrong root directory |
153
+ | 500 on staging URL | Missing runtime env var, wrong Node/Python version |
154
+ | Deploy timeout | Build too slow, increase timeout or optimize |
155
+
156
+ ---
157
+
158
+ ## 7. Verification gate
159
+
160
+ **Pass criteria:**
161
+
162
+ - [ ] Project created on hosting platform
163
+ - [ ] Staging environment configured
164
+ - [ ] Environment variables set (non-secret)
165
+ - [ ] Secret placeholders documented
166
+ - [ ] Deployment pipeline integrated with CI/CD
167
+ - [ ] First staging deploy succeeded
168
+ - [ ] Staging URL returns HTTP 200
169
+
170
+ > Present result to user: "✅ Hosting configured. Staging at [URL]. Proceeding to database setup." or "❌ Hosting failed: [error]. Fix required."
@@ -0,0 +1,157 @@
1
+ ---
2
+ description: Project initialization, directory structure, dependencies, and base configurations for the setup-workspace workflow
3
+ parent: setup-workspace
4
+ shard: scaffold
5
+ standalone: true
6
+ position: 1
7
+ pipeline:
8
+ position: 8.51
9
+ stage: setup
10
+ predecessors: [plan-phase]
11
+ successors: [setup-workspace-cicd]
12
+ skills: [git-workflow, clean-code]
13
+ calls-bootstrap: false
14
+ ---
15
+
16
+ // turbo-all
17
+
18
+ # Setup Workspace — Scaffold
19
+
20
+ Initialize the project, create the directory structure, install dependencies, and configure the development environment. Gate: the dev server starts without errors.
21
+
22
+ **Prerequisite**: Phase plan and architecture-design.md must exist. Surface stack map must have Languages row populated.
23
+
24
+ ---
25
+
26
+ ## 1. Read architecture pattern
27
+
28
+ Read `docs/plans/*-architecture-design.md` and determine:
29
+
30
+ 1. **Architecture pattern**: monolith / monorepo / multi-repo
31
+ 2. **Service list**: enumerate every service/package (for monolith: just one)
32
+ 3. **Language per service**: from the surface stack map in `.agent/instructions/tech-stack.md`
33
+
34
+ If multi-service, present the list to the user: "I'll scaffold these services: [list]. Correct?"
35
+
36
+ **STOP** until user confirms the service list.
37
+
38
+ ---
39
+
40
+ ## 2. Load skills
41
+
42
+ Read `.agent/skills/prd-templates/references/skill-loading-protocol.md`.
43
+
44
+ For each service's surface, load:
45
+ - **Languages** skill (e.g., TypeScript, Python, Rust)
46
+ - **BE Frameworks** skill (e.g., Next.js, Express, FastAPI)
47
+ - **FE Frameworks** skill if applicable (e.g., React, Svelte)
48
+
49
+ Read `.agent/skills/git-workflow/SKILL.md` for repository initialization patterns.
50
+
51
+ ---
52
+
53
+ ## 3. Initialize project
54
+
55
+ For each service in the service list:
56
+
57
+ 1. **Create the project** using the framework's official scaffolding tool:
58
+ - Read the BE/FE framework skill for the exact init command
59
+ - Run the init command (e.g., `npx create-next-app@latest`, `cargo init`, `uv init`)
60
+ - Use the project name from `architecture-design.md`
61
+
62
+ 2. **Verify initialization succeeded** — the scaffolding tool should exit 0 and create the expected files
63
+
64
+ > [!IMPORTANT]
65
+ > Use the framework's OFFICIAL scaffolding tool — never manually create package.json or equivalent. The scaffolding tool sets up the correct defaults, scripts, and configuration that manual creation would miss.
66
+
67
+ **For monorepo**: Initialize the workspace root first (e.g., `npm init -w`), then init each package within the workspace structure.
68
+
69
+ ---
70
+
71
+ ## 4. Create directory structure
72
+
73
+ Read `.agent/instructions/structure.md` for the project's directory layout.
74
+
75
+ 1. Create all directories specified in `structure.md`
76
+ 2. Create `README.md` files for directories with 3+ expected files (per extensibility rule)
77
+ 3. Create placeholder `index` files where the framework convention expects them
78
+
79
+ **Merge, don't overwrite**: If the scaffolding tool already created some directories, keep them. Only add missing ones.
80
+
81
+ ---
82
+
83
+ ## 5. Install dependencies
84
+
85
+ Read `docs/plans/*-architecture-design.md` dependency section.
86
+
87
+ 1. **Production dependencies**: Install all runtime dependencies listed in the architecture doc
88
+ 2. **Dev dependencies**: Install linter, formatter, type-checker, test framework (from the surface stack map's Unit Tests and E2E Tests cells)
89
+
90
+ For each dependency:
91
+ - Use exact versions from the architecture doc if specified
92
+ - Use latest stable if no version specified
93
+ - Verify installation succeeded
94
+
95
+ ---
96
+
97
+ ## 6. Create base configurations
98
+
99
+ Read `.agent/instructions/commands.md` for the validation command and expected tools.
100
+ Read `.agent/instructions/patterns.md` for code conventions.
101
+
102
+ Create/update configuration files:
103
+
104
+ | Config | Source | Examples |
105
+ |--------|--------|---------|
106
+ | Linter | Languages skill + commands.md | `.eslintrc`, `ruff.toml`, `clippy.toml` |
107
+ | Formatter | Languages skill + commands.md | `.prettierrc`, `rustfmt.toml` |
108
+ | Type checker | Languages skill | `tsconfig.json`, `mypy.ini` |
109
+ | Git ignore | `git-workflow` skill | `.gitignore` |
110
+ | Editor config | patterns.md | `.editorconfig` |
111
+
112
+ **Do not invent configurations** — copy patterns from the loaded skills and the project's `patterns.md`.
113
+
114
+ ---
115
+
116
+ ## 7. Create environment template
117
+
118
+ Read `docs/plans/*-architecture-design.md` environment/configuration section.
119
+
120
+ 1. Create `.env.example` with ALL environment variables documented
121
+ 2. Each variable gets a comment explaining its purpose and format
122
+ 3. Sensitive values get placeholder markers: `<your-api-key-here>`
123
+ 4. Group variables by category (database, auth, hosting, feature flags)
124
+
125
+ Also verify `.gitignore` includes `.env` and `.env.local` patterns.
126
+
127
+ ---
128
+
129
+ ## 8. Initialize git repository
130
+
131
+ Read `.agent/skills/git-workflow/SKILL.md` for repository setup patterns.
132
+
133
+ 1. `git init` (if not already initialized)
134
+ 2. Verify `.gitignore` is comprehensive (node_modules, .env, build artifacts, OS files)
135
+ 3. Create initial commit: `chore: scaffold project structure`
136
+ 4. Set up branch protection strategy from `git-workflow` skill (main branch)
137
+
138
+ For **multi-repo**: Push each repo to its own remote.
139
+ For **monorepo**: Single repo with workspace structure.
140
+
141
+ ---
142
+
143
+ ## 9. Verification gate
144
+
145
+ Run the dev server command from `.agent/instructions/commands.md`:
146
+
147
+ 1. Start the dev server
148
+ 2. Wait for it to be ready (watch for "ready" or "listening" output)
149
+ 3. Verify it starts without errors
150
+ 4. Verify the default page/endpoint responds (HTTP 200)
151
+ 5. Stop the dev server
152
+
153
+ **If the dev server fails to start** → **STOP.** Debug the issue before proceeding to the next shard. Common causes: missing dependency, wrong Node version, port conflict.
154
+
155
+ **Pass criteria**: Dev server starts, serves a response, and shuts down cleanly.
156
+
157
+ > Present result to user: "✅ Scaffold complete. Dev server starts cleanly. Proceeding to CI/CD setup." or "❌ Dev server failed: [error]. Fix required before continuing."
@@ -0,0 +1,75 @@
1
+ ---
2
+ description: Pre-code operational workspace setup — project scaffolding, CI/CD, hosting, and database provisioning before any implementation slices
3
+ pipeline:
4
+ position: 8.5
5
+ stage: setup
6
+ predecessors: [plan-phase]
7
+ successors: [verify-infrastructure, implement-slice]
8
+ skills: [deployment-procedures, git-workflow, workflow-automation]
9
+ calls-bootstrap: false
10
+ shards: [setup-workspace-scaffold, setup-workspace-cicd, setup-workspace-hosting, setup-workspace-data]
11
+ ---
12
+
13
+ // turbo-all
14
+
15
+ # Setup Workspace
16
+
17
+ Operational setup of the project workspace, CI/CD pipeline, hosting platform, and database infrastructure. Runs after `/plan-phase` and before any `/implement-slice`. These are operational tasks — not TDD-able code.
18
+
19
+ **Prerequisite**: Phase plan must exist and be approved. If no phase plan exists → **STOP**: run `/plan-phase` first.
20
+
21
+ ---
22
+
23
+ ## 0. Pre-flight
24
+
25
+ 1. Read the approved phase plan from `docs/plans/phases/phase-N.md`
26
+ 2. Read `docs/plans/*-architecture-design.md` for the architecture pattern
27
+
28
+ **Architecture pattern detection** — determines iteration strategy:
29
+
30
+ | Pattern | How to Detect | Iteration |
31
+ |---------|--------------|-----------|
32
+ | Monolith | Single service in architecture doc | Single pass through all shards |
33
+ | Monorepo | Multiple packages/workspaces listed | Iterate per package in scaffold; shared platform |
34
+ | Multi-repo | Separate repositories listed | Full pass per repo |
35
+
36
+ If the architecture pattern is not documented → **HARD STOP**: "Architecture pattern (monolith / monorepo / multi-repo) must be decided in `/create-prd-architecture`. Run it first."
37
+
38
+ 3. Read the surface stack map from `.agent/instructions/tech-stack.md`
39
+ 4. Verify cross-cutting categories (CI/CD, Hosting, Security) have filled values
40
+
41
+ **If any cross-cutting cell is empty** → **STOP**: run `/bootstrap-agents` first.
42
+
43
+ ---
44
+
45
+ ## 1. Run shards in sequence
46
+
47
+ Execute each shard in order. Each shard has its own verification gate — do not proceed to the next shard until the current one passes.
48
+
49
+ | Order | Shard | What It Does | Gate |
50
+ |-------|-------|-------------|------|
51
+ | 1 | `/setup-workspace-scaffold` | Project init, structure, deps, configs | Dev server starts |
52
+ | 2 | `/setup-workspace-cicd` | CI/CD pipeline configuration | Pipeline runs (even if tests fail — no code yet) |
53
+ | 3 | `/setup-workspace-hosting` | Hosting provisioning + first deploy | Staging URL accessible |
54
+ | 4 | `/setup-workspace-data` | Database provisioning + migration setup | DB connectable + migration framework initialized |
55
+
56
+ For **monorepo** projects: scaffold iterates per workspace, then CI/CD creates one pipeline with per-workspace jobs, hosting creates per-service deploy targets, data creates per-service databases (or shared if architecture specifies).
57
+
58
+ For **multi-repo** projects: run the entire 4-shard sequence per repository.
59
+
60
+ ---
61
+
62
+ ## 2. Run verification
63
+
64
+ After all 4 shards complete, run `/verify-infrastructure` with trigger `workspace`.
65
+
66
+ **HARD GATE**: Do not proceed to `/implement-slice` until `/verify-infrastructure` produces a `✅ PASS` report.
67
+
68
+ ---
69
+
70
+ ## 3. Completion
71
+
72
+ Use `notify_user` to present results:
73
+
74
+ - **All shards + verification pass**: "✅ Workspace operational. Next: `/implement-slice` for the first slice (00-infrastructure code layer)."
75
+ - **Any shard or verification fails**: "❌ Workspace setup incomplete. [list failures]. Fix and re-run the failing shard."
@@ -35,12 +35,13 @@ Scan the surface stack map (`.agent/instructions/tech-stack.md`) for completenes
35
35
 
36
36
  ## 0.5. Determine trigger
37
37
 
38
- Read the current phase plan (e.g., `docs/plans/phases/phase-1.md`) to identify which slice just completed.
38
+ Read the current phase plan (e.g., `docs/plans/phases/phase-1.md`) to identify what just completed.
39
39
 
40
+ - **If `/setup-workspace` was just completed** → trigger is `workspace`, report suffix is `-workspace`
40
41
  - **If the `00-infrastructure` slice was just completed** → trigger is `infrastructure`, report suffix is empty
41
42
  - **If the auth slice was just completed** → trigger is `auth`, report suffix is `-auth`
42
43
 
43
- Set the report filename now: `docs/audits/verify-infrastructure-YYYY-MM-DD-HHMM[-auth].md`.
44
+ Set the report filename now: `docs/audits/verify-infrastructure-YYYY-MM-DD-HHMM[-workspace|-auth].md`.
44
45
 
45
46
  **Re-run detection**: Check if a previous verification report exists for this trigger (search `docs/audits/` for `verify-infrastructure-*[-auth].md`).\n- If a previous report exists and shows `✅ PASS` → ask: \"A passing verification report already exists (`[filename]`). Re-run all checks or skip?\"\n- If a previous report exists and shows `❌ FAIL` → proceed automatically (re-verification needed).\n- If no previous report exists → proceed normally.
46
47
 
@@ -185,6 +185,17 @@ For each referenced deep dive:
185
185
 
186
186
  ## 8. Present all sections and request approval
187
187
 
188
+ **Section completeness gate**: Before requesting approval, verify the spec file at `docs/plans/ia/[shard-name].md` contains ALL of the following sections with non-empty content (not just headers or `<!-- TODO -->` markers):
189
+ - `## Interactions`
190
+ - `## Contracts`
191
+ - `## Data Models`
192
+ - `## Access Control`
193
+ - `## Accessibility`
194
+ - `## Edge Cases`
195
+ - `## Event Schemas` (may be marked N/A — that's valid, but the section must exist with an explicit statement)
196
+
197
+ If any required section is missing or contains only headers → **STOP**: "Section `[name]` is empty or missing in the spec file. Complete all sections before requesting user approval."
198
+
188
199
  All sections are now written to `docs/plans/ia/[shard-name].md`. Please review the file directly and confirm it's ready for deepening passes.
189
200
 
190
201
  > **Do NOT proceed to `/write-architecture-spec-deepen` until the user approves all sections. Proposing next steps is not the same as receiving approval.**
@@ -24,8 +24,9 @@ Decisions in this pipeline are **progressively locked**. Each pipeline stage bui
24
24
  5. `/write-be-spec` locks the **backend contracts** — API endpoints, schemas, middleware
25
25
  6. `/write-fe-spec` locks the **frontend specs** — components, state, interactions
26
26
  7. `/plan-phase` locks the **implementation order** — dependency-ordered TDD slices
27
- 7.5. `/verify-infrastructure` locks the **operational foundation** — CI/CD green, staging live, migrations clean, auth working
28
- 8. `/implement-slice` locks the **code** — tests implementation → validation
27
+ 7.5. `/setup-workspace` locks the **operational foundation** — project scaffolded, CI/CD green, staging live, database connectable
28
+ 8. `/verify-infrastructure` locks the **infrastructure verification** — all operational gates green
29
+ 9. `/implement-slice` locks the **code** — tests → implementation → validation
29
30
 
30
31
  Once a stage is locked, downstream stages may not contradict it. To change a locked decision, re-run the originating stage and cascade changes downstream.
31
32
 
@@ -78,10 +79,15 @@ Once a stage is locked, downstream stages may not contradict it. To change a loc
78
79
  | 8 | `/plan-phase` | Architecture + specs | Dependency-ordered TDD slices | Planning |
79
80
  | ↳ | `/plan-phase-preflight` | Approved specs | Phase gate + completeness audit + consistency check | Planning |
80
81
  | ↳ | `/plan-phase-write` | Preflight pass | Slices + acceptance criteria + progress files | Planning |
82
+ | 8.5 | `/setup-workspace` | Architecture + phase plan | Scaffolded project + CI/CD + staging + database | Setup |
83
+ | ↳ | `/setup-workspace-scaffold` | Architecture + structure | Project init + deps + configs + git | Setup |
84
+ | ↳ | `/setup-workspace-cicd` | Scaffolded project | CI/CD pipeline config + secrets | Setup |
85
+ | ↳ | `/setup-workspace-hosting` | CI/CD configured | Hosting + domains + first staging deploy | Setup |
86
+ | ↳ | `/setup-workspace-data` | Hosting configured | Database + migrations + connections | Setup |
81
87
  | 9 | `/implement-slice` | Slice acceptance criteria | Working code via Red→Green→Refactor | Implementation |
82
88
  | ↳ | `/implement-slice-setup` | Slice from phase plan | Progress check + skills + contracts + parallel mode | Implementation |
83
89
  | ↳ | `/implement-slice-tdd` | Contract + tests | Red→Green→Refactor + validation + progress tracking | Implementation |
84
- | 9.5 | `/verify-infrastructure` | Implemented infra or auth slice | Operational verification report | Verification |
90
+ | 9.5 | `/verify-infrastructure` | Workspace, infra slice, or auth slice | Operational verification report | Verification |
85
91
  | 10 | `/validate-phase` | Completed phase | Full validation gate | Verification |
86
92
  | ↳ | `/validate-phase-quality` | Completed phase | Code quality gates — tests, coverage, lint, type-check, build, CI/CD, staging, migrations, spec coverage | Verification |
87
93
  | ↳ | `/validate-phase-readiness` | Quality gates passed | Production readiness gates — API docs, accessibility, performance, security, dependency audit, results | Verification |
@@ -13,7 +13,7 @@
13
13
 
14
14
  ### Progressive Decision Lock
15
15
 
16
- Decisions are **progressively locked**: `/ideate` → vision, `/create-prd` → architecture, `/decompose-architecture` → domain boundaries, `/write-architecture-spec` → interaction specs, `/write-be-spec` → backend contracts, `/write-fe-spec` → frontend specs, `/plan-phase` → implementation order, `/verify-infrastructure` → operational foundation, `/implement-slice` → code.
16
+ Decisions are **progressively locked**: `/ideate` → vision, `/create-prd` → architecture, `/decompose-architecture` → domain boundaries, `/write-architecture-spec` → interaction specs, `/write-be-spec` → backend contracts, `/write-fe-spec` → frontend specs, `/plan-phase` → implementation order, `/setup-workspace` → operational foundation, `/verify-infrastructure` → infrastructure verification, `/implement-slice` → code.
17
17
 
18
18
  Once locked, downstream stages may not contradict. To change a locked decision, re-run the originating stage and cascade.
19
19
 
@@ -62,10 +62,15 @@ Once locked, downstream stages may not contradict. To change a locked decision,
62
62
  | 8 | `/plan-phase` | Architecture + specs | Dependency-ordered TDD slices | Planning |
63
63
  | ↳ | `/plan-phase-preflight` | Approved specs | Phase gate + completeness audit + consistency check | Planning |
64
64
  | ↳ | `/plan-phase-write` | Preflight pass | Slices + acceptance criteria + progress files | Planning |
65
+ | 8.5 | `/setup-workspace` | Architecture + phase plan | Scaffolded project + CI/CD + staging + database | Setup |
66
+ | ↳ | `/setup-workspace-scaffold` | Architecture + structure | Project init + deps + configs + git | Setup |
67
+ | ↳ | `/setup-workspace-cicd` | Scaffolded project | CI/CD pipeline config + secrets | Setup |
68
+ | ↳ | `/setup-workspace-hosting` | CI/CD configured | Hosting + domains + first staging deploy | Setup |
69
+ | ↳ | `/setup-workspace-data` | Hosting configured | Database + migrations + connections | Setup |
65
70
  | 9 | `/implement-slice` | Slice acceptance criteria | Working code via Red→Green→Refactor | Implementation |
66
71
  | ↳ | `/implement-slice-setup` | Slice from phase plan | Progress check + skills + contracts + parallel mode | Implementation |
67
72
  | ↳ | `/implement-slice-tdd` | Contract + tests | Red→Green→Refactor + validation + progress tracking | Implementation |
68
- | 7.5 | `/verify-infrastructure` | Implemented infra or auth slice | Operational verification report | Verification |
73
+ | 9.5 | `/verify-infrastructure` | Workspace, infra slice, or auth slice | Operational verification report | Verification |
69
74
  | 10 | `/validate-phase` | Completed phase | Full validation gate | Verification |
70
75
  | ↳ | `/validate-phase-quality` | Completed phase | Code quality gates — tests, coverage, lint, type-check, build, CI/CD, staging, migrations, spec coverage | Verification |
71
76
  | ↳ | `/validate-phase-readiness` | Quality gates passed | Production readiness gates — API docs, accessibility, performance, security, dependency audit, results | Verification |
@@ -156,6 +161,7 @@ Before acting on any task, detect the current pipeline phase from filesystem mar
156
161
  | Decomposition done | IA shards in `docs/plans/ia/` | `/write-architecture-spec` |
157
162
  | Spec writing | BE/FE specs exist | `/write-be-spec`, `/write-fe-spec` |
158
163
  | Planning | Phase plan in `docs/plans/phases/` | `/plan-phase` |
164
+ | Workspace setup | Phase plan exists, no `.agent/progress/` content | `/setup-workspace` → `/verify-infrastructure` |
159
165
  | Implementation | `.agent/progress/` has content | `/implement-slice` |
160
166
 
161
167
  **Use this table to gate every action.** If a user runs a command that doesn't match their current phase, explain what phase they're in and what to run instead.