Your First Spec with AI
Learn how LeanSpec helps you go from intent to implementation in minutes, not hours. You'll build a real feature—dark theme support—with AI doing the heavy lifting.
Time: 10 minutes
Outcome: Working feature with a completed spec
- Completed Getting Started guide
- AI coding tool (GitHub Copilot, Claude, etc.)
Try It Now
Get hands-on with a pre-configured example project:
npx lean-spec init --example dark-theme
cd dark-theme
npm install
npm start
Then prompt your AI tool:
- GitHub Copilot CLI
- Claude Code
- Gemini CLI
- IDE
In your terminal with GitHub Copilot CLI:
# Make sure you have GitHub Copilot CLI installed
npm install -g @github/copilot
# Send the prompt to Copilot CLI
copilot -p "Help me add dark theme support with theme switcher" \
--allow-all-tools \
--add-dir .
In your terminal with Claude Code:
# Make sure you have Claude Code installed
curl -fsSL https://claude.ai/install.sh | bash
# Create soft link to CLAUDE.md from the system prompt AGENTS.md
ln -s AGENTS.md CLAUDE.md
# Send the prompt to Claude Code
claude "Help me add dark theme support with theme switcher" \
--add-dir .
In your terminal with Gemini CLI:
# Make sure you have Gemini CLI installed
npm install -g @google/gemini-cli
# Create soft link to GEMINI.md from the system prompt AGENTS.md
ln -s AGENTS.md GEMINI.md
# Send the prompt to Gemini CLI
gemini -p "Help me add dark theme support with theme switcher" -y
In your IDE with an AI coding assistant (GitHub Copilot, Claude, Cursor, etc.):
- Open the project in your IDE
- Open your AI assistant chat panel
- Send the prompt: "Help me add dark theme support with theme switcher"
Want to understand what happens under the hood? The sections below walk through each step in detail.
The Scenario
You're building a task manager web app. Users love it, but keep requesting dark mode for late-night work sessions. Currently, the app only has a bright light theme.
Starting point:
your-project/
├── src/
│ ├── public/
│ │ ├── index.html # Task manager UI
│ │ ├── style.css # Current light theme
│ │ └── app.js # Task logic
│ └── server.js # Express server
└── specs/ # Your specs folder
Creating the Spec
In your AI tool, describe what you want:
Create a new spec for adding dark theme support to this task manager.
The theme should:
- Automatically detect system preference
- Include a manual theme switcher button
- Use accessible color contrast
- Smooth transition between themes
- Preserve the current design aesthetic
Keep it simple and user-friendly.
The AI reads your project structure and creates a spec in specs/015-dark-theme-support/. Here's what it generates:
---
status: planned
created: '2025-11-24'
priority: high
---
# Dark Theme Support
> **Status**: 📅 Planned · **Priority**: High
## Overview
Add dark theme that automatically switches based on user's system preferences.
Currently only light theme available, causing eye strain in low-light.
## Design
- Use CSS `prefers-color-scheme` media query for auto-detection
- Add manual theme switcher button in UI
- Define dark theme color palette (accessible contrast)
- Smooth transitions between themes
- Test with both light/dark system preferences
## Plan
- [ ] Define dark theme color variables
- [ ] Add media query for dark theme
- [ ] Create theme switcher button component
- [ ] Update all color references to use variables
- [ ] Test color contrast for accessibility
## Test
- [ ] Theme switches automatically with system preference
- [ ] All colors meet WCAG AA contrast standards
- [ ] Smooth transitions without flashing
- [ ] Works in Chrome, Firefox, Safari
What just happened? The AI:
- Understood your intent
- Analyzed your existing CSS structure
- Created a focused spec with implementation plan
- Set status to
planned(ready to build)
Implementation
Now ask the AI to implement it:
Implement spec 015.
The AI will:
- Read the spec requirements
- Add CSS color variables for both themes
- Implement the
prefers-color-schememedia query - Update all hardcoded colors to use variables
- Test the implementation
You'll see updates like:
✓ Updated style.css: Added CSS variables for theming
✓ Updated style.css: Added dark theme media query
✓ Updated style.css: Converted colors to variables
✓ Verified: Color contrast meets WCAG AA standards
Review and Complete
Test the feature locally:
npm start
# Open http://localhost:3000
# Toggle your system theme (macOS: System Settings > Appearance)
The app should smoothly switch between light and dark themes!
Everything works? Tell your AI:
Mark spec 015 as complete.
Or run manually:
lean-spec update 015 --status complete
The spec now shows:
---
status: complete
completed_at: '2025-11-24T16:45:00.000Z'
---
What Just Happened
You experienced spec-driven development with AI:
Without LeanSpec:
- Dive into CSS, miss edge cases
- Forget accessibility requirements
- No record of color choices or rationale
- Hard for others to understand decisions
With LeanSpec:
- Clear requirements captured upfront
- AI implements with full context
- Design decisions documented
- Accessibility checklist tracked
- Complete audit trail
The spec becomes your shared memory between you, the AI, and your team. Everyone knows what was built and why.
Next Steps
Try it yourself with these enhancements:
- Save user preference in localStorage
- Add more theme variants (high contrast, etc.)
- Extract theme colors to config file
- Add theme preview before switching
Or pick a different feature from your backlog and follow the same workflow.
Learn more:
- Managing Multiple Features → - Handle 2-3 related specs
- AI Coding Workflow - Best practices
- Spec Structure - Organizing specs
Need help? Check FAQ or file an issue.