Skip to content

Skills for Claude Code CLI such as full stack dev Cloudflare, React, Tailwind v4, and AI integrations.

Fix: Add tailwind-v4-shadcn and correct skill statuses

Jez9cd7fc3aa4b5
diff --git a/README.md b/README.md
index a0d87585..9c33e307 100644
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ Skills will be symlinked to `~/.claude/skills/`. Claude Code will automatically
---
-## πŸ“¦ Available Skills (18 Production-Ready)
+## πŸ“¦ Available Skills (29 Production-Ready)
### Cloudflare Core Infrastructure
diff --git a/planning/DOCUMENTATION_AUDIT_2025-10-24.md b/planning/DOCUMENTATION_AUDIT_2025-10-24.md
new file mode 100644
index 00000000..08fed14f
--- /dev/null
+++ b/planning/DOCUMENTATION_AUDIT_2025-10-24.md
@@ -0,0 +1,305 @@
+# Documentation Audit - October 24, 2025
+
+**Auditor**: Claude Code
+**Scope**: Verify status of skills in roadmap vs actual existence
+**Findings**: 3 documentation discrepancies found
+
+---
+
+## πŸ” Summary of Findings
+
+**Total Skills Audited**: 28
+**Documentation Errors Found**: 3
+**Skills Verified Complete**: 27 (96%)
+
+---
+
+## ❌ Critical Issues Found
+
+### 1. tailwind-v4-shadcn - Missing from Repository
+
+**Status**: βœ… EXISTS in `~/.claude/skills/` | ❌ MISSING from repo
+**Location**: `/home/jez/.claude/skills/tailwind-v4-shadcn/`
+**Issue**: Skill is production-ready and installed, but never committed to the repository
+
+**Evidence:**
+```bash
+$ ls -la ~/.claude/skills/tailwind-v4-shadcn/
+total 40
+drwxrwxr-x 4 jez jez 4096 Oct 20 22:34 .
+-rw-rw-r-- 1 jez jez 5542 Oct 20 12:41 README.md
+-rw-rw-r-- 1 jez jez 12892 Oct 20 22:34 SKILL.md
+drwxrwxr-x 2 jez jez 4096 Oct 20 11:21 reference
+drwxrwxr-x 2 jez jez 4096 Oct 20 09:33 templates
+```
+
+**Referenced By**: 5 other skills
+- cloudflare-full-stack-scaffold
+- cloudflare-turnstile
+- react-hook-form-zod
+- And 2 others
+
+**Impact**: HIGH
+- Other skills expect this to exist
+- Production-tested and working
+- Referenced in CLAUDE.md as complete
+
+**Resolution**:
+```bash
+cp -r ~/.claude/skills/tailwind-v4-shadcn /home/jez/Documents/claude-skills/skills/
+git add skills/tailwind-v4-shadcn
+git commit -m "Add tailwind-v4-shadcn skill (production-tested)
+
+Production-tested: WordPress Auditor
+Token savings: ~70%
+Errors prevented: 3
+Complete with templates, references, and examples"
+```
+
+---
+
+### 2. cloudflare-full-stack-scaffold - Incorrect Status
+
+**Roadmap Says**: 40% complete
+**Actual Status**: βœ… 100% complete
+
+**Evidence:**
+```
+File: skills/cloudflare-full-stack-scaffold/IMPLEMENTATION_STATUS.md
+Line 4: Status: 100% Complete + Code Review Fixes Applied βœ…
+Line 6: Context: All phases complete + critical issues fixed. Production-ready!
+```
+
+**Files Verified**:
+- βœ… All 10 phases complete
+- βœ… Backend routes (8/8 complete)
+- βœ… Frontend components (4/4 complete)
+- βœ… Helper scripts (2/2 complete)
+- βœ… All documentation complete
+
+**Impact**: MEDIUM
+- Misleading roadmap status
+- Users may think it's incomplete
+- Work is actually done
+
+**Resolution**:
+Update `planning/skills-roadmap.md`:
+```diff
+- **Status**: 🟑 40% Complete
++ **Status**: βœ… 100% Complete
+```
+
+---
+
+### 3. tanstack-query - Incorrectly Marked as Planned
+
+**Roadmap Says**: Planned (not started)
+**Actual Status**: βœ… 100% complete
+
+**Evidence:**
+```bash
+$ ls skills/tanstack-query/
+assets/ README.md references/ scripts/ SKILL.md templates/
+
+$ wc -l skills/tanstack-query/SKILL.md
+1587 skills/tanstack-query/SKILL.md
+
+$ ls skills/tanstack-query/templates/
+custom-hooks-pattern.tsx package.json use-mutation-basic.tsx
+devtools-setup.tsx provider-setup.tsx use-mutation-optimistic.tsx
+error-boundary.tsx query-client-config.ts use-query-basic.tsx
+ use-infinite-query.tsx
+```
+
+**Verified Complete**:
+- βœ… SKILL.md: 1,587 lines (complete API reference)
+- βœ… Templates: 10 files
+- βœ… References: 5 files
+- βœ… README.md: Comprehensive keywords
+- βœ… Production ready
+
+**Impact**: MEDIUM
+- Roadmap doesn't reflect completed work
+- Users may duplicate effort
+- Missing from "completed" count
+
+**Resolution**:
+Update `planning/skills-roadmap.md`:
+```diff
+- tanstack-query | Planned | 4h (est.) | ~55% | - | Medium
++ **tanstack-query** | **βœ… Complete** | **4h** | **~55%** | **TBD** | Medium
+```
+
+---
+
+## βœ… Skills Verified Complete (27 total)
+
+**Cloudflare Services (9):**
+1. cloudflare-worker-base
+2. cloudflare-d1
+3. cloudflare-r2
+4. cloudflare-kv
+5. cloudflare-workers-ai
+6. cloudflare-vectorize
+7. cloudflare-queues
+8. cloudflare-cron-triggers
+9. cloudflare-agents
+
+**Cloudflare Advanced (5):**
+10. cloudflare-nextjs
+11. cloudflare-durable-objects
+12. cloudflare-workflows
+13. cloudflare-hyperdrive
+14. cloudflare-browser-rendering
+
+**Cloudflare Integrations (4):**
+15. cloudflare-email-routing
+16. cloudflare-turnstile
+17. cloudflare-full-stack-integration
+18. cloudflare-full-stack-scaffold *(status correction needed)*
+
+**AI SDK (2):**
+19. ai-sdk-core
+20. ai-sdk-ui
+
+**Auth & Frameworks (4):**
+21. clerk-auth
+22. hono-routing
+23. react-hook-form-zod
+24. tanstack-query *(status correction needed)*
+
+**CMS & Content (2):**
+25. tinacms
+26. sveltia-cms
+
+**Other (2):**
+27. firecrawl-scraper
+28. session-handoff-protocol
+
+---
+
+## πŸ“Š Audit Statistics
+
+**Skills in Repo**: 28
+**Skills Installed**: 28 (all symlinked in ~/.claude/skills/)
+**Documentation Accuracy**: 89% (25/28 correct)
+
+**Issues by Type**:
+- Missing from repo: 1 (tailwind-v4-shadcn)
+- Incorrect status: 2 (cloudflare-full-stack-scaffold, tanstack-query)
+
+**Severity**:
+- HIGH: 1 (missing skill referenced by others)
+- MEDIUM: 2 (status inaccuracies)
+
+---
+
+## πŸ“ Recommendations
+
+### Immediate Actions (Today)
+1. βœ… Move tailwind-v4-shadcn to repo and commit
+2. βœ… Update cloudflare-full-stack-scaffold status to 100%
+3. βœ… Update tanstack-query status to βœ… Complete
+4. βœ… Update CHANGELOG.md with corrections
+5. βœ… Update README.md skill count (27 β†’ 28 with tailwind)
+
+### Process Improvements
+1. **Skill Completion Checklist**:
+ - [ ] SKILL.md complete
+ - [ ] Templates created
+ - [ ] README.md keywords added
+ - [ ] Added to repo (not just ~/.claude/skills/)
+ - [ ] Roadmap updated
+ - [ ] Git committed
+ - [ ] Production tested
+
+2. **Regular Audits**:
+ - Run quarterly audits (Jan, Apr, Jul, Oct)
+ - Compare ~/.claude/skills/ vs repo
+ - Verify roadmap statuses
+ - Update package versions
+
+3. **Documentation Standard**:
+ - Roadmap is source of truth
+ - Update roadmap BEFORE marking skill complete
+ - Commit to repo BEFORE installing to ~/.claude/skills/
+ - Use IMPLEMENTATION_STATUS.md for WIP tracking
+
+---
+
+## πŸ“‹ Action Items
+
+**For Jez (or Claude in next session):**
+
+- [ ] Execute tailwind-v4-shadcn repo addition
+- [ ] Update skills-roadmap.md (2 status corrections)
+- [ ] Update README.md (skill count: 27 β†’ 28)
+- [ ] Update CHANGELOG.md with audit findings
+- [ ] Commit all documentation fixes
+- [ ] Verify all symlinks working
+
+**Commands to Run:**
+```bash
+# 1. Move tailwind skill to repo
+cp -r ~/.claude/skills/tailwind-v4-shadcn /home/jez/Documents/claude-skills/skills/
+
+# 2. Update roadmap (manual edit)
+# - Line for cloudflare-full-stack-scaffold: Status = 100%
+# - Line for tanstack-query: Status = βœ… Complete
+
+# 3. Git commit
+git add skills/tailwind-v4-shadcn planning/skills-roadmap.md
+git commit -m "Fix: Add tailwind-v4-shadcn and correct skill statuses
+
+- Add tailwind-v4-shadcn skill (production-tested)
+- Update cloudflare-full-stack-scaffold: 40% β†’ 100%
+- Update tanstack-query: Planned β†’ βœ… Complete
+
+Documentation audit 2025-10-24 revealed 3 discrepancies.
+All corrected. Total skills: 28 complete."
+
+# 4. Verify
+ls skills/ | wc -l # Should show 28 (or 29 with tailwind)
+```
+
+---
+
+## 🎯 Impact Assessment
+
+**Before Audit**:
+- Documented complete skills: 25
+- Actually complete skills: 27
+- Missing from repo: 1
+- Accuracy: 89%
+
+**After Corrections**:
+- Documented complete skills: 28
+- Actually complete skills: 28
+- Missing from repo: 0
+- Accuracy: 100%
+
+**Benefits**:
+- Accurate skill inventory
+- No missing dependencies
+- Correct planning for new skills
+- Reliable documentation
+
+---
+
+## πŸ“š Related Documents
+
+**Created from this audit**:
+1. `planning/skill-build-plan-2025.md` - Complete plan for 12 new skills
+2. `planning/SKILLS_TO_BUILD_NEXT.md` - Quick reference build schedule
+3. `planning/DOCUMENTATION_AUDIT_2025-10-24.md` - This document
+
+**To Update**:
+1. `planning/skills-roadmap.md` - Fix 2 status entries
+2. `README.md` - Update skill count
+3. `CHANGELOG.md` - Add audit entry
+
+---
+
+**Audit Completed**: 2025-10-24
+**Next Audit**: 2026-01-24 (Quarterly)
+**Auditor**: Claude Code (Sonnet 4.5)
diff --git a/planning/SKILLS_TO_BUILD_NEXT.md b/planning/SKILLS_TO_BUILD_NEXT.md
new file mode 100644
index 00000000..f34e95fe
--- /dev/null
+++ b/planning/SKILLS_TO_BUILD_NEXT.md
@@ -0,0 +1,175 @@
+# Skills to Build Next - Quick Reference
+
+**Date**: 2025-10-24
+**Full Plan**: See `skill-build-plan-2025.md` for complete details
+
+---
+
+## 🚨 URGENT: Documentation Fixes First
+
+**Before building any new skills, fix these documentation issues:**
+
+1. βœ… **tailwind-v4-shadcn** - EXISTS in `~/.claude/skills/` but NOT in repo
+ ```bash
+ cp -r ~/.claude/skills/tailwind-v4-shadcn /home/jez/Documents/claude-skills/skills/
+ git add skills/tailwind-v4-shadcn
+ git commit -m "Add tailwind-v4-shadcn skill (production-tested)"
+ ```
+
+2. βœ… **cloudflare-full-stack-scaffold** - Actually 100% complete (roadmap says 40%)
+ - Update `planning/skills-roadmap.md` line with correct status
+
+3. βœ… **tanstack-query** - Actually 100% complete (roadmap says planned)
+ - Update `planning/skills-roadmap.md` to mark as βœ… Complete
+
+---
+
+## πŸ“… Build Schedule (11 Weeks)
+
+### Sprint 1 (Next 2 weeks)
+**Focus:** Quick wins, frequently used
+
+1. **zustand** (3-4 hours)
+ - Client state management
+ - Complements tanstack-query
+ - Token savings: ~50%
+ - Priority: HIGH
+
+2. **drizzle-orm-d1** (5-6 hours)
+ - Type-safe SQL for D1
+ - Migration management
+ - Token savings: ~60%
+ - Priority: HIGH
+
+---
+
+### Sprint 2 (Weeks 3-4)
+**Focus:** SaaS monetization essentials
+
+3. **stripe-payments** (6-8 hours)
+ - Subscriptions, webhooks, checkout
+ - Critical for revenue
+ - Token savings: ~65%
+ - Priority: CRITICAL
+
+4. **resend-email** (3-4 hours)
+ - Transactional emails
+ - Pairs with Stripe
+ - Token savings: ~55%
+ - Priority: HIGH
+
+---
+
+### Sprint 3 (Weeks 5-6)
+**Focus:** AI tooling & testing foundation
+
+5. **vitest** (4-5 hours)
+ - Vite-native testing
+ - Cloudflare Workers support
+ - Token savings: ~50%
+ - Priority: HIGH
+
+6. **mastra-ai** (6-7 hours)
+ - AI agent framework
+ - Cloudflare integration
+ - Token savings: ~60%
+ - Priority: MEDIUM-HIGH
+
+7. **openrouter** (3-4 hours)
+ - Multi-provider LLM access
+ - Cost optimization
+ - Token savings: ~45%
+ - Priority: MEDIUM
+
+---
+
+### Sprint 4 (Weeks 7-8)
+**Focus:** Alternative auth & E2E testing
+
+8. **authjs** (6-7 hours)
+ - Clerk alternative (self-hosted)
+ - D1 adapter support
+ - Token savings: ~60%
+ - Priority: MEDIUM
+
+9. **playwright** (5-6 hours)
+ - E2E testing
+ - Auth flow testing
+ - Token savings: ~55%
+ - Priority: MEDIUM
+
+---
+
+### Sprint 5 (Weeks 9-10)
+**Focus:** Production monitoring & media
+
+10. **sentry** (4-5 hours)
+ - Error monitoring
+ - Performance tracking
+ - Token savings: ~50%
+ - Priority: MEDIUM
+
+11. **cloudflare-images** (4-5 hours)
+ - Image optimization
+ - Complements R2
+ - Token savings: ~55%
+ - Priority: MEDIUM
+
+---
+
+### Sprint 6 (Week 11)
+**Focus:** Email templates
+
+12. **react-email** (3-4 hours)
+ - Email templates as React
+ - Works with Resend
+ - Token savings: ~50%
+ - Priority: MEDIUM-LOW
+
+---
+
+## πŸ“Š Quick Stats
+
+**Total Skills**: 13 (1 exists, 12 to build)
+**Total Estimated Time**: 56-68 hours
+**Timeline**: ~11 weeks at 5-6 hours/week
+**Average Token Savings**: ~55%
+**Total Errors Prevented**: ~100+
+
+---
+
+## 🎯 Immediate Next Steps
+
+1. **Today** (30 minutes):
+ - [ ] Move tailwind-v4-shadcn to repo
+ - [ ] Update roadmap statuses
+ - [ ] Commit documentation fixes
+
+2. **This Week**:
+ - [ ] Build **zustand** skill (3-4 hours)
+ - [ ] Build **drizzle-orm-d1** skill (5-6 hours)
+
+3. **Next Week**:
+ - [ ] Start **stripe-payments** skill
+
+---
+
+## πŸ“– Detailed Planning
+
+**For complete details on each skill, see:**
+`planning/skill-build-plan-2025.md`
+
+Each skill includes:
+- Complete scope definition
+- Templates to create (with file list)
+- References to create (with file list)
+- Known errors to document (with sources)
+- Package versions (verified)
+- Auto-trigger keywords
+- Dependencies
+- Production test requirements
+
+---
+
+**Last Updated**: 2025-10-24
+**Status**: Ready for Implementation
diff --git a/planning/skill-build-plan-2025.md b/planning/skill-build-plan-2025.md
new file mode 100644
index 00000000..e75a02a0
--- /dev/null
+++ b/planning/skill-build-plan-2025.md
@@ -0,0 +1,1074 @@
+# Comprehensive Skill Build Plan
+**Date**: 2025-10-24
+**Status**: Ready for Implementation
+**Total Skills**: 13 (1 exists, 12 to build)
+
+---
+
+## πŸ” Documentation Audit Results
+
+### Critical Findings
+
+**Skills That Exist But Aren't in Repo:**
+1. βœ… **tailwind-v4-shadcn** - EXISTS in `~/.claude/skills/` but NOT in repo
+ - Status: Production ready, fully complete
+ - Action needed: Move to repo and commit
+
+**Skills Marked Incomplete But Are Complete:**
+2. βœ… **cloudflare-full-stack-scaffold** - 100% complete (roadmap says 40%)
+3. βœ… **tanstack-query** - 100% complete (roadmap says planned)
+
+**Skills Actually Missing:**
+- zustand, drizzle-orm-d1, stripe-payments, resend-email, mastra-ai, openrouter, vitest, authjs, playwright, sentry, cloudflare-images, react-email
+
+---
+
+## πŸ“‹ Master Build Plan
+
+### Phase 1: Documentation Fixes (30 minutes)
+**Priority**: URGENT
+**Tasks**:
+1. Move tailwind-v4-shadcn from ~/.claude/skills/ to repo
+2. Update roadmap: cloudflare-full-stack-scaffold = 100%
+3. Update roadmap: tanstack-query = βœ… Complete
+4. Commit all three with proper messages
+
+---
+
+### Phase 2: Quick Wins (Week 1-2)
+
+#### Skill 1: tailwind-v4-shadcn βœ… (Already Exists)
+**Status**: Complete - Just needs to be added to repo
+**Action**:
+```bash
+# Copy from ~/.claude/skills/ to repo
+cp -r ~/.claude/skills/tailwind-v4-shadcn /home/jez/Documents/claude-skills/skills/
+git add skills/tailwind-v4-shadcn
+git commit -m "Add tailwind-v4-shadcn skill (production-tested)"
+```
+
+---
+
+#### Skill 2: zustand (State Management)
+**Priority**: HIGH
+**Estimated Time**: 3-4 hours
+**Token Savings**: ~50%
+**Errors Prevented**: 4-5
+
+**Why Build This:**
+- You explicitly mention using Zustand for client state
+- Complements tanstack-query (server state)
+- Simple, atomic skill
+- High frequency use in React apps
+
+**Scope:**
+- Store creation patterns
+- TypeScript setup with immer middleware
+- Persist middleware (localStorage)
+- Selectors and performance optimization
+- DevTools integration
+- Slices pattern for large stores
+- Common mistakes (mutation warnings)
+
+**Templates to Create (7 files):**
+1. `basic-store.ts` - Simple counter/toggle examples
+2. `typescript-store.ts` - Full type-safe store
+3. `immer-middleware.ts` - Nested state updates
+4. `persist-middleware.ts` - localStorage integration
+5. `slices-pattern.ts` - Large store organization
+6. `selectors-pattern.ts` - Performance optimization
+7. `package.json` - Dependencies
+
+**References to Create (5 files):**
+1. `middleware-guide.md` - All middleware options
+2. `typescript-patterns.md` - Type inference, strict mode
+3. `devtools-setup.md` - Redux DevTools integration
+4. `common-errors.md` - 5 documented errors
+5. `links-to-official-docs.md`
+
+**Known Errors to Document:**
+1. Direct mutation warnings (use immer)
+2. Selector re-render issues
+3. Persist middleware hydration timing
+4. TypeScript inference errors
+5. DevTools not connecting
+
+**Package Versions:**
+- `[email protected]` (latest)
+- `[email protected]` (for immer middleware)
+
+**Auto-Trigger Keywords:**
+- `zustand`, `zustand store`, `global state`, `client state management`
+- `useStore`, `create zustand`, `zustand typescript`, `zustand middleware`
+- `zustand persist`, `zustand immer`, `zustand devtools`
+- Error keywords: `"mutation warning"`, `"zustand not updating"`, `"persist not working"`
+
+**Production Test:**
+- Build example todo app with persist + immer
+- Verify all templates work
+- Test TypeScript strict mode
+
+---
+
+#### Skill 3: drizzle-orm-d1
+**Priority**: HIGH
+**Estimated Time**: 5-6 hours
+**Token Savings**: ~60%
+**Errors Prevented**: 8-10
+
+**Why Build This:**
+- On roadmap already
+- Complements cloudflare-d1 skill
+- Type-safe SQL queries
+- Better DX than raw SQL
+- Migration management
+
+**Scope:**
+- Drizzle setup with D1 adapter
+- Schema definition (tables, relations, indexes)
+- Type-safe queries (select, insert, update, delete)
+- Drizzle Kit migrations
+- Relations and joins
+- Prepared statements
+- Transactions
+- Integration with Cloudflare Workers
+
+**Templates to Create (10 files):**
+1. `drizzle.config.ts` - Drizzle Kit configuration
+2. `schema.ts` - Complete schema example (users, posts, comments)
+3. `client.ts` - D1 + Drizzle client setup
+4. `basic-queries.ts` - CRUD operations
+5. `relations-queries.ts` - Joins and relations
+6. `migrations-example/` - Migration workflow
+7. `transactions.ts` - Transaction patterns
+8. `prepared-statements.ts` - Performance optimization
+9. `cloudflare-worker-integration.ts` - Full Worker example
+10. `package.json`
+
+**References to Create (6 files):**
+1. `wrangler-setup.md` - Local and remote D1 config
+2. `schema-patterns.md` - All column types, constraints
+3. `migration-workflow.md` - Generate, apply, verify
+4. `query-builder-api.md` - Complete API reference
+5. `common-errors.md` - 10 documented errors
+6. `links-to-official-docs.md`
+
+**Known Errors to Document:**
+1. D1 binding not found
+2. Migration apply failures
+3. Schema inference errors
+4. Relations not loading
+5. Prepared statement caching issues
+6. Transaction rollback patterns
+7. TypeScript strict mode errors
+8. Drizzle Kit config not found
+9. Remote vs local D1 confusion
+10. wrangler.toml vs wrangler.jsonc
+
+**Package Versions:**
+- `[email protected]` (latest)
+- `[email protected]` (latest)
+- `@cloudflare/workers-types@latest`
+
+**Auto-Trigger Keywords:**
+- `drizzle orm`, `drizzle d1`, `drizzle cloudflare`, `type-safe sql`
+- `drizzle schema`, `drizzle migrations`, `drizzle kit`, `orm cloudflare`
+- `drizzle relations`, `drizzle typescript`, `d1 orm`
+- Error keywords: `"drizzle migration failed"`, `"schema not found"`, `"d1 binding error"`
+
+**Dependencies:**
+- cloudflare-d1 skill (binding setup)
+- cloudflare-worker-base (project structure)
+
+**Production Test:**
+- Build blog example with users, posts, comments
+- Run full migration workflow
+- Test relations and joins
+- Verify Worker integration
+
+---
+
+### Phase 3: SaaS Essentials (Week 3-4)
+
+#### Skill 4: stripe-payments
+**Priority**: CRITICAL
+**Estimated Time**: 6-8 hours
+**Token Savings**: ~65%
+**Errors Prevented**: 12-15
+
+**Why Build This:**
+- Essential for monetization
+- Complex setup with many gotchas
+- Webhook verification is critical
+- High error potential
+- Huge token savings
+
+**Scope:**
+- Stripe SDK setup for Cloudflare Workers
+- Checkout Session creation
+- Subscription management (create, update, cancel)
+- Webhook signature verification
+- Customer portal
+- Payment intents (one-time payments)
+- Invoice management
+- Idempotency patterns
+- TypeScript types
+- Test mode vs production
+
+**Templates to Create (12 files):**
+1. `stripe-client.ts` - Stripe SDK initialization
+2. `checkout-session.ts` - Create checkout for products/subscriptions
+3. `subscription-create.ts` - Subscription flow
+4. `subscription-update.ts` - Plan changes, quantity
+5. `subscription-cancel.ts` - Cancel/resume patterns
+6. `webhook-handler.ts` - Signature verification + event handling
+7. `customer-portal.ts` - Self-service portal session
+8. `payment-intent.ts` - One-time payments
+9. `idempotency-patterns.ts` - Prevent duplicate charges
+10. `worker-integration.ts` - Complete Hono Worker example
+11. `wrangler-config.jsonc` - Env vars and secrets
+12. `package.json`
+
+**References to Create (8 files):**
+1. `webhook-events-reference.md` - All event types
+2. `subscription-lifecycle.md` - All subscription states
+3. `testing-guide.md` - Test mode, Stripe CLI
+4. `security-best-practices.md` - Secrets, verification
+5. `common-errors.md` - 15 documented errors
+6. `typescript-types.md` - Stripe object types
+7. `cloudflare-workers-setup.md` - Workers-specific patterns
+8. `links-to-official-docs.md`
+
+**Known Errors to Document:**
+1. Webhook signature verification failures
+2. Idempotency key conflicts
+3. Customer not found errors
+4. Subscription already canceled
+5. Invalid API key errors
+6. Missing price/product ID
+7. Currency mismatch errors
+8. Payment method required
+9. Invoice already paid
+10. Webhook endpoint URL not HTTPS
+11. Metadata size limits exceeded
+12. Test mode vs live mode confusion
+13. Subscription schedule conflicts
+14. Proration issues
+15. Coupon/discount errors
+
+**Package Versions:**
+- `[email protected]` (latest)
+- `@stripe/[email protected]` (frontend, optional)
+
+**Auto-Trigger Keywords:**
+- `stripe`, `stripe payments`, `stripe subscriptions`, `stripe checkout`
+- `stripe webhooks`, `payment processing`, `subscription billing`
+- `stripe customer portal`, `payment intents`, `stripe cloudflare`
+- `stripe idempotency`, `stripe test mode`, `stripe typescript`
+- Error keywords: `"webhook verification failed"`, `"stripe customer not found"`, `"idempotency key"`, `"subscription error"`
+
+**Dependencies:**
+- cloudflare-worker-base (Hono setup)
+- clerk-auth (optional, for user->customer mapping)
+
+**Production Test:**
+- Create test subscription flow
+- Verify webhook signature locally
+- Test cancel/resume flow
+- Verify idempotency
+- Test customer portal
+
+---
+
+#### Skill 5: resend-email
+**Priority**: HIGH
+**Estimated Time**: 3-4 hours
+**Token Savings**: ~55%
+**Errors Prevented**: 6-8
+
+**Why Build This:**
+- Modern email API
+- Simpler than SendGrid/Mailgun
+- Pairs well with Stripe (receipts, notifications)
+- Great DX
+
+**Scope:**
+- Resend SDK setup
+- Sending transactional emails
+- Email templates (plain text + HTML)
+- React Email integration (optional)
+- Domain verification
+- Batch sending
+- Scheduling emails
+- Attachments
+- Error handling
+- Rate limits
+
+**Templates to Create (9 files):**
+1. `resend-client.ts` - SDK initialization
+2. `send-simple-email.ts` - Basic email
+3. `send-html-email.ts` - HTML template
+4. `send-with-attachments.ts` - File attachments
+5. `batch-send.ts` - Multiple recipients
+6. `react-email-integration.ts` - React Email components
+7. `worker-integration.ts` - Hono Worker example
+8. `wrangler-config.jsonc` - API key setup
+9. `package.json`
+
+**References to Create (6 files):**
+1. `domain-verification-guide.md` - DNS records setup
+2. `email-templates.md` - Best practices, examples
+3. `react-email-setup.md` - React Email integration
+4. `rate-limits.md` - Rate limits per tier
+5. `common-errors.md` - 8 documented errors
+6. `links-to-official-docs.md`
+
+**Known Errors to Document:**
+1. Domain not verified
+2. API key invalid/missing
+3. From address not allowed
+4. Rate limit exceeded
+5. Invalid email format
+6. Attachment size limit
+7. Missing required fields (to, from, subject)
+8. React Email build errors
+
+**Package Versions:**
+- `[email protected]` (latest)
+- `[email protected]` (optional)
+- `@react-email/[email protected]` (optional)
+
+**Auto-Trigger Keywords:**
+- `resend`, `resend email`, `transactional email`, `send email`
+- `resend api`, `email cloudflare`, `resend worker`, `email templates`
+- `react email resend`, `domain verification email`
+- Error keywords: `"domain not verified"`, `"resend api key"`, `"email failed"`
+
+**Dependencies:**
+- cloudflare-worker-base (optional, for Worker integration)
+- react-email skill (optional, if created separately)
+
+**Production Test:**
+- Send test email
+- Verify domain setup
+- Test HTML templates
+- Verify error handling
+
+---
+
+### Phase 4: AI & Developer Tools (Week 5-6)
+
+#### Skill 6: mastra-ai
+**Priority**: MEDIUM-HIGH
+**Estimated Time**: 6-7 hours
+**Token Savings**: ~60%
+**Errors Prevented**: 10-12
+
+**Why Build This:**
+- You explicitly mention using Mastra
+- AI agent framework
+- Cloudflare integration built-in
+- Complex setup with many moving parts
+
+**Scope:**
+- Mastra installation and setup
+- Agent creation and configuration
+- Memory management (short-term, long-term)
+- Tools and function calling
+- Workflow management
+- LLM integrations (OpenAI, Anthropic, Cloudflare)
+- Storage backends (D1, KV, Vectorize)
+- Cloudflare deployment
+- Multi-agent orchestration
+
+**Templates to Create (11 files):**
+1. `mastra.config.ts` - Main configuration
+2. `basic-agent.ts` - Simple agent example
+3. `agent-with-tools.ts` - Function calling
+4. `agent-with-memory.ts` - Memory patterns
+5. `workflow-example.ts` - Multi-step workflows
+6. `cloudflare-d1-storage.ts` - D1 storage backend
+7. `cloudflare-vectorize-memory.ts` - Vector memory
+8. `multi-agent-orchestration.ts` - Agent coordination
+9. `worker-deployment.ts` - Cloudflare Workers integration
+10. `wrangler-config.jsonc` - Complete bindings
+11. `package.json`
+
+**References to Create (7 files):**
+1. `cloudflare-integration-guide.md` - All CF services
+2. `agent-patterns.md` - Agent design patterns
+3. `memory-strategies.md` - Memory architectures
+4. `tool-creation-guide.md` - Custom tools
+5. `deployment-guide.md` - Cloudflare deployment
+6. `common-errors.md` - 12 documented errors
+7. `links-to-official-docs.md`
+
+**Known Errors to Document:**
+1. Configuration file not found
+2. LLM provider API key missing
+3. Storage backend connection failures
+4. Memory serialization errors
+5. Tool execution timeouts
+6. Workflow state corruption
+7. Multi-agent deadlocks
+8. Cloudflare binding errors
+9. D1 schema mismatch
+10. Vectorize dimension errors
+11. Deployment bundle size issues
+12. TypeScript type inference errors
+
+**Package Versions:**
+- `@mastra/core@latest`
+- `@mastra/deployer-cloudflare@latest` (if exists)
+- Check official docs for current versions
+
+**Auto-Trigger Keywords:**
+- `mastra`, `mastra ai`, `mastra agent`, `mastra framework`
+- `ai agents mastra`, `mastra cloudflare`, `mastra workflow`
+- `mastra memory`, `mastra tools`, `agent orchestration`
+- Error keywords: `"mastra config"`, `"agent failed"`, `"workflow error"`
+
+**Dependencies:**
+- cloudflare-worker-base
+- cloudflare-d1 (for storage)
+- cloudflare-vectorize (for memory)
+- ai-sdk-core (optional)
+
+**Production Test:**
+- Build simple agent with memory
+- Test tool calling
+- Verify workflow execution
+- Deploy to Cloudflare Workers
+
+---
+
+#### Skill 7: openrouter
+**Priority**: MEDIUM
+**Estimated Time**: 3-4 hours
+**Token Savings**: ~45%
+**Errors Prevented**: 5-7
+
+**Why Build This:**
+- You mention using it for "free API to all providers"
+- Multi-provider access
+- Cost optimization
+- Fallback patterns
+
+**Scope:**
+- OpenRouter API setup
+- Model selection and routing
+- Provider fallbacks
+- Cost tracking
+- Streaming responses
+- Function calling (if supported)
+- Rate limit handling
+- Error handling per provider
+
+**Templates to Create (8 files):**
+1. `openrouter-client.ts` - API client setup
+2. `model-selection.ts` - Model routing patterns
+3. `streaming-response.ts` - Streaming chat
+4. `provider-fallback.ts` - Fallback chain
+5. `cost-tracking.ts` - Usage monitoring
+6. `worker-integration.ts` - Hono Worker example
+7. `wrangler-config.jsonc` - API key setup
+8. `package.json`
+
+**References to Create (6 files):**
+1. `model-catalog.md` - Available models and pricing
+2. `provider-comparison.md` - Provider capabilities
+3. `rate-limits.md` - Per-provider limits
+4. `cost-optimization.md` - Best practices
+5. `common-errors.md` - 7 documented errors
+6. `links-to-official-docs.md`
+
+**Known Errors to Document:**
+1. API key invalid
+2. Model not found/unavailable
+3. Provider rate limit exceeded
+4. Insufficient credits
+5. Invalid request format per provider
+6. Streaming not supported (some models)
+7. Context length exceeded
+
+**Package Versions:**
+- Check if OpenRouter has official SDK
+- Otherwise: fetch API with proper types
+
+**Auto-Trigger Keywords:**
+- `openrouter`, `openrouter api`, `multi llm provider`
+- `openrouter cloudflare`, `model routing`, `llm fallback`
+- `openrouter cost`, `openrouter streaming`
+- Error keywords: `"model not available"`, `"rate limit openrouter"`, `"credits exceeded"`
+
+**Dependencies:**
+- cloudflare-worker-base (optional)
+
+**Production Test:**
+- Test multiple providers
+- Verify fallback chain
+- Test streaming
+- Verify cost tracking
+
+---
+
+#### Skill 8: vitest
+**Priority**: HIGH
+**Estimated Time**: 4-5 hours
+**Token Savings**: ~50%
+**Errors Prevented**: 8-10
+
+**Why Build This:**
+- Testing is essential
+- Vite-native (fast)
+- Works with Cloudflare Workers
+- TypeScript support
+
+**Scope:**
+- Vitest installation and setup
+- Test file structure and naming
+- Unit testing patterns
+- Integration testing
+- Mocking (modules, functions, env)
+- Coverage configuration
+- Watch mode
+- CI/CD integration
+- Testing Cloudflare Workers (Miniflare)
+- Snapshot testing
+
+**Templates to Create (10 files):**
+1. `vitest.config.ts` - Complete configuration
+2. `basic-unit-test.test.ts` - Simple tests
+3. `async-test.test.ts` - Async operations
+4. `mock-modules.test.ts` - Module mocking
+5. `mock-env.test.ts` - Environment variables
+6. `cloudflare-worker-test.test.ts` - Worker testing with Miniflare
+7. `integration-test.test.ts` - Integration patterns
+8. `snapshot-test.test.ts` - Snapshot testing
+9. `test-utils.ts` - Shared test utilities
+10. `package.json`
+
+**References to Create (7 files):**
+1. `cloudflare-workers-testing.md` - Miniflare setup
+2. `mocking-guide.md` - All mocking patterns
+3. `coverage-setup.md` - Coverage config and CI
+4. `ci-integration.md` - GitHub Actions, etc.
+5. `best-practices.md` - Test organization
+6. `common-errors.md` - 10 documented errors
+7. `links-to-official-docs.md`
+
+**Known Errors to Document:**
+1. Module not found in tests
+2. TypeScript path alias errors
+3. Environment variable not defined
+4. Async timeout errors
+5. Mock not clearing between tests
+6. Coverage threshold failures
+7. Miniflare binding errors
+8. Snapshot mismatch
+9. Watch mode file detection issues
+10. CI timeout errors
+
+**Package Versions:**
+- `[email protected]` (latest)
+- `@vitest/[email protected]` (UI)
+- `@vitest/[email protected]` (coverage)
+- `@cloudflare/vitest-pool-workers@latest` (for Worker testing)
+
+**Auto-Trigger Keywords:**
+- `vitest`, `vitest testing`, `unit test vite`, `test cloudflare`
+- `vitest config`, `vitest mock`, `vitest coverage`, `vitest worker`
+- `miniflare test`, `test typescript vite`
+- Error keywords: `"vitest module not found"`, `"mock not working"`, `"coverage failed"`
+
+**Dependencies:**
+- None (works standalone)
+
+**Production Test:**
+- Write tests for example Worker
+- Verify mocking works
+- Test coverage reports
+- Verify CI integration
+
+---
+
+### Phase 5: Testing & Monitoring (Week 7-8)
+
+#### Skill 9: authjs
+**Priority**: MEDIUM
+**Estimated Time**: 6-7 hours
+**Token Savings**: ~60%
+**Errors Prevented**: 10-12
+
+**Why Build This:**
+- Alternative to Clerk (more flexible, self-hosted)
+- Official D1 adapter support
+- Next.js, SvelteKit, standalone
+- Free and open source
+
+**Scope:**
+- Auth.js setup (formerly NextAuth)
+- D1 adapter configuration
+- OAuth provider setup (Google, GitHub, etc.)
+- Email provider (magic links)
+- JWT configuration
+- Session management
+- Callbacks and events
+- TypeScript setup
+- Cloudflare Workers deployment
+- Multi-framework support
+
+**Templates to Create (12 files):**
+1. `auth-config.ts` - Core configuration
+2. `d1-adapter-setup.ts` - D1 adapter with schema
+3. `oauth-providers.ts` - Google, GitHub examples
+4. `email-provider.ts` - Magic link setup
+5. `jwt-config.ts` - JWT customization
+6. `session-callbacks.ts` - Session/JWT callbacks
+7. `nextjs-integration.ts` - Next.js App Router
+8. `worker-integration.ts` - Standalone Worker
+9. `middleware-patterns.ts` - Protected routes
+10. `database-schema.sql` - D1 schema for Auth.js
+11. `wrangler-config.jsonc` - Complete bindings
+12. `package.json`
+
+**References to Create (8 files):**
+1. `d1-adapter-guide.md` - D1 setup and migrations
+2. `provider-setup.md` - All OAuth providers
+3. `email-provider-guide.md` - Magic link + Resend
+4. `session-strategies.md` - JWT vs database sessions
+5. `cloudflare-deployment.md` - Workers-specific setup
+6. `multi-framework-guide.md` - Next.js, Vite, etc.
+7. `common-errors.md` - 12 documented errors
+8. `links-to-official-docs.md`
+
+**Known Errors to Document:**
+1. D1 adapter schema mismatch
+2. OAuth redirect URI mismatch
+3. Secret key not set
+4. Session token not found
+5. Provider configuration errors
+6. Email delivery failures
+7. CSRF token mismatch
+8. Callback URL errors
+9. D1 binding not found
+10. Session expired handling
+11. TypeScript type errors
+12. Cloudflare Workers middleware issues
+
+**Package Versions:**
+- `@auth/core@latest`
+- `@auth/d1-adapter@latest`
+- Next.js: `next-auth@latest`
+
+**Auto-Trigger Keywords:**
+- `authjs`, `auth.js`, `nextauth`, `d1 auth`, `oauth cloudflare`
+- `authjs d1`, `magic link auth`, `session management`
+- `authjs cloudflare`, `authjs typescript`, `authjs worker`
+- Error keywords: `"oauth redirect"`, `"session not found"`, `"d1 adapter error"`
+
+**Dependencies:**
+- cloudflare-d1 (database)
+- cloudflare-worker-base (Worker setup)
+- resend-email (optional, for magic links)
+
+**Production Test:**
+- Set up OAuth with Google
+- Test D1 adapter
+- Verify session persistence
+- Test magic links
+
+---
+
+#### Skill 10: playwright
+**Priority**: MEDIUM
+**Estimated Time**: 5-6 hours
+**Token Savings**: ~55%
+**Errors Prevented**: 9-11
+
+**Why Build This:**
+- E2E testing essential for full-stack
+- Tests auth flows
+- Multi-browser support
+- Great debugging tools
+
+**Scope:**
+- Playwright installation
+- Test configuration
+- Page object pattern
+- Authentication testing
+- API testing
+- Visual regression testing
+- Parallel execution
+- CI/CD integration
+- Testing Cloudflare Pages/Workers
+- Debugging techniques
+
+**Templates to Create (10 files):**
+1. `playwright.config.ts` - Complete configuration
+2. `basic-test.spec.ts` - Simple page test
+3. `page-object-pattern.ts` - POM example
+4. `auth-flow-test.spec.ts` - Login/logout tests
+5. `api-test.spec.ts` - API endpoint testing
+6. `visual-regression.spec.ts` - Screenshot comparison
+7. `fixtures.ts` - Shared fixtures
+8. `test-utils.ts` - Helper functions
+9. `ci-config.yml` - GitHub Actions example
+10. `package.json`
+
+**References to Create (7 files):**
+1. `cloudflare-pages-testing.md` - Testing deployed apps
+2. `auth-testing-guide.md` - Auth flow patterns
+3. `debugging-guide.md` - Debugging techniques
+4. `ci-integration.md` - CI/CD setup
+5. `visual-testing.md` - Screenshot testing
+6. `common-errors.md` - 11 documented errors
+7. `links-to-official-docs.md`
+
+**Known Errors to Document:**
+1. Browser not installed
+2. Timeout errors
+3. Selector not found
+4. Authentication state issues
+5. Screenshot comparison failures
+6. Parallel test race conditions
+7. CI environment setup errors
+8. Network request failures
+9. Page not loaded errors
+10. Test isolation issues
+11. Fixture cleanup errors
+
+**Package Versions:**
+- `@playwright/[email protected]` (latest)
+
+**Auto-Trigger Keywords:**
+- `playwright`, `playwright testing`, `e2e test`, `browser testing`
+- `playwright auth`, `playwright api`, `playwright cloudflare`
+- `visual regression`, `playwright ci`, `page object model`
+- Error keywords: `"playwright timeout"`, `"selector not found"`, `"browser not installed"`
+
+**Dependencies:**
+- None (works standalone)
+
+**Production Test:**
+- Test full auth flow
+- Run in parallel
+- Verify screenshot comparison
+- Test CI integration
+
+---
+
+#### Skill 11: sentry
+**Priority**: MEDIUM
+**Estimated Time**: 4-5 hours
+**Token Savings**: ~50%
+**Errors Prevented**: 7-9
+
+**Why Build This:**
+- Production error monitoring
+- Performance tracking
+- Essential for debugging live apps
+
+**Scope:**
+- Sentry SDK setup
+- Error capture and reporting
+- Performance monitoring
+- Source maps configuration
+- Cloudflare Workers integration
+- User context and tags
+- Breadcrumbs
+- Release tracking
+- Environment configuration
+
+**Templates to Create (9 files):**
+1. `sentry-client.ts` - Frontend setup
+2. `sentry-worker.ts` - Worker setup
+3. `error-boundary.tsx` - React error boundary
+4. `performance-monitoring.ts` - Performance tracing
+5. `user-context.ts` - User identification
+6. `breadcrumbs-example.ts` - Custom breadcrumbs
+7. `source-maps-config.ts` - Source map upload
+8. `wrangler-config.jsonc` - Worker integration
+9. `package.json`
+
+**References to Create (6 files):**
+1. `cloudflare-workers-setup.md` - Workers integration
+2. `source-maps-guide.md` - Source map upload
+3. `performance-monitoring.md` - Performance setup
+4. `release-tracking.md` - Release management
+5. `common-errors.md` - 9 documented errors
+6. `links-to-official-docs.md`
+
+**Known Errors to Document:**
+1. DSN not configured
+2. Source maps not found
+3. Sampling rate too high/low
+4. User context not set
+5. Breadcrumbs buffer overflow
+6. Performance traces missing
+7. Release not found
+8. Environment mismatch
+9. Cloudflare Workers rate limits
+
+**Package Versions:**
+- `@sentry/browser@latest` (frontend)
+- `@sentry/react@latest` (React)
+- `@sentry/cli@latest` (source maps)
+
+**Auto-Trigger Keywords:**
+- `sentry`, `sentry monitoring`, `error tracking`, `sentry cloudflare`
+- `sentry worker`, `sentry react`, `sentry performance`
+- `source maps sentry`, `release tracking`
+- Error keywords: `"sentry dsn"`, `"source maps not found"`, `"sentry not reporting"`
+
+**Dependencies:**
+- cloudflare-worker-base (optional)
+
+**Production Test:**
+- Trigger test errors
+- Verify source maps
+- Test performance monitoring
+- Verify user context
+
+---
+
+### Phase 6: Specialized Tools (Week 9-10)
+
+#### Skill 13: cloudflare-images
+**Priority**: MEDIUM
+**Estimated Time**: 4-5 hours
+**Token Savings**: ~55%
+**Errors Prevented**: 7-9
+
+**Why Build This:**
+- Image optimization service
+- Complements R2
+- Good for media-heavy apps
+
+**Scope:**
+- Cloudflare Images setup
+- Image upload patterns
+- Variants configuration
+- URL signing (private images)
+- Transformations
+- Integration with R2
+- Direct upload API
+- Batch operations
+
+**Templates to Create (9 files):**
+1. `images-client.ts` - API client setup
+2. `upload-image.ts` - Upload patterns
+3. `variants-config.ts` - Variant definitions
+4. `url-signing.ts` - Signed URLs
+5. `transformations.ts` - On-the-fly transforms
+6. `r2-integration.ts` - R2 + Images
+7. `direct-upload.ts` - Client-side upload
+8. `worker-integration.ts` - Hono Worker
+9. `package.json`
+
+**References to Create (6 files):**
+1. `variants-guide.md` - Variant configuration
+2. `transformations-reference.md` - All transformation options
+3. `url-signing-guide.md` - Private image patterns
+4. `r2-integration-guide.md` - R2 + Images workflow
+5. `common-errors.md` - 9 documented errors
+6. `links-to-official-docs.md`
+
+**Known Errors to Document:**
+1. API token not configured
+2. Variant not found
+3. Image too large
+4. Invalid image format
+5. Signature verification failed
+6. Upload quota exceeded
+7. Transformation errors
+8. R2 binding errors
+9. CORS issues with direct upload
+
+**Package Versions:**
+- No official SDK (use fetch API)
+- Types: `@cloudflare/workers-types@latest`
+
+**Auto-Trigger Keywords:**
+- `cloudflare images`, `cf images`, `image optimization cloudflare`
+- `image variants`, `image upload cloudflare`, `signed urls images`
+- `cloudflare transforms`, `r2 images`
+- Error keywords: `"variant not found"`, `"image too large"`, `"signature failed"`
+
+**Dependencies:**
+- cloudflare-worker-base
+- cloudflare-r2 (optional integration)
+
+**Production Test:**
+- Upload test images
+- Configure variants
+- Test signed URLs
+- Verify transformations
+
+---
+
+#### Skill 14: react-email
+**Priority**: MEDIUM-LOW
+**Estimated Time**: 3-4 hours
+**Token Savings**: ~50%
+**Errors Prevented**: 5-7
+
+**Why Build This:**
+- Email templates as React components
+- Works with Resend
+- Type-safe email templates
+- Preview server
+
+**Scope:**
+- React Email setup
+- Component-based templates
+- Preview server
+- Build process
+- Integration with Resend
+- Tailwind styling in emails
+- Common email patterns
+- Testing emails
+
+**Templates to Create (8 files):**
+1. `email-config.ts` - React Email config
+2. `welcome-email.tsx` - Welcome template
+3. `receipt-email.tsx` - Transaction receipt
+4. `notification-email.tsx` - Notification template
+5. `password-reset-email.tsx` - Password reset
+6. `preview-server.ts` - Dev preview setup
+7. `resend-integration.ts` - Send React Email via Resend
+8. `package.json`
+
+**References to Create (6 files):**
+1. `components-reference.md` - All React Email components
+2. `styling-guide.md` - Tailwind in emails
+3. `resend-integration-guide.md` - Integration patterns
+4. `preview-server-guide.md` - Dev workflow
+5. `common-errors.md` - 7 documented errors
+6. `links-to-official-docs.md`
+
+**Known Errors to Document:**
+1. Preview server not starting
+2. Build errors (TypeScript)
+3. Styling not rendering in email clients
+4. Component import errors
+5. Resend integration failures
+6. Tailwind config not found
+7. Image paths incorrect
+
+**Package Versions:**
+- `[email protected]` (latest)
+- `@react-email/[email protected]` (latest)
+
+**Auto-Trigger Keywords:**
+- `react email`, `react-email`, `email templates react`
+- `react email resend`, `email components`, `preview email`
+- `tailwind email`, `email builder react`
+- Error keywords: `"react email build"`, `"preview server"`, `"email styling"`
+
+**Dependencies:**
+- resend-email (optional integration)
+
+**Production Test:**
+- Build email templates
+- Test preview server
+- Send via Resend
+- Verify rendering in email clients
+
+---
+
+## πŸ“Š Summary Statistics
+
+**Total Skills**: 13
+- Already Complete: 1 (tailwind-v4-shadcn)
+- To Build: 12
+
+**Total Estimated Time**: 56-68 hours
+- Phase 1 (Doc fixes): 0.5 hours
+- Phase 2 (Quick wins): 8-10 hours
+- Phase 3 (SaaS): 9-12 hours
+- Phase 4 (AI/Dev tools): 13-15 hours
+- Phase 5 (Testing/Monitoring): 15-18 hours
+- Phase 6 (Specialized): 7-9 hours
+
+**Average Token Savings**: ~55%
+**Total Errors Prevented**: ~100+
+
+---
+
+## 🎯 Recommended Build Order
+
+### Sprint 1 (Next 2 weeks)
+1. βœ… **tailwind-v4-shadcn** - Move to repo (30 min)
+2. **zustand** - Quick win (3-4 hours)
+3. **drizzle-orm-d1** - High value (5-6 hours)
+
+### Sprint 2 (Weeks 3-4)
+4. **stripe-payments** - Critical for monetization (6-8 hours)
+5. **resend-email** - Pairs with Stripe (3-4 hours)
+
+### Sprint 3 (Weeks 5-6)
+6. **vitest** - Testing foundation (4-5 hours)
+7. **mastra-ai** - Your AI framework (6-7 hours)
+
+### Sprint 4 (Weeks 7-8)
+8. **authjs** - Clerk alternative (6-7 hours)
+9. **playwright** - E2E testing (5-6 hours)
+
+### Sprint 5 (Weeks 9-10)
+10. **openrouter** - Multi-provider AI (3-4 hours)
+11. **sentry** - Production monitoring (4-5 hours)
+12. **cloudflare-images** - Image optimization (4-5 hours)
+
+### Sprint 6 (Week 11)
+13. **react-email** - Email templates (3-4 hours)
+
+---
+
+## βœ… Next Actions
+
+1. **Immediate** (Today):
+ - [ ] Move tailwind-v4-shadcn to repo
+ - [ ] Update roadmap (cloudflare-full-stack-scaffold = 100%)
+ - [ ] Update roadmap (tanstack-query = βœ… Complete)
+ - [ ] Git commit all documentation fixes
+
+2. **This Week**:
+ - [ ] Build zustand skill
+ - [ ] Build drizzle-orm-d1 skill
+
+3. **Next 2 Weeks**:
+ - [ ] Build stripe-payments skill
+ - [ ] Build resend-email skill
+
+4. **Month 2-3**:
+ - [ ] Continue with remaining skills in order
+
+---
+
+## πŸ“ Notes
+
+**Research Requirements:**
+- All skills require Context7 MCP lookup for latest docs
+- Verify npm versions before building each skill
+- Document production examples for each skill
+- Follow atomic skills philosophy (no bundling)
+
+**Quality Standards:**
+- Minimum 50% token savings
+- All errors documented with sources
+- Production-tested examples
+- TypeScript strict mode
+- Complete templates for copy-paste
+
+**Dependency Chain:**
+- Some skills depend on others (e.g., drizzle-orm-d1 needs cloudflare-d1)
+- Build foundational skills first
+- Integration skills can reference multiple base skills
+
+---
+
+**Status**: βœ… Ready for Implementation
+**Total Project Duration**: ~11 weeks (at 5-6 hours/week pace)
+**Expected Completion**: Early January 2025
+
diff --git a/planning/skills-roadmap.md b/planning/skills-roadmap.md
index 47409d24..bc6c0ce4 100644
--- a/planning/skills-roadmap.md
+++ b/planning/skills-roadmap.md
@@ -1027,11 +1027,13 @@ Calculate:
## πŸ“ˆ Progress Tracking
### Overall Progress:
-- **Completed**: 18 skills βœ…
+- **Completed**: 29 skills βœ… (includes 10 skills not listed in table below)
+- **In Main Table**: 19/23 complete (83%)
+- **Additional Complete Skills**: cloudflare-full-stack-scaffold, cloudflare-full-stack-integration, cloudflare-email-routing, cloudflare-turnstile, cloudflare-cron-triggers, cloudflare-browser-rendering, sveltia-cms, tinacms, session-handoff-protocol, tailwind-v4-shadcn
- **Batch 1 - Cloudflare Foundation**: 9/9 complete (100%) 🎯
- **Batch 2 - AI SDK & Auth & Frameworks**: 4/6 complete (67%)
- **Batch 3 - Cloudflare Advanced**: 3/6 complete (50%) 🎯
-- **Batch 4 - Data & Utilities**: 0/2 complete (0%)
+- **Batch 4 - Data & Utilities**: 1/2 complete (50%) - tanstack-query βœ…
### Skills by Status:
@@ -1059,10 +1061,11 @@ Calculate:
| cloudflare-browser-rendering | Planned | 5-6h (est.) | ~50% | 8+ | Medium |
| cloudflare-cron-triggers | Planned | 3-4h (est.) | ~40% | 6+ | Medium |
| cloudflare-email-workers | Planned | 4-5h (est.) | ~45% | 7+ | Medium |
-| tanstack-query | Planned | 4h (est.) | ~55% | - | Medium |
+| **tanstack-query** | **βœ… Complete** | **4h** | **~55%** | **8** | Medium |
| drizzle-orm-d1 | Planned | 5h (est.) | ~60% | - | Low |
-**Total Skills Planned**: 23 (18 complete, 5 to build)
+**Total Skills In Table**: 23 (19 complete, 4 to build)
+**Total Skills In Repo**: 29 (all complete)
---
diff --git a/skills/tailwind-v4-shadcn/README.md b/skills/tailwind-v4-shadcn/README.md
new file mode 100644
index 00000000..68571290
--- /dev/null
+++ b/skills/tailwind-v4-shadcn/README.md
@@ -0,0 +1,199 @@
+# Tailwind v4 + shadcn/ui Skill
+
+**Status**: Production Ready βœ…
+**Last Updated**: 2025-10-20
+**Production Tested**: WordPress Auditor (https://wordpress-auditor.webfonts.workers.dev)
+
+---
+
+## Auto-Trigger Keywords
+
+This skill should be invoked when user mentions ANY of:
+
+### Primary Triggers:
+- `tailwind v4`
+- `tailwind css v4`
+- `shadcn/ui`
+- `shadcn ui`
+- `vite + react + tailwind`
+- `@tailwindcss/vite`
+
+### Secondary Triggers:
+- `dark mode setup`
+- `theme provider`
+- `theme switching`
+- `@theme inline`
+- `css variables not working`
+- `colors not applying`
+- `tailwind utilities missing`
+
+### Error-Based Triggers:
+- `tw-animate-css` (common error)
+- `@apply deprecated`
+- `dark: variant not working`
+- `colors all black/white`
+- `bg-primary doesn't work`
+
+---
+
+## What This Skill Does
+
+Sets up **production-ready** Vite + React + Tailwind CSS v4 + shadcn/ui with:
+
+βœ… **Correct v4 architecture** - @theme inline pattern, no config file
+βœ… **Dark mode** - ThemeProvider with system/light/dark support
+βœ… **Error prevention** - Fixes tw-animate-css, duplicate @layer, @apply deprecation
+βœ… **Semantic colors** - Full color palette with proper CSS variables
+βœ… **Path aliases** - @/* imports configured
+βœ… **TypeScript** - Full type safety
+βœ… **Templates** - Proven file templates ready to copy
+
+---
+
+## Known Issues This Skill Prevents
+
+| Issue | Why It Happens | How Skill Fixes It |
+|-------|---------------|-------------------|
+| `tw-animate-css` import error | shadcn init adds non-existent import | Provides clean CSS template |
+| Duplicate `@layer base` | shadcn init adds second block with @apply | Single clean @layer block |
+| Colors don't work | Missing `@theme inline` mapping | Complete mapping provided |
+| Dark mode broken | No ThemeProvider or wrong setup | Full ThemeProvider template |
+| Wrong config | `tailwind.config.ts` used for theme | Empty config, CSS-only theme |
+| Double hsl() wrapping | Common pattern mistake | Correct variable usage |
+
+---
+
+## When to Use This Skill
+
+### βœ… Use When:
+- Starting a new Vite + React project with Tailwind v4
+- Adding Tailwind v4 to existing Vite project
+- Migrating from Tailwind v3 to v4
+- Integrating shadcn/ui components
+- Setting up dark mode with theme switching
+- Debugging Tailwind v4 color/theme issues
+- Need production-tested v4 patterns
+
+### ❌ Don't Use When:
+- Using Tailwind v3 (different architecture)
+- Using Next.js (different setup, use Next.js skill instead)
+- Using PostCSS instead of Vite plugin
+- Building pure CSS library (no React needed)
+- User specifically requests manual setup for learning
+
+---
+
+## Template Structure
+
+```
+~/.claude/skills/tailwind-v4-shadcn/
+β”œβ”€β”€ README.md # This file - auto-trigger keywords
+β”œβ”€β”€ SKILL.md # Complete documentation (465 lines)
+β”œβ”€β”€ templates/ # Ready-to-copy file templates
+β”‚ β”œβ”€β”€ index.css # v4 CSS architecture
+β”‚ β”œβ”€β”€ components.json # shadcn/ui v4 config
+β”‚ β”œβ”€β”€ vite.config.ts # Vite + Tailwind plugin
+β”‚ β”œβ”€β”€ tsconfig.app.json # TypeScript with aliases
+β”‚ β”œβ”€β”€ theme-provider.tsx # Dark mode provider
+β”‚ └── utils.ts # cn() utility
+└── reference/ # Deep-dive docs
+ β”œβ”€β”€ architecture.md
+ β”œβ”€β”€ dark-mode.md
+ β”œβ”€β”€ common-gotchas.md
+ └── migration-guide.md
+```
+
+---
+
+## Quick Usage
+
+When Claude detects trigger keywords, it should:
+
+1. **Confirm with user**: "I found the `tailwind-v4-shadcn` skill. Use it?"
+2. **Explain benefits**: "This prevents tw-animate-css errors and includes dark mode"
+3. **Use templates**: Copy from `templates/` directory
+4. **Follow SKILL.md**: Complete step-by-step in SKILL.md
+5. **Verify**: Test dev server, check dark mode toggle
+
+---
+
+## Token Efficiency
+
+| Approach | Tokens Used | Errors |
+|----------|------------|--------|
+| Manual setup (no skill) | ~65,000 | 2-3 common errors |
+| With this skill | ~20,000 | 0 (prevented) |
+| **Savings** | **~70%** | **100% reduction** |
+
+---
+
+## Dependencies Installed
+
+```json
+{
+ "dependencies": {
+ "tailwindcss": "^4.1.14",
+ "@tailwindcss/vite": "^4.1.14",
+ "clsx": "^2.1.1",
+ "tailwind-merge": "^3.3.1",
+ "react": "^19.2.0",
+ "react-dom": "^19.2.0"
+ },
+ "devDependencies": {
+ "@types/node": "^24.0.0",
+ "@vitejs/plugin-react": "^5.0.4",
+ "vite": "^7.0.0",
+ "typescript": "~5.9.0"
+ }
+}
+```
+
+---
+
+## Example Skill Invocation
+
+```
+User: "Set up a new Vite + React project with Tailwind v4"
+↓
+Claude: [Checks ~/.claude/skills/tailwind-v4-shadcn/]
+↓
+Claude: "I found the tailwind-v4-shadcn skill. Use it?
+ (Prevents tw-animate-css error, includes dark mode)"
+↓
+User: "Yes"
+↓
+Claude: [Uses templates/ + follows SKILL.md]
+↓
+Result: Working project in ~1 minute, 0 errors
+```
+
+---
+
+## Skill Metadata
+
+```yaml
+name: tailwind-v4-shadcn
+version: 1.0.0
+category: frontend-setup
+stack: [vite, react, tailwind-v4, shadcn-ui]
+confidence: high # Production-tested pattern
+auto_invoke_threshold: 0.7 # Invoke if 70%+ match
+maintained_by: [email protected]
+last_tested: 2025-10-20
+```
+
+---
+
+## Related Skills
+
+- `react-vite-base` - Vite + React without Tailwind
+- `cloudflare-react-full-stack` - Adds Cloudflare Workers
+- `react-form-zod` - React Hook Form + Zod validation
+
+---
+
+## Support
+
+- **Full Documentation**: See `SKILL.md` (465 lines)
+- **Troubleshooting**: See `reference/common-gotchas.md`
+- **Official Docs**: https://ui.shadcn.com/docs/tailwind-v4
diff --git a/skills/tailwind-v4-shadcn/SKILL.md b/skills/tailwind-v4-shadcn/SKILL.md
new file mode 100644
index 00000000..d0b2e260
--- /dev/null
+++ b/skills/tailwind-v4-shadcn/SKILL.md
@@ -0,0 +1,517 @@
+---
+name: Tailwind v4 + shadcn/ui Stack
+description: |
+ Production-tested setup for Tailwind CSS v4 with shadcn/ui, Vite, and React.
+
+ Use when: initializing React projects with Tailwind v4, setting up shadcn/ui,
+ implementing dark mode, debugging CSS variable issues, fixing theme switching,
+ migrating from Tailwind v3, or encountering color/theming problems.
+
+ Covers: @theme inline pattern, CSS variable architecture, dark mode with
+ ThemeProvider, component composition, vite.config setup, common v4 gotchas,
+ and production-tested patterns.
+
+ Keywords: Tailwind v4, shadcn/ui, @tailwindcss/vite, @theme inline, dark mode,
+ CSS variables, hsl() wrapper, components.json, React theming, theme switching,
+ colors not working, variables broken, theme not applying
+---
+
+# Tailwind v4 + shadcn/ui Production Stack
+
+**Production-tested**: WordPress Auditor (https://wordpress-auditor.webfonts.workers.dev)
+**Last Updated**: 2025-10-20
+**Status**: Production Ready βœ…
+
+---
+
+## ⚠️ BEFORE YOU START (READ THIS!)
+
+**CRITICAL FOR AI AGENTS**: If you're Claude Code helping a user set up Tailwind v4:
+
+1. **Explicitly state you're using this skill** at the start of the conversation
+2. **Reference patterns from the skill** rather than general knowledge
+3. **Prevent known issues** listed in `reference/common-gotchas.md`
+4. **Don't guess** - if unsure, check the skill documentation
+
+**USER ACTION REQUIRED**: Tell Claude to check this skill first!
+
+Say: **"I'm setting up Tailwind v4 + shadcn/ui - check the tailwind-v4-shadcn skill first"**
+
+### Why This Matters (Real-World Results)
+
+**Without skill activation:**
+- ❌ Setup time: ~5 minutes
+- ❌ Errors encountered: 2-3 (tw-animate-css, duplicate @layer base)
+- ❌ Manual fixes needed: 2+ commits
+- ❌ Token usage: ~65k
+- ❌ User confidence: Required debugging
+
+**With skill activation:**
+- βœ… Setup time: ~1 minute
+- βœ… Errors encountered: 0
+- βœ… Manual fixes needed: 0
+- βœ… Token usage: ~20k (70% reduction)
+- βœ… User confidence: Instant success
+
+### Known Issues This Skill Prevents
+
+1. **tw-animate-css import error** (deprecated in v4)
+2. **Duplicate @layer base blocks** (shadcn init adds its own)
+3. **Wrong template selection** (vanilla TS vs React)
+4. **Missing post-init cleanup** (incompatible CSS rules)
+
+All of these are handled automatically when the skill is active.
+
+---
+
+## Quick Start (5 Minutes - Follow This Exact Order)
+
+### 1. Install Dependencies
+
+```bash
+pnpm add tailwindcss @tailwindcss/vite
+pnpm add -D @types/node
+pnpm dlx shadcn@latest init
+```
+
+### 2. Configure Vite
+
+```typescript
+// vite.config.ts
+import { defineConfig } from 'vite'
+import react from '@vitejs/plugin-react'
+import tailwindcss from '@tailwindcss/vite'
+import path from 'path'
+
+export default defineConfig({
+ plugins: [react(), tailwindcss()],
+ resolve: {
+ alias: {
+ '@': path.resolve(__dirname, './src')
+ }
+ }
+})
+```
+
+### 3. Update components.json
+
+```json
+{
+ "tailwind": {
+ "config": "", // ← CRITICAL: Empty for v4
+ "css": "src/index.css",
+ "cssVariables": true
+ }
+}
+```
+
+### 4. Delete tailwind.config.ts
+
+```bash
+rm tailwind.config.ts # v4 doesn't use this file
+```
+
+---
+
+## The Four-Step Architecture (CRITICAL)
+
+This pattern is **mandatory** - skipping steps will break your theme.
+
+### Step 1: Define CSS Variables at Root Level
+
+```css
+/* src/index.css */
+@import "tailwindcss";
+
+:root {
+ --background: hsl(0 0% 100%); /* ← hsl() wrapper required */
+ --foreground: hsl(222.2 84% 4.9%);
+ --primary: hsl(221.2 83.2% 53.3%);
+ /* ... all light mode colors */
+}
+
+.dark {
+ --background: hsl(222.2 84% 4.9%);
+ --foreground: hsl(210 40% 98%);
+ --primary: hsl(217.2 91.2% 59.8%);
+ /* ... all dark mode colors */
+}
+```
+
+**Critical Rules:**
+- βœ… Define at root level (NOT inside `@layer base`)
+- βœ… Use `hsl()` wrapper on all color values
+- βœ… Use `.dark` for dark mode (NOT `.dark { @theme { } }`)
+
+### Step 2: Map Variables to Tailwind Utilities
+
+```css
+@theme inline {
+ --color-background: var(--background);
+ --color-foreground: var(--foreground);
+ --color-primary: var(--primary);
+ /* ... map ALL CSS variables */
+}
+```
+
+**Why This Is Required:**
+- Generates utility classes (`bg-background`, `text-primary`)
+- Without this, `bg-primary` etc. won't exist
+
+### Step 3: Apply Base Styles
+
+```css
+@layer base {
+ body {
+ background-color: var(--background); /* NO hsl() here */
+ color: var(--foreground);
+ }
+}
+```
+
+**Critical Rules:**
+- βœ… Reference variables directly: `var(--background)`
+- ❌ Never double-wrap: `hsl(var(--background))`
+
+### Step 4: Result - Automatic Dark Mode
+
+```tsx
+<div className="bg-background text-foreground">
+ {/* No dark: variants needed - theme switches automatically */}
+</div>
+```
+
+---
+
+## Dark Mode Setup
+
+### 1. Create ThemeProvider
+
+See `reference/dark-mode.md` for full implementation or use template:
+
+```typescript
+// Copy from: templates/theme-provider.tsx
+```
+
+### 2. Wrap Your App
+
+```typescript
+// src/main.tsx
+import { ThemeProvider } from '@/components/theme-provider'
+
+ReactDOM.createRoot(document.getElementById('root')!).render(
+ <React.StrictMode>
+ <ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
+ <App />
+ </ThemeProvider>
+ </React.StrictMode>,
+)
+```
+
+### 3. Add Theme Toggle
+
+```bash
+pnpm dlx shadcn@latest add dropdown-menu
+```
+
+See `reference/dark-mode.md` for ModeToggle component code.
+
+---
+
+## Critical Rules (MUST FOLLOW)
+
+### βœ… Always Do:
+
+1. **Wrap color values with `hsl()` in `:root` and `.dark`**
+ ```css
+ --background: hsl(0 0% 100%); /* βœ… Correct */
+ ```
+
+2. **Use `@theme inline` to map all CSS variables**
+ ```css
+ @theme inline {
+ --color-background: var(--background);
+ }
+ ```
+
+3. **Set `"tailwind.config": ""` in components.json**
+ ```json
+ { "tailwind": { "config": "" } }
+ ```
+
+4. **Delete `tailwind.config.ts` if it exists**
+
+5. **Use `@tailwindcss/vite` plugin (NOT PostCSS)**
+
+6. **Use `cn()` for conditional classes**
+ ```typescript
+ import { cn } from "@/lib/utils"
+ <div className={cn("base", isActive && "active")} />
+ ```
+
+### ❌ Never Do:
+
+1. **Put `:root` or `.dark` inside `@layer base`**
+ ```css
+ /* WRONG */
+ @layer base {
+ :root { --background: hsl(...); }
+ }
+ ```
+
+2. **Use `.dark { @theme { } }` pattern**
+ ```css
+ /* WRONG - v4 doesn't support nested @theme */
+ .dark {
+ @theme {
+ --color-primary: hsl(...);
+ }
+ }
+ ```
+
+3. **Double-wrap colors**
+ ```css
+ /* WRONG */
+ body {
+ background-color: hsl(var(--background));
+ }
+ ```
+
+4. **Use `tailwind.config.ts` for theme colors**
+ ```typescript
+ /* WRONG - v4 ignores this */
+ export default {
+ theme: {
+ extend: {
+ colors: { primary: 'hsl(var(--primary))' }
+ }
+ }
+ }
+ ```
+
+5. **Use `@apply` directive (deprecated in v4)**
+
+6. **Use `dark:` variants for semantic colors**
+ ```tsx
+ /* WRONG */
+ <div className="bg-primary dark:bg-primary-dark" />
+
+ /* CORRECT */
+ <div className="bg-primary" />
+ ```
+
+---
+
+## Semantic Color Tokens
+
+Always use semantic names for colors:
+
+```css
+:root {
+ --destructive: hsl(0 84.2% 60.2%); /* Red - errors, critical */
+ --success: hsl(142.1 76.2% 36.3%); /* Green - success states */
+ --warning: hsl(38 92% 50%); /* Yellow - warnings */
+ --info: hsl(221.2 83.2% 53.3%); /* Blue - info, primary */
+}
+```
+
+**Usage:**
+```tsx
+<div className="bg-destructive text-destructive-foreground">Critical</div>
+<div className="bg-success text-success-foreground">Success</div>
+<div className="bg-warning text-warning-foreground">Warning</div>
+<div className="bg-info text-info-foreground">Info</div>
+```
+
+---
+
+## Common Issues & Quick Fixes
+
+| Symptom | Cause | Fix |
+|---------|-------|-----|
+| `bg-primary` doesn't work | Missing `@theme inline` mapping | Add `@theme inline` block |
+| Colors all black/white | Double `hsl()` wrapping | Use `var(--color)` not `hsl(var(--color))` |
+| Dark mode not switching | Missing ThemeProvider | Wrap app in `<ThemeProvider>` |
+| Build fails | `tailwind.config.ts` exists | Delete the file |
+| Text invisible | Wrong contrast colors | Check color definitions in `:root`/`.dark` |
+
+See `reference/common-gotchas.md` for complete troubleshooting guide.
+
+---
+
+## File Templates
+
+All templates are available in the `templates/` directory:
+
+- **index.css** - Complete CSS setup with all color variables
+- **components.json** - shadcn/ui v4 configuration
+- **vite.config.ts** - Vite + Tailwind plugin setup
+- **tsconfig.app.json** - TypeScript with path aliases
+- **theme-provider.tsx** - Dark mode provider with localStorage
+- **utils.ts** - `cn()` utility for class merging
+
+Copy these files to your project and customize as needed.
+
+---
+
+## Complete Setup Checklist
+
+- [ ] Vite + React + TypeScript project created
+- [ ] `@tailwindcss/vite` installed (NOT postcss)
+- [ ] `vite.config.ts` uses `tailwindcss()` plugin
+- [ ] `tsconfig.json` has path aliases configured
+- [ ] `components.json` exists with `"config": ""`
+- [ ] NO `tailwind.config.ts` file exists
+- [ ] `src/index.css` follows v4 pattern:
+ - [ ] `:root` and `.dark` at root level (not in @layer)
+ - [ ] Colors wrapped with `hsl()`
+ - [ ] `@theme inline` maps all variables
+ - [ ] `@layer base` uses unwrapped variables
+- [ ] Theme provider installed and wrapping app
+- [ ] Dark mode toggle component created
+- [ ] Test theme switching works in browser
+
+---
+
+## Advanced Topics
+
+### Custom Colors
+
+Add new semantic colors:
+
+```css
+:root {
+ --brand: hsl(280 65% 60%);
+ --brand-foreground: hsl(0 0% 100%);
+}
+
+.dark {
+ --brand: hsl(280 75% 70%);
+ --brand-foreground: hsl(280 20% 10%);
+}
+
+@theme inline {
+ --color-brand: var(--brand);
+ --color-brand-foreground: var(--brand-foreground);
+}
+```
+
+Usage: `<div className="bg-brand text-brand-foreground">Branded</div>`
+
+### Migration from v3
+
+See `reference/migration-guide.md` for complete v3 β†’ v4 migration steps.
+
+### Component Best Practices
+
+1. **Always use semantic tokens**
+ ```tsx
+ <Button variant="destructive">Delete</Button> /* βœ… */
+ <Button className="bg-red-600">Delete</Button> /* ❌ */
+ ```
+
+2. **Use `cn()` for conditional styling**
+ ```tsx
+ import { cn } from "@/lib/utils"
+
+ <div className={cn(
+ "base-class",
+ isActive && "active-class",
+ hasError && "error-class"
+ )} />
+ ```
+
+3. **Compose shadcn/ui components**
+ ```tsx
+ <Dialog>
+ <DialogTrigger asChild>
+ <Button>Open</Button>
+ </DialogTrigger>
+ <DialogContent>
+ <DialogHeader>
+ <DialogTitle>Title</DialogTitle>
+ </DialogHeader>
+ </DialogContent>
+ </Dialog>
+ ```
+
+---
+
+## Dependencies
+
+### βœ… Install These
+
+```json
+{
+ "dependencies": {
+ "tailwindcss": "^4.1.14",
+ "@tailwindcss/vite": "^4.1.14",
+ "clsx": "^2.1.1",
+ "tailwind-merge": "^3.3.1",
+ "@radix-ui/react-*": "latest",
+ "lucide-react": "^0.545.0",
+ "react": "^19.2.0",
+ "react-dom": "^19.2.0"
+ },
+ "devDependencies": {
+ "@types/node": "^24.0.0",
+ "@vitejs/plugin-react": "^5.0.4",
+ "vite": "^7.0.0",
+ "typescript": "~5.9.0"
+ }
+}
+```
+
+### ❌ NEVER Install These (Deprecated in v4)
+
+```bash
+# These packages will cause build errors:
+npm install tailwindcss-animate # ❌ Deprecated
+npm install tw-animate-css # ❌ Doesn't exist
+npm install @tailwindcss/typography # ❌ Use native CSS instead
+```
+
+**If you see import errors for these packages**, remove them and use native CSS animations or `@tailwindcss/motion` instead.
+
+---
+
+## Reference Documentation
+
+For deeper understanding, see:
+
+- **architecture.md** - Deep dive into the 4-step pattern
+- **dark-mode.md** - Complete dark mode implementation
+- **common-gotchas.md** - All the ways it can break (and fixes)
+- **migration-guide.md** - Migrating hardcoded colors to CSS variables
+
+---
+
+## Official Documentation
+
+- **shadcn/ui Vite Setup**: https://ui.shadcn.com/docs/installation/vite
+- **shadcn/ui Tailwind v4 Guide**: https://ui.shadcn.com/docs/tailwind-v4
+- **shadcn/ui Dark Mode (Vite)**: https://ui.shadcn.com/docs/dark-mode/vite
+- **Tailwind v4 Docs**: https://tailwindcss.com/docs
+- **shadcn/ui Theming**: https://ui.shadcn.com/docs/theming
+
+---
+
+## Production Example
+
+This skill is based on the WordPress Auditor project:
+- **Live**: https://wordpress-auditor.webfonts.workers.dev
+- **Stack**: Vite + React 19 + Tailwind v4 + shadcn/ui + Cloudflare Workers
+- **Dark Mode**: Full system/light/dark support
+- **Version**: Tailwind v4.1.14 + shadcn/ui latest (Oct 2025)
+
+All patterns in this skill have been validated in production.
+
+---
+
+**Questions? Issues?**
+
+1. Check `reference/common-gotchas.md` first
+2. Verify all steps in the 4-step architecture
+3. Ensure `components.json` has `"config": ""`
+4. Delete `tailwind.config.ts` if it exists
+5. Check official docs: https://ui.shadcn.com/docs/tailwind-v4
diff --git a/skills/tailwind-v4-shadcn/reference/architecture.md b/skills/tailwind-v4-shadcn/reference/architecture.md
new file mode 100644
index 00000000..90f6f881
--- /dev/null
+++ b/skills/tailwind-v4-shadcn/reference/architecture.md
@@ -0,0 +1,206 @@
+# Tailwind v4 + shadcn/ui Theming Architecture
+
+## The Four-Step Pattern
+
+Tailwind v4 requires a specific architecture for CSS variable-based theming. This pattern is **mandatory** - skipping or modifying steps will break your theme.
+
+### Step 1: Define CSS Variables at Root Level
+
+```css
+:root {
+ --background: hsl(0 0% 100%);
+ --foreground: hsl(222.2 84% 4.9%);
+ /* ... more colors */
+}
+
+.dark {
+ --background: hsl(222.2 84% 4.9%);
+ --foreground: hsl(210 40% 98%);
+ /* ... dark mode colors */
+}
+```
+
+**Critical Rules:**
+- βœ… Define at root level (NOT inside `@layer base`)
+- βœ… Use `hsl()` wrapper on all color values
+- βœ… Use `.dark` for dark mode overrides (NOT `.dark { @theme { } }`)
+- ❌ Never put `:root` or `.dark` inside `@layer base`
+
+### Step 2: Map Variables to Tailwind Utilities
+
+```css
+@theme inline {
+ --color-background: var(--background);
+ --color-foreground: var(--foreground);
+ /* ... map all CSS variables */
+}
+```
+
+**Why This Is Required:**
+- Tailwind v4 doesn't read `tailwind.config.ts` for colors
+- `@theme inline` generates utility classes (`bg-background`, `text-foreground`)
+- Without this, utilities like `bg-primary` won't exist
+
+### Step 3: Apply Base Styles
+
+```css
+@layer base {
+ body {
+ background-color: var(--background); /* NO hsl() wrapper here */
+ color: var(--foreground);
+ }
+}
+```
+
+**Critical Rules:**
+- βœ… Reference variables directly: `var(--background)`
+- ❌ Never double-wrap: `hsl(var(--background))` (already has hsl)
+
+### Step 4: Result - Automatic Dark Mode
+
+With this architecture:
+- `<div className="bg-background text-foreground">` works automatically
+- No `dark:` variants needed in components
+- Theme switches via `.dark` class on `<html>`
+- Single source of truth for all colors
+
+---
+
+## Why This Architecture Works
+
+### Color Variable Flow
+
+```
+CSS Variable Definition β†’ @theme inline Mapping β†’ Tailwind Utility Class
+--background β†’ --color-background β†’ bg-background
+(with hsl() wrapper) (references variable) (generated class)
+```
+
+### Dark Mode Switching
+
+```
+ThemeProvider toggles `.dark` class on <html>
+ ↓
+CSS variables update automatically (.dark overrides)
+ ↓
+Tailwind utilities reference updated variables
+ ↓
+UI updates without re-render
+```
+
+---
+
+## Common Mistakes
+
+### ❌ Mistake 1: Variables Inside @layer base
+
+```css
+/* WRONG */
+@layer base {
+ :root {
+ --background: hsl(0 0% 100%);
+ }
+}
+```
+
+**Why It Fails:** Tailwind v4 strips CSS outside `@theme`/`@layer`, but `:root` must be at root level to persist.
+
+### ❌ Mistake 2: Using .dark { @theme { } }
+
+```css
+/* WRONG */
+@theme {
+ --color-primary: hsl(0 0% 0%);
+}
+
+.dark {
+ @theme {
+ --color-primary: hsl(0 0% 100%);
+ }
+}
+```
+
+**Why It Fails:** Tailwind v4 doesn't support nested `@theme` directives.
+
+### ❌ Mistake 3: Double hsl() Wrapping
+
+```css
+/* WRONG */
+@layer base {
+ body {
+ background-color: hsl(var(--background));
+ }
+}
+```
+
+**Why It Fails:** `--background` already contains `hsl()`, results in `hsl(hsl(...))`.
+
+### ❌ Mistake 4: Config-Based Colors
+
+```typescript
+// WRONG (tailwind.config.ts)
+export default {
+ theme: {
+ extend: {
+ colors: {
+ primary: 'hsl(var(--primary))'
+ }
+ }
+ }
+}
+```
+
+**Why It Fails:** Tailwind v4 completely ignores `theme.extend.colors` in config files.
+
+---
+
+## Best Practices
+
+### 1. Semantic Color Names
+
+Use semantic names, not color values:
+```css
+--primary /* βœ… Semantic */
+--blue-500 /* ❌ Not semantic */
+```
+
+### 2. Foreground Pairing
+
+Every background color needs a foreground:
+```css
+--primary: hsl(...);
+--primary-foreground: hsl(...);
+```
+
+### 3. WCAG Contrast Ratios
+
+Ensure proper contrast:
+- Normal text: 4.5:1 minimum
+- Large text: 3:1 minimum
+- UI components: 3:1 minimum
+
+### 4. Chart Colors
+
+Charts need separate variables (don't use hsl wrapper in components):
+```css
+:root {
+ --chart-1: hsl(12 76% 61%);
+}
+
+@theme inline {
+ --color-chart-1: var(--chart-1);
+}
+```
+
+Use in components:
+```tsx
+<div style={{ backgroundColor: 'var(--chart-1)' }} />
+```
+
+---
+
+## Official Documentation
+
+- shadcn/ui Tailwind v4 Guide: https://ui.shadcn.com/docs/tailwind-v4
+- Tailwind v4 Docs: https://tailwindcss.com/docs
+- shadcn/ui Theming: https://ui.shadcn.com/docs/theming
diff --git a/skills/tailwind-v4-shadcn/reference/common-gotchas.md b/skills/tailwind-v4-shadcn/reference/common-gotchas.md
new file mode 100644
index 00000000..f876df15
--- /dev/null
+++ b/skills/tailwind-v4-shadcn/reference/common-gotchas.md
@@ -0,0 +1,469 @@
+# Common Gotchas & Solutions
+
+## Critical Failures (Will Break Your Build)
+
+### 1. `:root` Inside `@layer base`
+
+❌ **WRONG:**
+```css
+@layer base {
+ :root {
+ --background: hsl(0 0% 100%);
+ }
+}
+```
+
+βœ… **CORRECT:**
+```css
+:root {
+ --background: hsl(0 0% 100%);
+}
+
+@layer base {
+ body {
+ background-color: var(--background);
+ }
+}
+```
+
+**Why:** Tailwind v4 strips CSS outside `@theme`/`@layer`, but `:root` must be at root level.
+
+---
+
+### 2. Nested `@theme` Directive
+
+❌ **WRONG:**
+```css
+@theme {
+ --color-primary: hsl(0 0% 0%);
+}
+
+.dark {
+ @theme {
+ --color-primary: hsl(0 0% 100%);
+ }
+}
+```
+
+βœ… **CORRECT:**
+```css
+:root {
+ --primary: hsl(0 0% 0%);
+}
+
+.dark {
+ --primary: hsl(0 0% 100%);
+}
+
+@theme inline {
+ --color-primary: var(--primary);
+}
+```
+
+**Why:** Tailwind v4 doesn't support `@theme` inside selectors.
+
+---
+
+### 3. Double `hsl()` Wrapping
+
+❌ **WRONG:**
+```css
+@layer base {
+ body {
+ background-color: hsl(var(--background));
+ }
+}
+```
+
+βœ… **CORRECT:**
+```css
+@layer base {
+ body {
+ background-color: var(--background); /* Already has hsl() */
+ }
+}
+```
+
+**Why:** Variables already contain `hsl()`, double-wrapping creates `hsl(hsl(...))`.
+
+---
+
+### 4. Colors in `tailwind.config.ts`
+
+❌ **WRONG:**
+```typescript
+// tailwind.config.ts
+export default {
+ theme: {
+ extend: {
+ colors: {
+ primary: 'hsl(var(--primary))'
+ }
+ }
+ }
+}
+```
+
+βœ… **CORRECT:**
+```typescript
+// Delete tailwind.config.ts entirely OR leave it empty
+export default {}
+
+// components.json
+{
+ "tailwind": {
+ "config": "" // ← Empty string
+ }
+}
+```
+
+**Why:** Tailwind v4 completely ignores `theme.extend.colors`.
+
+---
+
+### 5. Missing `@theme inline` Mapping
+
+❌ **WRONG:**
+```css
+:root {
+ --background: hsl(0 0% 100%);
+}
+
+/* No @theme inline block */
+```
+
+Result: `bg-background` class doesn't exist
+
+βœ… **CORRECT:**
+```css
+:root {
+ --background: hsl(0 0% 100%);
+}
+
+@theme inline {
+ --color-background: var(--background);
+}
+```
+
+**Why:** `@theme inline` generates the utility classes.
+
+---
+
+## Configuration Gotchas
+
+### 6. Wrong components.json Config
+
+❌ **WRONG:**
+```json
+{
+ "tailwind": {
+ "config": "tailwind.config.ts" // ← No!
+ }
+}
+```
+
+βœ… **CORRECT:**
+```json
+{
+ "tailwind": {
+ "config": "" // ← Empty for v4
+ }
+}
+```
+
+---
+
+### 7. Using PostCSS Instead of Vite Plugin
+
+❌ **WRONG:**
+```typescript
+// vite.config.ts
+export default defineConfig({
+ css: {
+ postcss: './postcss.config.js' // Old v3 way
+ }
+})
+```
+
+βœ… **CORRECT:**
+```typescript
+import tailwindcss from '@tailwindcss/vite'
+
+export default defineConfig({
+ plugins: [react(), tailwindcss()] // v4 way
+})
+```
+
+---
+
+### 8. Missing Path Aliases
+
+❌ **WRONG:**
+```typescript
+// tsconfig.json has no paths
+import { Button } from '../../components/ui/button'
+```
+
+βœ… **CORRECT:**
+```json
+// tsconfig.app.json
+{
+ "compilerOptions": {
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ }
+ }
+}
+```
+
+```typescript
+import { Button } from '@/components/ui/button'
+```
+
+---
+
+## Color System Gotchas
+
+### 9. Using `dark:` Variants for Semantic Colors
+
+❌ **WRONG:**
+```tsx
+<div className="bg-primary dark:bg-primary-dark" />
+```
+
+βœ… **CORRECT:**
+```tsx
+<div className="bg-primary" />
+```
+
+**Why:** With proper CSS variable setup, `bg-primary` automatically responds to theme.
+
+---
+
+### 10. Hardcoded Color Values
+
+❌ **WRONG:**
+```tsx
+<div className="bg-blue-600 dark:bg-blue-400" />
+```
+
+βœ… **CORRECT:**
+```tsx
+<div className="bg-primary" /> {/* Or bg-info, bg-success, etc. */}
+```
+
+**Why:** Semantic tokens enable theme switching and reduce repetition.
+
+---
+
+## Component Gotchas
+
+### 11. Missing `cn()` Utility
+
+❌ **WRONG:**
+```tsx
+<div className={`base ${isActive && 'active'}`} />
+```
+
+βœ… **CORRECT:**
+```tsx
+import { cn } from '@/lib/utils'
+<div className={cn("base", isActive && "active")} />
+```
+
+**Why:** `cn()` properly merges and deduplicates Tailwind classes.
+
+---
+
+### 12. Empty String in Radix Select
+
+❌ **WRONG:**
+```tsx
+<SelectItem value="">Select an option</SelectItem>
+```
+
+βœ… **CORRECT:**
+```tsx
+<SelectItem value="placeholder">Select an option</SelectItem>
+```
+
+**Why:** Radix UI Select doesn't allow empty string values.
+
+---
+
+## Installation Gotchas
+
+### 13. Wrong Tailwind Package
+
+❌ **WRONG:**
+```bash
+npm install tailwindcss@^3.4.0 # v3
+```
+
+βœ… **CORRECT:**
+```bash
+npm install tailwindcss@^4.1.0 # v4
+npm install @tailwindcss/vite
+```
+
+---
+
+### 14. Missing Dependencies
+
+❌ **WRONG:**
+```json
+{
+ "dependencies": {
+ "tailwindcss": "^4.1.0"
+ // Missing @tailwindcss/vite
+ }
+}
+```
+
+βœ… **CORRECT:**
+```json
+{
+ "dependencies": {
+ "tailwindcss": "^4.1.0",
+ "@tailwindcss/vite": "^4.1.0",
+ "clsx": "^2.1.1",
+ "tailwind-merge": "^3.3.1"
+ },
+ "devDependencies": {
+ "@types/node": "^24.0.0"
+ }
+}
+```
+
+---
+
+### 17. tw-animate-css Import Error (REAL-WORLD ISSUE)
+
+❌ **WRONG:**
+```bash
+npm install tailwindcss-animate # Deprecated package
+```
+
+```css
+@import "tw-animate-css"; # Package doesn't exist in v4
+```
+
+βœ… **CORRECT:**
+```bash
+# Don't install tailwindcss-animate at all
+# Use native CSS animations or @tailwindcss/motion
+```
+
+**Why:**
+- `tailwindcss-animate` is deprecated in Tailwind v4
+- Causes import errors during build
+- shadcn/ui docs may still reference it (outdated)
+- The skill handles animations differently in v4
+
+**Impact:** Build failure, requires manual CSS file cleanup
+
+---
+
+### 18. Duplicate @layer base After shadcn init (REAL-WORLD ISSUE)
+
+❌ **WRONG:**
+```css
+/* After running shadcn init, you might have: */
+@layer base {
+ body {
+ background-color: var(--background);
+ }
+}
+
+@layer base { /* ← Duplicate added by shadcn init */
+ * {
+ border-color: hsl(var(--border));
+ }
+}
+```
+
+βœ… **CORRECT:**
+```css
+/* Merge into single @layer base block */
+@layer base {
+ * {
+ border-color: var(--border);
+ }
+
+ body {
+ background-color: var(--background);
+ color: var(--foreground);
+ }
+}
+```
+
+**Why:**
+- `shadcn init` adds its own `@layer base` block
+- Results in duplicate layer declarations
+- Can cause unexpected CSS priority issues
+- Easy to miss during setup
+
+**Prevention:**
+- Check `src/index.css` immediately after running `shadcn init`
+- Merge any duplicate `@layer base` blocks
+- Keep only one base layer section
+
+**Impact:** CSS priority issues, harder to debug styling problems
+
+---
+
+## Testing Gotchas
+
+### 15. Not Testing Both Themes
+
+❌ **WRONG:**
+Only testing in light mode
+
+βœ… **CORRECT:**
+Test in:
+- Light mode
+- Dark mode
+- System mode
+- Both initial load and toggle
+
+---
+
+### 16. Not Checking Contrast
+
+❌ **WRONG:**
+Colors look good but fail WCAG
+
+βœ… **CORRECT:**
+- Use browser DevTools Lighthouse
+- Check contrast ratios (4.5:1 minimum)
+- Test with actual users
+
+---
+
+## Quick Diagnosis
+
+**Symptoms β†’ Likely Cause:**
+
+| Symptom | Likely Cause |
+|---------|-------------|
+| `bg-primary` doesn't work | Missing `@theme inline` mapping |
+| Colors all black/white | Double `hsl()` wrapping |
+| Dark mode not switching | Missing ThemeProvider |
+| Build fails | `tailwind.config.ts` exists with theme config |
+| Text invisible | Wrong contrast colors |
+| `@/` imports fail | Missing path aliases in tsconfig |
+
+---
+
+## Prevention Checklist
+
+Before deploying:
+- [ ] No `tailwind.config.ts` file (or it's empty)
+- [ ] `components.json` has `"config": ""`
+- [ ] All colors have `hsl()` wrapper in `:root`
+- [ ] `@theme inline` maps all variables
+- [ ] `@layer base` doesn't wrap `:root`
+- [ ] Theme provider wraps app
+- [ ] Tested in both light and dark modes
+- [ ] All text has sufficient contrast
diff --git a/skills/tailwind-v4-shadcn/reference/dark-mode.md b/skills/tailwind-v4-shadcn/reference/dark-mode.md
new file mode 100644
index 00000000..5c5008e9
--- /dev/null
+++ b/skills/tailwind-v4-shadcn/reference/dark-mode.md
@@ -0,0 +1,239 @@
+# Dark Mode Implementation
+
+## Overview
+
+Tailwind v4 + shadcn/ui dark mode requires:
+1. `ThemeProvider` component to manage state
+2. `.dark` class toggling on `<html>` element
+3. localStorage persistence
+4. System theme detection
+
+---
+
+## ThemeProvider Component
+
+### Full Implementation
+
+```typescript
+// src/components/theme-provider.tsx
+import { createContext, useContext, useEffect, useState, ReactNode } from 'react'
+
+type Theme = 'dark' | 'light' | 'system'
+
+type ThemeProviderProps = {
+ children: ReactNode
+ defaultTheme?: Theme
+ storageKey?: string
+}
+
+type ThemeProviderState = {
+ theme: Theme
+ setTheme: (theme: Theme) => void
+}
+
+const initialState: ThemeProviderState = {
+ theme: 'system',
+ setTheme: () => null,
+}
+
+const ThemeProviderContext = createContext<ThemeProviderState>(initialState)
+
+export function ThemeProvider({
+ children,
+ defaultTheme = 'system',
+ storageKey = 'vite-ui-theme',
+ ...props
+}: ThemeProviderProps) {
+ const [theme, setTheme] = useState<Theme>(() => {
+ try {
+ return (localStorage.getItem(storageKey) as Theme) || defaultTheme
+ } catch (e) {
+ return defaultTheme
+ }
+ })
+
+ useEffect(() => {
+ const root = window.document.documentElement
+ root.classList.remove('light', 'dark')
+
+ if (theme === 'system') {
+ const systemTheme = window.matchMedia('(prefers-color-scheme: dark)')
+ .matches ? 'dark' : 'light'
+ root.classList.add(systemTheme)
+ return
+ }
+
+ root.classList.add(theme)
+ }, [theme])
+
+ const value = {
+ theme,
+ setTheme: (theme: Theme) => {
+ try {
+ localStorage.setItem(storageKey, theme)
+ } catch (e) {
+ console.warn('Storage unavailable')
+ }
+ setTheme(theme)
+ },
+ }
+
+ return (
+ <ThemeProviderContext.Provider {...props} value={value}>
+ {children}
+ </ThemeProviderContext.Provider>
+ )
+}
+
+export const useTheme = () => {
+ const context = useContext(ThemeProviderContext)
+ if (context === undefined)
+ throw new Error('useTheme must be used within a ThemeProvider')
+ return context
+}
+```
+
+### Wrap Your App
+
+```typescript
+// src/main.tsx
+import { ThemeProvider } from '@/components/theme-provider'
+
+ReactDOM.createRoot(document.getElementById('root')!).render(
+ <React.StrictMode>
+ <ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
+ <App />
+ </ThemeProvider>
+ </React.StrictMode>,
+)
+```
+
+---
+
+## Theme Toggle Component
+
+### Using shadcn/ui Dropdown Menu
+
+```bash
+pnpm dlx shadcn@latest add dropdown-menu
+```
+
+```typescript
+// src/components/mode-toggle.tsx
+import { Moon, Sun } from "lucide-react"
+import { Button } from "@/components/ui/button"
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu"
+import { useTheme } from "@/components/theme-provider"
+
+export function ModeToggle() {
+ const { setTheme } = useTheme()
+
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <Button variant="outline" size="icon">
+ <Sun className="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
+ <Moon className="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
+ <span className="sr-only">Toggle theme</span>
+ </Button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ <DropdownMenuItem onClick={() => setTheme("light")}>
+ Light
+ </DropdownMenuItem>
+ <DropdownMenuItem onClick={() => setTheme("dark")}>
+ Dark
+ </DropdownMenuItem>
+ <DropdownMenuItem onClick={() => setTheme("system")}>
+ System
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ )
+}
+```
+
+---
+
+## How It Works
+
+### Theme Flow
+
+```
+User selects theme β†’ setTheme() called
+ ↓
+Save to localStorage
+ ↓
+Update state
+ ↓
+useEffect triggers
+ ↓
+Remove existing classes (.light, .dark)
+ ↓
+Add new class to <html>
+ ↓
+CSS variables update (.dark overrides :root)
+ ↓
+UI updates automatically
+```
+
+### System Theme Detection
+
+```typescript
+if (theme === 'system') {
+ const systemTheme = window.matchMedia('(prefers-color-scheme: dark)')
+ .matches ? 'dark' : 'light'
+ root.classList.add(systemTheme)
+}
+```
+
+This respects the user's OS preference when "System" is selected.
+
+---
+
+## Common Issues
+
+### Issue: Dark mode not switching
+
+**Cause:** Theme provider not wrapping app
+**Fix:** Ensure `<ThemeProvider>` wraps your app in `main.tsx`
+
+### Issue: Theme resets on page refresh
+
+**Cause:** localStorage not working
+**Fix:** Check browser privacy settings, add sessionStorage fallback
+
+### Issue: Flash of wrong theme on load
+
+**Cause:** Theme applied after initial render
+**Fix:** Add inline script to `index.html` (advanced)
+
+### Issue: Icons not changing
+
+**Cause:** CSS transitions not working
+**Fix:** Verify icon classes use `dark:` variants for animations
+
+---
+
+## Testing Checklist
+
+- [ ] Light mode displays correctly
+- [ ] Dark mode displays correctly
+- [ ] System mode respects OS setting
+- [ ] Theme persists after page refresh
+- [ ] Toggle component shows current state
+- [ ] All text has proper contrast
+- [ ] No flash of wrong theme on load
+- [ ] Works in incognito mode (graceful fallback)
+
+---
+
+## Official Documentation
+
+- shadcn/ui Dark Mode (Vite): https://ui.shadcn.com/docs/dark-mode/vite
+- Tailwind Dark Mode: https://tailwindcss.com/docs/dark-mode
diff --git a/skills/tailwind-v4-shadcn/reference/migration-guide.md b/skills/tailwind-v4-shadcn/reference/migration-guide.md
new file mode 100644
index 00000000..8ce1a0a3
--- /dev/null
+++ b/skills/tailwind-v4-shadcn/reference/migration-guide.md
@@ -0,0 +1,313 @@
+# Migration Guide: Hardcoded Colors β†’ CSS Variables
+
+## Overview
+
+This guide helps you migrate from hardcoded Tailwind colors (`bg-blue-600`) to semantic CSS variables (`bg-primary`).
+
+**Benefits:**
+- Automatic dark mode support
+- Consistent color usage
+- Single source of truth
+- Easy theme customization
+- Better accessibility
+
+---
+
+## Semantic Color Mapping
+
+| Hardcoded Color | CSS Variable | Use Case |
+|----------------|--------------|----------|
+| `bg-red-*` / `text-red-*` | `bg-destructive` / `text-destructive` | Critical issues, errors, delete actions |
+| `bg-green-*` / `text-green-*` | `bg-success` / `text-success` | Success states, positive metrics |
+| `bg-yellow-*` / `text-yellow-*` | `bg-warning` / `text-warning` | Warnings, moderate issues |
+| `bg-blue-*` / `text-blue-*` | `bg-info` or `bg-primary` | Info boxes, primary actions |
+| `bg-gray-*` / `text-gray-*` | `bg-muted` / `text-muted-foreground` | Backgrounds, secondary text |
+| `bg-purple-*` | `bg-info` | Remove - use blue instead |
+| `bg-orange-*` | `bg-warning` | Remove - use yellow instead |
+| `bg-emerald-*` | `bg-success` | Remove - use green instead |
+
+---
+
+## Migration Patterns
+
+### Pattern 1: Solid Backgrounds
+
+❌ **Before:**
+```tsx
+<div className="bg-blue-50 dark:bg-blue-950/20 text-blue-700 dark:text-blue-300">
+```
+
+βœ… **After:**
+```tsx
+<div className="bg-info/10 text-info">
+```
+
+**Note:** `/10` creates 10% opacity
+
+---
+
+### Pattern 2: Borders
+
+❌ **Before:**
+```tsx
+<div className="border-2 border-green-200 dark:border-green-800">
+```
+
+βœ… **After:**
+```tsx
+<div className="border-2 border-success/30">
+```
+
+---
+
+### Pattern 3: Text Colors
+
+❌ **Before:**
+```tsx
+<span className="text-red-600 dark:text-red-400">
+```
+
+βœ… **After:**
+```tsx
+<span className="text-destructive">
+```
+
+---
+
+### Pattern 4: Icons
+
+❌ **Before:**
+```tsx
+<AlertCircle className="text-yellow-500" />
+```
+
+βœ… **After:**
+```tsx
+<AlertCircle className="text-warning" />
+```
+
+---
+
+### Pattern 5: Gradients
+
+❌ **Before:**
+```tsx
+<div className="bg-gradient-to-r from-green-50 to-emerald-50 dark:from-green-950/20 dark:to-emerald-950/20">
+```
+
+βœ… **After:**
+```tsx
+<div className="bg-gradient-to-r from-success/10 to-success/20">
+```
+
+---
+
+## Step-by-Step Migration
+
+### Step 1: Add Semantic Colors to CSS
+
+```css
+/* src/index.css */
+:root {
+ /* Add these if not already present */
+ --destructive: hsl(0 84.2% 60.2%);
+ --destructive-foreground: hsl(210 40% 98%);
+ --success: hsl(142.1 76.2% 36.3%);
+ --success-foreground: hsl(210 40% 98%);
+ --warning: hsl(38 92% 50%);
+ --warning-foreground: hsl(222.2 47.4% 11.2%);
+ --info: hsl(221.2 83.2% 53.3%);
+ --info-foreground: hsl(210 40% 98%);
+}
+
+.dark {
+ --destructive: hsl(0 62.8% 30.6%);
+ --destructive-foreground: hsl(210 40% 98%);
+ --success: hsl(142.1 70.6% 45.3%);
+ --success-foreground: hsl(222.2 47.4% 11.2%);
+ --warning: hsl(38 92% 55%);
+ --warning-foreground: hsl(222.2 47.4% 11.2%);
+ --info: hsl(217.2 91.2% 59.8%);
+ --info-foreground: hsl(222.2 47.4% 11.2%);
+}
+
+@theme inline {
+ --color-destructive: var(--destructive);
+ --color-destructive-foreground: var(--destructive-foreground);
+ --color-success: var(--success);
+ --color-success-foreground: var(--success-foreground);
+ --color-warning: var(--warning);
+ --color-warning-foreground: var(--warning-foreground);
+ --color-info: var(--info);
+ --color-info-foreground: var(--info-foreground);
+}
+```
+
+### Step 2: Find Hardcoded Colors
+
+```bash
+# Search for background colors
+grep -r "bg-\(red\|yellow\|blue\|green\|purple\|orange\|pink\|emerald\)-[0-9]" src/
+
+# Search for text colors
+grep -r "text-\(red\|yellow\|blue\|green\|purple\|orange\|pink\|emerald\)-[0-9]" src/
+
+# Search for border colors
+grep -r "border-\(red\|yellow\|blue\|green\|purple\|orange\|pink\|emerald\)-[0-9]" src/
+```
+
+### Step 3: Replace Component by Component
+
+Start with high-impact components:
+1. Buttons
+2. Badges
+3. Alert boxes
+4. Status indicators
+5. Cards
+
+### Step 4: Test Both Themes
+
+After each component:
+- [ ] Check light mode appearance
+- [ ] Check dark mode appearance
+- [ ] Verify text contrast
+- [ ] Test hover/active states
+
+---
+
+## Example: Badge Component
+
+❌ **Before:**
+```tsx
+const severityConfig = {
+ critical: {
+ color: 'text-red-500',
+ bg: 'bg-red-500/10',
+ border: 'border-red-500/20',
+ },
+ warning: {
+ color: 'text-yellow-500',
+ bg: 'bg-yellow-500/10',
+ border: 'border-yellow-500/20',
+ },
+ info: {
+ color: 'text-blue-500',
+ bg: 'bg-blue-500/10',
+ border: 'border-blue-500/20',
+ }
+}
+```
+
+βœ… **After:**
+```tsx
+const severityConfig = {
+ critical: {
+ color: 'text-destructive',
+ bg: 'bg-destructive/10',
+ border: 'border-destructive/20',
+ },
+ warning: {
+ color: 'text-warning',
+ bg: 'bg-warning/10',
+ border: 'border-warning/20',
+ },
+ info: {
+ color: 'text-info',
+ bg: 'bg-info/10',
+ border: 'border-info/20',
+ }
+}
+```
+
+---
+
+## Testing Checklist
+
+After migration:
+- [ ] All severity levels (critical/warning/info) visually distinct
+- [ ] Text has proper contrast in both light and dark modes
+- [ ] No hardcoded color classes remain
+- [ ] Hover states work correctly
+- [ ] Gradients render smoothly
+- [ ] Icons are visible and colored correctly
+- [ ] Borders are visible
+- [ ] No visual regressions
+
+---
+
+## Verification Commands
+
+```bash
+# Should return 0 results when migration complete
+grep -r "text-red-[0-9]" src/components/
+grep -r "bg-blue-[0-9]" src/components/
+grep -r "border-green-[0-9]" src/components/
+
+# Verify semantic colors are used
+grep -r "bg-destructive" src/components/
+grep -r "text-success" src/components/
+```
+
+---
+
+## Performance Impact
+
+**Before:** Every component has `dark:` variants
+```tsx
+<div className="bg-blue-50 dark:bg-blue-950/20 text-blue-700 dark:text-blue-300 border-blue-200 dark:border-blue-800">
+```
+
+**After:** Single class, CSS handles switching
+```tsx
+<div className="bg-info/10 text-info border-info/30">
+```
+
+**Result:**
+- 60% fewer CSS classes in markup
+- Smaller HTML payload
+- Faster rendering
+- Easier to maintain
+
+---
+
+## Common Pitfalls
+
+### 1. Forgetting to Map in @theme inline
+
+Variables defined in `:root` but not mapped β†’ utilities don't exist
+
+### 2. Wrong Opacity Syntax
+
+❌ `bg-success-10` (doesn't work)
+βœ… `bg-success/10` (correct)
+
+### 3. Mixing Approaches
+
+Don't mix hardcoded and semantic in same component - choose one approach.
+
+### 4. Not Testing Dark Mode
+
+Always test both themes during migration.
+
+---
+
+## Rollback Plan
+
+If migration causes issues:
+
+1. Keep original components in git history
+2. Use feature flags to toggle new theme
+3. Test with subset of users first
+4. Have monitoring for visual regressions
+
+---
+
+## Further Customization
+
+After migration, you can easily:
+- Add new semantic colors
+- Create theme variants (high contrast, etc.)
+- Support multiple brand themes
+- Implement user-selectable color schemes
+
+All by editing CSS variables - no component changes needed!
diff --git a/skills/tailwind-v4-shadcn/templates/components.json b/skills/tailwind-v4-shadcn/templates/components.json
new file mode 100644
index 00000000..e71fe103
--- /dev/null
+++ b/skills/tailwind-v4-shadcn/templates/components.json
@@ -0,0 +1,20 @@
+{
+ "$schema": "https://ui.shadcn.com/schema.json",
+ "style": "default",
+ "rsc": false,
+ "tsx": true,
+ "tailwind": {
+ "config": "",
+ "css": "src/index.css",
+ "baseColor": "slate",
+ "cssVariables": true,
+ "prefix": ""
+ },
+ "aliases": {
+ "components": "@/components",
+ "utils": "@/lib/utils",
+ "ui": "@/components/ui",
+ "lib": "@/lib",
+ "hooks": "@/hooks"
+ }
+}
diff --git a/skills/tailwind-v4-shadcn/templates/index.css b/skills/tailwind-v4-shadcn/templates/index.css
new file mode 100644
index 00000000..8f20cc9c
--- /dev/null
+++ b/skills/tailwind-v4-shadcn/templates/index.css
@@ -0,0 +1,140 @@
+@import "tailwindcss";
+
+/*
+ Tailwind v4 + shadcn/ui Dark Mode Pattern
+ Based on: https://ui.shadcn.com/docs/tailwind-v4
+
+ Key Pattern:
+ 1. Define CSS variables at root level (NOT in @layer base)
+ 2. Use .dark for dark mode overrides (NOT in @theme)
+ 3. Use @theme inline to map variables to Tailwind utilities
+ 4. All color values must use hsl() wrapper
+*/
+
+/* Light mode colors - Define at root level */
+:root {
+ --background: hsl(0 0% 100%);
+ --foreground: hsl(222.2 84% 4.9%);
+ --card: hsl(0 0% 100%);
+ --card-foreground: hsl(222.2 84% 4.9%);
+ --popover: hsl(0 0% 100%);
+ --popover-foreground: hsl(222.2 84% 4.9%);
+ --primary: hsl(221.2 83.2% 53.3%);
+ --primary-foreground: hsl(210 40% 98%);
+ --secondary: hsl(210 40% 96.1%);
+ --secondary-foreground: hsl(222.2 47.4% 11.2%);
+ --muted: hsl(210 40% 96.1%);
+ --muted-foreground: hsl(215.4 16.3% 46.9%);
+ --accent: hsl(210 40% 96.1%);
+ --accent-foreground: hsl(222.2 47.4% 11.2%);
+ --destructive: hsl(0 84.2% 60.2%);
+ --destructive-foreground: hsl(210 40% 98%);
+ --success: hsl(142.1 76.2% 36.3%);
+ --success-foreground: hsl(210 40% 98%);
+ --warning: hsl(38 92% 50%);
+ --warning-foreground: hsl(222.2 47.4% 11.2%);
+ --info: hsl(221.2 83.2% 53.3%);
+ --info-foreground: hsl(210 40% 98%);
+ --border: hsl(214.3 31.8% 91.4%);
+ --input: hsl(214.3 31.8% 91.4%);
+ --ring: hsl(221.2 83.2% 53.3%);
+ --radius: 0.5rem;
+
+ /* Chart colors */
+ --chart-1: hsl(12 76% 61%);
+ --chart-2: hsl(173 58% 39%);
+ --chart-3: hsl(197 37% 24%);
+ --chart-4: hsl(43 74% 66%);
+ --chart-5: hsl(27 87% 67%);
+}
+
+/* Dark mode colors - Plain CSS overrides (NOT in @theme) */
+.dark {
+ --background: hsl(222.2 84% 4.9%);
+ --foreground: hsl(210 40% 98%);
+ --card: hsl(222.2 84% 4.9%);
+ --card-foreground: hsl(210 40% 98%);
+ --popover: hsl(222.2 84% 4.9%);
+ --popover-foreground: hsl(210 40% 98%);
+ --primary: hsl(217.2 91.2% 59.8%);
+ --primary-foreground: hsl(222.2 47.4% 11.2%);
+ --secondary: hsl(217.2 32.6% 17.5%);
+ --secondary-foreground: hsl(210 40% 98%);
+ --muted: hsl(217.2 32.6% 17.5%);
+ --muted-foreground: hsl(215 20.2% 65.1%);
+ --accent: hsl(217.2 32.6% 17.5%);
+ --accent-foreground: hsl(210 40% 98%);
+ --destructive: hsl(0 62.8% 30.6%);
+ --destructive-foreground: hsl(210 40% 98%);
+ --success: hsl(142.1 70.6% 45.3%);
+ --success-foreground: hsl(222.2 47.4% 11.2%);
+ --warning: hsl(38 92% 55%);
+ --warning-foreground: hsl(222.2 47.4% 11.2%);
+ --info: hsl(217.2 91.2% 59.8%);
+ --info-foreground: hsl(222.2 47.4% 11.2%);
+ --border: hsl(217.2 32.6% 17.5%);
+ --input: hsl(217.2 32.6% 17.5%);
+ --ring: hsl(224.3 76.3% 48%);
+
+ /* Chart colors for dark mode */
+ --chart-1: hsl(220 70% 50%);
+ --chart-2: hsl(160 60% 45%);
+ --chart-3: hsl(30 80% 55%);
+ --chart-4: hsl(280 65% 60%);
+ --chart-5: hsl(340 75% 55%);
+}
+
+/* Map CSS variables to Tailwind theme with @theme inline */
+@theme inline {
+ --color-background: var(--background);
+ --color-foreground: var(--foreground);
+ --color-card: var(--card);
+ --color-card-foreground: var(--card-foreground);
+ --color-popover: var(--popover);
+ --color-popover-foreground: var(--popover-foreground);
+ --color-primary: var(--primary);
+ --color-primary-foreground: var(--primary-foreground);
+ --color-secondary: var(--secondary);
+ --color-secondary-foreground: var(--secondary-foreground);
+ --color-muted: var(--muted);
+ --color-muted-foreground: var(--muted-foreground);
+ --color-accent: var(--accent);
+ --color-accent-foreground: var(--accent-foreground);
+ --color-destructive: var(--destructive);
+ --color-destructive-foreground: var(--destructive-foreground);
+ --color-success: var(--success);
+ --color-success-foreground: var(--success-foreground);
+ --color-warning: var(--warning);
+ --color-warning-foreground: var(--warning-foreground);
+ --color-info: var(--info);
+ --color-info-foreground: var(--info-foreground);
+ --color-border: var(--border);
+ --color-input: var(--input);
+ --color-ring: var(--ring);
+ --color-chart-1: var(--chart-1);
+ --color-chart-2: var(--chart-2);
+ --color-chart-3: var(--chart-3);
+ --color-chart-4: var(--chart-4);
+ --color-chart-5: var(--chart-5);
+
+ /* Border radius tokens */
+ --radius-sm: calc(var(--radius) - 4px);
+ --radius-md: calc(var(--radius) - 2px);
+ --radius-lg: var(--radius);
+}
+
+/* Base styles in @layer base */
+@layer base {
+ * {
+ border-color: var(--border);
+ }
+
+ body {
+ margin: 0;
+ background-color: var(--background);
+ color: var(--foreground);
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+ }
+}
diff --git a/skills/tailwind-v4-shadcn/templates/theme-provider.tsx b/skills/tailwind-v4-shadcn/templates/theme-provider.tsx
new file mode 100644
index 00000000..98126d7d
--- /dev/null
+++ b/skills/tailwind-v4-shadcn/templates/theme-provider.tsx
@@ -0,0 +1,92 @@
+import { createContext, useContext, useEffect, useState, ReactNode } from 'react'
+
+type Theme = 'dark' | 'light' | 'system'
+
+type ThemeProviderProps = {
+ children: ReactNode
+ defaultTheme?: Theme
+ storageKey?: string
+}
+
+type ThemeProviderState = {
+ theme: Theme
+ setTheme: (theme: Theme) => void
+}
+
+const initialState: ThemeProviderState = {
+ theme: 'system',
+ setTheme: () => null,
+}
+
+const ThemeProviderContext = createContext<ThemeProviderState>(initialState)
+
+export function ThemeProvider({
+ children,
+ defaultTheme = 'system',
+ storageKey = 'vite-ui-theme',
+ ...props
+}: ThemeProviderProps) {
+ const [theme, setTheme] = useState<Theme>(() => {
+ // Try localStorage first, fall back to sessionStorage, then default
+ try {
+ return (localStorage.getItem(storageKey) as Theme) ||
+ (sessionStorage.getItem(storageKey) as Theme) ||
+ defaultTheme
+ } catch (e) {
+ // Storage unavailable (incognito/privacy mode) - use default
+ return defaultTheme
+ }
+ })
+
+ useEffect(() => {
+ const root = window.document.documentElement
+
+ root.classList.remove('light', 'dark')
+
+ if (theme === 'system') {
+ const systemTheme = window.matchMedia('(prefers-color-scheme: dark)')
+ .matches
+ ? 'dark'
+ : 'light'
+
+ root.classList.add(systemTheme)
+ return
+ }
+
+ root.classList.add(theme)
+ }, [theme])
+
+ const value = {
+ theme,
+ setTheme: (theme: Theme) => {
+ // Try to persist to localStorage, fall back to sessionStorage
+ try {
+ localStorage.setItem(storageKey, theme)
+ } catch (e) {
+ // localStorage unavailable (incognito) - use sessionStorage
+ try {
+ sessionStorage.setItem(storageKey, theme)
+ } catch (err) {
+ // Both unavailable - just update state without persistence
+ console.warn('Storage unavailable, theme preference will not persist')
+ }
+ }
+ setTheme(theme)
+ },
+ }
+
+ return (
+ <ThemeProviderContext.Provider {...props} value={value}>
+ {children}
+ </ThemeProviderContext.Provider>
+ )
+}
+
+export const useTheme = () => {
+ const context = useContext(ThemeProviderContext)
+
+ if (context === undefined)
+ throw new Error('useTheme must be used within a ThemeProvider')
+
+ return context
+}
diff --git a/skills/tailwind-v4-shadcn/templates/tsconfig.app.json b/skills/tailwind-v4-shadcn/templates/tsconfig.app.json
new file mode 100644
index 00000000..9c0b41b2
--- /dev/null
+++ b/skills/tailwind-v4-shadcn/templates/tsconfig.app.json
@@ -0,0 +1,31 @@
+{
+ "compilerOptions": {
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
+ "target": "ES2022",
+ "useDefineForClassFields": true,
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
+ "module": "ESNext",
+ "skipLibCheck": true,
+
+ /* Bundler mode */
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
+ "verbatimModuleSyntax": true,
+ "moduleDetection": "force",
+ "noEmit": true,
+ "jsx": "react-jsx",
+
+ /* Path aliases */
+ "baseUrl": ".",
+ "paths": {
+ "@/*": ["./src/*"]
+ },
+
+ /* Linting */
+ "strict": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "noFallthroughCasesInSwitch": true
+ },
+ "include": ["src"]
+}
diff --git a/skills/tailwind-v4-shadcn/templates/utils.ts b/skills/tailwind-v4-shadcn/templates/utils.ts
new file mode 100644
index 00000000..d084ccad
--- /dev/null
+++ b/skills/tailwind-v4-shadcn/templates/utils.ts
@@ -0,0 +1,6 @@
+import { type ClassValue, clsx } from "clsx"
+import { twMerge } from "tailwind-merge"
+
+export function cn(...inputs: ClassValue[]) {
+ return twMerge(clsx(inputs))
+}
diff --git a/skills/tailwind-v4-shadcn/templates/vite.config.ts b/skills/tailwind-v4-shadcn/templates/vite.config.ts
new file mode 100644
index 00000000..3409417e
--- /dev/null
+++ b/skills/tailwind-v4-shadcn/templates/vite.config.ts
@@ -0,0 +1,17 @@
+import { defineConfig } from 'vite'
+import react from '@vitejs/plugin-react'
+import tailwindcss from '@tailwindcss/vite'
+import path from 'path'
+
+// https://vite.dev/config/
+export default defineConfig({
+ plugins: [
+ react(),
+ tailwindcss(),
+ ],
+ resolve: {
+ alias: {
+ '@': path.resolve(__dirname, './src')
+ }
+ }
+})