Multi-dimensional visual scoring using pixel-diff and structural analysis for design-to-implementation comparison
Analyzes design mockups against implementations using pixel-diff and structural analysis to generate multi-dimensional visual scores.
npx claudepluginhub a5c-ai/babysitterThis skill is limited to using the following tools:
You are visual-diff-scorer - a specialized skill for multi-dimensional visual scoring using pixel-diff and structural analysis to compare design mocks with implementations.
This skill enables comprehensive visual comparison between design mocks and implementation screenshots, producing detailed multi-dimensional scores across layout, typography, colors, spacing, components, and decorative elements.
pixelmatch for pixel-level comparisonScore implementations across 6 dimensions with configurable weights:
const defaultWeights = {
layout: 25, // Structure, positioning, alignment
typography: 20, // Fonts, sizes, weights, spacing
colors: 20, // Colors, gradients, opacity
spacing: 15, // Margins, padding, gaps
components: 10, // Buttons, inputs, cards
decorative: 10 // Icons, illustrations, effects
};
const pixelmatch = require('pixelmatch');
const { PNG } = require('pngjs');
// Compare mock and implementation
const mockImg = PNG.sync.read(fs.readFileSync(mockPath));
const implImg = PNG.sync.read(fs.readFileSync(implPath));
const diff = new PNG({ width, height });
const numDiffPixels = pixelmatch(
mockImg.data,
implImg.data,
diff.data,
width,
height,
{ threshold: 0.1 }
);
const diffPercentage = (numDiffPixels / (width * height)) * 100;
Analyze specific regions for targeted scoring:
const regions = [
{ name: 'header', bounds: { x: 0, y: 0, width: 1920, height: 80 } },
{ name: 'hero', bounds: { x: 0, y: 80, width: 1920, height: 500 } },
{ name: 'content', bounds: { x: 0, y: 580, width: 1920, height: 600 } }
];
for (const region of regions) {
const regionDiff = analyzeRegion(mockImg, implImg, region.bounds);
results.push({ region: region.name, score: regionDiff.score });
}
const Vibrant = require('node-vibrant');
// Extract color palette from mock
const mockPalette = await Vibrant.from(mockPath).getPalette();
// Compare with implementation colors
const colorDelta = calculateColorDelta(mockPalette, implPalette);
// Analyze DOM structure alignment
const mockStructure = await extractStructure(mockAnalysis);
const implStructure = await extractStructure(page);
const structuralScore = compareStructures(mockStructure, implStructure);
{
"type": "object",
"required": ["mockPath", "screenshotPath"],
"properties": {
"mockPath": {
"type": "string",
"description": "Path to design mock image"
},
"screenshotPath": {
"type": "string",
"description": "Path to implementation screenshot"
},
"scoringWeights": {
"type": "object",
"description": "Custom weights for scoring dimensions"
},
"tolerances": {
"type": "object",
"description": "Tolerance thresholds for scoring"
},
"regions": {
"type": "array",
"description": "Specific regions to analyze"
}
}
}
{
"type": "object",
"properties": {
"overallScore": { "type": "number" },
"breakdown": {
"type": "object",
"properties": {
"layout": { "type": "number" },
"typography": { "type": "number" },
"colors": { "type": "number" },
"spacing": { "type": "number" },
"components": { "type": "number" },
"decorative": { "type": "number" }
}
},
"pixelDiff": {
"type": "object",
"properties": {
"percentage": { "type": "number" },
"diffImagePath": { "type": "string" }
}
},
"differences": { "type": "array" },
"feedback": { "type": "array" }
}
}
This skill integrates with:
pixel-perfect-implementation.js - Main convergence processdesign-qa.js - Design QA verificationhifi-prototyping.js - High-fidelity prototype validation/skill visual-diff-scorer \
--mock designs/homepage-mock.png \
--screenshot artifacts/screenshot.png \
--weights '{"layout":30,"typography":25,"colors":20,"spacing":10,"components":10,"decorative":5}'
Activates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.
Search, retrieve, and install Agent Skills from the prompts.chat registry using MCP tools. Use when the user asks to find skills, browse skill catalogs, install a skill for Claude, or extend Claude's capabilities with reusable AI agent components.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.