Install
npx skillscat add wasintoh/toh-framework/src-skills-preview-mode Install via the SkillsCat registry.
šļø Preview Mode Skill
Purpose: Show users what will change before applying
Version: 1.0.0
Author: Toh Framework Team
Overview
This skill enables AI to show previews of changes before applying them, giving users confidence in what's being created.
Core Principle
AI completes work
ā
Show preview (description + URL if available)
ā
User confirms or requests changes
ā
Apply changes (or iterate)SEE BEFORE COMMIT
Preview Types
Type 1: Dev Server Preview (Live)
When dev server is running:
ā
**ąøŖąø£ą¹ąø²ąø Dashboard ą¹ąøŖąø£ą¹ąøą¹ąø„ą¹ąø§!**
šļø **Preview:**
š http://localhost:3000/dashboard
šø **ąøŖąø“ą¹ąøąøąøµą¹ąøŖąø£ą¹ąø²ąø:**
- Header ąøąø£ą¹ąøąø” navigation
- Stats cards (4 ąøąø±ąø§)
- Sales chart
- Recent orders table
ą¹ąøąø“ąø URL ąøą¹ąø²ąøąøąøą¹ąøąø·ą¹ąøąøąø¹ preview ą¹ąøą¹ą¹ąø„ąø¢ąøąø£ąø±ąø!
š” ąøą¹ąøąøąøąø²ąø£ą¹ąøą¹ą¹ąøąøąø°ą¹ąø£ą¹ąø«ąø”ąøąø£ąø±ąø?Type 2: Description Preview (No Server)
When dev server isn't running:
ā
**ą¹ąøąø£ąøµąø¢ąø” Dashboard ąøąø£ą¹ąøąø”ą¹ąø„ą¹ąø§!**
š **Preview ąøŖąø“ą¹ąøąøąøµą¹ąøąø°ąøŖąø£ą¹ąø²ąø:**
**Layout:**
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā šµ Header (Logo + Nav + Profile) ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā š Stats Cards (4 columns) ā
ā āāāāā āāāāā āāāāā āāāāā ā
ā ā $ ā ā š¦ā ā š„ā ā šā ā
ā āāāāā āāāāā āāāāā āāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā š Sales Chart (Line/Bar) ā
ā [Chart area] ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā š Recent Orders Table ā
ā ID | Customer | Amount | Status ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
**Components:**
- StatsCard.tsx (reusable)
- SalesChart.tsx (with Recharts)
- OrdersTable.tsx (with pagination)
ąøŖąø£ą¹ąø²ąøą¹ąø„ąø¢ą¹ąø«ąø”ąøąø£ąø±ąø? ąø«ąø£ąø·ąøąøą¹ąøąøąøąø²ąø£ąøąø£ąø±ąøąøąø°ą¹ąø£ąøą¹ąøąø?Type 3: Before/After Preview (Modifications)
When modifying existing code:
š **Preview ąøąø²ąø£ą¹ąøąø„ąøµą¹ąø¢ąøą¹ąøąø„ąø:**
**Before:**
```tsx
<Button>Submit</Button>After:
<Button
onClick={handleSubmit}
disabled={isLoading}
>
{isLoading ? <Spinner /> : 'Submit'}
</Button>Changes:
- ā ą¹ąøąø“ą¹ąø” onClick handler
- ā ą¹ąøąø“ą¹ąø” loading state
- ā ą¹ąøąø“ą¹ąø” Spinner component
Apply ąøąø²ąø£ą¹ąøąø„ąøµą¹ąø¢ąøą¹ąøąø„ąøąøąøµą¹ą¹ąø«ąø”ąøąø£ąø±ąø?
---
## Auto Dev Server Detection
AI should detect if dev server is running:
```javascript
// Check if localhost:3000 is accessible
// If yes ā Provide live URL
// If no ā Provide description previewWith Dev Server
šļø **Live Preview ąøąø£ą¹ąøąø”ą¹ąø„ą¹ąø§:**
š http://localhost:3000/[path]
(ą¹ąøąø“ąøąøąø¹ą¹ąøą¹ą¹ąø„ąø¢ąøąø£ąø±ąø!)Without Dev Server
š” **ą¹ąøąø“ąø preview ą¹ąøą¹ą¹ąøąø¢:**
```bash
npm run devą¹ąø„ą¹ąø§ą¹ąøąøąøµą¹ http://localhost:3000/[path]
---
## Preview Confirmation Flow
### Standard Flow
- AI creates/modifies files
- AI shows preview
- User reviews
- Options:
- "OK" / "ą¹ąøą¹ą¹ąø„ąø¢" ā Continue
- "ą¹ąøą¹ą¹ąø [detail]" ā AI modifies
- "ąø¢ąøą¹ąø„ąø“ąø" ā AI reverts
### Quick Flow (For Simple Changes)
- AI shows preview inline
- Applies immediately
- User can undo if needed
---
## Preview Templates by Task Type
### New Page Preview
```markdown
š **New Page: /dashboard**
**Layout:**
[ASCII art layout]
**Features:**
- [Feature list]
**Components Used:**
- [Component list]
**Files to Create:**
- app/dashboard/page.tsx
- components/dashboard/StatsCard.tsx
- components/dashboard/SalesChart.tsx
ąøŖąø£ą¹ąø²ąøą¹ąø„ąø¢ą¹ąø«ąø”ąøąø£ąø±ąø?New Component Preview
š§© **New Component: ProductCard**
**Preview:**
āāāāāāāāāāāāāāāāāāā
ā [Image] ā
ā Product Name ā
ā ąøæ199 ā
ā [Add to Cart] ā
āāāāāāāāāāāāāāāāāāā
**Props:**
- product: Product
- onAddToCart: () => void
**Features:**
- Responsive
- Hover effect
- Loading state
ąøŖąø£ą¹ąø²ąøą¹ąø„ąø¢ą¹ąø«ąø”ąøąø£ąø±ąø?Design Change Preview
⨠**Design Changes:**
**Color Palette:**
- Primary: #3B82F6 ā #2563EB (darker)
- Background: #F9FAFB ā #F3F4F6 (warmer)
**Typography:**
- Headings: font-semibold ā font-bold
- Body: text-gray-600 ā text-gray-700
**Spacing:**
- Cards: p-4 ā p-6 (more breathing room)
- Sections: gap-4 ā gap-6
**Before/After:**
[Side by side comparison if possible]
Apply changes ą¹ąø«ąø”ąøąø£ąø±ąø?Logic Change Preview
āļø **Logic Changes: handleSubmit**
**What changes:**
1. Add validation before submit
2. Add loading state
3. Add success/error toast
4. Clear form on success
**Flow:**User clicks Submit
ā
Validate form (Zod)
ā
Show loading state
ā
Call API
ā
Success? ā Show toast + Clear form
Error? ā Show error message
Apply changes ą¹ąø«ąø”ąøąø£ąø±ąø?Multi-File Change Preview
When changes span multiple files:
š **Files to Change:**
**Create:**
- components/checkout/PaymentForm.tsx
- lib/stripe.ts
- app/api/checkout/route.ts
**Modify:**
- app/cart/page.tsx (add checkout button)
- types/index.ts (add PaymentIntent type)
**Total:** 3 new files, 2 modified
ąøąø¹ diff ą¹ąøą¹ąø„ąø°ą¹ąøąø„ą¹ą¹ąø«ąø”ąøąø£ąø±ąø? หรืภapply ą¹ąø„ąø¢?Preview for Destructive Actions
Extra confirmation for risky operations:
ā ļø **Warning: Destructive Action**
**ąøąø°ąø„ąø:**
- app/old-dashboard/ (3 files)
- components/old-chart/ (2 files)
**Total:** 5 files ąøąø°ąøąø¹ąøąø„ąø
ā” ąøą¹ąøąøąø„ąø:
- [x] ąøŖąø£ą¹ąø²ąø backup checkpoint ą¹ąø„ą¹ąø§
- [x] ą¹ąøąø„ą¹ą¹ąø«ąø”ą¹ąøąø£ą¹ąøąø”ą¹ąøą¹ą¹ąøąøą¹ąø„ą¹ąø§
ąøąø“ąø”ąøą¹ 'confirm' ą¹ąøąø·ą¹ąøąø¢ąø·ąøąø¢ąø±ąøąøąø²ąø£ąø„ąø
หรืภ'cancel' ą¹ąøąø·ą¹ąøąø¢ąøą¹ąø„ąø“ąøPreview Settings
User can configure preview behavior:
/toh-settings preview
**Preview Mode:**
- [x] Always show preview (default)
- [ ] Quick mode (apply without preview)
- [ ] Ask each time
**Preview Detail:**
- [ ] Minimal (layout only)
- [x] Normal (layout + components)
- [ ] Verbose (everything)Integration with Other Skills
| Skill | Integration |
|---|---|
| Version Control | Auto-checkpoint before apply |
| Error Handling | Preview potential issues |
| Smart Suggestions | Suggest improvements in preview |
| Progress Tracking | Show progress after apply |
Best Practices
DO:
- ā Always show preview for major changes
- ā Provide live URL when possible
- ā Use ASCII art for layout preview
- ā List all files that will change
- ā Highlight breaking changes
DON'T:
- ā Skip preview for destructive actions
- ā Show too much technical detail
- ā Assume user wants to proceed
- ā Apply without any confirmation for major changes
ASCII Art Templates
Dashboard Layout
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Header ā
āāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā Sidebar ā Main Content ā
ā ā ā
ā Nav ā Cards / Charts / Tables ā
ā Items ā ā
ā ā ā
āāāāāāāāāāā“āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāCard Grid
āāāāāāāāā āāāāāāāāā āāāāāāāāā
ā Card ā ā Card ā ā Card ā
ā 1 ā ā 2 ā ā 3 ā
āāāāāāāāā āāāāāāāāā āāāāāāāāāForm Layout
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Form Title ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā Label [Input ] ā
ā Label [Input ] ā
ā Label [Textarea ] ā
ā [ ] ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā [Cancel] [Submit] ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāTable Layout
āāāāāā¬āāāāāāāāāāā¬āāāāāāāāā¬āāāāāāāāā
ā ID ā Name ā Amount ā Status ā
āāāāāā¼āāāāāāāāāāā¼āāāāāāāāā¼āāāāāāāāā¤
ā 1 ā Item 1 ā ąøæ100 ā ā
ā
ā 2 ā Item 2 ā ąøæ200 ā ā³ ā
āāāāāā“āāāāāāāāāāā“āāāāāāāāā“āāāāāāāāāLast Updated: 2024-12-03