.claude/skills/block-decision-matrix/SKILL.md
Decision framework for determining new block vs variant vs existing. Covers decision criteria, edge cases, and anti-patterns. Use this skill when planning block conversion from mocks.
npx skillsauth add NextSpark-js/nextspark block-decision-matrixInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Framework for deciding whether a mock section should use an existing block, create a variant, or require a completely new block.
Mock Section Analysis
│
▼
┌───────────────────────────────┐
│ Find semantically similar │
│ existing block │
└───────────────┬───────────────┘
│
┌─────────────┴─────────────┐
│ │
▼ ▼
FOUND MATCH NO MATCH
│ │
▼ ▼
┌─────────────────────┐ ┌─────────────────┐
│ Structure match │ │ NEW_BLOCK │
│ >= 80%? │ │ (definitely) │
└──────────┬──────────┘ └─────────────────┘
│
┌─────────┴─────────┐
│ │
▼ ▼
YES NO
│ │
▼ ▼
┌─────────────┐ ┌─────────────────────┐
│ How many │ │ Can existing block │
│ new props │ │ be extended? │
│ needed? │ └──────────┬──────────┘
└──────┬──────┘ │
│ ┌──────┴──────┐
│ │ │
▼ ▼ ▼
┌────────┐ YES NO
│ 0-1 │ │ │
│ props │ ▼ ▼
└───┬────┘ ┌─────────┐ ┌─────────┐
│ │ 2-3 │ │NEW_BLOCK│
▼ │ props? │ └─────────┘
┌───────────┐ └────┬────┘
│USE_EXISTING│ │
└───────────┘ ┌────┴────┐
│ │
▼ ▼
YES NO (4+)
│ │
▼ ▼
┌─────────┐ ┌─────────┐
│ VARIANT │ │NEW_BLOCK│
└─────────┘ └─────────┘
Use existing block when:
| Criterion | Required | |-----------|----------| | Same semantic purpose | Yes | | Same HTML structure | Yes (>80%) | | Differences only in styling | Yes | | No new fields needed | 0-1 max | | No new interaction patterns | Yes |
Example scenarios:
hero, change backgroundColorfeatures-grid, change columnscta-section, change content propsCreate variant when:
| Criterion | Required | |-----------|----------| | Same semantic purpose | Yes | | Similar structure (60-80%) | Yes | | 2-3 new fields needed | Yes | | No structural changes | Yes | | Enhancement, not transformation | Yes |
Example scenarios:
badge fieldanimateOnScroll fieldcountdown fieldCreate new block when:
| Criterion | Trigger | |-----------|---------| | Different semantic purpose | Automatic | | 4+ new custom fields | Strong indicator | | Different HTML structure | Strong indicator | | Unique interaction patterns | Strong indicator | | Would require >3 conditionals | Strong indicator |
Example scenarios:
hero-terminal (unique component)features-comparison (different structure)cta-with-form (different interaction)| Custom Props | Decision | Confidence | |--------------|----------|------------| | 0 | USE_EXISTING | 100% | | 1 | USE_EXISTING | 95% | | 2 | Consider VARIANT | 70% | | 3 | VARIANT likely | 60% | | 4 | NEW_BLOCK likely | 70% | | 5+ | NEW_BLOCK | 90% |
| Conditionals | Decision | Rationale | |--------------|----------|-----------| | 0-1 | Acceptable | Normal branching | | 2 | Review | May be overloading | | 3 | Concern | Likely should split | | 4+ | Split required | Anti-pattern territory |
Initial assessment: Variant of hero
Final decision: NEW_BLOCK → hero-terminal
Analysis:
Existing hero structure:
- title (string)
- content (string)
- cta (object)
- backgroundImage (string)
- textColor (enum)
Terminal requires:
- terminalLines (array of {command, output, delay})
- typingSpeed (number)
- cursorStyle (enum)
- promptSymbol (string)
- showLineNumbers (boolean)
Why NEW_BLOCK:
<pre> blocks)Initial assessment: Variant of features-grid
Final decision: NEW_BLOCK → features-comparison
Analysis:
Existing features-grid:
- Grid of cards
- Each card: icon, title, description
Comparison table needs:
- Table headers (feature names)
- Row groups (categories)
- Check/X marks per plan
- Sticky header on scroll
Why NEW_BLOCK:
Initial assessment: NEW_BLOCK
Final decision: VARIANT → stats-counter with animateOnScroll
Analysis:
Existing stats-counter:
- Array of {value, label, prefix, suffix}
- Grid layout options
Animation needs:
- animateOnScroll (boolean)
- animationDuration (number)
Why VARIANT:
Initial assessment: Variant of cta-section
Final decision: NEW_BLOCK → cta-with-form
Analysis:
Existing cta-section:
- title, content
- primary button
- secondary button (optional)
Form needs:
- Form fields configuration
- Validation rules
- Success/error states
- Integration settings (API endpoint)
Why NEW_BLOCK:
When conditionals accumulate:
// BAD - Over-engineered block
function HeroBlock(props) {
return (
<section>
{props.variant === 'terminal' && <TerminalAnimation {...} />}
{props.variant === 'video' && <VideoPlayer {...} />}
{props.variant === 'form' && <LeadForm {...} />}
{props.variant === 'slider' && <ImageSlider {...} />}
{props.variant === 'basic' && <BasicHero {...} />}
</section>
)
}
Problems:
Solution: Split into focused blocks:
hero (basic)hero-terminalhero-videohero-with-formhero-sliderAdding fields "just in case":
// BAD - Too many optional fields
interface HeroProps {
title?: string
subtitle?: string
subtitle2?: string
subtitle3?: string
badge?: string
badgeColor?: string
badgeIcon?: string
badgePosition?: string
video?: string
videoAutoplay?: boolean
videoMuted?: boolean
videoLoop?: boolean
// ... 30 more optional fields
}
Problems:
Solution: Create specific variants for specific needs.
One block trying to do everything:
// BAD - One block for all content sections
function ContentBlock(props) {
switch (props.layout) {
case 'hero': return <HeroLayout {...} />
case 'features': return <FeaturesLayout {...} />
case 'cta': return <CTALayout {...} />
case 'testimonials': return <TestimonialsLayout {...} />
// ... 20 more layouts
}
}
Problems:
Solution: Separate blocks per semantic purpose.
Before finalizing decision:
REUSE: Same purpose + Same structure + 0-1 props
VARIANT: Same purpose + Similar structure + 2-3 props
NEW: Different purpose OR 4+ props OR Different structure
page-builder-blocks - Block structure and patternsmock-analysis - For understanding mock requirementsdevelopment
Zod validation patterns for this Next.js application. Covers schema definition, API validation, form integration, error formatting, and type inference. Use this skill when implementing validation for APIs, forms, or entity schemas.
development
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
testing
Test coverage metrics and registry system for this Next.js application. Covers FEATURE_REGISTRY, FLOW_REGISTRY, TAGS_REGISTRY, and coverage metrics interpretation. Use this skill when evaluating test coverage, identifying gaps, or planning testing priorities.
development
TanStack Query (React Query) patterns for data fetching in this Next.js application. Covers useQuery, useMutation, optimistic updates, cache invalidation, and anti-patterns. Use this skill when implementing data fetching or state management with server data.