gspec 1.7.0 → 1.10.0

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.
Files changed (72) hide show
  1. package/bin/gspec.js +275 -8
  2. package/commands/gspec.analyze.md +1 -1
  3. package/commands/gspec.implement.md +3 -3
  4. package/commands/gspec.practices.md +3 -1
  5. package/commands/gspec.stack.md +11 -6
  6. package/commands/gspec.style.md +18 -23
  7. package/dist/antigravity/gspec-analyze/SKILL.md +1 -1
  8. package/dist/antigravity/gspec-architect/SKILL.md +1 -1
  9. package/dist/antigravity/gspec-feature/SKILL.md +1 -1
  10. package/dist/antigravity/gspec-implement/SKILL.md +4 -4
  11. package/dist/antigravity/gspec-migrate/SKILL.md +5 -5
  12. package/dist/antigravity/gspec-practices/SKILL.md +4 -2
  13. package/dist/antigravity/gspec-profile/SKILL.md +1 -1
  14. package/dist/antigravity/gspec-research/SKILL.md +3 -3
  15. package/dist/antigravity/gspec-stack/SKILL.md +12 -7
  16. package/dist/antigravity/gspec-style/SKILL.md +19 -24
  17. package/dist/claude/gspec-analyze/SKILL.md +1 -1
  18. package/dist/claude/gspec-architect/SKILL.md +1 -1
  19. package/dist/claude/gspec-feature/SKILL.md +1 -1
  20. package/dist/claude/gspec-implement/SKILL.md +4 -4
  21. package/dist/claude/gspec-migrate/SKILL.md +5 -5
  22. package/dist/claude/gspec-practices/SKILL.md +4 -2
  23. package/dist/claude/gspec-profile/SKILL.md +1 -1
  24. package/dist/claude/gspec-research/SKILL.md +3 -3
  25. package/dist/claude/gspec-stack/SKILL.md +12 -7
  26. package/dist/claude/gspec-style/SKILL.md +19 -24
  27. package/dist/codex/gspec-analyze/SKILL.md +1 -1
  28. package/dist/codex/gspec-architect/SKILL.md +1 -1
  29. package/dist/codex/gspec-feature/SKILL.md +1 -1
  30. package/dist/codex/gspec-implement/SKILL.md +4 -4
  31. package/dist/codex/gspec-migrate/SKILL.md +5 -5
  32. package/dist/codex/gspec-practices/SKILL.md +4 -2
  33. package/dist/codex/gspec-profile/SKILL.md +1 -1
  34. package/dist/codex/gspec-research/SKILL.md +3 -3
  35. package/dist/codex/gspec-stack/SKILL.md +12 -7
  36. package/dist/codex/gspec-style/SKILL.md +19 -24
  37. package/dist/cursor/gspec-analyze.mdc +1 -1
  38. package/dist/cursor/gspec-architect.mdc +1 -1
  39. package/dist/cursor/gspec-feature.mdc +1 -1
  40. package/dist/cursor/gspec-implement.mdc +4 -4
  41. package/dist/cursor/gspec-migrate.mdc +5 -5
  42. package/dist/cursor/gspec-practices.mdc +4 -2
  43. package/dist/cursor/gspec-profile.mdc +1 -1
  44. package/dist/cursor/gspec-research.mdc +3 -3
  45. package/dist/cursor/gspec-stack.mdc +12 -7
  46. package/dist/cursor/gspec-style.mdc +19 -24
  47. package/dist/opencode/gspec-analyze/SKILL.md +168 -0
  48. package/dist/opencode/gspec-architect/SKILL.md +361 -0
  49. package/dist/opencode/gspec-feature/SKILL.md +204 -0
  50. package/dist/opencode/gspec-implement/SKILL.md +200 -0
  51. package/dist/opencode/gspec-migrate/SKILL.md +118 -0
  52. package/dist/opencode/gspec-practices/SKILL.md +137 -0
  53. package/dist/opencode/gspec-profile/SKILL.md +221 -0
  54. package/dist/opencode/gspec-research/SKILL.md +302 -0
  55. package/dist/opencode/gspec-stack/SKILL.md +305 -0
  56. package/dist/opencode/gspec-style/SKILL.md +224 -0
  57. package/package.json +3 -1
  58. package/starters/features/about-page.md +98 -0
  59. package/starters/features/contact-form.md +147 -0
  60. package/starters/features/contact-page.md +103 -0
  61. package/starters/features/home-page.md +103 -0
  62. package/starters/features/responsive-navbar.md +113 -0
  63. package/starters/features/services-page.md +103 -0
  64. package/starters/features/site-footer.md +121 -0
  65. package/starters/features/theme-switcher.md +124 -0
  66. package/starters/practices/tdd-pipeline-first.md +192 -0
  67. package/starters/stacks/astro-tailwind-github-pages.md +283 -0
  68. package/starters/stacks/nextjs-supabase-vercel.md +319 -0
  69. package/starters/stacks/nextjs-vercel-typescript.md +264 -0
  70. package/starters/styles/clean-professional.md +316 -0
  71. package/starters/styles/dark-minimal-developer.md +442 -0
  72. package/templates/spec-sync.md +1 -1
@@ -0,0 +1,192 @@
1
+ ---
2
+ gspec-version: 1.8.0
3
+ description: TDD, pipeline-first CI/CD, DRY principles, and clean code standards
4
+ ---
5
+
6
+ # Development Practices Guide
7
+
8
+ ## 1. Overview
9
+
10
+ **Context**: This guide serves as the strict instruction set for AI agents and developers working on the project.
11
+ **Goal**: Maintain a high-velocity, high-quality codebase through rigorous adherence to Test-Driven Development (TDD), DRY principles, and clean code standards.
12
+
13
+ > **Precedence rule**: Where this document conflicts with technology-specific practices in `gspec/stack.md`, the stack's technology-specific practices take precedence for framework-specific concerns (e.g., file naming conventions dictated by a framework, framework-specific component patterns). This document governs general engineering principles.
14
+ >
15
+ > **Tooling authority**: This document defines testing *philosophy* (TDD, coverage targets, test organization). The specific testing *tools* (Vitest, Playwright, Cypress, etc.) are defined in `gspec/stack.md`. This document defines CI/CD pipeline *structure* (stages, gates, ordering). The specific CI/CD *platform* (GitHub Actions, GitLab CI, etc.) is defined in `gspec/stack.md`.
16
+
17
+ ## 2. Core Development Practices
18
+
19
+ ### Pipeline-First Development
20
+
21
+ > [!IMPORTANT]
22
+ > **The CI/CD pipeline MUST be established immediately after scaffolding the project, before any application-specific features are implemented.**
23
+ > A working pipeline is the foundation that validates every subsequent change.
24
+
25
+ #### Implementation Order
26
+
27
+ After the initial project scaffold (framework setup, dependency installation, basic configuration), the following must be completed in order:
28
+
29
+ 1. **Lint stage**: Configure the project's linter and formatter. Verify linting passes on the scaffolded codebase.
30
+ 2. **Typecheck stage**: Ensure static type checking passes with strict mode enabled.
31
+ 3. **Test stage**: Set up the unit test runner (as specified in `gspec/stack.md`) with a single trivial passing test (e.g., a smoke test that asserts `true`). Configure the E2E test runner (as specified in `gspec/stack.md`) with a minimal test that loads the index page. Both unit and E2E test commands must pass.
32
+ 4. **Build stage**: Confirm the production build completes successfully.
33
+ 5. **CI pipeline**: Configure the CI/CD platform (as specified in `gspec/stack.md`) with pipeline stages for lint, typecheck, test, build, and deploy. The pipeline must pass end-to-end on the scaffolded project before any feature work begins.
34
+
35
+ #### Acceptance Criteria
36
+
37
+ * All pipeline stages are configured and green.
38
+ * The pipeline runs automatically on every push and merge request.
39
+ * Pre-commit hooks are installed and functional, running the linter and formatter on staged files.
40
+ * No feature branch may be started until the pipeline is verified on the default branch.
41
+
42
+ #### Rationale
43
+
44
+ * **Catch regressions from the first commit**: Every change, no matter how small, is validated.
45
+ * **Avoid pipeline debt**: Retrofitting CI/CD after features are built leads to a batch of failures that are harder to triage.
46
+ * **Enforce quality gates early**: Developers and AI agents build the habit of writing code that passes all checks from day one.
47
+
48
+ ### Testing Standards (TDD)
49
+
50
+ > [!IMPORTANT]
51
+ > **Test-Driven Development (TDD) is MANDATORY.**
52
+ > Strict adherence to the Red-Green-Refactor cycle is required for all logic changes.
53
+
54
+ 1. **Red**: Write a failing test for the smallest possible unit of functionality.
55
+ 2. **Green**: Write the minimum amount of code required to pass the test.
56
+ 3. **Refactor**: Improve the code structure without changing behavior, ensuring tests remain green.
57
+
58
+ * **Scope**:
59
+ * **Unit Tests**: Required for all utility functions, helpers, and complex components. Target 100% coverage for business logic.
60
+ * **Integration Tests**: Required for API routes and critical user flows.
61
+ * **End-to-End Tests**: Headless E2E tests are required for all critical pages to verify they load and render correctly. These tests ensure that routing, layout rendering, and key UI elements are functional from the user's perspective.
62
+ * **Location**: Dedicated `tests/` directory at the project root or module level, mirroring the source structure. DO NOT colocate tests with source files. E2E tests live in a separate directory (e.g., `e2e/`).
63
+ * **Naming**: `[filename].spec.*` exclusively. E2E tests use `[page-name].spec.*`.
64
+ * **E2E Configuration**:
65
+ * **Headless by default**: All E2E tests MUST run in headless mode in CI and during standard test runs.
66
+ * **Critical Page Coverage**: Every user-facing route must have at minimum a "page loads successfully" E2E test that asserts the page renders without errors and key elements are visible.
67
+ * **No Flaky Tests**: E2E tests must be deterministic. Stub external API calls where needed to avoid flakiness.
68
+
69
+ ### Code Quality Standards
70
+
71
+ #### DRY (Don't Repeat Yourself)
72
+ * **Rule**: Do not duplicate business logic or complex styling.
73
+ * **Action**: Extract reusable logic into shared functions, helpers, or modules.
74
+ * **Exceptions**: Minor duplication (3-4 lines) is acceptable if abstraction increases complexity significantly (WET - Write Everything Twice, but not thrice).
75
+
76
+ #### Nesting & Complexity
77
+ * **Max Nesting Depth**: 3 levels.
78
+ * *Violation*: `if (...) { for (...) { if (...) { ... } } }`
79
+ * *Fix*: Extract the inner logic into a named private function or guard clause.
80
+ * **Function Length**: Keep functions under 30 lines where possible. Single Responsibility Principle (SRP) applies strictly.
81
+ * **Cognitive Load**: Use "Early Return" pattern to reduce indentation.
82
+
83
+ ### Code Organization
84
+
85
+ #### Typing & Safety
86
+ * **Strict Typing**: If the project uses a statically typed language, enable the strictest available type checking mode. Avoid escape hatches (e.g., `any` in TypeScript, `Object` in Java) — use narrower types or generics instead.
87
+
88
+ #### Naming Conventions
89
+ * **Variables/Properties**: `camelCase` (e.g., `userProfile`, `isValid`)
90
+ * **Functions**: `camelCase` (e.g., `calculateTotal`, `fetchUserData`)
91
+ * **Types/Interfaces/Classes**: `PascalCase` (e.g., `UserProfile`, `AuthResponse`)
92
+ * **Constants**: `UPPER_SNAKE_CASE` for global constants (e.g., `MAX_RETRY_COUNT`); `camelCase` for local constants.
93
+ * **Files**: `kebab-case` (e.g., `user-profile`) for general source files; `PascalCase` for component files where idiomatic for the framework.
94
+ * **Descriptive Naming**:
95
+ * *Bad*: `val = getData(d)`
96
+ * *Good*: `userProfile = fetchUserProfile(date)`
97
+ * Boolean variables should ideally be prefixed with `is`, `has`, `should` (e.g., `isValid`, `hasAccess`).
98
+
99
+ #### File Structure
100
+ * **Colocation**: Keep related files together (e.g., component, test, and styles if utilizing modules).
101
+ * **Barrels**: Use index/barrel files sparingly to export the public API of a module.
102
+
103
+ ## 3. Version Control & Collaboration
104
+
105
+ ### Git Practices
106
+ * **Commits**: Conventional Commits style (e.g., `feat: add login page`, `fix: resolve auth timeout`).
107
+ * **Branches**: `feat/feature-name`, `fix/issue-description`, `chore/maintenance`.
108
+
109
+ ### Code Review Standards
110
+
111
+ To be defined.
112
+
113
+ ## 4. Documentation Requirements
114
+
115
+ * **Self-Documenting Code**: Prioritize clear naming over comments.
116
+ * **Comments**: Use comments *only* to explain "Why", not "What".
117
+ * *Bad*: `// increment i by 1`
118
+ * *Good*: `// Retry logic required due to potential API race condition`
119
+ * **API Documentation**: Use the language's standard doc comment format for public utility functions and complex interfaces to provide IDE hints.
120
+ * **Deployment Guide**: A `DEPLOYMENT.md` file MUST exist at the project root with step-by-step instructions covering:
121
+ * **SaaS Product Configuration**: Account setup and configuration for every third-party service the project depends on. Include required environment variables, API keys, webhook URLs, and any dashboard settings that must be configured.
122
+ * **Infrastructure Setup**: Instructions for provisioning hosting, databases, DNS, CDN, and any other infrastructure components.
123
+ * **Environment Variables**: A complete list of all required environment variables with descriptions, expected formats, and where to obtain each value.
124
+ * **Build & Deploy Steps**: Commands and procedures to build and deploy the application to production, including any CI/CD pipeline configuration.
125
+ * **Post-Deploy Verification**: Checklist of smoke tests and health checks to confirm a successful deployment.
126
+ * **Rollback Procedure**: Steps to revert to the previous version if a deployment fails.
127
+ * Keep `DEPLOYMENT.md` updated whenever a new SaaS dependency is added or deployment steps change.
128
+
129
+ ## 5. Error Handling & Logging
130
+
131
+ * **Pattern**: Use error boundaries or equivalent mechanisms to catch and handle UI errors gracefully.
132
+ * **Backend**: Use structured error objects. Avoid throwing raw strings or untyped errors.
133
+ * **Logging**: Log significant state changes and errors. Do not leave debugging log statements in production code.
134
+
135
+ ## 6. Performance & Optimization
136
+
137
+ * **Rendering**: Memoize or cache expensive computations only when profiling shows a measurable benefit. Virtualize long lists to avoid rendering off-screen items.
138
+ * **Images**: Always use optimized image components or pipelines provided by the framework.
139
+
140
+ ### SEO & Discoverability
141
+
142
+ > [!IMPORTANT]
143
+ > **SEO is a core product requirement, not an afterthought.**
144
+ > Every page should be optimized for search engines and social sharing.
145
+
146
+ #### Metadata Standards
147
+ * Every page must export metadata including title, description, and Open Graph tags.
148
+ * **Title Format**: `[Page Name] - [Site Name]` (max 60 characters)
149
+ * **Description**: 120-160 characters, include primary keyword naturally
150
+ * **Open Graph**: Always include `title`, `description`, and `images` for social sharing
151
+
152
+ #### Technical SEO
153
+ * **Semantic HTML**: Use proper heading hierarchy (`h1` → `h2` → `h3`). One `h1` per page.
154
+ * **Image Alt Text**: All images MUST have descriptive `alt` attributes.
155
+ * *Bad*: `alt="image"`
156
+ * *Good*: `alt="Professional reviewing code on laptop screen"`
157
+ * **Structured Data**: Add JSON-LD schema markup where applicable.
158
+ * **Sitemap**: Keep `sitemap.xml` updated via dynamic sitemap generation.
159
+ * **Robots.txt**: Configure properly to allow indexing of public pages, block admin/auth routes.
160
+
161
+ #### Performance for SEO
162
+ * **Core Web Vitals**: Monitor and optimize for LCP, FID, CLS.
163
+ * Use optimized image components with priority for above-fold images
164
+ * Lazy load below-fold content
165
+ * **Mobile-First**: All pages must be responsive and mobile-friendly (Google mobile-first indexing).
166
+ * **Page Speed**: Target < 3s initial load on 3G connections.
167
+
168
+ #### Content Guidelines
169
+ * **URLs**: Use descriptive, keyword-rich slugs
170
+ * *Good*: `/services/web-development`
171
+ * *Bad*: `/s/123`
172
+ * **Internal Linking**: Link related content naturally using descriptive anchor text.
173
+ * **Heading Structure**: Front-load important keywords in headings without keyword stuffing.
174
+
175
+ ## 7. Security Practices
176
+
177
+ * **Input Validation**: Validate all external inputs (API params, form data) using a schema validation library.
178
+ * **Authentication**: Never implement custom crypto. Use an established auth provider.
179
+ * **Authorization**: Verify user permissions on *every* server action/API route.
180
+
181
+ ## 8. Refactoring Guidelines
182
+
183
+ * **Boy Scout Rule**: Always leave the code cleaner than you found it.
184
+ * **Refactor Step**: In TDD, the refactor step is not optional. It is the moment to apply DRY and clean up nesting.
185
+
186
+ ## 9. Definition of Done
187
+
188
+ 1. [ ] Tests written (red -> green).
189
+ 2. [ ] Code follows style guide (linted & formatted).
190
+ 3. [ ] No new Type errors.
191
+ 4. [ ] Logic extracted and readable.
192
+
@@ -0,0 +1,283 @@
1
+ ---
2
+ gspec-version: 1.8.0
3
+ description: Static documentation site with Astro, Tailwind CSS v4, and GitHub Pages deployment
4
+ ---
5
+
6
+ # Technology Stack Definition
7
+
8
+ ## 1. Overview
9
+
10
+ A **static documentation and marketing site** deployed to GitHub Pages, built with Astro.
11
+
12
+ ### Architecture Style
13
+ - Static site generated at build time with Astro. Zero server-side runtime, no API, no database.
14
+ - Content-driven architecture — pages are authored in Markdown/MDX and rendered through Astro layouts.
15
+
16
+ ### Deployment Target
17
+ - **GitHub Pages** — static hosting via GitHub Actions build-and-deploy workflow
18
+
19
+ ### Scale & Performance Requirements
20
+ - Minimal — static HTML/CSS/JS served via GitHub Pages CDN. Target: perfect Lighthouse scores.
21
+
22
+ ---
23
+
24
+ ## 2. Open Questions & Clarifications
25
+
26
+ None — all information is clear.
27
+
28
+ ---
29
+
30
+ ## 3. Core Technology Stack
31
+
32
+ ### Programming Languages
33
+
34
+ - **Astro Components (.astro)** — Astro's template syntax, compiles to static HTML
35
+ - **Markdown / MDX** — Content authoring format for documentation pages
36
+ - **JavaScript (ES Modules)** — For any client-side interactivity and Astro configuration
37
+
38
+ ### Runtime Environment
39
+
40
+ - **Node.js 20 LTS** — Used for Astro site generation. Pinned in CI via GitHub Actions `setup-node`.
41
+ - **No container runtime** — Not needed for a static site.
42
+
43
+ ---
44
+
45
+ ## 4. Frontend Stack
46
+
47
+ ### Framework
48
+
49
+ - **Astro 5.x** — Static site generator optimized for content-driven websites
50
+ - **Why Astro:**
51
+ - Zero-JS-by-default output — ideal for a documentation/marketing site
52
+ - First-class Markdown/MDX support for content pages
53
+ - Built-in GitHub Pages deployment support
54
+ - Islands architecture allows interactive components only where needed
55
+ - Excellent performance out of the box (perfect Lighthouse scores)
56
+
57
+ ### Build Tools
58
+
59
+ - **Astro's built-in Vite pipeline** — Astro uses Vite internally; no separate bundler configuration needed
60
+ - **`@astrojs/tailwind`** — Official Astro integration for Tailwind CSS
61
+
62
+ ### State Management
63
+
64
+ Not Applicable — static site with no client-side application state. Any interactivity (e.g., mobile nav toggle, copy-to-clipboard) uses vanilla JS or Astro's `<script>` tags.
65
+
66
+ ### Styling Technology
67
+
68
+ - **Tailwind CSS v4** — Utility-first CSS framework
69
+ - **Why Tailwind:**
70
+ - Astro's officially recommended CSS solution with first-class integration
71
+ - Zero runtime cost in static output — all CSS is purged and inlined at build time
72
+ - Rapid prototyping without writing custom CSS files
73
+ - Excellent responsive design utilities built in
74
+ - `@tailwindcss/typography` plugin for long-form Markdown content styling
75
+ - **Design token mapping:** Visual design values defined in `gspec/style.md` (when created) map to Tailwind's `theme.extend` configuration in `tailwind.config.mjs`. Custom colors, fonts, and spacing scales are defined there as Tailwind theme tokens rather than as raw CSS variables.
76
+
77
+ ---
78
+
79
+ ## 5. Backend Stack
80
+
81
+ Not Applicable — fully static site. Pre-rendered HTML served from GitHub Pages.
82
+
83
+ ---
84
+
85
+ ## 6. Infrastructure & DevOps
86
+
87
+ ### Cloud Provider
88
+
89
+ - **GitHub** — The sole infrastructure provider:
90
+ - **GitHub Pages** — Static site hosting
91
+ - **GitHub Actions** — CI/CD pipeline
92
+
93
+ ### Container Orchestration
94
+
95
+ Not Applicable.
96
+
97
+ ### CI/CD Pipeline
98
+
99
+ - **Platform:** GitHub Actions
100
+ - *Rationale:* Native integration with GitHub Pages deployment. No external CI service needed — hosting and CI are in the same platform.
101
+ - **Deployment trigger:** Push to main (website paths changed). Path filtering scopes the workflow so non-website changes don't trigger deploys.
102
+ - **Deployment method:** `actions/deploy-pages` for GitHub Pages.
103
+ - **Note:** Pipeline stages and structure (lint → typecheck → test → build → deploy) are defined in `gspec/practices.md`. This section defines the CI technology and deployment configuration.
104
+
105
+ ### Infrastructure as Code
106
+
107
+ Not Applicable — GitHub Pages requires no IaC. Configuration lives in `astro.config.mjs` and the GitHub Actions workflow YAML.
108
+
109
+ ---
110
+
111
+ ## 7. Data & Storage
112
+
113
+ ### File Storage
114
+
115
+ - **GitHub Pages CDN** — Serves all static assets (HTML, CSS, JS, images)
116
+
117
+ ### Data Warehouse / Analytics
118
+
119
+ Not Applicable.
120
+
121
+ ---
122
+
123
+ ## 8. Authentication & Security
124
+
125
+ Not Applicable — public static site with no user accounts, login, or protected resources.
126
+
127
+ ---
128
+
129
+ ## 9. Monitoring & Observability
130
+
131
+ Not Applicable — static site with no runtime to monitor. GitHub Pages provides basic traffic analytics if needed.
132
+
133
+ ---
134
+
135
+ ## 10. Testing Infrastructure
136
+
137
+ ### Testing Frameworks
138
+
139
+ - **Build verification:** `astro build` succeeds without errors (run in CI)
140
+ - **Lighthouse CI** (optional) — Automated performance/accessibility audits in the deploy pipeline
141
+ - **E2E testing:** Playwright or Cypress can be used for page-load and rendering verification if required by `gspec/practices.md`. Astro sites are static HTML — E2E tests verify that built pages load correctly and key elements are visible.
142
+ - **Unit testing:** Vitest can be used for testing utility functions, content collection schemas, or build-time logic if required by `gspec/practices.md`.
143
+ - **Note:** Whether and how extensively to test is defined by `gspec/practices.md`. This section defines the available tools for the Astro ecosystem.
144
+
145
+ ### Test Data Management
146
+
147
+ Not Applicable — static content site with no database.
148
+
149
+ ### Performance Testing
150
+
151
+ Not Applicable — static assets served from CDN.
152
+
153
+ ---
154
+
155
+ ## 11. Third-Party Integrations
156
+
157
+ ### External Services
158
+
159
+ - **GitHub Pages** — Website hosting
160
+ - **Formspree** — Client-side form submission service for contact forms and visitor inquiries. Accepts POST requests directly from the browser — no server-side endpoint or backend code required.
161
+ - *Rationale*: GitHub Pages is static-only with no server runtime. Formspree provides form handling without requiring a backend, keeping the architecture zero-server.
162
+ - Free tier supports up to 50 submissions per month.
163
+ - Submissions are forwarded to a configured email address.
164
+
165
+ ### API Clients
166
+
167
+ Not Applicable.
168
+
169
+ ---
170
+
171
+ ## 12. Development Tools
172
+
173
+ ### Package Management
174
+
175
+ - **Package manager:** npm
176
+ - *Rationale:* Simplest option for a static site with minimal dependencies. No need for pnpm's strict resolution or yarn's workspaces at this project scale.
177
+ - Key dependencies:
178
+ - `astro` — Static site generator
179
+ - `@astrojs/tailwind` — Tailwind CSS integration
180
+ - `tailwindcss` — Utility-first CSS framework
181
+ - `@tailwindcss/typography` — Prose styling for Markdown content
182
+
183
+ ### Project Structure
184
+
185
+ ```
186
+ src/
187
+ ├── pages/ # Astro file-based routing
188
+ ├── layouts/ # Page layouts (BaseLayout.astro, DocsLayout.astro)
189
+ ├── components/ # Reusable UI components
190
+ └── content/ # Markdown/MDX content collections
191
+ public/ # Static assets (images, favicon, etc.)
192
+ astro.config.mjs
193
+ tailwind.config.mjs
194
+ package.json
195
+ ```
196
+
197
+ ### Code Quality Tools
198
+
199
+ - **Prettier** — Consistent formatting across Astro, JS, and Markdown files (with `prettier-plugin-astro`)
200
+ - No linter needed at current project scale
201
+
202
+ ### Local Development
203
+
204
+ - `npm run dev` — Astro dev server with hot reload
205
+ - No Docker, no database, no environment variables required
206
+
207
+ ---
208
+
209
+ ## 13. Migration & Compatibility
210
+
211
+ ### Legacy System Integration
212
+
213
+ Not Applicable.
214
+
215
+ ### Upgrade Path
216
+
217
+ - **Astro:** Follow major version upgrade guides. Astro has a strong commitment to smooth upgrades.
218
+ - **Tailwind CSS:** v4 is current. Tailwind's upgrade tooling (`@tailwindcss/upgrade`) automates major version migrations.
219
+ - **Node.js:** Track LTS releases. Currently Node 20, move to Node 22 LTS when ready.
220
+
221
+ ---
222
+
223
+ ## 14. Technology Decisions & Tradeoffs
224
+
225
+ ### Key Architectural Decisions
226
+
227
+ | Decision | Rationale | Alternatives Considered |
228
+ |----------|-----------|------------------------|
229
+ | **Astro over Next.js/Docusaurus** | Zero-JS static output, first-class Markdown support, perfect for docs/marketing. No SSR or client-side routing needed. | Next.js (overkill, ships unnecessary JS), Docusaurus (opinionated, React dependency), Hugo (Go templating less flexible) |
230
+ | **Tailwind over vanilla CSS** | Rapid styling, consistent design system, excellent Astro integration, zero runtime cost after build. | Vanilla CSS (slower to prototype), UnoCSS (smaller ecosystem), Open Props (less utility coverage) |
231
+ | **Minimal dependency footprint** | Only install what the static site needs — no backend or toolchain bloat. | Monorepo with shared dependencies (unnecessary complexity for a static site) |
232
+
233
+ ### Risk Mitigation
234
+
235
+ | Risk | Mitigation |
236
+ |------|------------|
237
+ | Astro breaking changes | Pin major version, test builds in CI, upgrade intentionally |
238
+ | Tailwind v4 is relatively new | First-class Astro support, large community, easy fallback to v3 |
239
+ | GitHub Pages limitations | Static site is tiny; unlikely to hit limits. Could move to Cloudflare Pages or Netlify if needed |
240
+
241
+ ---
242
+
243
+ ## 15. Technology-Specific Practices
244
+
245
+ ### Framework Conventions & Patterns
246
+
247
+ - Use `.astro` components for all pages and layouts — avoid unnecessary framework islands (React, Vue, etc.) unless interactive behavior demands it
248
+ - Use Astro's built-in `<Content />` component for rendering Markdown content
249
+ - Use Astro's file-based routing in `src/pages/`
250
+ - Use `src/layouts/` for page layouts (e.g., `BaseLayout.astro`, `DocsLayout.astro`)
251
+ - Use `src/components/` for reusable UI components
252
+ - Prefer Astro's scoped `<style>` blocks for component-specific styles that don't map well to Tailwind utilities
253
+ - Use content collections (`src/content/`) for structured Markdown content with schema validation
254
+ - Use `getStaticPaths()` for dynamic routes when generating pages from collections
255
+
256
+ ### Library Usage Patterns
257
+
258
+ #### Tailwind CSS in Astro
259
+ - Configure design tokens in `tailwind.config.mjs` under `theme.extend` — map from `gspec/style.md` definitions
260
+ - Use `@apply` sparingly and only in Astro `<style>` blocks for repeated patterns — prefer utility classes in templates
261
+ - Use Tailwind's responsive prefixes (`sm:`, `md:`, `lg:`) rather than custom media queries
262
+ - Use `@tailwindcss/typography` with the `prose` class for all long-form Markdown content
263
+
264
+ ### Language Idioms
265
+
266
+ - **ES Modules** — Use `import`/`export` exclusively
267
+ - **`node:` prefix for built-in modules** — e.g., `import { readFileSync } from 'node:fs'`
268
+
269
+ ### Client-Side Interactivity Patterns
270
+
271
+ Features that require client-side JavaScript (e.g., theme switching, mobile navigation toggles) need special handling in Astro's zero-JS architecture:
272
+
273
+ - **Inline `<script>` tags** — For critical scripts that must run before paint (e.g., applying a saved theme preference to prevent flash-of-wrong-theme), use an inline `<script is:inline>` in the `<head>` of the base layout. This runs synchronously before the page renders.
274
+ - **Astro `<script>` tags** — For non-critical interactivity (e.g., hamburger menu toggle, copy-to-clipboard), use Astro's `<script>` tags in components. These are bundled and optimized by Astro.
275
+ - **Framework islands** — Use `client:load`, `client:visible`, or `client:idle` only for complex interactive components that require a framework (React, Vue, etc.). Most interactivity on a static site can be handled with vanilla JS.
276
+
277
+ ### Stack-Specific Anti-Patterns
278
+
279
+ - **Don't add React/Vue/Svelte islands** unless a component genuinely requires client-side interactivity — the site should ship zero JS by default
280
+ - **Don't use `client:load`** without justification — prefer `client:visible` or `client:idle` if interactivity is truly needed
281
+ - **Don't install a CSS-in-JS library** alongside Tailwind — pick one styling approach
282
+ - **Don't over-engineer navigation or routing** — Astro's file-based routing handles everything a docs site needs
283
+ - **Don't use deferred scripts for theme initialization** — theme preference must be applied in a blocking inline script to prevent flash-of-wrong-theme