gspec 1.7.0 → 1.11.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 +10 -8
  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 +11 -9
  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 +11 -9
  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 +11 -9
  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 +11 -9
  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 +202 -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,121 @@
1
+ ---
2
+ gspec-version: 1.8.0
3
+ description: Site footer with nav links, social icons, and copyright
4
+ ---
5
+
6
+ # Site Footer
7
+
8
+ ## Overview
9
+
10
+ A standard informational footer rendered at the bottom of every page, providing consistent brand identity, copyright information, and site-wide navigation and legal links. Without a persistent footer, visitors lack a reliable anchor for finding key links and verifying they are on a legitimate, professional site — reducing trust and increasing navigation friction.
11
+
12
+ ## Users & Use Cases
13
+
14
+ **Primary users:** All site visitors, regardless of their entry point or intent.
15
+
16
+ **Key use cases:**
17
+
18
+ 1. A visitor reaches the bottom of any page and wants to navigate to another section of the site without scrolling back to the top — the footer provides quick links to key pages.
19
+ 2. A visitor wants to review legal or policy information (privacy policy, terms of use) and looks to the footer as the conventional location for these links.
20
+ 3. A first-time visitor glances at the footer to confirm the business identity, read a brief description, and see a copyright notice — reinforcing legitimacy and professionalism.
21
+
22
+ ## Scope
23
+
24
+ **In scope:**
25
+
26
+ - Business identity display (name and short tagline or description)
27
+ - Copyright notice with current year
28
+ - Navigation links to main site pages
29
+ - Legal and support links (privacy policy, terms of use, accessibility)
30
+ - Consistent rendering across all pages
31
+ - Responsive layout across device sizes
32
+
33
+ **Out of scope:**
34
+
35
+ - Contact forms, email signup forms, or interactive input elements
36
+ - Embedded maps or dynamic content
37
+ - Page-specific content or messaging that varies by page
38
+ - CMS or admin interface for managing footer content
39
+
40
+ **Deferred ideas:**
41
+
42
+ - Social media profile icon links
43
+ - Certification badges or trust seals
44
+ - Micro-CTA buttons (e.g., "Get a Quote")
45
+ - Newsletter signup field
46
+ - Secondary tagline or seasonal messaging
47
+
48
+ ## Capabilities
49
+
50
+ - [ ] **P0**: Footer displays the business name and a short tagline or description
51
+ - Business name is visible and prominent within the footer
52
+ - A brief tagline or description (1 sentence) accompanies the name
53
+ - Identity text is legible at all viewport sizes
54
+
55
+ - [ ] **P0**: Footer displays a copyright notice
56
+ - Copyright notice includes the current year and business name
57
+ - Notice is positioned in a conventional footer location (typically bottom of the footer)
58
+ - Text is legible but visually secondary to navigation and identity content
59
+
60
+ - [ ] **P0**: Footer includes navigation links to main site pages
61
+ - Links to all primary site pages (Home, About, Contact) are present
62
+ - Links are clearly labeled with readable text
63
+ - Each link navigates to the correct page when activated
64
+
65
+ - [ ] **P0**: Footer includes legal and support links
66
+ - Links for privacy policy, terms of use, and accessibility statement are present
67
+ - Legal links are visually grouped or separated from main navigation links to indicate their distinct purpose
68
+ - Each link navigates to the correct destination when activated
69
+
70
+ - [ ] **P0**: Footer renders consistently on every page
71
+ - The footer appears at the bottom of the page content on all site pages
72
+ - Footer content and layout are identical regardless of which page the visitor is on
73
+ - Footer does not overlap or interfere with page-specific content or sticky navigation elements
74
+
75
+ - [ ] **P0**: Footer is fully responsive across common device sizes
76
+ - Layout adapts cleanly to desktop (1024px+), tablet (768px), and mobile (375px) viewports
77
+ - No horizontal scrolling caused by the footer on any viewport
78
+ - Links remain legible and tappable (adequate touch target size) on mobile devices
79
+
80
+ - [ ] **P1**: Footer content is organized with clear visual hierarchy
81
+ - Business identity, navigation links, legal links, and copyright are visually distinct sections or groups
82
+ - A visitor can distinguish between navigation and legal links without reading every label
83
+ - Layout uses spacing and grouping to prevent the footer from feeling cluttered
84
+
85
+ - [ ] **P2**: Footer structure supports accessibility
86
+ - Footer uses a semantic landmark element so assistive technologies can identify it
87
+ - All links are keyboard-navigable and have accessible labels
88
+ - Sufficient color contrast for all text and link elements
89
+
90
+ ## Dependencies
91
+
92
+ - **Home Page** ([home-page.md](home-page.md)): Footer navigation links include a link to the home page.
93
+ - **About Page** ([about-page.md](about-page.md)): Footer navigation links include a link to the about page.
94
+ - **Contact Page** ([contact-page.md](contact-page.md)): Footer navigation links include a link to the contact page.
95
+
96
+ Note: The footer can be built before these pages exist by using placeholder destinations. The dependency is on the link targets being available at launch.
97
+
98
+ ## Assumptions & Risks
99
+
100
+ **Assumptions:**
101
+
102
+ - The business has an established name and can provide a short tagline or description for footer use.
103
+ - Legal pages (privacy policy, terms of use, accessibility statement) will exist as link destinations by launch, even if as simple placeholder pages.
104
+ - Footer content (identity info, links) is stable and changes infrequently; developer-managed updates are acceptable.
105
+ - A single, shared footer is sufficient — no page-specific footer variations are needed.
106
+
107
+ **Key risks:**
108
+
109
+ - **Legal page readiness:** The footer links to legal pages that may not yet exist. Mitigation: links can point to placeholder pages during development; the footer layout is not blocked by legal content.
110
+ - **Navigation consistency with header:** If a separate header or navigation bar exists, the footer's navigation links must stay in sync. Mitigation: both should draw link destinations from a shared configuration or data source to avoid drift.
111
+
112
+ ## Success Metrics
113
+
114
+ 1. The footer is present and visually consistent on every page of the site.
115
+ 2. All footer links (navigation and legal) navigate to their correct destinations without errors.
116
+ 3. Visitors can identify the business name and find at least one navigation link within 3 seconds of viewing the footer.
117
+ 4. The footer renders correctly across desktop, tablet, and mobile viewports with no layout issues.
118
+
119
+ ## Implementation Context
120
+
121
+ > This feature PRD is portable and project-agnostic. During implementation, consult the project's `gspec/profile.md` (target users, positioning), `gspec/style.md` (design system), `gspec/stack.md` (technology choices), and `gspec/practices.md` (development standards) to resolve project-specific context.
@@ -0,0 +1,124 @@
1
+ ---
2
+ gspec-version: 1.8.0
3
+ description: Light/dark mode toggle with system preference detection
4
+ ---
5
+
6
+ # Theme Switcher
7
+
8
+ ## Overview
9
+
10
+ A light/dark theme switcher that allows visitors to toggle between light and dark color schemes across all pages of the site. Many users prefer dark interfaces for comfort, reduced eye strain, or personal taste — and increasingly expect websites to respect their system-level preference. Without theme support, the site forces a single visual mode on all visitors regardless of context or preference.
11
+
12
+ ## Users & Use Cases
13
+
14
+ **Primary users:** All site visitors.
15
+
16
+ **Key use cases:**
17
+
18
+ 1. A visitor browsing at night prefers a dark interface to reduce eye strain and toggles to dark mode using the switcher in the header.
19
+ 2. A visitor whose operating system is set to dark mode arrives at the site and sees it automatically rendered in dark mode without needing to take any action.
20
+ 3. A visitor who previously selected light mode returns to the site days later and finds their preference preserved — the site loads in light mode without requiring them to toggle again.
21
+ 4. A visitor who normally uses OS-level dark mode wants the site specifically in light mode, so they override the default using the toggle — and the override sticks on future visits.
22
+
23
+ ## Scope
24
+
25
+ **In scope:**
26
+
27
+ - Toggle between a light theme and a dark theme
28
+ - Detection of the visitor's operating system color scheme preference
29
+ - User override of the OS default via manual toggle
30
+ - Persistence of the user's theme preference across browser sessions using client-side storage
31
+ - A toggle control placed in the site header/navigation bar, visible on all pages
32
+ - Theming applied consistently across all existing pages (home, about, contact)
33
+ - Smooth visual transition when switching themes (no jarring flash)
34
+
35
+ **Out of scope:**
36
+
37
+ - Multiple color themes beyond light and dark
38
+ - Custom user-defined themes or color pickers
39
+ - Server-side or account-based theme preference storage
40
+ - Theming of third-party embedded content (maps, widgets, iframes)
41
+ - High-contrast or accessibility-specific themes (separate feature)
42
+
43
+ **Deferred ideas:**
44
+
45
+ - Additional predefined color themes (e.g., sepia, high-contrast)
46
+ - Scheduled auto-switching based on time of day
47
+ - Per-page theme overrides
48
+ - Animated theme transition effects beyond a simple crossfade
49
+
50
+ ## Capabilities
51
+
52
+ - [ ] **P0**: Visitor can toggle between light and dark themes using a control in the site header
53
+ - A toggle or icon button is visible in the header/navigation bar on all pages
54
+ - Clicking the toggle switches the entire page between light and dark color schemes
55
+ - The current theme state is visually indicated by the toggle (e.g., sun icon for light, moon icon for dark)
56
+ - The toggle is reachable and operable via keyboard
57
+
58
+ - [ ] **P0**: Theme is applied consistently across all pages and components
59
+ - All text, backgrounds, borders, and interactive elements reflect the active theme
60
+ - No unstyled or mismatched elements remain when switching themes
61
+ - Theme applies to the home page, about page, and contact page without page-specific overrides
62
+
63
+ - [ ] **P0**: Site detects and respects the visitor's operating system color scheme preference on first visit
64
+ - If the OS is set to dark mode, the site renders in dark mode on the first visit (before any manual toggle)
65
+ - If the OS is set to light mode or has no preference, the site renders in light mode
66
+ - Detection happens before the initial page paint to avoid a flash of the wrong theme
67
+
68
+ - [ ] **P0**: Visitor's manual theme preference is persisted in client-side storage
69
+ - After toggling, the selected theme is saved and survives browser tab closure and reopening
70
+ - On subsequent visits, the persisted preference takes priority over the OS preference
71
+ - If no persisted preference exists, the OS preference is used as the default
72
+
73
+ - [ ] **P1**: Theme switch occurs without a flash of unstyled or incorrect-theme content
74
+ - On page load, the correct theme is applied before the page becomes visible to the visitor
75
+ - Toggling themes mid-session produces a smooth transition without a jarring flicker
76
+ - Navigation between pages does not cause a momentary flash of the wrong theme
77
+
78
+ - [ ] **P1**: Toggle control is responsive and works across all device sizes
79
+ - Toggle is visible and tappable on mobile viewports without being obscured by other header elements
80
+ - Toggle does not break header layout on any supported viewport size (desktop, tablet, mobile)
81
+
82
+ - [ ] **P2**: Theme preference is accessible
83
+ - Toggle has an accessible label describing its function (e.g., "Switch to dark mode" / "Switch to light mode")
84
+ - Theme colors maintain sufficient contrast ratios for text readability in both light and dark modes
85
+ - Toggle state change is announced to screen readers
86
+
87
+ ## Dependencies
88
+
89
+ - **Home Page** ([home-page.md](home-page.md)): Theme must apply to all home page sections (hero, value proposition, services).
90
+ - **About Page** ([about-page.md](about-page.md)): Theme must apply to all about page content.
91
+ - **Contact Page** ([contact-page.md](contact-page.md)): Theme must apply to all contact page content.
92
+
93
+ The theme switcher depends on a shared site header/navigation existing across pages. If no shared header exists yet, one must be established for the toggle to have a consistent location.
94
+
95
+ > **Compatibility note**: This feature requires client-side JavaScript for toggle interaction, OS preference detection (`prefers-color-scheme`), localStorage persistence, and flash-of-wrong-theme prevention. Stacks that default to zero client-side JS (e.g., static site generators with island architecture) will need an interactive component or inline script for the toggle, plus a blocking inline script in `<head>` to apply the saved theme before first paint. Consult `gspec/stack.md` Section 15 (Technology-Specific Practices) for the framework's approach to client-side interactivity.
96
+
97
+ ## Assumptions & Risks
98
+
99
+ **Assumptions:**
100
+
101
+ - The site uses a design approach where colors are defined as variables or tokens, making it feasible to swap between two palettes.
102
+ - A shared header or navigation component exists (or will be created) across all pages.
103
+ - Client-side storage is available in the visitor's browser (virtually universal in modern browsers).
104
+
105
+ **Open questions:**
106
+
107
+ - Exact contrast ratios and color values for the dark theme will need validation during implementation against accessibility standards.
108
+
109
+ **Key risks:**
110
+
111
+ - **Flash of incorrect theme on load:** If the theme preference is read too late in the page load process, visitors may see a brief flash of the wrong theme. Mitigation: apply the theme preference as early as possible in the page rendering pipeline, before the main content is painted.
112
+ - **Inconsistent theming across pages:** If pages are styled independently, some elements may not respond to the theme toggle. Mitigation: define theme colors as shared design tokens or variables referenced by all page styles.
113
+ - **Dark theme readability:** Poorly chosen dark theme colors can reduce readability or make the site feel amateurish. Mitigation: follow established dark theme design conventions (muted backgrounds, appropriate contrast, desaturated accent colors).
114
+
115
+ ## Success Metrics
116
+
117
+ 1. Visitors can switch between light and dark themes with a single click/tap and see the change applied immediately across the entire page.
118
+ 2. The site loads in the visitor's preferred theme (OS-detected or previously saved) without a visible flash of the wrong theme.
119
+ 3. A visitor's manually selected theme preference persists across at least 3 return visits over multiple days.
120
+ 4. Both light and dark themes meet WCAG AA contrast requirements for all body text.
121
+
122
+ ## Implementation Context
123
+
124
+ > This feature PRD is portable and project-agnostic. During implementation, consult the project's `gspec/profile.md` (target users, positioning), `gspec/style.md` (design system), `gspec/stack.md` (technology choices), and `gspec/practices.md` (development standards) to resolve project-specific context.
@@ -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
+