Incubation Workflow (GitHub Spark)
Rapid prototyping with GitHub Spark and a zero-friction graduation path into the Foundation production monorepo.
Incubation Workflow (GitHub Spark)
The Incubation Workflow allows for zero-friction prototyping using GitHub Spark. Use Spark to vibe the initial UI and logic of a feature or micro-app. Once the idea has legs, use the Foundation agentic pipeline to port the code into the production monorepo.
The Service-First Rule
To ensure graduation is a near 1:1 operation, every Spark project must follow the Service Abstraction Pattern. This prevents lock-in to Spark's managed runtime (window.spark).
Spark Context File
When starting a new Spark project, upload or paste the following rules into the Spark editor as context. A ready-to-use template is available for download:
SPARK-RULES.md lives in public/templates/SPARK-RULES.md. To bootstrap a new Spark session, cat public/templates/SPARK-RULES.md and paste the output into the Spark editor.
Spark Context: Foundation Portability Rules
- Directory Structure: All side effects must live in a
src/services/directory. - Data Abstraction: Create a
DataService.ts. Never callwindow.spark.kvdirectly in a component. Wrap it in methods likegetData()andsetData()(use domain-specific names in practice, e.g.,getUserProfile(),saveUserProfile()). - AI Abstraction: Create an
AIService.ts. Wrapwindow.spark.llmin a typed function. - Auth Abstraction: Create an
AuthService.ts. Use a placeholder for user identity that can be swapped for Better Auth. - Styling: Use Tailwind CSS exclusively. Avoid custom CSS files to ensure compatibility with the Foundation design system.
The Graduation Process
When you are ready to move a Spark project into the Foundation monorepo, follow these steps:
| Step | Action |
|---|---|
| 1. Sync | Ensure the Spark project is synced to a standalone GitHub repository. |
| 2. Target | Identify the target workspace in the Foundation monorepo (e.g., ui/web-app/features/[name]). |
| 3. Port | Use the APPLY-ARCHITECTURE.md prompt with the instruction: "Port this Spark repository to the Foundation architecture. Review APPLY-ARCHITECTURE.md specifically for the Service Mapping rules." |
Before merging a ported Spark project, ensure the Pre-Commit Check skill runs clean and a PR Preview Environment has been verified by the submitter.
Self-Consistency Checklist
The Incubation Workflow is consistent with the following Foundation principles:
| Principle | How it applies |
|---|---|
| One concern per file | Each service (DataService.ts, AIService.ts, AuthService.ts) addresses exactly one side-effect concern. No service file is responsible for more than one Spark API. |
| Pre-Commit Check | Ported code must pass the Pre-Commit Check skill before the PR is opened. The skill enforces Biome and Ruff formatting rules that the graduated code must satisfy. |
| PR Preview Environment | Every graduation PR automatically provisions a PR Preview Environment — an isolated Neon branch plus a dedicated Cloud Run deployment — so the submitter can verify the result before anything touches production. |