AI Builder - Technical Specifications
This skill creates/updates the technical specifications documentation defining the technology stack, security posture, theme standards (extracted from UX mockup), coding standards, testing standards, and security standards.
When to Use This Skill
- User asks to "define tech specs" or "choose tech stack"
- User requests to start Stage 7 or the next stage after architecture
- User wants to select technologies and frameworks
- User wants to establish coding and testing standards
- User needs to define security standards
Prerequisites
This skill requires 06-architecture to be completed for L3+ projects. For L2 projects, this stage can proceed without architecture documentation.
Your Roles in This Skill
- Tech Manager (Architect): Lead tech stack selection and standards definition. Review architecture to choose appropriate technologies. Define coding and testing standards. Ensure technical choices align with requirements and constraints.
- Security Engineer: Define security posture, authentication approach, and secure coding standards. Identify security threats and mitigation strategies. Establish security testing and compliance requirements.
- UI Designer: Extract theme standards from approved UX mockup. Document colors, fonts, spacing, and design tokens. Ensure design consistency rules are clear for implementation.
- DevOps Engineer: Review tech stack for deployment and operational feasibility. Provide input on infrastructure compatibility. Consider monitoring and logging requirements.
Role Communication
As an expert in your assigned roles, you must announce your actions before performing them using the following format:
As a {Role} [and {Role}, ...], I will {action description}
This communication pattern ensures transparency and allows for human-in-the-loop oversight at key decision points.
Instructions
Follow these steps in order:
Step 0: Verify Prerequisites and Gather Context
First read and understand rules: dev-swarm/docs/research-specs-rules.md then:
Check for Project Scale (L2 vs L3+):
- Check
00-init-ideas/README.md or classification to determine project scale.
Check if 06-architecture/ folder exists:
- For L3+ projects (Mandatory):
- If NOT found: Inform user they need to create architecture first, then STOP.
- If found: Read all files.
- For L2 projects (Optional):
- If found: Read files.
- If NOT found: Proceed without it.
Check if 05-ux/ folder exists (Mandatory for L3+):
- If NOT found and project is L3+: Warn user.
- For L2: Skip if not relevant.
- CSS variables and design tokens
- Color palette
- Typography (fonts, sizes)
- Spacing system
- Border radius and shadows
- Component styles
Check if 00-init-ideas/ folder exists (recommended):
- If found: Read all files to understand it
Check if 04-prd/ folder exists (recommended):
- If found: Read to understand:
- Non-functional requirements (performance, security, compliance)
- Technical constraints
Check if 03-mvp/ folder exists (recommended):
- If found: Read to understand:
- MVP scope (prioritize tech choices for MVP)
- Timeline constraints
Check if this stage should be skipped:
- Check if
07-tech-specs/SKIP.md exists
- If SKIP.md exists:
- Read SKIP.md to understand why this stage was skipped
- Inform the user: "Stage 7 (tech-specs) is marked as SKIP because [reason from SKIP.md]"
- Ask the user: "Would you like to proceed to the next stage (devops)?"
- If user says yes:
- Exit this skill and inform them to run the next stage skill
- If user says no:
- Ask if they want to proceed with tech specs anyway
- If yes, delete SKIP.md and continue with this skill
- If no, exit the skill
Check if 07-tech-specs/ folder exists:
- If exists: Read all existing files to understand current tech specs state
- If NOT exists: Will create new structure
If README.md exists: Check whether it requires diagrams. If it does,
follow dev-swarm/docs/mermaid-diagram-guide.md and use the
dev-swarm-mermaid skill to render outputs.
Read source code structure guidance (mandatory):
- Read
dev-swarm/docs/source-code-structure.md
- Use it as the baseline when creating
07-tech-specs/source-code-structure.md
Proceed to Step 1 with gathered context
Step 1: Refine Design Requirements in README and Get Approval
CRITICAL: Create/update README.md first based on previous stage results, get user approval, then create other docs.
Analyze information from previous stages:
- Read
06-architecture/ to understand system components and deployment
- Read
05-ux/mockups/styles.css to extract theme (CRITICAL for theme-standards.md)
- Read
04-prd/ to understand non-functional requirements
- Read
03-mvp/ (if exists) to understand what to prioritize
- Consider cost-budget constraints for this stage
Create or update 07-tech-specs/README.md with refined requirements:
- For L2 projects: Create a simple README (just several lines) indicating the project level and that only
tech-stack.md is required.
- For L3+ projects: List deliverables explicitly in README (typical: tech-stack.md, security.md, theme-standards.md, coding-standards.md, source-code-structure.md, testing-standards.md, security-standards.md)
- Stage overview and objectives (based on previous stage context)
- Owners: Tech Manager (lead), Security Engineer, UI Designer, DevOps Engineer
- Diagrams (if required by project init):
- Reference
dev-swarm/docs/mermaid-diagram-guide.md
- Include
diagram/ deliverables when needed
- What tech specs will include:
- Technology stack selection with rationale
- Security posture and authentication approach
- Theme standards extracted from UX mockup (CRITICAL)
- Coding standards and best practices
- Testing standards and coverage requirements
- Security standards for secure coding
- Methodology:
- How tech stack will be selected (based on architecture + requirements)
- How theme will be extracted from mockup CSS (DO NOT invent values)
- Deliverables planned:
- List of files that will be created (tech-stack.md, theme-standards.md, etc.)
- Budget allocation for this stage (from cost-budget.md)
- Status: In Progress (update to "Completed" after implementation)
Present README to user:
- Show the tech specs approach and what will be defined
- Show what documentation files will be created
- Explain how it aligns with previous stages
- Ask: "Does this tech specs plan look good? Should I proceed with defining technology stack and standards?"
Wait for user approval:
- If user says yes: Proceed to Step 2
- If user says no:
- Ask what needs to be changed
- Update README based on feedback
- Ask for approval again
Step 2: Create/Update Tech Specs Structure
Only after user approves the README:
Create files as specified in the approved README.md:
IMPORTANT: The file structure below is a SAMPLE only. The actual files you create must follow what was approved in the README.md in Step 1.
Typical structure (example):
07-tech-specs/
├── README.md (already created and approved in Step 1)
├── tech-stack.md (if specified in README)
├── security.md (if specified in README)
├── theme-standards.md (if specified in README - MUST extract from UX mockup)
├── coding-standards.md (if specified in README)
├── source-code-structure.md (if specified in README)
├── testing-standards.md (if specified in README)
└── security-standards.md (if specified in README)
Create only the files listed in the README's "Deliverables planned" section.
Step 3: Create/Update Technical Specifications Documentation
IMPORTANT: Only create tech specs documentation after README is approved in Step 1.
NOTE: The content structure below provides GUIDELINES for typical tech specs documentation. Adapt based on the approved README and project needs.
07-tech-specs/README.md:
- Stage overview and objectives
- Specify the owners: Tech Manager (lead), Security Engineer, UI Designer, DevOps Engineer
- Summary of technical approach and key decisions
- Links to all tech specs documentation files
- Rationale for major technical decisions
tech-stack.md:
Define the complete technology stack:
Technology Selection Criteria:
- Must support requirements from PRD
- Must work with chosen architecture
- Team familiarity and expertise
- Community support and ecosystem
- Performance and scalability
- Cost considerations
- Long-term maintainability
Frontend Stack:
- Define framework/library choice and rationale
- Specify language (JavaScript/TypeScript) and why
- Select UI component library approach
- Choose state management solution
- Define styling approach
- Specify build tool and package manager
- For mobile: Define framework and navigation approach
- For desktop: Define framework if applicable
Backend Stack:
- Select language and version with rationale
- Choose framework and explain why
- Define API style (REST/GraphQL/gRPC/etc.)
- Specify background job processing approach
- Define scheduler if needed
Database & Data Storage:
- Select primary database type and version with rationale
- Choose caching solution
- Define object storage approach
- Specify search solution if applicable
Infrastructure & Deployment:
- Select cloud provider with rationale
- Choose compute service approach
- Define container orchestration if applicable
- Specify CDN service
DevOps & Tools:
- Define version control platform and branching strategy
- Choose CI/CD platform with rationale
- Select application monitoring solution
- Choose error tracking service
- Define logging approach
- Select infrastructure as code tool
External Services & APIs:
- Choose authentication service approach
- Select email delivery service
- Define payment processing if applicable
- Choose analytics service
- Select SMS service if applicable
security.md:
Define the security posture and approach:
Security Principles:
- Security by design
- Defense in depth
- Principle of least privilege
- Zero trust architecture
- Fail securely
Authentication Approach:
- Method: [JWT / Session-based / OAuth 2.0 / SAML / etc.]
- Token Storage: [httpOnly cookies / localStorage / sessionStorage]
- Token Expiration: [Access token: 15 minutes, Refresh token: 7 days, etc.]
- Multi-Factor Authentication (MFA): [Required / Optional / Not implemented]
- Password Policy:
- Minimum length: [8-12 characters]
- Complexity requirements
- Password hashing: [bcrypt / Argon2 / PBKDF2]
- Rounds/iterations: [Specify]
Authorization Model:
- Approach: [RBAC (Role-Based) / ABAC (Attribute-Based) / ACL / etc.]
- Roles: [List of roles: Admin, User, Moderator, etc.]
- Permissions: [How permissions are defined and checked]
Secrets Management:
- Approach: [AWS Secrets Manager / HashiCorp Vault / Environment Variables / etc.]
- API Keys: [How stored and rotated]
- Database Credentials: [How stored and accessed]
- Encryption Keys: [How managed]
Data Security:
- Encryption at Rest: [AES-256 / etc.]
- Encryption in Transit: [TLS 1.3 / etc.]
- PII Handling: [How personally identifiable information is protected]
- Data Retention: [How long data is kept]
- Data Deletion: [Hard delete vs soft delete approach]
Threat Mitigation:
OWASP Top 10 Protections:
Additional Protections:
- CSRF Protection: CSRF tokens on state-changing requests
- Rate Limiting: Prevent brute force and DDoS
- SQL Injection: ORM usage, parameterized queries
- Clickjacking: X-Frame-Options header
- CORS: Proper CORS configuration
Compliance Requirements:
- GDPR (if applicable): Data privacy, right to deletion, consent
- CCPA (if applicable): California privacy rights
- HIPAA (if healthcare): Healthcare data protection
- PCI-DSS (if payment): Payment card data security
- SOC 2 (if enterprise): Security, availability, confidentiality
theme-standards.md (CRITICAL - Based on Approved UX Mockup):
IMPORTANT: This file MUST be extracted from the approved UX mockup in 05-ux/mockups/styles.css. Do NOT invent theme values - extract them from the actual mockup.
Extract and document the UI theme from the UX mockup:
Theme Extraction from Mockup:
Step 1: Read 05-ux/mockups/styles.css file
Step 2: Extract all CSS variables defined in :root
Step 3: Document them here with exact values from mockup
Color Palette:
- Extract all color variables from mockup CSS (primary, secondary, accent, neutral, semantic colors)
- Document use cases for each color
- Ensure color contrast requirements (WCAG AA minimum)
- Define dark mode variations if applicable
Typography:
- Extract font families and their use cases
- Document font sizes scale (xs through 3xl)
- Define font weights (regular, medium, semibold, bold)
- Specify line heights for different content types
- Define typography hierarchy and usage rules
Spacing System:
- Extract spacing scale variables from mockup
- Define spacing usage rules for components, margins, and gaps
- Specify default spacing for common UI patterns
Border Radius:
- Extract border radius values from mockup
- Define usage rules for different component types
Shadows:
- Extract shadow values from mockup
- Define shadow usage for elevation and states
Transitions:
- Extract transition timing values from mockup
- Define transition usage for interactions and animations
Component-Specific Styles:
- Extract button styles (variants, sizes, states)
- Extract form styles (inputs, focus, error, success states)
- Extract card styles (background, padding, shadow, border)
- Document other component-specific styles as needed
Responsive Breakpoints:
- Extract breakpoints from mockup media queries
- Define responsive behavior rules for fonts, spacing, and layouts
Design Tokens for Implementation:
- Provide design tokens in format suitable for the chosen tech stack
- Ensure tokens match extracted CSS variable values
- Include all theme values (colors, fonts, spacing, etc.)
CRITICAL RULES for theme-standards.md:
- ❌ DO NOT invent or guess theme values
- ✅ DO extract exact values from
05-ux/mockups/styles.css
- ✅ DO preserve the exact CSS variable names
- ✅ DO include usage rules and accessibility notes
- ✅ DO provide code examples for implementation
coding-standards.md:
Define code style rules and conventions:
General Principles:
- Write clean, readable code
- Follow DRY (Don't Repeat Yourself)
- KISS (Keep It Simple, Stupid)
- SOLID principles (for OOP languages)
- Functional programming principles (where applicable)
Naming Conventions:
Variables:
- camelCase for JavaScript/TypeScript:
userName, isActive
- snake_case for Python:
user_name, is_active
- PascalCase for classes/components:
UserProfile, LoginForm
Functions/Methods:
- Verb-first naming:
getUserData(), validateEmail(), handleSubmit()
- Boolean functions:
isValid(), hasPermission(), canEdit()
Constants:
- UPPER_SNAKE_CASE:
MAX_RETRIES, API_BASE_URL
Files:
- Component files: PascalCase (
LoginForm.tsx, UserProfile.jsx)
- Utility files: camelCase (
formatDate.js, validateInput.ts)
- Keep filenames descriptive and consistent
Code Organization:
- Define frontend folder structure (components, pages, hooks, utils, services, store, styles, types, constants)
- Define backend folder structure (controllers, models, services, routes, middleware, utils, config, validators)
- Ensure clear separation of concerns
Code Style:
Indentation:
- Use 2 spaces for JavaScript/TypeScript/HTML/CSS
- Use 4 spaces for Python
- No tabs
Line Length:
- Maximum 80-100 characters per line
- Break long lines at logical points
Comments:
- Use comments to explain WHY, not WHAT
- Write JSDoc/TSDoc for functions
- Keep comments up-to-date
Formatting:
- Use Prettier for auto-formatting (JavaScript/TypeScript)
- Use Black for Python formatting
- Configure IDE to format on save
Best Practices:
Error Handling:
- Always handle errors, never ignore them
- Use try-catch for async operations
- Provide meaningful error messages
- Log errors with context
Async Code:
- Use async/await over promises.then()
- Handle promise rejections
- Avoid callback hell
Security:
- Never commit secrets or credentials
- Validate all user input
- Sanitize data before rendering
- Use prepared statements for SQL
Performance:
- Avoid unnecessary re-renders (React)
- Use proper indexing (Database)
- Cache when appropriate
- Lazy load when possible
Version Control:
Commit Messages:
- Format:
<type>: <description>
- Types: feat, fix, docs, style, refactor, test, chore
- Examples:
feat: add user authentication
fix: resolve login redirect bug
docs: update API documentation
Branch Naming:
- feature/[feature-name]
- bugfix/[bug-description]
- hotfix/[issue-number]
source-code-structure.md
Define the organization and structure of source code under the src/ folder based on the project's needs. Follow dev-swarm/docs/source-code-structure.md as the baseline:
Overview:
- Explain the chosen code organization approach
- Purpose: Enable AI developers to navigate and locate code efficiently
- Maintain clear separation of concerns
- Support scalability and maintainability
Choose Organization Strategy:
Select and document the code organization strategy that best fits the project. Use the options listed in dev-swarm/docs/source-code-structure.md for the sample structures.
File Naming Conventions:
- Define file naming conventions (e.g., kebab-case, snake_case, PascalCase)
- Test file conventions (e.g.,
.test.*, .spec.*, test_*)
- Type definition conventions (e.g.,
.types.*, types.*)
Code Organization Principles:
- Single Responsibility: One file, one primary purpose
- Clear Entry Points: Well-defined public APIs
- Co-located Tests: Tests live near the code they test
- Shared Code: Define when code should be shared vs duplicated
Documentation Requirements:
- Document where each type of code belongs
- Provide examples for common scenarios
- Explain the rationale for the chosen structure
- Define guidelines for adding new code
testing-standards.md:
Define testing requirements and standards:
Testing Principles:
- Write tests before or alongside code (TDD encouraged)
- Test behavior, not implementation
- Keep tests simple and readable
- One assertion per test (when possible)
- Tests should be independent and isolated
Testing Pyramid:
/\
/E2E\ <- Few (10%)
/------\
/Integration\ <- Some (30%)
/------------\
/ Unit Tests \ <- Many (60%)
Required Test Coverage:
- Minimum Coverage: 80% overall
- Critical Code: 100% coverage (authentication, payment, data validation)
- Nice-to-have Code: 60-70% coverage (UI components, utilities)
Unit Testing:
What to Test:
- All business logic functions
- Data transformations and calculations
- Validation functions
- Utility functions
- Component logic (React hooks, etc.)
Testing Framework:
- JavaScript/TypeScript: Jest, Vitest
- Python: pytest, unittest
- Go: testing package
Naming Convention:
- Test file:
fileName.test.js or fileName.spec.js
- Test description:
describe('functionName', () => { it('should do something', () => {}) })
- Follow testing framework conventions for structure
Integration Testing:
What to Test:
- API endpoints (request/response)
- Database operations
- External service integrations
- Authentication flows
Testing Tools:
- API Testing: Supertest, Postman/Newman
- Database: In-memory DB or test DB
- Mocking: Mock external services
End-to-End (E2E) Testing:
What to Test:
- Critical user flows (from UX design)
- User registration and login
- Core feature workflows
- Payment flows (if applicable)
Testing Framework:
- Playwright (recommended)
- Cypress
- Selenium
E2E Test Approach:
- Write tests that simulate real user interactions
- Test complete workflows from start to finish
- Verify expected outcomes and navigation
Test Execution:
Local Development:
- Run tests before committing:
npm test
- Run tests in watch mode:
npm test --watch
CI/CD Pipeline:
- Run all tests on pull requests
- Block merge if tests fail
- Run tests before deployment
Test Commands:
npm test - Run all tests
npm test:unit - Run unit tests only
npm test:integration - Run integration tests
npm test:e2e - Run E2E tests
npm test:coverage - Generate coverage report
Minimum Test Gates:
Before Merging to Main:
Before Deployment:
security-standards.md:
Define secure coding rules and practices:
Secure Coding Principles:
- Validate all input, trust no one
- Fail securely (default deny)
- Defense in depth
- Principle of least privilege
- Keep security simple
- Don't rely on security through obscurity
Input Validation:
- Validate on server-side (never trust client)
- Use allowlists, not denylists
- Sanitize all user input
- Validate data types, lengths, formats
- Reject invalid input, don't try to fix it
Output Encoding:
- Encode output based on context (HTML, URL, JavaScript)
- Use framework-provided encoding functions
- Prevent XSS by encoding user data
Authentication & Authorization:
- Never store passwords in plain text
- Use bcrypt/Argon2 for password hashing
- Implement rate limiting on auth endpoints
- Require re-authentication for sensitive operations
- Check authorization on EVERY request
Sensitive Data Handling:
- Never log sensitive data (passwords, tokens, SSNs, credit cards)
- Encrypt sensitive data at rest
- Use HTTPS for all data in transit
- Redact sensitive data in logs and errors
Secret Management:
- Never commit secrets to version control
- Use environment variables or secret management services
- Rotate secrets regularly
- Use different secrets for dev/staging/production
Dependency Security:
- Regularly scan dependencies for vulnerabilities
- Keep dependencies up-to-date
- Use
npm audit or pip-audit in CI/CD
- Remove unused dependencies
SQL Injection Prevention:
- Use parameterized queries (prepared statements)
- Use ORM frameworks properly
- Never concatenate SQL strings with user input
- Validate input before queries
Logging & Monitoring:
- Log all authentication events (success and failure)
- Log all authorization failures
- Log all data access to sensitive resources
- Set up alerts for suspicious activity
- Redaction Rules:
- Redact passwords, tokens, API keys
- Redact credit card numbers, SSNs
- Redact PII in production logs
Security Checklist for Code Review:
Step 4: Ensure Alignment
Make sure tech specs align with:
- Architecture from 06-architecture/
- Non-functional requirements from 04-prd/non-functional-requirements.md
- UX mockup theme from 05-ux/mockups/styles.css (CRITICAL for theme-standards.md)
- MVP scope from 03-mvp/ (prioritize tech choices for MVP)
Verify that:
- Tech stack can implement the architecture
- Theme standards match the UX mockup exactly
- Security standards address requirements
- Testing standards ensure quality
- Coding standards are clear and enforceable
Step 5: Final User Review
Inform user that tech specs are complete
Update README.md:
- Change Status from "In Progress" to "Completed"
- Add a Summary section with key insights (2-3 paragraphs)
- Add a Created Files section listing all created files
Present completed work to user:
- Review chosen tech stack and rationale
- Show theme standards extracted from UX mockup
- Explain security approach
- Walk through coding and testing standards
Highlight key insights:
- Frontend framework choice and why
- Backend framework choice and why
- Database choice and why
- Theme values extracted from mockup (show side-by-side)
- Security compliance level
- Test coverage requirements
Ask questions:
- Comfortable with tech stack choices?
- Theme standards match their vision?
- Any security concerns?
- Testing requirements achievable?
- Ready to proceed to next stage (DevOps)?
Make adjustments based on user feedback if needed
Step 6: Commit to Git (if user confirms)
- If user confirms tech specs are complete:
- Ask if they want to commit to git
- If user wants to commit:
- Stage all changes in
07-tech-specs/
- Commit with message: "Define tech stack and engineering standards (Stage 7)"
Expected Project Structure
For L3+ Projects (Full Scale)
project-root/
├── 00-init-ideas/
│ └── [existing files]
├── 01-market-research/ (optional)
│ └── [existing files if present]
├── 02-personas/
│ └── [existing files]
├── 03-mvp/
│ └── [existing files]
├── 04-prd/
│ └── [existing files]
├── 05-ux/
│ └── [existing files including mockups/]
├── 06-architecture/
│ └── [existing files]
└── 07-tech-specs/
├── README.md (with owners and summary)
├── tech-stack.md (languages, frameworks, tools)
├── security.md (auth, secrets, threats)
├── theme-standards.md (EXTRACTED FROM UX MOCKUP)
├── coding-standards.md (style, naming, organization)
├── source-code-structure.md (src/ organization)
├── testing-standards.md (coverage, frameworks, gates)
└── security-standards.md (secure coding, logging redaction)
For L2 Projects (Tools)
project-root/
├── 00-init-ideas/
│ └── [existing files]
└── 07-tech-specs/
├── README.md (minimal requirements)
└── tech-stack.md (language and package selection)
Key Tech Specs Principles
- Justify Choices: Explain WHY each technology was chosen
- Extract Theme from Mockup: Never invent theme values, extract from approved UX
- Standards Over Preferences: Define standards that everyone follows
- Security First: Build security into standards, not bolt on later
- Testable: Make standards measurable and enforceable
- Practical: Standards should be realistic and achievable
- Documented: Clear documentation prevents confusion
Theme Standards Best Practices (CRITICAL)
- Always Extract from Mockup: Read
05-ux/mockups/ first
- Preserve Variable Names: Keep CSS variable names from mockup
- Document Usage: Explain when and how to use each value
- Accessibility Check: Ensure color contrast meets WCAG standards
- Provide Examples: Show code examples for implementation
- Design Tokens: Convert CSS variables to JS/TS tokens for frameworks
- Keep In Sync: If mockup changes, update theme standards immediately
Deliverables
By the end of this stage, you should have:
- Complete tech stack definition with rationale for each choice
- Security posture and authentication approach defined
- Theme standards extracted from approved UX mockup (colors, fonts, spacing)
- Coding standards for style, naming, and organization
- Source code structure for feature-driven development (src/ organization)
- Testing standards with coverage requirements and frameworks
- Security standards for secure coding and logging
- Foundation for DevOps setup (next stage)
- Clear implementation guidelines for developers
1---2name: dev-swarm-tech-specs-23description: Define technical specifications including tech stack, security, theme standards (from UX mockup), coding standards, and testing standards. Use when user asks to define tech specs, choose tech stack, or start Stage 7 after architecture.4---5
6# AI Builder - Technical Specifications
7
8This skill creates/updates the technical specifications documentation defining the technology stack, security posture, theme standards (extracted from UX mockup), coding standards, testing standards, and security standards.
9
10## When to Use This Skill
11
12- User asks to "define tech specs" or "choose tech stack"
13- User requests to start Stage 7 or the next stage after architecture
14- User wants to select technologies and frameworks
15- User wants to establish coding and testing standards
16- User needs to define security standards
17
18## Prerequisites
19
20This skill requires **06-architecture** to be completed for L3+ projects. For L2 projects, this stage can proceed without architecture documentation.
21
22## Your Roles in This Skill
23
24- **Tech Manager (Architect)**: Lead tech stack selection and standards definition. Review architecture to choose appropriate technologies. Define coding and testing standards. Ensure technical choices align with requirements and constraints.
25- **Security Engineer**: Define security posture, authentication approach, and secure coding standards. Identify security threats and mitigation strategies. Establish security testing and compliance requirements.
26- **UI Designer**: Extract theme standards from approved UX mockup. Document colors, fonts, spacing, and design tokens. Ensure design consistency rules are clear for implementation.
27- **DevOps Engineer**: Review tech stack for deployment and operational feasibility. Provide input on infrastructure compatibility. Consider monitoring and logging requirements.
28
29## Role Communication
30
31As an expert in your assigned roles, you must announce your actions before performing them using the following format:
32
33As a {Role} [and {Role}, ...], I will {action description}
34
35This communication pattern ensures transparency and allows for human-in-the-loop oversight at key decision points.
36## Instructions
37
38Follow these steps in order:
39
40### Step 0: Verify Prerequisites and Gather Context
41
42First read and understand rules: `dev-swarm/docs/research-specs-rules.md` then:
43
441. **Check for Project Scale (L2 vs L3+):**
45 - Check `00-init-ideas/README.md` or classification to determine project scale.
46
472. **Check if `06-architecture/` folder exists:**
48 - **For L3+ projects (Mandatory):**
49 - If NOT found: Inform user they need to create architecture first, then STOP.
50 - If found: Read all files.
51 - **For L2 projects (Optional):**
52 - If found: Read files.
53 - If NOT found: Proceed without it.
54
553. **Check if `05-ux/` folder exists (Mandatory for L3+):**
56 - If NOT found and project is L3+: Warn user.
57 - For L2: Skip if not relevant.
58 - **CSS variables and design tokens**
59 - **Color palette**
60 - **Typography (fonts, sizes)**
61 - **Spacing system**
62 - **Border radius and shadows**
63 - **Component styles**
64
653. **Check if `00-init-ideas/` folder exists (recommended):**
66 - If found: Read all files to understand it
67
684. **Check if `04-prd/` folder exists (recommended):**
69 - If found: Read to understand:
70 - Non-functional requirements (performance, security, compliance)
71 - Technical constraints
72
735. **Check if `03-mvp/` folder exists (recommended):**
74 - If found: Read to understand:
75 - MVP scope (prioritize tech choices for MVP)
76 - Timeline constraints
77
786. **Check if this stage should be skipped:**
79 - Check if `07-tech-specs/SKIP.md` exists
80 - **If SKIP.md exists:**
81 - Read SKIP.md to understand why this stage was skipped
82 - Inform the user: "Stage 7 (tech-specs) is marked as SKIP because [reason from SKIP.md]"
83 - Ask the user: "Would you like to proceed to the next stage (devops)?"
84 - **If user says yes:**
85 - Exit this skill and inform them to run the next stage skill
86 - **If user says no:**
87 - Ask if they want to proceed with tech specs anyway
88 - If yes, delete SKIP.md and continue with this skill
89 - If no, exit the skill
90
917. **Check if `07-tech-specs/` folder exists:**
92 - If exists: Read all existing files to understand current tech specs state
93 - If NOT exists: Will create new structure
94
958. **If README.md exists:** Check whether it requires diagrams. If it does,
96 follow `dev-swarm/docs/mermaid-diagram-guide.md` and use the
97 `dev-swarm-mermaid` skill to render outputs.
98
999. **Read source code structure guidance (mandatory):**
100 - Read `dev-swarm/docs/source-code-structure.md`
101 - Use it as the baseline when creating `07-tech-specs/source-code-structure.md`
102
10310. Proceed to Step 1 with gathered context
104
105### Step 1: Refine Design Requirements in README and Get Approval
106
107**CRITICAL: Create/update README.md first based on previous stage results, get user approval, then create other docs.**
108
1091. **Analyze information from previous stages:**
110 - Read `06-architecture/` to understand system components and deployment
111 - Read `05-ux/mockups/styles.css` to extract theme (CRITICAL for theme-standards.md)
112 - Read `04-prd/` to understand non-functional requirements
113 - Read `03-mvp/` (if exists) to understand what to prioritize
114 - Consider cost-budget constraints for this stage
115
1162. **Create or update 07-tech-specs/README.md with refined requirements:**
117 - **For L2 projects:** Create a simple README (just several lines) indicating the project level and that only `tech-stack.md` is required.
118 - **For L3+ projects:** List deliverables explicitly in README (typical: tech-stack.md, security.md, theme-standards.md, coding-standards.md, source-code-structure.md, testing-standards.md, security-standards.md)
119 - **Stage overview and objectives** (based on previous stage context)
120 - **Owners:** Tech Manager (lead), Security Engineer, UI Designer, DevOps Engineer
121 - **Diagrams (if required by project init):**
122 - Reference `dev-swarm/docs/mermaid-diagram-guide.md`
123 - Include `diagram/` deliverables when needed
124 - **What tech specs will include:**
125 - Technology stack selection with rationale
126 - Security posture and authentication approach
127 - Theme standards extracted from UX mockup (CRITICAL)
128 - Coding standards and best practices
129 - Testing standards and coverage requirements
130 - Security standards for secure coding
131 - **Methodology:**
132 - How tech stack will be selected (based on architecture + requirements)
133 - How theme will be extracted from mockup CSS (DO NOT invent values)
134 - **Deliverables planned:**
135 - List of files that will be created (tech-stack.md, theme-standards.md, etc.)
136 - **Budget allocation for this stage** (from cost-budget.md)
137 - **Status:** In Progress (update to "Completed" after implementation)
138
1393. **Present README to user:**
140 - Show the tech specs approach and what will be defined
141 - Show what documentation files will be created
142 - Explain how it aligns with previous stages
143 - Ask: "Does this tech specs plan look good? Should I proceed with defining technology stack and standards?"
144
1454. **Wait for user approval:**
146 - **If user says yes:** Proceed to Step 2
147 - **If user says no:**
148 - Ask what needs to be changed
149 - Update README based on feedback
150 - Ask for approval again
151
152### Step 2: Create/Update Tech Specs Structure
153
154**Only after user approves the README:**
155
1561. **Create files as specified in the approved README.md:**
157
158 **IMPORTANT:** The file structure below is a SAMPLE only. The actual files you create must follow what was approved in the README.md in Step 1.
159
160 **Typical structure (example):**
161 ```
162 07-tech-specs/
163 ├── README.md (already created and approved in Step 1)
164 ├── tech-stack.md (if specified in README)
165 ├── security.md (if specified in README)
166 ├── theme-standards.md (if specified in README - MUST extract from UX mockup)
167 ├── coding-standards.md (if specified in README)
168 ├── source-code-structure.md (if specified in README)
169 ├── testing-standards.md (if specified in README)
170 └── security-standards.md (if specified in README)
171 ```
172
173 **Create only the files listed in the README's "Deliverables planned" section.**
174
175### Step 3: Create/Update Technical Specifications Documentation
176
177**IMPORTANT: Only create tech specs documentation after README is approved in Step 1.**
178
179**NOTE:** The content structure below provides GUIDELINES for typical tech specs documentation. Adapt based on the approved README and project needs.
180
181**07-tech-specs/README.md:**
182- Stage overview and objectives
183- Specify the owners: Tech Manager (lead), Security Engineer, UI Designer, DevOps Engineer
184- Summary of technical approach and key decisions
185- Links to all tech specs documentation files
186- Rationale for major technical decisions
187
188**tech-stack.md:**
189
190Define the complete technology stack:
191
1921. **Technology Selection Criteria:**
193 - Must support requirements from PRD
194 - Must work with chosen architecture
195 - Team familiarity and expertise
196 - Community support and ecosystem
197 - Performance and scalability
198 - Cost considerations
199 - Long-term maintainability
200
2012. **Frontend Stack:**
202 - Define framework/library choice and rationale
203 - Specify language (JavaScript/TypeScript) and why
204 - Select UI component library approach
205 - Choose state management solution
206 - Define styling approach
207 - Specify build tool and package manager
208 - For mobile: Define framework and navigation approach
209 - For desktop: Define framework if applicable
210
2113. **Backend Stack:**
212 - Select language and version with rationale
213 - Choose framework and explain why
214 - Define API style (REST/GraphQL/gRPC/etc.)
215 - Specify background job processing approach
216 - Define scheduler if needed
217
2184. **Database & Data Storage:**
219 - Select primary database type and version with rationale
220 - Choose caching solution
221 - Define object storage approach
222 - Specify search solution if applicable
223
2245. **Infrastructure & Deployment:**
225 - Select cloud provider with rationale
226 - Choose compute service approach
227 - Define container orchestration if applicable
228 - Specify CDN service
229
2306. **DevOps & Tools:**
231 - Define version control platform and branching strategy
232 - Choose CI/CD platform with rationale
233 - Select application monitoring solution
234 - Choose error tracking service
235 - Define logging approach
236 - Select infrastructure as code tool
237
2387. **External Services & APIs:**
239 - Choose authentication service approach
240 - Select email delivery service
241 - Define payment processing if applicable
242 - Choose analytics service
243 - Select SMS service if applicable
244
245**security.md:**
246
247Define the security posture and approach:
248
2491. **Security Principles:**
250 - Security by design
251 - Defense in depth
252 - Principle of least privilege
253 - Zero trust architecture
254 - Fail securely
255
2562. **Authentication Approach:**
257 - **Method**: [JWT / Session-based / OAuth 2.0 / SAML / etc.]
258 - **Token Storage**: [httpOnly cookies / localStorage / sessionStorage]
259 - **Token Expiration**: [Access token: 15 minutes, Refresh token: 7 days, etc.]
260 - **Multi-Factor Authentication (MFA)**: [Required / Optional / Not implemented]
261 - **Password Policy**:
262 - Minimum length: [8-12 characters]
263 - Complexity requirements
264 - Password hashing: [bcrypt / Argon2 / PBKDF2]
265 - Rounds/iterations: [Specify]
266
2673. **Authorization Model:**
268 - **Approach**: [RBAC (Role-Based) / ABAC (Attribute-Based) / ACL / etc.]
269 - **Roles**: [List of roles: Admin, User, Moderator, etc.]
270 - **Permissions**: [How permissions are defined and checked]
271
2724. **Secrets Management:**
273 - **Approach**: [AWS Secrets Manager / HashiCorp Vault / Environment Variables / etc.]
274 - **API Keys**: [How stored and rotated]
275 - **Database Credentials**: [How stored and accessed]
276 - **Encryption Keys**: [How managed]
277
2785. **Data Security:**
279 - **Encryption at Rest**: [AES-256 / etc.]
280 - **Encryption in Transit**: [TLS 1.3 / etc.]
281 - **PII Handling**: [How personally identifiable information is protected]
282 - **Data Retention**: [How long data is kept]
283 - **Data Deletion**: [Hard delete vs soft delete approach]
284
2856. **Threat Mitigation:**
286
287 **OWASP Top 10 Protections:**
288 - [ ] **Injection**: Parameterized queries, input validation
289 - [ ] **Broken Authentication**: Secure session management, MFA
290 - [ ] **Sensitive Data Exposure**: Encryption, secure storage
291 - [ ] **XML External Entities (XXE)**: Disable XML external entities
292 - [ ] **Broken Access Control**: Authorization checks on every request
293 - [ ] **Security Misconfiguration**: Secure defaults, minimal attack surface
294 - [ ] **Cross-Site Scripting (XSS)**: Input sanitization, Content Security Policy
295 - [ ] **Insecure Deserialization**: Validate serialized data
296 - [ ] **Using Components with Known Vulnerabilities**: Dependency scanning
297 - [ ] **Insufficient Logging & Monitoring**: Comprehensive logging, alerts
298
299 **Additional Protections:**
300 - **CSRF Protection**: CSRF tokens on state-changing requests
301 - **Rate Limiting**: Prevent brute force and DDoS
302 - **SQL Injection**: ORM usage, parameterized queries
303 - **Clickjacking**: X-Frame-Options header
304 - **CORS**: Proper CORS configuration
305
3067. **Compliance Requirements:**
307 - **GDPR** (if applicable): Data privacy, right to deletion, consent
308 - **CCPA** (if applicable): California privacy rights
309 - **HIPAA** (if healthcare): Healthcare data protection
310 - **PCI-DSS** (if payment): Payment card data security
311 - **SOC 2** (if enterprise): Security, availability, confidentiality
312
313**theme-standards.md (CRITICAL - Based on Approved UX Mockup):**
314
315**IMPORTANT**: This file MUST be extracted from the approved UX mockup in `05-ux/mockups/styles.css`. Do NOT invent theme values - extract them from the actual mockup.
316
317Extract and document the UI theme from the UX mockup:
318
3191. **Theme Extraction from Mockup:**
320
321 **Step 1**: Read `05-ux/mockups/styles.css` file
322 **Step 2**: Extract all CSS variables defined in `:root`
323 **Step 3**: Document them here with exact values from mockup
324
3252. **Color Palette:**
326 - Extract all color variables from mockup CSS (primary, secondary, accent, neutral, semantic colors)
327 - Document use cases for each color
328 - Ensure color contrast requirements (WCAG AA minimum)
329 - Define dark mode variations if applicable
330
3313. **Typography:**
332 - Extract font families and their use cases
333 - Document font sizes scale (xs through 3xl)
334 - Define font weights (regular, medium, semibold, bold)
335 - Specify line heights for different content types
336 - Define typography hierarchy and usage rules
337
3384. **Spacing System:**
339 - Extract spacing scale variables from mockup
340 - Define spacing usage rules for components, margins, and gaps
341 - Specify default spacing for common UI patterns
342
3435. **Border Radius:**
344 - Extract border radius values from mockup
345 - Define usage rules for different component types
346
3476. **Shadows:**
348 - Extract shadow values from mockup
349 - Define shadow usage for elevation and states
350
3517. **Transitions:**
352 - Extract transition timing values from mockup
353 - Define transition usage for interactions and animations
354
3558. **Component-Specific Styles:**
356 - Extract button styles (variants, sizes, states)
357 - Extract form styles (inputs, focus, error, success states)
358 - Extract card styles (background, padding, shadow, border)
359 - Document other component-specific styles as needed
360
3619. **Responsive Breakpoints:**
362 - Extract breakpoints from mockup media queries
363 - Define responsive behavior rules for fonts, spacing, and layouts
364
36510. **Design Tokens for Implementation:**
366 - Provide design tokens in format suitable for the chosen tech stack
367 - Ensure tokens match extracted CSS variable values
368 - Include all theme values (colors, fonts, spacing, etc.)
369
370**CRITICAL RULES for theme-standards.md:**
371- ❌ **DO NOT** invent or guess theme values
372- ✅ **DO** extract exact values from `05-ux/mockups/styles.css`
373- ✅ **DO** preserve the exact CSS variable names
374- ✅ **DO** include usage rules and accessibility notes
375- ✅ **DO** provide code examples for implementation
376
377**coding-standards.md:**
378
379Define code style rules and conventions:
380
3811. **General Principles:**
382 - Write clean, readable code
383 - Follow DRY (Don't Repeat Yourself)
384 - KISS (Keep It Simple, Stupid)
385 - SOLID principles (for OOP languages)
386 - Functional programming principles (where applicable)
387
3882. **Naming Conventions:**
389
390 **Variables:**
391 - camelCase for JavaScript/TypeScript: `userName`, `isActive`
392 - snake_case for Python: `user_name`, `is_active`
393 - PascalCase for classes/components: `UserProfile`, `LoginForm`
394
395 **Functions/Methods:**
396 - Verb-first naming: `getUserData()`, `validateEmail()`, `handleSubmit()`
397 - Boolean functions: `isValid()`, `hasPermission()`, `canEdit()`
398
399 **Constants:**
400 - UPPER_SNAKE_CASE: `MAX_RETRIES`, `API_BASE_URL`
401
402 **Files:**
403 - Component files: PascalCase (`LoginForm.tsx`, `UserProfile.jsx`)
404 - Utility files: camelCase (`formatDate.js`, `validateInput.ts`)
405 - Keep filenames descriptive and consistent
406
4073. **Code Organization:**
408 - Define frontend folder structure (components, pages, hooks, utils, services, store, styles, types, constants)
409 - Define backend folder structure (controllers, models, services, routes, middleware, utils, config, validators)
410 - Ensure clear separation of concerns
411
4124. **Code Style:**
413
414 **Indentation:**
415 - Use 2 spaces for JavaScript/TypeScript/HTML/CSS
416 - Use 4 spaces for Python
417 - No tabs
418
419 **Line Length:**
420 - Maximum 80-100 characters per line
421 - Break long lines at logical points
422
423 **Comments:**
424 - Use comments to explain WHY, not WHAT
425 - Write JSDoc/TSDoc for functions
426 - Keep comments up-to-date
427
428 **Formatting:**
429 - Use Prettier for auto-formatting (JavaScript/TypeScript)
430 - Use Black for Python formatting
431 - Configure IDE to format on save
432
4335. **Best Practices:**
434
435 **Error Handling:**
436 - Always handle errors, never ignore them
437 - Use try-catch for async operations
438 - Provide meaningful error messages
439 - Log errors with context
440
441 **Async Code:**
442 - Use async/await over promises.then()
443 - Handle promise rejections
444 - Avoid callback hell
445
446 **Security:**
447 - Never commit secrets or credentials
448 - Validate all user input
449 - Sanitize data before rendering
450 - Use prepared statements for SQL
451
452 **Performance:**
453 - Avoid unnecessary re-renders (React)
454 - Use proper indexing (Database)
455 - Cache when appropriate
456 - Lazy load when possible
457
4586. **Version Control:**
459
460 **Commit Messages:**
461 - Format: `<type>: <description>`
462 - Types: feat, fix, docs, style, refactor, test, chore
463 - Examples:
464 - `feat: add user authentication`
465 - `fix: resolve login redirect bug`
466 - `docs: update API documentation`
467
468 **Branch Naming:**
469 - feature/[feature-name]
470 - bugfix/[bug-description]
471 - hotfix/[issue-number]
472
473**source-code-structure.md**
474
475Define the organization and structure of source code under the `src/` folder based on the project's needs. Follow `dev-swarm/docs/source-code-structure.md` as the baseline:
476
4771. **Overview:**
478 - Explain the chosen code organization approach
479 - Purpose: Enable AI developers to navigate and locate code efficiently
480 - Maintain clear separation of concerns
481 - Support scalability and maintainability
482
4832. **Choose Organization Strategy:**
484
485 Select and document the code organization strategy that best fits the project. Use the options listed in `dev-swarm/docs/source-code-structure.md` for the sample structures.
486
4873. **File Naming Conventions:**
488 - Define file naming conventions (e.g., kebab-case, snake_case, PascalCase)
489 - Test file conventions (e.g., `.test.*`, `.spec.*`, `test_*`)
490 - Type definition conventions (e.g., `.types.*`, `types.*`)
491
4924. **Code Organization Principles:**
493 - **Single Responsibility**: One file, one primary purpose
494 - **Clear Entry Points**: Well-defined public APIs
495 - **Co-located Tests**: Tests live near the code they test
496 - **Shared Code**: Define when code should be shared vs duplicated
497
4985. **Documentation Requirements:**
499 - Document where each type of code belongs
500 - Provide examples for common scenarios
501 - Explain the rationale for the chosen structure
502 - Define guidelines for adding new code
503
504**testing-standards.md:**
505
506Define testing requirements and standards:
507
5081. **Testing Principles:**
509 - Write tests before or alongside code (TDD encouraged)
510 - Test behavior, not implementation
511 - Keep tests simple and readable
512 - One assertion per test (when possible)
513 - Tests should be independent and isolated
514
5152. **Testing Pyramid:**
516 ```
517 /\
518 /E2E\ <- Few (10%)
519 /------\
520 /Integration\ <- Some (30%)
521 /------------\
522 / Unit Tests \ <- Many (60%)
523 ```
524
5253. **Required Test Coverage:**
526 - **Minimum Coverage**: 80% overall
527 - **Critical Code**: 100% coverage (authentication, payment, data validation)
528 - **Nice-to-have Code**: 60-70% coverage (UI components, utilities)
529
5304. **Unit Testing:**
531
532 **What to Test:**
533 - All business logic functions
534 - Data transformations and calculations
535 - Validation functions
536 - Utility functions
537 - Component logic (React hooks, etc.)
538
539 **Testing Framework:**
540 - JavaScript/TypeScript: Jest, Vitest
541 - Python: pytest, unittest
542 - Go: testing package
543
544 **Naming Convention:**
545 - Test file: `fileName.test.js` or `fileName.spec.js`
546 - Test description: `describe('functionName', () => { it('should do something', () => {}) })`
547 - Follow testing framework conventions for structure
548
5495. **Integration Testing:**
550
551 **What to Test:**
552 - API endpoints (request/response)
553 - Database operations
554 - External service integrations
555 - Authentication flows
556
557 **Testing Tools:**
558 - API Testing: Supertest, Postman/Newman
559 - Database: In-memory DB or test DB
560 - Mocking: Mock external services
561
5626. **End-to-End (E2E) Testing:**
563
564 **What to Test:**
565 - Critical user flows (from UX design)
566 - User registration and login
567 - Core feature workflows
568 - Payment flows (if applicable)
569
570 **Testing Framework:**
571 - Playwright (recommended)
572 - Cypress
573 - Selenium
574
575 **E2E Test Approach:**
576 - Write tests that simulate real user interactions
577 - Test complete workflows from start to finish
578 - Verify expected outcomes and navigation
579
5807. **Test Execution:**
581
582 **Local Development:**
583 - Run tests before committing: `npm test`
584 - Run tests in watch mode: `npm test --watch`
585
586 **CI/CD Pipeline:**
587 - Run all tests on pull requests
588 - Block merge if tests fail
589 - Run tests before deployment
590
591 **Test Commands:**
592 - `npm test` - Run all tests
593 - `npm test:unit` - Run unit tests only
594 - `npm test:integration` - Run integration tests
595 - `npm test:e2e` - Run E2E tests
596 - `npm test:coverage` - Generate coverage report
597
5988. **Minimum Test Gates:**
599
600 **Before Merging to Main:**
601 - [ ] All tests pass
602 - [ ] Code coverage >= 80%
603 - [ ] No critical bugs
604 - [ ] E2E tests pass for critical flows
605
606 **Before Deployment:**
607 - [ ] All tests pass in production-like environment
608 - [ ] E2E tests pass on staging
609 - [ ] Performance tests pass (if applicable)
610 - [ ] Security tests pass
611
612**security-standards.md:**
613
614Define secure coding rules and practices:
615
6161. **Secure Coding Principles:**
617 - Validate all input, trust no one
618 - Fail securely (default deny)
619 - Defense in depth
620 - Principle of least privilege
621 - Keep security simple
622 - Don't rely on security through obscurity
623
6242. **Input Validation:**
625 - Validate on server-side (never trust client)
626 - Use allowlists, not denylists
627 - Sanitize all user input
628 - Validate data types, lengths, formats
629 - Reject invalid input, don't try to fix it
630
6313. **Output Encoding:**
632 - Encode output based on context (HTML, URL, JavaScript)
633 - Use framework-provided encoding functions
634 - Prevent XSS by encoding user data
635
6364. **Authentication & Authorization:**
637 - Never store passwords in plain text
638 - Use bcrypt/Argon2 for password hashing
639 - Implement rate limiting on auth endpoints
640 - Require re-authentication for sensitive operations
641 - Check authorization on EVERY request
642
6435. **Sensitive Data Handling:**
644 - Never log sensitive data (passwords, tokens, SSNs, credit cards)
645 - Encrypt sensitive data at rest
646 - Use HTTPS for all data in transit
647 - Redact sensitive data in logs and errors
648
6496. **Secret Management:**
650 - Never commit secrets to version control
651 - Use environment variables or secret management services
652 - Rotate secrets regularly
653 - Use different secrets for dev/staging/production
654
6557. **Dependency Security:**
656 - Regularly scan dependencies for vulnerabilities
657 - Keep dependencies up-to-date
658 - Use `npm audit` or `pip-audit` in CI/CD
659 - Remove unused dependencies
660
6618. **SQL Injection Prevention:**
662 - Use parameterized queries (prepared statements)
663 - Use ORM frameworks properly
664 - Never concatenate SQL strings with user input
665 - Validate input before queries
666
6679. **Logging & Monitoring:**
668 - Log all authentication events (success and failure)
669 - Log all authorization failures
670 - Log all data access to sensitive resources
671 - Set up alerts for suspicious activity
672 - **Redaction Rules**:
673 - Redact passwords, tokens, API keys
674 - Redact credit card numbers, SSNs
675 - Redact PII in production logs
676
67710. **Security Checklist for Code Review:**
678 - [ ] All user input is validated
679 - [ ] SQL uses parameterized queries
680 - [ ] No secrets in code
681 - [ ] Sensitive data is not logged
682 - [ ] Authorization is checked
683 - [ ] HTTPS is enforced
684 - [ ] CSRF protection is enabled
685 - [ ] XSS prevention is in place
686 - [ ] Error messages don't leak information
687
688### Step 4: Ensure Alignment
689
690Make sure tech specs align with:
691- Architecture from 06-architecture/
692- Non-functional requirements from 04-prd/non-functional-requirements.md
693- **UX mockup theme** from 05-ux/mockups/styles.css (CRITICAL for theme-standards.md)
694- MVP scope from 03-mvp/ (prioritize tech choices for MVP)
695
696Verify that:
697- Tech stack can implement the architecture
698- Theme standards match the UX mockup exactly
699- Security standards address requirements
700- Testing standards ensure quality
701- Coding standards are clear and enforceable
702
703### Step 5: Final User Review
704
7051. **Inform user that tech specs are complete**
7062. **Update README.md:**
707 - Change **Status** from "In Progress" to "Completed"
708 - Add a **Summary** section with key insights (2-3 paragraphs)
709 - Add a **Created Files** section listing all created files
710
7113. **Present completed work to user:**
712 - Review chosen tech stack and rationale
713 - Show theme standards extracted from UX mockup
714 - Explain security approach
715 - Walk through coding and testing standards
716
7174. **Highlight key insights:**
718 - Frontend framework choice and why
719 - Backend framework choice and why
720 - Database choice and why
721 - **Theme values extracted from mockup** (show side-by-side)
722 - Security compliance level
723 - Test coverage requirements
724
7255. **Ask questions:**
726 - Comfortable with tech stack choices?
727 - Theme standards match their vision?
728 - Any security concerns?
729 - Testing requirements achievable?
730 - Ready to proceed to next stage (DevOps)?
731
7326. Make adjustments based on user feedback if needed
733
734### Step 6: Commit to Git (if user confirms)
735
7361. **If user confirms tech specs are complete:**
737 - Ask if they want to commit to git
7382. **If user wants to commit:**
739 - Stage all changes in `07-tech-specs/`
740 - Commit with message: "Define tech stack and engineering standards (Stage 7)"
741
742## Expected Project Structure
743
744### For L3+ Projects (Full Scale)
745```
746project-root/
747├── 00-init-ideas/
748│ └── [existing files]
749├── 01-market-research/ (optional)
750│ └── [existing files if present]
751├── 02-personas/
752│ └── [existing files]
753├── 03-mvp/
754│ └── [existing files]
755├── 04-prd/
756│ └── [existing files]
757├── 05-ux/
758│ └── [existing files including mockups/]
759├── 06-architecture/
760│ └── [existing files]
761└── 07-tech-specs/
762 ├── README.md (with owners and summary)
763 ├── tech-stack.md (languages, frameworks, tools)
764 ├── security.md (auth, secrets, threats)
765 ├── theme-standards.md (EXTRACTED FROM UX MOCKUP)
766 ├── coding-standards.md (style, naming, organization)
767 ├── source-code-structure.md (src/ organization)
768 ├── testing-standards.md (coverage, frameworks, gates)
769 └── security-standards.md (secure coding, logging redaction)
770```
771
772### For L2 Projects (Tools)
773```
774project-root/
775├── 00-init-ideas/
776│ └── [existing files]
777└── 07-tech-specs/
778 ├── README.md (minimal requirements)
779 └── tech-stack.md (language and package selection)
780```
781
782## Key Tech Specs Principles
783
7841. **Justify Choices**: Explain WHY each technology was chosen
7852. **Extract Theme from Mockup**: Never invent theme values, extract from approved UX
7863. **Standards Over Preferences**: Define standards that everyone follows
7874. **Security First**: Build security into standards, not bolt on later
7885. **Testable**: Make standards measurable and enforceable
7896. **Practical**: Standards should be realistic and achievable
7907. **Documented**: Clear documentation prevents confusion
791
792## Theme Standards Best Practices (CRITICAL)
793
7941. **Always Extract from Mockup**: Read `05-ux/mockups/` first
7952. **Preserve Variable Names**: Keep CSS variable names from mockup
7963. **Document Usage**: Explain when and how to use each value
7974. **Accessibility Check**: Ensure color contrast meets WCAG standards
7985. **Provide Examples**: Show code examples for implementation
7996. **Design Tokens**: Convert CSS variables to JS/TS tokens for frameworks
8007. **Keep In Sync**: If mockup changes, update theme standards immediately
801
802## Deliverables
803
804By the end of this stage, you should have:
805- Complete tech stack definition with rationale for each choice
806- Security posture and authentication approach defined
807- **Theme standards extracted from approved UX mockup** (colors, fonts, spacing)
808- Coding standards for style, naming, and organization
809- **Source code structure for feature-driven development** (src/ organization)
810- Testing standards with coverage requirements and frameworks
811- Security standards for secure coding and logging
812- Foundation for DevOps setup (next stage)
813- Clear implementation guidelines for developers