πŸ‘οΈ Preview Mode Skill

SkillDev tools

Show-before-commit previews β€” after completing work, present what changed as a live dev-server URL or a concise plain-language description so the user can confirm or request changes with confidence. Use when delivering visible changes (pages, components, styling) to a running project.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the πŸ‘οΈ Preview Mode Skill skill

What this skill tells your AI

The instructions your AI receives, as published by wasintoh/toh-framework in src/skills/preview-mode/SKILL.md and read by ahel’s review.

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 preview

With 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

  1. AI creates/modifies files
  2. AI shows preview
  3. User reviews
  4. Options:
    • "OK" / "ΰΉ„ΰΈ”ΰΉ‰ΰΉ€ΰΈ₯ΰΈ’" β†’ Continue
    • "แก้ไข [detail]" β†’ AI modifies
    • "ฒกเΰΈ₯ิก" β†’ AI reverts

### Quick Flow (For Simple Changes)

  1. AI shows preview inline
  2. Applies immediately
  3. 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

SkillIntegration
Version ControlAuto-checkpoint before apply
Error HandlingPreview potential issues
Smart SuggestionsSuggest improvements in preview
Progress TrackingShow 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

Signals

GitHub stars
96
Forks
19
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
preview-mode
Source
github.com/wasintoh/toh-framework