source-command-snapshot
БесплатноБез исполняемых скриптовНе проверенMigrated source command `snapshot`
от databayt★ 19 звёзд на GitHubОб этом скилле
source-command-snapshot
Use this skill when the user asks to run the migrated source command snapshot.
Command Template
Snapshot Command - Visual UI Testing
Generate and validate visual snapshots for UI components using Playwright
Usage
/snapshot [component|page|all] [options]
Examples
/snapshot StudentCard # Snapshot specific component
/snapshot /students # Snapshot page route
/snapshot all --update # Update all snapshots
/snapshot StudentForm --mobile # Mobile viewport snapshot
Process
1. Identify Target
- Parse command arguments to determine what to snapshot
- Locate component or page files
- Check for existing snapshots
2. Generate Snapshot Test
// Generate tests file
import { expect, test } from "@playwright/tests"
test.describe("Visual Snapshots: ${componentName}", () => {
test("default state", async ({ page }) => {
await page.goto("/components/${componentName}")
await expect(page).toHaveScreenshot("${componentName}-default.png")
})
test("hover state", async ({ page }) => {
await page.goto("/components/${componentName}")
await page.hover('[data-testid="${componentName}"]')
await expect(page).toHaveScreenshot("${componentName}-hover.png")
})
test("mobile viewport", async ({ page }) => {
await page.setViewportSize({ width: 375, height: 667 })
await page.goto("/components/${componentName}")
await expect(page).toHaveScreenshot("${componentName}-mobile.png")
})
})
3. Run Snapshot Tests
# Execute Playwright snapshot tests
pnpm playwright tests --project=chromium --grep="Visual Snapshots"
# Update snapshots if --update flag
pnpm playwright tests --update-snapshots
4. Multi-Browser Testing
- Chrome/Chromium (default)
- Firefox (cross-browser)
- Safari/WebKit (macOS)
- Mobile viewports (responsive)
5. Accessibility Snapshots
// Include accessibility tree snapshot
const accessibilitySnapshot = await page.accessibility.snapshot()
await expect(accessibilitySnapshot).toMatchSnapshot(
"${componentName}-a11y.json"
)
6. Dark Mode Snapshots
// Test both light and dark themes
test("dark mode", async ({ page }) => {
await page.emulateMedia({ colorScheme: "dark" })
await page.goto("/components/${componentName}")
await expect(page).toHaveScreenshot("${componentName}-dark.png")
})
Options
Flags
--update: Update existing snapshots--mobile: Include mobile viewports--a11y: Include accessibility snapshots--dark: Include dark mode snapshots--all-browsers: Test all browsers--diff: Show visual diff for failures
Viewport Presets
desktop: 1920x1080laptop: 1366x768tablet: 768x1024mobile: 375x667
Integration with Hogwarts Platform
Component Library Snapshots
# Snapshot all shadcn/ui components
/snapshot components/ui/* --update
# Specific school-dashboard components
/snapshot StudentCard TeacherCard ClassroomCard
Critical Page Snapshots
# Snapshot key pages
/snapshot /lab /students /teachers /exams
Multi-Language Snapshots
# Test Arabic RTL layout
/snapshot StudentForm --lang=ar
# Test English LTR layout
/snapshot StudentForm --lang=en
Validation Rules
Snapshot Comparison
- Pixel-perfect matching (strict mode)
- Threshold matching (5% tolerance)
- Layout shift detection
- Color contrast validation
- Text rendering consistency
Failure Handling
// On snapshot mismatch
1. Generate diff image
2. Save actual vs expected
3. Create HTML report
4. Suggest fixes
Storage Structure
tests/
snapshots/
StudentCard/
StudentCard-default-chromium.png
StudentCard-hover-chromium.png
StudentCard-mobile-chromium.png
StudentCard-dark-chromium.png
StudentCard-a11y.json
__diff_output__/
StudentCard-default-diff.png
CI/CD Integration
GitHub Actions
- name: Visual Regression Tests
run: |
pnpm playwright install
pnpm /snapshot all
- name: Upload Snapshots
if: failure()
uses: actions/upload-artifact@v3
with:
name: snapshot-diffs
path: tests/snapshots/__diff_output__
Pre-Commit Hook
# Validate changed components
/snapshot --changed-only
Performance Considerations
Optimization
- Parallel snapshot generation
- Cached browser instances
- Smart diffing algorithm
- Compressed image storage
Benchmarks
- Single component: ~2s
- Full page: ~5s
- Component library: ~30s
- All pages: ~2min
Error Recovery
Common Issues
- Timing issues: Add wait conditions
- Flaky elements: Mask dynamic content
- Font loading: Wait for fonts
- Animations: Disable for snapshots
Retry Logic
test.describe.configure({
retries: 2,
timeout: 30000,
})
Success Metrics
- 100% component cover
Установить source-command-snapshot в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл source-command-snapshot?
Migrated source command `snapshot`
Как установить скилл source-command-snapshot?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл source-command-snapshot запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic