diff --git a/.agents/skills/adapt/SKILL.md b/.agents/skills/adapt/SKILL.md deleted file mode 100644 index 21a4241621978c70c42edab64d2808d1b1e64f78..0000000000000000000000000000000000000000 --- a/.agents/skills/adapt/SKILL.md +++ /dev/null @@ -1,199 +0,0 @@ ---- -name: adapt -description: Adapt designs to work across different screen sizes, devices, contexts, or platforms. Implements breakpoints, fluid layouts, and touch targets. Use when the user mentions responsive design, mobile layouts, breakpoints, viewport adaptation, or cross-device compatibility. -version: 2.1.1 -user-invocable: true -argument-hint: "[target] [context (mobile, tablet, print...)]" ---- - -Adapt existing designs to work effectively across different contexts - different screen sizes, devices, platforms, or use cases. - -## MANDATORY PREPARATION - -Invoke /impeccable — it contains design principles, anti-patterns, and the **Context Gathering Protocol**. Follow the protocol before proceeding — if no design context exists yet, you MUST run /impeccable teach first. Additionally gather: target platforms/devices and usage contexts. - ---- - -## Assess Adaptation Challenge - -Understand what needs adaptation and why: - -1. **Identify the source context**: - - What was it designed for originally? (Desktop web? Mobile app?) - - What assumptions were made? (Large screen? Mouse input? Fast connection?) - - What works well in current context? - -2. **Understand target context**: - - **Device**: Mobile, tablet, desktop, TV, watch, print? - - **Input method**: Touch, mouse, keyboard, voice, gamepad? - - **Screen constraints**: Size, resolution, orientation? - - **Connection**: Fast wifi, slow 3G, offline? - - **Usage context**: On-the-go vs desk, quick glance vs focused reading? - - **User expectations**: What do users expect on this platform? - -3. **Identify adaptation challenges**: - - What won't fit? (Content, navigation, features) - - What won't work? (Hover states on touch, tiny touch targets) - - What's inappropriate? (Desktop patterns on mobile, mobile patterns on desktop) - -**CRITICAL**: Adaptation is not just scaling - it's rethinking the experience for the new context. - -## Plan Adaptation Strategy - -Create context-appropriate strategy: - -### Mobile Adaptation (Desktop → Mobile) - -**Layout Strategy**: -- Single column instead of multi-column -- Vertical stacking instead of side-by-side -- Full-width components instead of fixed widths -- Bottom navigation instead of top/side navigation - -**Interaction Strategy**: -- Touch targets 44x44px minimum (not hover-dependent) -- Swipe gestures where appropriate (lists, carousels) -- Bottom sheets instead of dropdowns -- Thumbs-first design (controls within thumb reach) -- Larger tap areas with more spacing - -**Content Strategy**: -- Progressive disclosure (don't show everything at once) -- Prioritize primary content (secondary content in tabs/accordions) -- Shorter text (more concise) -- Larger text (16px minimum) - -**Navigation Strategy**: -- Hamburger menu or bottom navigation -- Reduce navigation complexity -- Sticky headers for context -- Back button in navigation flow - -### Tablet Adaptation (Hybrid Approach) - -**Layout Strategy**: -- Two-column layouts (not single or three-column) -- Side panels for secondary content -- Master-detail views (list + detail) -- Adaptive based on orientation (portrait vs landscape) - -**Interaction Strategy**: -- Support both touch and pointer -- Touch targets 44x44px but allow denser layouts than phone -- Side navigation drawers -- Multi-column forms where appropriate - -### Desktop Adaptation (Mobile → Desktop) - -**Layout Strategy**: -- Multi-column layouts (use horizontal space) -- Side navigation always visible -- Multiple information panels simultaneously -- Fixed widths with max-width constraints (don't stretch to 4K) - -**Interaction Strategy**: -- Hover states for additional information -- Keyboard shortcuts -- Right-click context menus -- Drag and drop where helpful -- Multi-select with Shift/Cmd - -**Content Strategy**: -- Show more information upfront (less progressive disclosure) -- Data tables with many columns -- Richer visualizations -- More detailed descriptions - -### Print Adaptation (Screen → Print) - -**Layout Strategy**: -- Page breaks at logical points -- Remove navigation, footer, interactive elements -- Black and white (or limited color) -- Proper margins for binding - -**Content Strategy**: -- Expand shortened content (show full URLs, hidden sections) -- Add page numbers, headers, footers -- Include metadata (print date, page title) -- Convert charts to print-friendly versions - -### Email Adaptation (Web → Email) - -**Layout Strategy**: -- Narrow width (600px max) -- Single column only -- Inline CSS (no external stylesheets) -- Table-based layouts (for email client compatibility) - -**Interaction Strategy**: -- Large, obvious CTAs (buttons not text links) -- No hover states (not reliable) -- Deep links to web app for complex interactions - -## Implement Adaptations - -Apply changes systematically: - -### Responsive Breakpoints - -Choose appropriate breakpoints: -- Mobile: 320px-767px -- Tablet: 768px-1023px -- Desktop: 1024px+ -- Or content-driven breakpoints (where design breaks) - -### Layout Adaptation Techniques - -- **CSS Grid/Flexbox**: Reflow layouts automatically -- **Container Queries**: Adapt based on container, not viewport -- **`clamp()`**: Fluid sizing between min and max -- **Media queries**: Different styles for different contexts -- **Display properties**: Show/hide elements per context - -### Touch Adaptation - -- Increase touch target sizes (44x44px minimum) -- Add more spacing between interactive elements -- Remove hover-dependent interactions -- Add touch feedback (ripples, highlights) -- Consider thumb zones (easier to reach bottom than top) - -### Content Adaptation - -- Use `display: none` sparingly (still downloads) -- Progressive enhancement (core content first, enhancements on larger screens) -- Lazy loading for off-screen content -- Responsive images (`srcset`, `picture` element) - -### Navigation Adaptation - -- Transform complex nav to hamburger/drawer on mobile -- Bottom nav bar for mobile apps -- Persistent side navigation on desktop -- Breadcrumbs on smaller screens for context - -**IMPORTANT**: Test on real devices, not just browser DevTools. Device emulation is helpful but not perfect. - -**NEVER**: -- Hide core functionality on mobile (if it matters, make it work) -- Assume desktop = powerful device (consider accessibility, older machines) -- Use different information architecture across contexts (confusing) -- Break user expectations for platform (mobile users expect mobile patterns) -- Forget landscape orientation on mobile/tablet -- Use generic breakpoints blindly (use content-driven breakpoints) -- Ignore touch on desktop (many desktop devices have touch) - -## Verify Adaptations - -Test thoroughly across contexts: - -- **Real devices**: Test on actual phones, tablets, desktops -- **Different orientations**: Portrait and landscape -- **Different browsers**: Safari, Chrome, Firefox, Edge -- **Different OS**: iOS, Android, Windows, macOS -- **Different input methods**: Touch, mouse, keyboard -- **Edge cases**: Very small screens (320px), very large screens (4K) -- **Slow connections**: Test on throttled network - -Remember: You're a cross-platform design expert. Make experiences that feel native to each context while maintaining brand and functionality consistency. Adapt intentionally, test thoroughly. \ No newline at end of file diff --git a/.agents/skills/audit/SKILL.md b/.agents/skills/audit/SKILL.md deleted file mode 100644 index ea30301c13d4d1bb79b45affda1429e0eac64d4b..0000000000000000000000000000000000000000 --- a/.agents/skills/audit/SKILL.md +++ /dev/null @@ -1,148 +0,0 @@ ---- -name: audit -description: Run technical quality checks across accessibility, performance, theming, responsive design, and anti-patterns. Generates a scored report with P0-P3 severity ratings and actionable plan. Use when the user wants an accessibility check, performance audit, or technical quality review. -version: 2.1.1 -user-invocable: true -argument-hint: "[area (feature, page, component...)]" ---- - -## MANDATORY PREPARATION - -Invoke /impeccable — it contains design principles, anti-patterns, and the **Context Gathering Protocol**. Follow the protocol before proceeding — if no design context exists yet, you MUST run /impeccable teach first. - ---- - -Run systematic **technical** quality checks and generate a comprehensive report. Don't fix issues — document them for other commands to address. - -This is a code-level audit, not a design critique. Check what's measurable and verifiable in the implementation. - -## Diagnostic Scan - -Run comprehensive checks across 5 dimensions. Score each dimension 0-4 using the criteria below. - -### 1. Accessibility (A11y) - -**Check for**: -- **Contrast issues**: Text contrast ratios < 4.5:1 (or 7:1 for AAA) -- **Missing ARIA**: Interactive elements without proper roles, labels, or states -- **Keyboard navigation**: Missing focus indicators, illogical tab order, keyboard traps -- **Semantic HTML**: Improper heading hierarchy, missing landmarks, divs instead of buttons -- **Alt text**: Missing or poor image descriptions -- **Form issues**: Inputs without labels, poor error messaging, missing required indicators - -**Score 0-4**: 0=Inaccessible (fails WCAG A), 1=Major gaps (few ARIA labels, no keyboard nav), 2=Partial (some a11y effort, significant gaps), 3=Good (WCAG AA mostly met, minor gaps), 4=Excellent (WCAG AA fully met, approaches AAA) - -### 2. Performance - -**Check for**: -- **Layout thrashing**: Reading/writing layout properties in loops -- **Expensive animations**: Animating layout properties (width, height, top, left) instead of transform/opacity -- **Missing optimization**: Images without lazy loading, unoptimized assets, missing will-change -- **Bundle size**: Unnecessary imports, unused dependencies -- **Render performance**: Unnecessary re-renders, missing memoization - -**Score 0-4**: 0=Severe issues (layout thrash, unoptimized everything), 1=Major problems (no lazy loading, expensive animations), 2=Partial (some optimization, gaps remain), 3=Good (mostly optimized, minor improvements possible), 4=Excellent (fast, lean, well-optimized) - -### 3. Theming - -**Check for**: -- **Hard-coded colors**: Colors not using design tokens -- **Broken dark mode**: Missing dark mode variants, poor contrast in dark theme -- **Inconsistent tokens**: Using wrong tokens, mixing token types -- **Theme switching issues**: Values that don't update on theme change - -**Score 0-4**: 0=No theming (hard-coded everything), 1=Minimal tokens (mostly hard-coded), 2=Partial (tokens exist but inconsistently used), 3=Good (tokens used, minor hard-coded values), 4=Excellent (full token system, dark mode works perfectly) - -### 4. Responsive Design - -**Check for**: -- **Fixed widths**: Hard-coded widths that break on mobile -- **Touch targets**: Interactive elements < 44x44px -- **Horizontal scroll**: Content overflow on narrow viewports -- **Text scaling**: Layouts that break when text size increases -- **Missing breakpoints**: No mobile/tablet variants - -**Score 0-4**: 0=Desktop-only (breaks on mobile), 1=Major issues (some breakpoints, many failures), 2=Partial (works on mobile, rough edges), 3=Good (responsive, minor touch target or overflow issues), 4=Excellent (fluid, all viewports, proper touch targets) - -### 5. Anti-Patterns (CRITICAL) - -Check against ALL the **DON'T** guidelines in the impeccable skill. Look for AI slop tells (AI color palette, gradient text, glassmorphism, hero metrics, card grids, generic fonts) and general design anti-patterns (gray on color, nested cards, bounce easing, redundant copy). - -**Score 0-4**: 0=AI slop gallery (5+ tells), 1=Heavy AI aesthetic (3-4 tells), 2=Some tells (1-2 noticeable), 3=Mostly clean (subtle issues only), 4=No AI tells (distinctive, intentional design) - -## Generate Report - -### Audit Health Score - -| # | Dimension | Score | Key Finding | -|---|-----------|-------|-------------| -| 1 | Accessibility | ? | [most critical a11y issue or "--"] | -| 2 | Performance | ? | | -| 3 | Responsive Design | ? | | -| 4 | Theming | ? | | -| 5 | Anti-Patterns | ? | | -| **Total** | | **??/20** | **[Rating band]** | - -**Rating bands**: 18-20 Excellent (minor polish), 14-17 Good (address weak dimensions), 10-13 Acceptable (significant work needed), 6-9 Poor (major overhaul), 0-5 Critical (fundamental issues) - -### Anti-Patterns Verdict -**Start here.** Pass/fail: Does this look AI-generated? List specific tells. Be brutally honest. - -### Executive Summary -- Audit Health Score: **??/20** ([rating band]) -- Total issues found (count by severity: P0/P1/P2/P3) -- Top 3-5 critical issues -- Recommended next steps - -### Detailed Findings by Severity - -Tag every issue with **P0-P3 severity**: -- **P0 Blocking**: Prevents task completion — fix immediately -- **P1 Major**: Significant difficulty or WCAG AA violation — fix before release -- **P2 Minor**: Annoyance, workaround exists — fix in next pass -- **P3 Polish**: Nice-to-fix, no real user impact — fix if time permits - -For each issue, document: -- **[P?] Issue name** -- **Location**: Component, file, line -- **Category**: Accessibility / Performance / Theming / Responsive / Anti-Pattern -- **Impact**: How it affects users -- **WCAG/Standard**: Which standard it violates (if applicable) -- **Recommendation**: How to fix it -- **Suggested command**: Which command to use (prefer: /animate, /quieter, /shape, /optimize, /adapt, /clarify, /layout, /distill, /delight, /audit, /harden, /polish, /bolder, /typeset, /critique, /colorize, /overdrive) - -### Patterns & Systemic Issues - -Identify recurring problems that indicate systemic gaps rather than one-off mistakes: -- "Hard-coded colors appear in 15+ components, should use design tokens" -- "Touch targets consistently too small (<44px) throughout mobile experience" - -### Positive Findings - -Note what's working well — good practices to maintain and replicate. - -## Recommended Actions - -List recommended commands in priority order (P0 first, then P1, then P2): - -1. **[P?] `/command-name`** — Brief description (specific context from audit findings) -2. **[P?] `/command-name`** — Brief description (specific context) - -**Rules**: Only recommend commands from: /animate, /quieter, /shape, /optimize, /adapt, /clarify, /layout, /distill, /delight, /audit, /harden, /polish, /bolder, /typeset, /critique, /colorize, /overdrive. Map findings to the most appropriate command. End with `/polish` as the final step if any fixes were recommended. - -After presenting the summary, tell the user: - -> You can ask me to run these one at a time, all at once, or in any order you prefer. -> -> Re-run `/audit` after fixes to see your score improve. - -**IMPORTANT**: Be thorough but actionable. Too many P3 issues creates noise. Focus on what actually matters. - -**NEVER**: -- Report issues without explaining impact (why does this matter?) -- Provide generic recommendations (be specific and actionable) -- Skip positive findings (celebrate what works) -- Forget to prioritize (everything can't be P0) -- Report false positives without verification - -Remember: You're a technical quality auditor. Document systematically, prioritize ruthlessly, cite specific code locations, and provide clear paths to improvement. \ No newline at end of file diff --git a/.agents/skills/bolder/SKILL.md b/.agents/skills/bolder/SKILL.md deleted file mode 100644 index e80f55ed1f28e4ce9185c64dca5e62854f3b668d..0000000000000000000000000000000000000000 --- a/.agents/skills/bolder/SKILL.md +++ /dev/null @@ -1,117 +0,0 @@ ---- -name: bolder -description: Amplify safe or boring designs to make them more visually interesting and stimulating. Increases impact while maintaining usability. Use when the user says the design looks bland, generic, too safe, lacks personality, or wants more visual impact and character. -version: 2.1.1 -user-invocable: true -argument-hint: "[target]" ---- - -Increase visual impact and personality in designs that are too safe, generic, or visually underwhelming, creating more engaging and memorable experiences. - -## MANDATORY PREPARATION - -Invoke /impeccable — it contains design principles, anti-patterns, and the **Context Gathering Protocol**. Follow the protocol before proceeding — if no design context exists yet, you MUST run /impeccable teach first. - ---- - -## Assess Current State - -Analyze what makes the design feel too safe or boring: - -1. **Identify weakness sources**: - - **Generic choices**: System fonts, basic colors, standard layouts - - **Timid scale**: Everything is medium-sized with no drama - - **Low contrast**: Everything has similar visual weight - - **Static**: No motion, no energy, no life - - **Predictable**: Standard patterns with no surprises - - **Flat hierarchy**: Nothing stands out or commands attention - -2. **Understand the context**: - - What's the brand personality? (How far can we push?) - - What's the purpose? (Marketing can be bolder than financial dashboards) - - Who's the audience? (What will resonate?) - - What are the constraints? (Brand guidelines, accessibility, performance) - -If any of these are unclear from the codebase, ask the user directly to clarify what you cannot infer. - -**CRITICAL**: "Bolder" doesn't mean chaotic or garish. It means distinctive, memorable, and confident. Think intentional drama, not random chaos. - -**WARNING - AI SLOP TRAP**: When making things "bolder," AI defaults to the same tired tricks: cyan/purple gradients, glassmorphism, neon accents on dark backgrounds, gradient text on metrics. These are the OPPOSITE of bold—they're generic. Review ALL the DON'T guidelines in the impeccable skill before proceeding. Bold means distinctive, not "more effects." - -## Plan Amplification - -Create a strategy to increase impact while maintaining coherence: - -- **Focal point**: What should be the hero moment? (Pick ONE, make it amazing) -- **Personality direction**: Maximalist chaos? Elegant drama? Playful energy? Dark moody? Choose a lane. -- **Risk budget**: How experimental can we be? Push boundaries within constraints. -- **Hierarchy amplification**: Make big things BIGGER, small things smaller (increase contrast) - -**IMPORTANT**: Bold design must still be usable. Impact without function is just decoration. - -## Amplify the Design - -Systematically increase impact across these dimensions: - -### Typography Amplification -- **Replace generic fonts**: Swap system fonts for distinctive choices (see impeccable skill for inspiration) -- **Extreme scale**: Create dramatic size jumps (3x-5x differences, not 1.5x) -- **Weight contrast**: Pair 900 weights with 200 weights, not 600 with 400 -- **Unexpected choices**: Variable fonts, display fonts for headlines, condensed/extended widths, monospace as intentional accent (not as lazy "dev tool" default) - -### Color Intensification -- **Increase saturation**: Shift to more vibrant, energetic colors (but not neon) -- **Bold palette**: Introduce unexpected color combinations—avoid the purple-blue gradient AI slop -- **Dominant color strategy**: Let one bold color own 60% of the design -- **Sharp accents**: High-contrast accent colors that pop -- **Tinted neutrals**: Replace pure grays with tinted grays that harmonize with your palette -- **Rich gradients**: Intentional multi-stop gradients (not generic purple-to-blue) - -### Spatial Drama -- **Extreme scale jumps**: Make important elements 3-5x larger than surroundings -- **Break the grid**: Let hero elements escape containers and cross boundaries -- **Asymmetric layouts**: Replace centered, balanced layouts with tension-filled asymmetry -- **Generous space**: Use white space dramatically (100-200px gaps, not 20-40px) -- **Overlap**: Layer elements intentionally for depth - -### Visual Effects -- **Dramatic shadows**: Large, soft shadows for elevation (but not generic drop shadows on rounded rectangles) -- **Background treatments**: Mesh patterns, noise textures, geometric patterns, intentional gradients (not purple-to-blue) -- **Texture & depth**: Grain, halftone, duotone, layered elements—NOT glassmorphism (it's overused AI slop) -- **Borders & frames**: Thick borders, decorative frames, custom shapes (not rounded rectangles with colored border on one side) -- **Custom elements**: Illustrative elements, custom icons, decorative details that reinforce brand - -### Motion & Animation -- **Entrance choreography**: Staggered, dramatic page load animations with 50-100ms delays -- **Scroll effects**: Parallax, reveal animations, scroll-triggered sequences -- **Micro-interactions**: Satisfying hover effects, click feedback, state changes -- **Transitions**: Smooth, noticeable transitions using ease-out-quart/quint/expo (not bounce or elastic—they cheapen the effect) - -### Composition Boldness -- **Hero moments**: Create clear focal points with dramatic treatment -- **Diagonal flows**: Escape horizontal/vertical rigidity with diagonal arrangements -- **Full-bleed elements**: Use full viewport width/height for impact -- **Unexpected proportions**: Golden ratio? Throw it out. Try 70/30, 80/20 splits - -**NEVER**: -- Add effects randomly without purpose (chaos ≠ bold) -- Sacrifice readability for aesthetics (body text must be readable) -- Make everything bold (then nothing is bold - need contrast) -- Ignore accessibility (bold design must still meet WCAG standards) -- Overwhelm with motion (animation fatigue is real) -- Copy trendy aesthetics blindly (bold means distinctive, not derivative) - -## Verify Quality - -Ensure amplification maintains usability and coherence: - -- **NOT AI slop**: Does this look like every other AI-generated "bold" design? If yes, start over. -- **Still functional**: Can users accomplish tasks without distraction? -- **Coherent**: Does everything feel intentional and unified? -- **Memorable**: Will users remember this experience? -- **Performant**: Do all these effects run smoothly? -- **Accessible**: Does it still meet accessibility standards? - -**The test**: If you showed this to someone and said "AI made this bolder," would they believe you immediately? If yes, you've failed. Bold means distinctive, not "more AI effects." - -Remember: Bold design is confident design. It takes risks, makes statements, and creates memorable experiences. But bold without strategy is just loud. Be intentional, be dramatic, be unforgettable. \ No newline at end of file diff --git a/.agents/skills/clarify/SKILL.md b/.agents/skills/clarify/SKILL.md deleted file mode 100644 index f0013b2cf0c012914d15fd06990758281ebda82f..0000000000000000000000000000000000000000 --- a/.agents/skills/clarify/SKILL.md +++ /dev/null @@ -1,183 +0,0 @@ ---- -name: clarify -description: Improve unclear UX copy, error messages, microcopy, labels, and instructions to make interfaces easier to understand. Use when the user mentions confusing text, unclear labels, bad error messages, hard-to-follow instructions, or wanting better UX writing. -version: 2.1.1 -user-invocable: true -argument-hint: "[target]" ---- - -Identify and improve unclear, confusing, or poorly written interface text to make the product easier to understand and use. - -## MANDATORY PREPARATION - -Invoke /impeccable — it contains design principles, anti-patterns, and the **Context Gathering Protocol**. Follow the protocol before proceeding — if no design context exists yet, you MUST run /impeccable teach first. Additionally gather: audience technical level and users' mental state in context. - ---- - -## Assess Current Copy - -Identify what makes the text unclear or ineffective: - -1. **Find clarity problems**: - - **Jargon**: Technical terms users won't understand - - **Ambiguity**: Multiple interpretations possible - - **Passive voice**: "Your file has been uploaded" vs "We uploaded your file" - - **Length**: Too wordy or too terse - - **Assumptions**: Assuming user knowledge they don't have - - **Missing context**: Users don't know what to do or why - - **Tone mismatch**: Too formal, too casual, or inappropriate for situation - -2. **Understand the context**: - - Who's the audience? (Technical? General? First-time users?) - - What's the user's mental state? (Stressed during error? Confident during success?) - - What's the action? (What do we want users to do?) - - What's the constraint? (Character limits? Space limitations?) - -**CRITICAL**: Clear copy helps users succeed. Unclear copy creates frustration, errors, and support tickets. - -## Plan Copy Improvements - -Create a strategy for clearer communication: - -- **Primary message**: What's the ONE thing users need to know? -- **Action needed**: What should users do next (if anything)? -- **Tone**: How should this feel? (Helpful? Apologetic? Encouraging?) -- **Constraints**: Length limits, brand voice, localization considerations - -**IMPORTANT**: Good UX writing is invisible. Users should understand immediately without noticing the words. - -## Improve Copy Systematically - -Refine text across these common areas: - -### Error Messages -**Bad**: "Error 403: Forbidden" -**Good**: "You don't have permission to view this page. Contact your admin for access." - -**Bad**: "Invalid input" -**Good**: "Email addresses need an @ symbol. Try: name@example.com" - -**Principles**: -- Explain what went wrong in plain language -- Suggest how to fix it -- Don't blame the user -- Include examples when helpful -- Link to help/support if applicable - -### Form Labels & Instructions -**Bad**: "DOB (MM/DD/YYYY)" -**Good**: "Date of birth" (with placeholder showing format) - -**Bad**: "Enter value here" -**Good**: "Your email address" or "Company name" - -**Principles**: -- Use clear, specific labels (not generic placeholders) -- Show format expectations with examples -- Explain why you're asking (when not obvious) -- Put instructions before the field, not after -- Keep required field indicators clear - -### Button & CTA Text -**Bad**: "Click here" | "Submit" | "OK" -**Good**: "Create account" | "Save changes" | "Got it, thanks" - -**Principles**: -- Describe the action specifically -- Use active voice (verb + noun) -- Match user's mental model -- Be specific ("Save" is better than "OK") - -### Help Text & Tooltips -**Bad**: "This is the username field" -**Good**: "Choose a username. You can change this later in Settings." - -**Principles**: -- Add value (don't just repeat the label) -- Answer the implicit question ("What is this?" or "Why do you need this?") -- Keep it brief but complete -- Link to detailed docs if needed - -### Empty States -**Bad**: "No items" -**Good**: "No projects yet. Create your first project to get started." - -**Principles**: -- Explain why it's empty (if not obvious) -- Show next action clearly -- Make it welcoming, not dead-end - -### Success Messages -**Bad**: "Success" -**Good**: "Settings saved! Your changes will take effect immediately." - -**Principles**: -- Confirm what happened -- Explain what happens next (if relevant) -- Be brief but complete -- Match the user's emotional moment (celebrate big wins) - -### Loading States -**Bad**: "Loading..." (for 30+ seconds) -**Good**: "Analyzing your data... this usually takes 30-60 seconds" - -**Principles**: -- Set expectations (how long?) -- Explain what's happening (when it's not obvious) -- Show progress when possible -- Offer escape hatch if appropriate ("Cancel") - -### Confirmation Dialogs -**Bad**: "Are you sure?" -**Good**: "Delete 'Project Alpha'? This can't be undone." - -**Principles**: -- State the specific action -- Explain consequences (especially for destructive actions) -- Use clear button labels ("Delete project" not "Yes") -- Don't overuse confirmations (only for risky actions) - -### Navigation & Wayfinding -**Bad**: Generic labels like "Items" | "Things" | "Stuff" -**Good**: Specific labels like "Your projects" | "Team members" | "Settings" - -**Principles**: -- Be specific and descriptive -- Use language users understand (not internal jargon) -- Make hierarchy clear -- Consider information scent (breadcrumbs, current location) - -## Apply Clarity Principles - -Every piece of copy should follow these rules: - -1. **Be specific**: "Enter email" not "Enter value" -2. **Be concise**: Cut unnecessary words (but don't sacrifice clarity) -3. **Be active**: "Save changes" not "Changes will be saved" -4. **Be human**: "Oops, something went wrong" not "System error encountered" -5. **Be helpful**: Tell users what to do, not just what happened -6. **Be consistent**: Use same terms throughout (don't vary for variety) - -**NEVER**: -- Use jargon without explanation -- Blame users ("You made an error" → "This field is required") -- Be vague ("Something went wrong" without explanation) -- Use passive voice unnecessarily -- Write overly long explanations (be concise) -- Use humor for errors (be empathetic instead) -- Assume technical knowledge -- Vary terminology (pick one term and stick with it) -- Repeat information (headers restating intros, redundant explanations) -- Use placeholders as the only labels (they disappear when users type) - -## Verify Improvements - -Test that copy improvements work: - -- **Comprehension**: Can users understand without context? -- **Actionability**: Do users know what to do next? -- **Brevity**: Is it as short as possible while remaining clear? -- **Consistency**: Does it match terminology elsewhere? -- **Tone**: Is it appropriate for the situation? - -Remember: You're a clarity expert with excellent communication skills. Write like you're explaining to a smart friend who's unfamiliar with the product. Be clear, be helpful, be human. \ No newline at end of file diff --git a/.agents/skills/critique/SKILL.md b/.agents/skills/critique/SKILL.md deleted file mode 100644 index a827f2241acd992f8e134500c83eebef057e1dfe..0000000000000000000000000000000000000000 --- a/.agents/skills/critique/SKILL.md +++ /dev/null @@ -1,225 +0,0 @@ ---- -name: critique -description: Evaluate design from a UX perspective, assessing visual hierarchy, information architecture, emotional resonance, cognitive load, and overall quality with quantitative scoring, persona-based testing, automated anti-pattern detection, and actionable feedback. Use when the user asks to review, critique, evaluate, or give feedback on a design or component. -version: 2.1.1 -user-invocable: true -argument-hint: "[area (feature, page, component...)]" ---- - -## STEPS - -### Step 1: Preparation - -Invoke /impeccable, which contains design principles, anti-patterns, and the **Context Gathering Protocol**. Follow the protocol before proceeding. If no design context exists yet, you MUST run /impeccable teach first. Additionally gather: what the interface is trying to accomplish. - -### Step 2: Gather Assessments - -Launch two independent assessments. **Neither must see the other's output** to avoid bias. - -You SHOULD delegate each assessment to a separate sub-agent for independence. Use your environment's agent spawning mechanism (e.g., Claude Code's `Agent` tool, or Codex's subagent spawning). Sub-agents should return their findings as structured text. Do NOT output findings to the user yet. - -If sub-agents are not available in the current environment, complete each assessment sequentially, writing findings to internal notes before proceeding. - -**Tab isolation**: When browser automation is available, each assessment MUST create its own new tab. Never reuse an existing tab, even if one is already open at the correct URL. This prevents the two assessments from interfering with each other's page state. - -#### Assessment A: LLM Design Review - -Read the relevant source files (HTML, CSS, JS/TS) and, if browser automation is available, visually inspect the live page. **Create a new tab** for this; do not reuse existing tabs. After navigation, label the tab by setting the document title: -```javascript -document.title = '[LLM] ' + document.title; -``` -Think like a design director. Evaluate: - -**AI Slop Detection (CRITICAL)**: Does this look like every other AI-generated interface? Review against ALL **DON'T** guidelines in the impeccable skill. Check for AI color palette, gradient text, dark glows, glassmorphism, hero metric layouts, identical card grids, generic fonts, and all other tells. **The test**: If someone said "AI made this," would you believe them immediately? - -**Holistic Design Review**: visual hierarchy (eye flow, primary action clarity), information architecture (structure, grouping, cognitive load), emotional resonance (does it match brand and audience?), discoverability (are interactive elements obvious?), composition (balance, whitespace, rhythm), typography (hierarchy, readability, font choices), color (purposeful use, cohesion, accessibility), states & edge cases (empty, loading, error, success), microcopy (clarity, tone, helpfulness). - -**Cognitive Load** (consult [cognitive-load](reference/cognitive-load.md)): -- Run the 8-item cognitive load checklist. Report failure count: 0-1 = low (good), 2-3 = moderate, 4+ = critical. -- Count visible options at each decision point. If >4, flag it. -- Check for progressive disclosure: is complexity revealed only when needed? - -**Emotional Journey**: -- What emotion does this interface evoke? Is that intentional? -- **Peak-end rule**: Is the most intense moment positive? Does the experience end well? -- **Emotional valleys**: Check for anxiety spikes at high-stakes moments (payment, delete, commit). Are there design interventions (progress indicators, reassurance copy, undo options)? - -**Nielsen's Heuristics** (consult [heuristics-scoring](reference/heuristics-scoring.md)): -Score each of the 10 heuristics 0-4. This scoring will be presented in the report. - -Return structured findings covering: AI slop verdict, heuristic scores, cognitive load assessment, what's working (2-3 items), priority issues (3-5 with what/why/fix), minor observations, and provocative questions. - -#### Assessment B: Automated Detection - -Run the bundled deterministic detector, which flags 25 specific patterns (AI slop tells + general design quality). - -**CLI scan**: -```bash -npx impeccable --json [--fast] [target] -``` - -- Pass HTML/JSX/TSX/Vue/Svelte files or directories as `[target]` (anything with markup). Do not pass CSS-only files. -- For URLs, skip the CLI scan (it requires Puppeteer). Use browser visualization instead. -- For large directories (200+ scannable files), use `--fast` (regex-only, skips jsdom) -- For 500+ files, narrow scope or ask the user -- Exit code 0 = clean, 2 = findings - -**Browser visualization** (when browser automation tools are available AND the target is a viewable page): - -The overlay is a **visual aid for the user**. It highlights issues directly in their browser. Do NOT scroll through the page to screenshot overlays. Instead, read the console output to get the results programmatically. - -1. **Start the live detection server**: - ```bash - npx impeccable live & - ``` - Note the port printed to stdout (auto-assigned). Use `--port=PORT` to fix it. -2. **Create a new tab** and navigate to the page (use dev server URL for local files, or direct URL). Do not reuse existing tabs. -3. **Label the tab** via `javascript_tool` so the user can distinguish it: - ```javascript - document.title = '[Human] ' + document.title; - ``` -4. **Scroll to top** to ensure the page is scrolled to the very top before injection -5. **Inject** via `javascript_tool` (replace PORT with the port from step 1): - ```javascript - const s = document.createElement('script'); s.src = 'http://localhost:PORT/detect.js'; document.head.appendChild(s); - ``` -6. Wait 2-3 seconds for the detector to render overlays -7. **Read results from console** using `read_console_messages` with pattern `impeccable`. The detector logs all findings with the `[impeccable]` prefix. Do NOT scroll through the page to take screenshots of the overlays. -8. **Cleanup**: Stop the live server when done: - ```bash - npx impeccable live stop - ``` - -For multi-view targets, inject on 3-5 representative pages. If injection fails, continue with CLI results only. - -Return: CLI findings (JSON), browser console findings (if applicable), and any false positives noted. - -### Step 3: Generate Combined Critique Report - -Synthesize both assessments into a single report. Do NOT simply concatenate. Weave the findings together, noting where the LLM review and detector agree, where the detector caught issues the LLM missed, and where detector findings are false positives. - -Structure your feedback as a design director would: - -#### Design Health Score -> *Consult [heuristics-scoring](reference/heuristics-scoring.md)* - -Present the Nielsen's 10 heuristics scores as a table: - -| # | Heuristic | Score | Key Issue | -|---|-----------|-------|-----------| -| 1 | Visibility of System Status | ? | [specific finding or "n/a" if solid] | -| 2 | Match System / Real World | ? | | -| 3 | User Control and Freedom | ? | | -| 4 | Consistency and Standards | ? | | -| 5 | Error Prevention | ? | | -| 6 | Recognition Rather Than Recall | ? | | -| 7 | Flexibility and Efficiency | ? | | -| 8 | Aesthetic and Minimalist Design | ? | | -| 9 | Error Recovery | ? | | -| 10 | Help and Documentation | ? | | -| **Total** | | **??/40** | **[Rating band]** | - -Be honest with scores. A 4 means genuinely excellent. Most real interfaces score 20-32. - -#### Anti-Patterns Verdict - -**Start here.** Does this look AI-generated? - -**LLM assessment**: Your own evaluation of AI slop tells. Cover overall aesthetic feel, layout sameness, generic composition, missed opportunities for personality. - -**Deterministic scan**: Summarize what the automated detector found, with counts and file locations. Note any additional issues the detector caught that you missed, and flag any false positives. - -**Visual overlays** (if browser was used): Tell the user that overlays are now visible in the **[Human]** tab in their browser, highlighting the detected issues. Summarize what the console output reported. - -#### Overall Impression -A brief gut reaction: what works, what doesn't, and the single biggest opportunity. - -#### What's Working -Highlight 2-3 things done well. Be specific about why they work. - -#### Priority Issues -The 3-5 most impactful design problems, ordered by importance. - -For each issue, tag with **P0-P3 severity** (consult [heuristics-scoring](reference/heuristics-scoring.md) for severity definitions): -- **[P?] What**: Name the problem clearly -- **Why it matters**: How this hurts users or undermines goals -- **Fix**: What to do about it (be concrete) -- **Suggested command**: Which command could address this (from: /animate, /quieter, /shape, /optimize, /adapt, /clarify, /layout, /distill, /delight, /audit, /harden, /polish, /bolder, /typeset, /critique, /colorize, /overdrive) - -#### Persona Red Flags -> *Consult [personas](reference/personas.md)* - -Auto-select 2-3 personas most relevant to this interface type (use the selection table in the reference). If `.github/copilot-instructions.md` contains a `## Design Context` section from `impeccable teach`, also generate 1-2 project-specific personas from the audience/brand info. - -For each selected persona, walk through the primary user action and list specific red flags found: - -**Alex (Power User)**: No keyboard shortcuts detected. Form requires 8 clicks for primary action. Forced modal onboarding. High abandonment risk. - -**Jordan (First-Timer)**: Icon-only nav in sidebar. Technical jargon in error messages ("404 Not Found"). No visible help. Will abandon at step 2. - -Be specific. Name the exact elements and interactions that fail each persona. Don't write generic persona descriptions; write what broke for them. - -#### Minor Observations -Quick notes on smaller issues worth addressing. - -#### Questions to Consider -Provocative questions that might unlock better solutions: -- "What if the primary action were more prominent?" -- "Does this need to feel this complex?" -- "What would a confident version of this look like?" - -**Remember**: -- Be direct. Vague feedback wastes everyone's time. -- Be specific. "The submit button," not "some elements." -- Say what's wrong AND why it matters to users. -- Give concrete suggestions, not just "consider exploring..." -- Prioritize ruthlessly. If everything is important, nothing is. -- Don't soften criticism. Developers need honest feedback to ship great design. - -### Step 4: Ask the User - -**After presenting findings**, use targeted questions based on what was actually found. ask the user directly to clarify what you cannot infer. These answers will shape the action plan. - -Ask questions along these lines (adapt to the specific findings; do NOT ask generic questions): - -1. **Priority direction**: Based on the issues found, ask which category matters most to the user right now. For example: "I found problems with visual hierarchy, color usage, and information overload. Which area should we tackle first?" Offer the top 2-3 issue categories as options. - -2. **Design intent**: If the critique found a tonal mismatch, ask whether it was intentional. For example: "The interface feels clinical and corporate. Is that the intended tone, or should it feel warmer/bolder/more playful?" Offer 2-3 tonal directions as options based on what would fix the issues found. - -3. **Scope**: Ask how much the user wants to take on. For example: "I found N issues. Want to address everything, or focus on the top 3?" Offer scope options like "Top 3 only", "All issues", "Critical issues only". - -4. **Constraints** (optional; only ask if relevant): If the findings touch many areas, ask if anything is off-limits. For example: "Should any sections stay as-is?" This prevents the plan from touching things the user considers done. - -**Rules for questions**: -- Every question must reference specific findings from the report. Never ask generic "who is your audience?" questions. -- Keep it to 2-4 questions maximum. Respect the user's time. -- Offer concrete options, not open-ended prompts. -- If findings are straightforward (e.g., only 1-2 clear issues), skip questions and go directly to Step 5. - -### Step 5: Recommended Actions - -**After receiving the user's answers**, present a prioritized action summary reflecting the user's priorities and scope from Step 4. - -#### Action Summary - -List recommended commands in priority order, based on the user's answers: - -1. **`/command-name`**: Brief description of what to fix (specific context from critique findings) -2. **`/command-name`**: Brief description (specific context) -... - -**Rules for recommendations**: -- Only recommend commands from: /animate, /quieter, /shape, /optimize, /adapt, /clarify, /layout, /distill, /delight, /audit, /harden, /polish, /bolder, /typeset, /critique, /colorize, /overdrive -- Order by the user's stated priorities first, then by impact -- Each item's description should carry enough context that the command knows what to focus on -- Map each Priority Issue to the appropriate command -- Skip commands that would address zero issues -- If the user chose a limited scope, only include items within that scope -- If the user marked areas as off-limits, exclude commands that would touch those areas -- End with `/polish` as the final step if any fixes were recommended - -After presenting the summary, tell the user: - -> You can ask me to run these one at a time, all at once, or in any order you prefer. -> -> Re-run `/critique` after fixes to see your score improve. \ No newline at end of file diff --git a/.agents/skills/delight/SKILL.md b/.agents/skills/delight/SKILL.md deleted file mode 100644 index fedebff9c9c6d3f347de95a5d6c1db195e4a15af..0000000000000000000000000000000000000000 --- a/.agents/skills/delight/SKILL.md +++ /dev/null @@ -1,304 +0,0 @@ ---- -name: delight -description: Add moments of joy, personality, and unexpected touches that make interfaces memorable and enjoyable to use. Elevates functional to delightful. Use when the user asks to add polish, personality, animations, micro-interactions, delight, or make an interface feel fun or memorable. -version: 2.1.1 -user-invocable: true -argument-hint: "[target]" ---- - -Identify opportunities to add moments of joy, personality, and unexpected polish that transform functional interfaces into delightful experiences. - -## MANDATORY PREPARATION - -Invoke /impeccable — it contains design principles, anti-patterns, and the **Context Gathering Protocol**. Follow the protocol before proceeding — if no design context exists yet, you MUST run /impeccable teach first. Additionally gather: what's appropriate for the domain (playful vs professional vs quirky vs elegant). - ---- - -## Assess Delight Opportunities - -Identify where delight would enhance (not distract from) the experience: - -1. **Find natural delight moments**: - - **Success states**: Completed actions (save, send, publish) - - **Empty states**: First-time experiences, onboarding - - **Loading states**: Waiting periods that could be entertaining - - **Achievements**: Milestones, streaks, completions - - **Interactions**: Hover states, clicks, drags - - **Errors**: Softening frustrating moments - - **Easter eggs**: Hidden discoveries for curious users - -2. **Understand the context**: - - What's the brand personality? (Playful? Professional? Quirky? Elegant?) - - Who's the audience? (Tech-savvy? Creative? Corporate?) - - What's the emotional context? (Accomplishment? Exploration? Frustration?) - - What's appropriate? (Banking app ≠ gaming app) - -3. **Define delight strategy**: - - **Subtle sophistication**: Refined micro-interactions (luxury brands) - - **Playful personality**: Whimsical illustrations and copy (consumer apps) - - **Helpful surprises**: Anticipating needs before users ask (productivity tools) - - **Sensory richness**: Satisfying sounds, smooth animations (creative tools) - -If any of these are unclear from the codebase, ask the user directly to clarify what you cannot infer. - -**CRITICAL**: Delight should enhance usability, never obscure it. If users notice the delight more than accomplishing their goal, you've gone too far. - -## Delight Principles - -Follow these guidelines: - -### Delight Amplifies, Never Blocks -- Delight moments should be quick (< 1 second) -- Never delay core functionality for delight -- Make delight skippable or subtle -- Respect user's time and task focus - -### Surprise and Discovery -- Hide delightful details for users to discover -- Reward exploration and curiosity -- Don't announce every delight moment -- Let users share discoveries with others - -### Appropriate to Context -- Match delight to emotional moment (celebrate success, empathize with errors) -- Respect the user's state (don't be playful during critical errors) -- Match brand personality and audience expectations -- Cultural sensitivity (what's delightful varies by culture) - -### Compound Over Time -- Delight should remain fresh with repeated use -- Vary responses (not same animation every time) -- Reveal deeper layers with continued use -- Build anticipation through patterns - -## Delight Techniques - -Add personality and joy through these methods: - -### Micro-interactions & Animation - -**Button delight**: -```css -/* Satisfying button press */ -.button { - transition: transform 0.1s, box-shadow 0.1s; -} -.button:active { - transform: translateY(2px); - box-shadow: 0 2px 4px rgba(0,0,0,0.2); -} - -/* Ripple effect on click */ -/* Smooth lift on hover */ -.button:hover { - transform: translateY(-2px); - transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1); /* ease-out-quart */ -} -``` - -**Loading delight**: -- Playful loading animations (not just spinners) -- Personality in loading messages (write product-specific ones, not generic AI filler) -- Progress indication with encouraging messages -- Skeleton screens with subtle animations - -**Success animations**: -- Checkmark draw animation -- Confetti burst for major achievements -- Gentle scale + fade for confirmation -- Satisfying sound effects (subtle) - -**Hover surprises**: -- Icons that animate on hover -- Color shifts or glow effects -- Tooltip reveals with personality -- Cursor changes (custom cursors for branded experiences) - -### Personality in Copy - -**Playful error messages**: -``` -"Error 404" -"This page is playing hide and seek. (And winning)" - -"Connection failed" -"Looks like the internet took a coffee break. Want to retry?" -``` - -**Encouraging empty states**: -``` -"No projects" -"Your canvas awaits. Create something amazing." - -"No messages" -"Inbox zero! You're crushing it today." -``` - -**Playful labels & tooltips**: -``` -"Delete" -"Send to void" (for playful brand) - -"Help" -"Rescue me" (tooltip) -``` - -**IMPORTANT**: Match copy personality to brand. Banks shouldn't be wacky, but they can be warm. - -### Illustrations & Visual Personality - -**Custom illustrations**: -- Empty state illustrations (not stock icons) -- Error state illustrations (friendly monsters, quirky characters) -- Loading state illustrations (animated characters) -- Success state illustrations (celebrations) - -**Icon personality**: -- Custom icon set matching brand personality -- Animated icons (subtle motion on hover/click) -- Illustrative icons (more detailed than generic) -- Consistent style across all icons - -**Background effects**: -- Subtle particle effects -- Gradient mesh backgrounds -- Geometric patterns -- Parallax depth -- Time-of-day themes (morning vs night) - -### Satisfying Interactions - -**Drag and drop delight**: -- Lift effect on drag (shadow, scale) -- Snap animation when dropped -- Satisfying placement sound -- Undo toast ("Dropped in wrong place? [Undo]") - -**Toggle switches**: -- Smooth slide with spring physics -- Color transition -- Haptic feedback on mobile -- Optional sound effect - -**Progress & achievements**: -- Streak counters with celebratory milestones -- Progress bars that "celebrate" at 100% -- Badge unlocks with animation -- Playful stats ("You're on fire! 5 days in a row") - -**Form interactions**: -- Input fields that animate on focus -- Checkboxes with a satisfying scale pulse when checked -- Success state that celebrates valid input -- Auto-grow textareas - -### Sound Design - -**Subtle audio cues** (when appropriate): -- Notification sounds (distinctive but not annoying) -- Success sounds (satisfying "ding") -- Error sounds (empathetic, not harsh) -- Typing sounds for chat/messaging -- Ambient background audio (very subtle) - -**IMPORTANT**: -- Respect system sound settings -- Provide mute option -- Keep volumes quiet (subtle cues, not alarms) -- Don't play on every interaction (sound fatigue is real) - -### Easter Eggs & Hidden Delights - -**Discovery rewards**: -- Konami code unlocks special theme -- Hidden keyboard shortcuts (Cmd+K for special features) -- Hover reveals on logos or illustrations -- Alt text jokes on images (for screen reader users too!) -- Console messages for developers ("Like what you see? We're hiring!") - -**Seasonal touches**: -- Holiday themes (subtle, tasteful) -- Seasonal color shifts -- Weather-based variations -- Time-based changes (dark at night, light during day) - -**Contextual personality**: -- Different messages based on time of day -- Responses to specific user actions -- Randomized variations (not same every time) -- Progressive reveals with continued use - -### Loading & Waiting States - -**Make waiting engaging**: -- Interesting loading messages that rotate -- Progress bars with personality -- Mini-games during long loads -- Fun facts or tips while waiting -- Countdown with encouraging messages - -``` -Loading messages — write ones specific to your product, not generic AI filler: -- "Crunching your latest numbers..." -- "Syncing with your team's changes..." -- "Preparing your dashboard..." -- "Checking for updates since yesterday..." -``` - -**WARNING**: Avoid cliched loading messages like "Herding pixels", "Teaching robots to dance", "Consulting the magic 8-ball", "Counting backwards from infinity". These are AI-slop copy — instantly recognizable as machine-generated. Write messages that are specific to what your product actually does. - -### Celebration Moments - -**Success celebrations**: -- Confetti for major milestones -- Animated checkmarks for completions -- Progress bar celebrations at 100% -- "Achievement unlocked" style notifications -- Personalized messages ("You published your 10th article!") - -**Milestone recognition**: -- First-time actions get special treatment -- Streak tracking and celebration -- Progress toward goals -- Anniversary celebrations - -## Implementation Patterns - -**Animation libraries**: -- Framer Motion (React) -- GSAP (universal) -- Lottie (After Effects animations) -- Canvas confetti (party effects) - -**Sound libraries**: -- Howler.js (audio management) -- Use-sound (React hook) - -**Physics libraries**: -- React Spring (spring physics) -- Popmotion (animation primitives) - -**IMPORTANT**: File size matters. Compress images, optimize animations, lazy load delight features. - -**NEVER**: -- Delay core functionality for delight -- Force users through delightful moments (make skippable) -- Use delight to hide poor UX -- Overdo it (less is more) -- Ignore accessibility (animate responsibly, provide alternatives) -- Make every interaction delightful (special moments should be special) -- Sacrifice performance for delight -- Be inappropriate for context (read the room) - -## Verify Delight Quality - -Test that delight actually delights: - -- **User reactions**: Do users smile? Share screenshots? -- **Doesn't annoy**: Still pleasant after 100th time? -- **Doesn't block**: Can users opt out or skip? -- **Performant**: No jank, no slowdown -- **Appropriate**: Matches brand and context -- **Accessible**: Works with reduced motion, screen readers - -Remember: Delight is the difference between a tool and an experience. Add personality, surprise users positively, and create moments worth sharing. But always respect usability - delight should enhance, never obstruct. \ No newline at end of file diff --git a/.agents/skills/distill/SKILL.md b/.agents/skills/distill/SKILL.md deleted file mode 100644 index f3f721c996d9eb2d981f2f55ada88d35fbbe9dd4..0000000000000000000000000000000000000000 --- a/.agents/skills/distill/SKILL.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -name: distill -description: Strip designs to their essence by removing unnecessary complexity. Great design is simple, powerful, and clean. Use when the user asks to simplify, declutter, reduce noise, remove elements, or make a UI cleaner and more focused. -version: 2.1.1 -user-invocable: true -argument-hint: "[target]" ---- - -Remove unnecessary complexity from designs, revealing the essential elements and creating clarity through ruthless simplification. - -## MANDATORY PREPARATION - -Invoke /impeccable — it contains design principles, anti-patterns, and the **Context Gathering Protocol**. Follow the protocol before proceeding — if no design context exists yet, you MUST run /impeccable teach first. - ---- - -## Assess Current State - -Analyze what makes the design feel complex or cluttered: - -1. **Identify complexity sources**: - - **Too many elements**: Competing buttons, redundant information, visual clutter - - **Excessive variation**: Too many colors, fonts, sizes, styles without purpose - - **Information overload**: Everything visible at once, no progressive disclosure - - **Visual noise**: Unnecessary borders, shadows, backgrounds, decorations - - **Confusing hierarchy**: Unclear what matters most - - **Feature creep**: Too many options, actions, or paths forward - -2. **Find the essence**: - - What's the primary user goal? (There should be ONE) - - What's actually necessary vs nice-to-have? - - What can be removed, hidden, or combined? - - What's the 20% that delivers 80% of value? - -If any of these are unclear from the codebase, ask the user directly to clarify what you cannot infer. - -**CRITICAL**: Simplicity is not about removing features - it's about removing obstacles between users and their goals. Every element should justify its existence. - -## Plan Simplification - -Create a ruthless editing strategy: - -- **Core purpose**: What's the ONE thing this should accomplish? -- **Essential elements**: What's truly necessary to achieve that purpose? -- **Progressive disclosure**: What can be hidden until needed? -- **Consolidation opportunities**: What can be combined or integrated? - -**IMPORTANT**: Simplification is hard. It requires saying no to good ideas to make room for great execution. Be ruthless. - -## Simplify the Design - -Systematically remove complexity across these dimensions: - -### Information Architecture -- **Reduce scope**: Remove secondary actions, optional features, redundant information -- **Progressive disclosure**: Hide complexity behind clear entry points (accordions, modals, step-through flows) -- **Combine related actions**: Merge similar buttons, consolidate forms, group related content -- **Clear hierarchy**: ONE primary action, few secondary actions, everything else tertiary or hidden -- **Remove redundancy**: If it's said elsewhere, don't repeat it here - -### Visual Simplification -- **Reduce color palette**: Use 1-2 colors plus neutrals, not 5-7 colors -- **Limit typography**: One font family, 3-4 sizes maximum, 2-3 weights -- **Remove decorations**: Eliminate borders, shadows, backgrounds that don't serve hierarchy or function -- **Flatten structure**: Reduce nesting, remove unnecessary containers—never nest cards inside cards -- **Remove unnecessary cards**: Cards aren't needed for basic layout; use spacing and alignment instead -- **Consistent spacing**: Use one spacing scale, remove arbitrary gaps - -### Layout Simplification -- **Linear flow**: Replace complex grids with simple vertical flow where possible -- **Remove sidebars**: Move secondary content inline or hide it -- **Full-width**: Use available space generously instead of complex multi-column layouts -- **Consistent alignment**: Pick left or center, stick with it -- **Generous white space**: Let content breathe, don't pack everything tight - -### Interaction Simplification -- **Reduce choices**: Fewer buttons, fewer options, clearer path forward (paradox of choice is real) -- **Smart defaults**: Make common choices automatic, only ask when necessary -- **Inline actions**: Replace modal flows with inline editing where possible -- **Remove steps**: Can signup be one step instead of three? Can checkout be simplified? -- **Clear CTAs**: ONE obvious next step, not five competing actions - -### Content Simplification -- **Shorter copy**: Cut every sentence in half, then do it again -- **Active voice**: "Save changes" not "Changes will be saved" -- **Remove jargon**: Plain language always wins -- **Scannable structure**: Short paragraphs, bullet points, clear headings -- **Essential information only**: Remove marketing fluff, legalese, hedging -- **Remove redundant copy**: No headers restating intros, no repeated explanations, say it once - -### Code Simplification -- **Remove unused code**: Dead CSS, unused components, orphaned files -- **Flatten component trees**: Reduce nesting depth -- **Consolidate styles**: Merge similar styles, use utilities consistently -- **Reduce variants**: Does that component need 12 variations, or can 3 cover 90% of cases? - -**NEVER**: -- Remove necessary functionality (simplicity ≠ feature-less) -- Sacrifice accessibility for simplicity (clear labels and ARIA still required) -- Make things so simple they're unclear (mystery ≠ minimalism) -- Remove information users need to make decisions -- Eliminate hierarchy completely (some things should stand out) -- Oversimplify complex domains (match complexity to actual task complexity) - -## Verify Simplification - -Ensure simplification improves usability: - -- **Faster task completion**: Can users accomplish goals more quickly? -- **Reduced cognitive load**: Is it easier to understand what to do? -- **Still complete**: Are all necessary features still accessible? -- **Clearer hierarchy**: Is it obvious what matters most? -- **Better performance**: Does simpler design load faster? - -## Document Removed Complexity - -If you removed features or options: -- Document why they were removed -- Consider if they need alternative access points -- Note any user feedback to monitor - -Remember: You have great taste and judgment. Simplification is an act of confidence - knowing what to keep and courage to remove the rest. As Antoine de Saint-Exupéry said: "Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away." \ No newline at end of file diff --git a/.agents/skills/harden/SKILL.md b/.agents/skills/harden/SKILL.md deleted file mode 100644 index 31b996fa8be0db0223d6d56dc00769ec4c93e911..0000000000000000000000000000000000000000 --- a/.agents/skills/harden/SKILL.md +++ /dev/null @@ -1,389 +0,0 @@ ---- -name: harden -description: Make interfaces production-ready: error handling, empty states, onboarding flows, i18n, text overflow, and edge case management. Use when the user asks to harden, make production-ready, handle edge cases, add error states, design empty states, improve onboarding, or fix overflow and i18n issues. -version: 2.1.1 -user-invocable: true -argument-hint: "[target]" ---- - -Strengthen interfaces against edge cases, errors, internationalization issues, and real-world usage scenarios that break idealized designs. - -## Assess Hardening Needs - -Identify weaknesses and edge cases: - -1. **Test with extreme inputs**: - - Very long text (names, descriptions, titles) - - Very short text (empty, single character) - - Special characters (emoji, RTL text, accents) - - Large numbers (millions, billions) - - Many items (1000+ list items, 50+ options) - - No data (empty states) - -2. **Test error scenarios**: - - Network failures (offline, slow, timeout) - - API errors (400, 401, 403, 404, 500) - - Validation errors - - Permission errors - - Rate limiting - - Concurrent operations - -3. **Test internationalization**: - - Long translations (German is often 30% longer than English) - - RTL languages (Arabic, Hebrew) - - Character sets (Chinese, Japanese, Korean, emoji) - - Date/time formats - - Number formats (1,000 vs 1.000) - - Currency symbols - -**CRITICAL**: Designs that only work with perfect data aren't production-ready. Harden against reality. - -## Hardening Dimensions - -Systematically improve resilience: - -### Text Overflow & Wrapping - -**Long text handling**: -```css -/* Single line with ellipsis */ -.truncate { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -/* Multi-line with clamp */ -.line-clamp { - display: -webkit-box; - -webkit-line-clamp: 3; - -webkit-box-orient: vertical; - overflow: hidden; -} - -/* Allow wrapping */ -.wrap { - word-wrap: break-word; - overflow-wrap: break-word; - hyphens: auto; -} -``` - -**Flex/Grid overflow**: -```css -/* Prevent flex items from overflowing */ -.flex-item { - min-width: 0; /* Allow shrinking below content size */ - overflow: hidden; -} - -/* Prevent grid items from overflowing */ -.grid-item { - min-width: 0; - min-height: 0; -} -``` - -**Responsive text sizing**: -- Use `clamp()` for fluid typography -- Set minimum readable sizes (14px on mobile) -- Test text scaling (zoom to 200%) -- Ensure containers expand with text - -### Internationalization (i18n) - -**Text expansion**: -- Add 30-40% space budget for translations -- Use flexbox/grid that adapts to content -- Test with longest language (usually German) -- Avoid fixed widths on text containers - -```jsx -// ❌ Bad: Assumes short English text - - -// ✅ Good: Adapts to content - -``` - -**RTL (Right-to-Left) support**: -```css -/* Use logical properties */ -margin-inline-start: 1rem; /* Not margin-left */ -padding-inline: 1rem; /* Not padding-left/right */ -border-inline-end: 1px solid; /* Not border-right */ - -/* Or use dir attribute */ -[dir="rtl"] .arrow { transform: scaleX(-1); } -``` - -**Character set support**: -- Use UTF-8 encoding everywhere -- Test with Chinese/Japanese/Korean (CJK) characters -- Test with emoji (they can be 2-4 bytes) -- Handle different scripts (Latin, Cyrillic, Arabic, etc.) - -**Date/Time formatting**: -```javascript -// ✅ Use Intl API for proper formatting -new Intl.DateTimeFormat('en-US').format(date); // 1/15/2024 -new Intl.DateTimeFormat('de-DE').format(date); // 15.1.2024 - -new Intl.NumberFormat('en-US', { - style: 'currency', - currency: 'USD' -}).format(1234.56); // $1,234.56 -``` - -**Pluralization**: -```javascript -// ❌ Bad: Assumes English pluralization -`${count} item${count !== 1 ? 's' : ''}` - -// ✅ Good: Use proper i18n library -t('items', { count }) // Handles complex plural rules -``` - -### Error Handling - -**Network errors**: -- Show clear error messages -- Provide retry button -- Explain what happened -- Offer offline mode (if applicable) -- Handle timeout scenarios - -```jsx -// Error states with recovery -{error && ( - -

Failed to load data. {error.message}

- -
-)} -``` - -**Form validation errors**: -- Inline errors near fields -- Clear, specific messages -- Suggest corrections -- Don't block submission unnecessarily -- Preserve user input on error - -**API errors**: -- Handle each status code appropriately - - 400: Show validation errors - - 401: Redirect to login - - 403: Show permission error - - 404: Show not found state - - 429: Show rate limit message - - 500: Show generic error, offer support - -**Graceful degradation**: -- Core functionality works without JavaScript -- Images have alt text -- Progressive enhancement -- Fallbacks for unsupported features - -### Edge Cases & Boundary Conditions - -**Empty states**: -- No items in list -- No search results -- No notifications -- No data to display -- Provide clear next action - -**Loading states**: -- Initial load -- Pagination load -- Refresh -- Show what's loading ("Loading your projects...") -- Time estimates for long operations - -**Large datasets**: -- Pagination or virtual scrolling -- Search/filter capabilities -- Performance optimization -- Don't load all 10,000 items at once - -**Concurrent operations**: -- Prevent double-submission (disable button while loading) -- Handle race conditions -- Optimistic updates with rollback -- Conflict resolution - -**Permission states**: -- No permission to view -- No permission to edit -- Read-only mode -- Clear explanation of why - -**Browser compatibility**: -- Polyfills for modern features -- Fallbacks for unsupported CSS -- Feature detection (not browser detection) -- Test in target browsers - -### Onboarding & First-Run Experience - -Production-ready features work for first-time users, not just power users. Design the paths that get new users to value: - -**Empty states**: Every zero-data screen needs: -- What will appear here (description or illustration) -- Why it matters to the user -- Clear CTA to create the first item or start from a template -- Visual interest (not just blank space with "No items yet") - -Empty state types to handle: -- **First use**: emphasize value, provide templates -- **User cleared**: light touch, easy to recreate -- **No results**: suggest a different query, offer to clear filters -- **No permissions**: explain why, how to get access - -**First-run experience**: Get users to their "aha moment" as quickly as possible. -- Show, don't tell -- working examples over descriptions -- Progressive disclosure -- teach one thing at a time, not everything upfront -- Make onboarding optional -- let experienced users skip -- Provide smart defaults so required setup is minimal - -**Feature discovery**: Teach features when users need them, not upfront. -- Contextual tooltips at point of use (brief, dismissable, one-time) -- Badges or indicators on new or unused features -- Celebrate activation events quietly (a toast, not a modal) - -**NEVER**: -- Force long onboarding before users can touch the product -- Show the same tooltip repeatedly (track and respect dismissals) -- Block the entire UI during a guided tour -- Create separate tutorial modes disconnected from the real product -- Design empty states that just say "No items" with no next action - -### Input Validation & Sanitization - -**Client-side validation**: -- Required fields -- Format validation (email, phone, URL) -- Length limits -- Pattern matching -- Custom validation rules - -**Server-side validation** (always): -- Never trust client-side only -- Validate and sanitize all inputs -- Protect against injection attacks -- Rate limiting - -**Constraint handling**: -```html - - - - Letters and numbers only, up to 100 characters - -``` - -### Accessibility Resilience - -**Keyboard navigation**: -- All functionality accessible via keyboard -- Logical tab order -- Focus management in modals -- Skip links for long content - -**Screen reader support**: -- Proper ARIA labels -- Announce dynamic changes (live regions) -- Descriptive alt text -- Semantic HTML - -**Motion sensitivity**: -```css -@media (prefers-reduced-motion: reduce) { - * { - animation-duration: 0.01ms !important; - animation-iteration-count: 1 !important; - transition-duration: 0.01ms !important; - } -} -``` - -**High contrast mode**: -- Test in Windows high contrast mode -- Don't rely only on color -- Provide alternative visual cues - -### Performance Resilience - -**Slow connections**: -- Progressive image loading -- Skeleton screens -- Optimistic UI updates -- Offline support (service workers) - -**Memory leaks**: -- Clean up event listeners -- Cancel subscriptions -- Clear timers/intervals -- Abort pending requests on unmount - -**Throttling & Debouncing**: -```javascript -// Debounce search input -const debouncedSearch = debounce(handleSearch, 300); - -// Throttle scroll handler -const throttledScroll = throttle(handleScroll, 100); -``` - -## Testing Strategies - -**Manual testing**: -- Test with extreme data (very long, very short, empty) -- Test in different languages -- Test offline -- Test slow connection (throttle to 3G) -- Test with screen reader -- Test keyboard-only navigation -- Test on old browsers - -**Automated testing**: -- Unit tests for edge cases -- Integration tests for error scenarios -- E2E tests for critical paths -- Visual regression tests -- Accessibility tests (axe, WAVE) - -**IMPORTANT**: Hardening is about expecting the unexpected. Real users will do things you never imagined. - -**NEVER**: -- Assume perfect input (validate everything) -- Ignore internationalization (design for global) -- Leave error messages generic ("Error occurred") -- Forget offline scenarios -- Trust client-side validation alone -- Use fixed widths for text -- Assume English-length text -- Block entire interface when one component errors - -## Verify Hardening - -Test thoroughly with edge cases: - -- **Long text**: Try names with 100+ characters -- **Emoji**: Use emoji in all text fields -- **RTL**: Test with Arabic or Hebrew -- **CJK**: Test with Chinese/Japanese/Korean -- **Network issues**: Disable internet, throttle connection -- **Large datasets**: Test with 1000+ items -- **Concurrent actions**: Click submit 10 times rapidly -- **Errors**: Force API errors, test all error states -- **Empty**: Remove all data, test empty states - -Remember: You're hardening for production reality, not demo perfection. Expect users to input weird data, lose connection mid-flow, and use your product in unexpected ways. Build resilience into every component. \ No newline at end of file diff --git a/.agents/skills/impeccable/SKILL.md b/.agents/skills/impeccable/SKILL.md index bc4574d35883cc51ecdd7448d1321d3a519b8e58..8af38df3d3fbd86df84bc3e5f98d6ffa60789a4e 100644 --- a/.agents/skills/impeccable/SKILL.md +++ b/.agents/skills/impeccable/SKILL.md @@ -1,365 +1,163 @@ --- name: impeccable -description: Create distinctive, production-grade frontend interfaces with high design quality. Generates creative, polished code that avoids generic AI aesthetics. Use when the user asks to build web components, pages, artifacts, posters, or applications, or when any design skill requires project context. Call with 'craft' for shape-then-build, 'teach' for design context setup, or 'extract' to pull reusable components and tokens into the design system. -version: 2.1.1 -user-invocable: true -argument-hint: "[craft|teach|extract]" -license: Apache 2.0. Based on Anthropic's frontend-design skill. See NOTICE.md for attribution. +description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding, and empty states. Handles UX review, visual hierarchy, information architecture, cognitive load, accessibility, performance, responsive behavior, theming, anti-patterns, typography, fonts, spacing, layout, alignment, color, motion, micro-interactions, UX copy, error states, edge cases, i18n, and reusable design systems or tokens. Also use for bland designs that need to become bolder or more delightful, loud designs that should become quieter, live browser iteration on UI elements, or ambitious visual effects that should feel technically extraordinary. Not for backend-only or non-UI tasks. --- - -BEFORE doing any design work, run this one-time maintenance step. Tell the user: +Designs and iterates production-grade frontend interfaces. Real working code, committed design choices, exceptional craft. -> **Impeccable was updated.** A few skills were renamed or merged in this version (e.g. `/arrange` is now `/layout`, `/normalize` was folded into `/polish`). I'll clean up the old skill files so they don't clutter your project. This only runs once after an update. +## Setup -Then run: +Before any design work or file edits: -```bash -node .agents/skills/impeccable/scripts/cleanup-deprecated.mjs -``` - -If the script removed files, briefly confirm what was cleaned up. If it found nothing, skip any output and move on. - -After running the script, delete this entire section (from `` through `` inclusive) from THIS file so it does not run again until the next update. Save the file. - - -This skill guides creation of distinctive, production-grade frontend interfaces that avoid generic "AI slop" aesthetics. Implement real working code with exceptional attention to aesthetic details and creative choices. - -## Context Gathering Protocol - -Design skills produce generic output without project context. You MUST have confirmed design context before doing any design work. - -**Required context** (every design skill needs at minimum): -- **Target audience**: Who uses this product and in what context? -- **Use cases**: What jobs are they trying to get done? -- **Brand personality/tone**: How should the interface feel? +1. Load context (PRODUCT.md / DESIGN.md) via the loader script. +2. Identify the register and load the matching register reference (brand.md or product.md). +3. **If the user invoked a sub-command (e.g. `craft`, `shape`, `audit`), load its reference file too.** This is non-negotiable: `craft` without `craft.md` loaded means you'll skip the shape-and-confirm step the user expects. -Individual skills may require additional context. Check the skill's preparation section for specifics. +Skipping these produces generic output that ignores the project. -**CRITICAL**: You cannot infer this context by reading the codebase. Code tells you what was built, not who it's for or what it should feel like. Only the creator can provide this context. +### 1. Context gathering -**Gathering order:** -1. **Check current instructions (instant)**: If your loaded instructions already contain a **Design Context** section, proceed immediately. -2. **Check .impeccable.md (fast)**: If not in instructions, read `.impeccable.md` from the project root. If it exists and contains the required context, proceed. -3. **Run impeccable teach (REQUIRED)**: If neither source has context, you MUST run /impeccable teach NOW before doing anything else. Do NOT skip this step. Do NOT attempt to infer context from the codebase instead. +Two files, case-insensitive. The loader looks at the project root by default and falls back to `.agents/context/` and `docs/` if the root is clean. Override with `IMPECCABLE_CONTEXT_DIR=path/to/dir` (absolute or relative to cwd). ---- - -## Design Direction - -Commit to a BOLD aesthetic direction: -- **Purpose**: What problem does this interface solve? Who uses it? -- **Tone**: Pick an extreme: brutally minimal, maximalist chaos, retro-futuristic, organic/natural, luxury/refined, playful/toy-like, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian, etc. There are so many flavors to choose from. Use these for inspiration but design one that is true to the aesthetic direction. -- **Constraints**: Technical requirements (framework, performance, accessibility). -- **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember? - -**CRITICAL**: Choose a clear conceptual direction and execute it with precision. Bold maximalism and refined minimalism both work. The key is intentionality, not intensity. +- **PRODUCT.md**: required. Users, brand, tone, anti-references, strategic principles. +- **DESIGN.md**: optional, strongly recommended. Colors, typography, elevation, components. -Then implement working code that is: -- Production-grade and functional -- Visually striking and memorable -- Cohesive with a clear aesthetic point-of-view -- Meticulously refined in every detail +Load both in one call: -## Frontend Aesthetics Guidelines - -### Typography -→ *Consult [typography reference](reference/typography.md) for OpenType features, web font loading, and the deeper material on scales.* - -Choose fonts that are beautiful, unique, and interesting. Pair a distinctive display font with a refined body font. - - -Always apply these — do not consult a reference, just do them: - -- Use a modular type scale with fluid sizing (clamp) for headings on marketing/content pages. Use fixed `rem` scales for app UIs and dashboards (no major design system uses fluid type in product UI). -- Use fewer sizes with more contrast. A 5-step scale with at least a 1.25 ratio between steps creates clearer hierarchy than 8 sizes that are 1.1× apart. -- Line-height scales inversely with line length. Narrow columns want tighter leading, wide columns want more. For light text on dark backgrounds, ADD 0.05-0.1 to your normal line-height — light type reads as lighter weight and needs more breathing room. -- Cap line length at ~65-75ch. Body text wider than that is fatiguing. - - - -DO THIS BEFORE TYPING ANY FONT NAME. - -The model's natural failure mode is "I was told not to use Inter, so I will pick my next favorite font, which becomes the new monoculture." Avoid this by performing the following procedure on every project, in order: - -Step 1. Read the brief once. Write down 3 concrete words for the brand voice (e.g., "warm and mechanical and opinionated", "calm and clinical and careful", "fast and dense and unimpressed", "handmade and a little weird"). NOT "modern" or "elegant" — those are dead categories. - -Step 2. List the 3 fonts you would normally reach for given those words. Write them down. They are most likely from this list: - - -Fraunces -Newsreader -Lora -Crimson -Crimson Pro -Crimson Text -Playfair Display -Cormorant -Cormorant Garamond -Syne -IBM Plex Mono -IBM Plex Sans -IBM Plex Serif -Space Mono -Space Grotesk -Inter -DM Sans -DM Serif Display -DM Serif Text -Outfit -Plus Jakarta Sans -Instrument Sans -Instrument Serif - - -Reject every font that appears in the reflex_fonts_to_reject list. They are your training-data defaults and they create monoculture across projects. - -Step 3. Browse a font catalog with the 3 brand words in mind. Sources: Google Fonts, Pangram Pangram, Future Fonts, Adobe Fonts, ABC Dinamo, Klim Type Foundry, Velvetyne. Look for something that fits the brand as a *physical object* — a museum exhibit caption, a hand-painted shop sign, a 1970s mainframe terminal manual, a fabric label on the inside of a coat, a children's book printed on cheap newsprint. Reject the first thing that "looks designy" — that's the trained reflex too. Keep looking. - -Step 4. Cross-check the result. The right font for an "elegant" brief is NOT necessarily a serif. The right font for a "technical" brief is NOT necessarily a sans-serif. The right font for a "warm" brief is NOT Fraunces. If your final pick lines up with your reflex pattern, go back to Step 3. - - - -DO use a modular type scale with fluid sizing (clamp) on headings. -DO vary font weights and sizes to create clear visual hierarchy. -DO vary your font choices across projects. If you used a serif display font on the last project, look for a sans, monospace, or display face on this one. - -DO NOT use overused fonts like Inter, Roboto, Arial, Open Sans, or system defaults — but also do not simply switch to your second-favorite. Every font in the reflex_fonts_to_reject list above is banned. Look further. -DO NOT use monospace typography as lazy shorthand for "technical/developer" vibes. -DO NOT put large icons with rounded corners above every heading. They rarely add value and make sites look templated. -DO NOT use only one font family for the entire page. Pair a distinctive display font with a refined body font. -DO NOT use a flat type hierarchy where sizes are too close together. Aim for at least a 1.25 ratio between steps. -DO NOT set long body passages in uppercase. Reserve all-caps for short labels and headings. - - -### Color & Theme -→ *Consult [color reference](reference/color-and-contrast.md) for the deeper material on contrast, accessibility, and palette construction.* - -Commit to a cohesive palette. Dominant colors with sharp accents outperform timid, evenly-distributed palettes. - - -Always apply these — do not consult a reference, just do them: - -- Use OKLCH, not HSL. OKLCH is perceptually uniform: equal steps in lightness *look* equal, which HSL does not deliver. As you move toward white or black, REDUCE chroma — high chroma at extreme lightness looks garish. A light blue at 85% lightness wants ~0.08 chroma, not the 0.15 of your base color. -- Tint your neutrals toward your brand hue. Even a chroma of 0.005-0.01 is perceptible and creates subconscious cohesion between brand color and UI surfaces. The hue you tint toward should come from THIS brand, not from a "warm = friendly" or "cool = tech" formula. Pick the brand's actual hue first, then tint everything toward it. -- The 60-30-10 rule is about visual *weight*, not pixel count. 60% neutral / surface, 30% secondary text and borders, 10% accent. Accents work BECAUSE they're rare. Overuse kills their power. - - - -Theme (light vs dark) should be DERIVED from audience and viewing context, not picked from a default. Read the brief and ask: when is this product used, by whom, in what physical setting? - -- A perp DEX consumed during fast trading sessions → dark -- A hospital portal consumed by anxious patients on phones late at night → light -- A children's reading app → light -- A vintage motorcycle forum where users sit in their garage at 9pm → dark -- An observability dashboard for SREs in a dark office → dark -- A wedding planning checklist for couples on a Sunday morning → light -- A music player app for headphone listening at night → dark -- A food magazine homepage browsed during a coffee break → light - -Do not default everything to light "to play it safe." Do not default everything to dark "to look cool." Both defaults are the lazy reflex. The correct theme is the one the actual user wants in their actual context. - - - -DO use modern CSS color functions (oklch, color-mix, light-dark) for perceptually uniform, maintainable palettes. -DO tint your neutrals toward your brand hue. Even a subtle hint creates subconscious cohesion. - -DO NOT use gray text on colored backgrounds; it looks washed out. Use a shade of the background color instead. -DO NOT use pure black (#000) or pure white (#fff). Always tint; pure black/white never appears in nature. -DO NOT use the AI color palette: cyan-on-dark, purple-to-blue gradients, neon accents on dark backgrounds. -DO NOT use gradient text for impact — see below for the strict definition. Solid colors only for text. -DO NOT default to dark mode with glowing accents. It looks "cool" without requiring actual design decisions. -DO NOT default to light mode "to be safe" either. The point is to choose, not to retreat to a safe option. - - -### Layout & Space -→ *Consult [spatial reference](reference/spatial-design.md) for the deeper material on grids, container queries, and optical adjustments.* - -Create visual rhythm through varied spacing, not the same padding everywhere. Embrace asymmetry and unexpected compositions. Break the grid intentionally for emphasis. - - -Always apply these — do not consult a reference, just do them: - -- Use a 4pt spacing scale with semantic token names (`--space-sm`, `--space-md`), not pixel-named (`--spacing-8`). Scale: 4, 8, 12, 16, 24, 32, 48, 64, 96. 8pt is too coarse — you'll often want 12px between two values. -- Use `gap` instead of margins for sibling spacing. It eliminates margin collapse and the cleanup hacks that come with it. -- Vary spacing for hierarchy. A heading with extra space above it reads as more important — make use of that. Don't apply the same padding everywhere. -- Self-adjusting grid pattern: `grid-template-columns: repeat(auto-fit, minmax(280px, 1fr))` is the breakpoint-free responsive grid for card-style content. -- Container queries are for components, viewport queries are for page layout. A card in a sidebar should adapt to the sidebar's width, not the viewport's. - - - -DO create visual rhythm through varied spacing: tight groupings, generous separations. -DO use fluid spacing with clamp() that breathes on larger screens. -DO use asymmetry and unexpected compositions; break the grid intentionally for emphasis. - -DO NOT wrap everything in cards. Not everything needs a container. -DO NOT nest cards inside cards. Visual noise; flatten the hierarchy. -DO NOT use identical card grids (same-sized cards with icon + heading + text, repeated endlessly). -DO NOT use the hero metric layout template (big number, small label, supporting stats, gradient accent). -DO NOT center everything. Left-aligned text with asymmetric layouts feels more designed. -DO NOT use the same spacing everywhere. Without rhythm, layouts feel monotonous. -DO NOT let body text wrap beyond ~80 characters per line. Add a max-width like 65–75ch so the eye can track easily. - - -### Visual Details - - -These CSS patterns are NEVER acceptable. They are the most recognizable AI design tells. Match-and-refuse: if you find yourself about to write any of these, stop and rewrite the element with a different structure entirely. - -BAN 1: Side-stripe borders on cards/list items/callouts/alerts - - PATTERN: `border-left:` or `border-right:` with width greater than 1px - - INCLUDES: hard-coded colors AND CSS variables - - FORBIDDEN: `border-left: 3px solid red`, `border-left: 4px solid #ff0000`, `border-left: 4px solid var(--color-warning)`, `border-left: 5px solid oklch(...)`, etc. - - WHY: this is the single most overused "design touch" in admin, dashboard, and medical UIs. It never looks intentional regardless of color, radius, opacity, or whether the variable name is "primary" or "warning" or "accent." - - REWRITE: use a different element structure entirely. Do not just swap to box-shadow inset. Reach for full borders, background tints, leading numbers/icons, or no visual indicator at all. - -BAN 2: Gradient text - - PATTERN: `background-clip: text` (or `-webkit-background-clip: text`) combined with a gradient background - - FORBIDDEN: any combination that makes text fill come from a `linear-gradient`, `radial-gradient`, or `conic-gradient` - - WHY: gradient text is decorative rather than meaningful and is one of the top three AI design tells - - REWRITE: use a single solid color for text. If you want emphasis, use weight or size, not gradient fill. - - -DO: Use intentional, purposeful decorative elements that reinforce brand. -DO NOT: Use border-left or border-right greater than 1px as a colored accent stripe on cards, list items, callouts, or alerts. See above for the strict CSS pattern. -DO NOT: Use glassmorphism everywhere (blur effects, glass cards, glow borders used decoratively rather than purposefully). -DO NOT: Use sparklines as decoration. Tiny charts that look sophisticated but convey nothing meaningful. -DO NOT: Use rounded rectangles with generic drop shadows. Safe, forgettable, could be any AI output. -DO NOT: Use modals unless there's truly no better alternative. Modals are lazy. - -### Motion -→ *Consult [motion reference](reference/motion-design.md) for timing, easing, and reduced motion.* +```bash +node .agents/skills/impeccable/scripts/load-context.mjs +``` -Focus on high-impact moments: one well-orchestrated page load with staggered reveals creates more delight than scattered micro-interactions. +Consume the full JSON output. Never pipe through `head`, `tail`, `grep`, or `jq`. The output's `contextDir` field tells you where the files were resolved from. -**DO**: Use motion to convey state changes: entrances, exits, feedback -**DO**: Use exponential easing (ease-out-quart/quint/expo) for natural deceleration -**DO**: For height animations, use grid-template-rows transitions instead of animating height directly -**DON'T**: Animate layout properties (width, height, padding, margin). Use transform and opacity only -**DON'T**: Use bounce or elastic easing. They feel dated and tacky; real objects decelerate smoothly +If the output is already in this session's conversation history, don't re-run. Exceptions requiring a fresh load: you just ran `$impeccable teach` or `$impeccable document` (they rewrite the files), or the user manually edited one. -### Interaction -→ *Consult [interaction reference](reference/interaction-design.md) for forms, focus, and loading patterns.* +`$impeccable live` already warms context via `live.mjs`. If you've run `live.mjs`, don't also run `load-context.mjs` this session. -Make interactions feel fast. Use optimistic UI: update immediately, sync later. +If PRODUCT.md is missing, empty, or placeholder (`[TODO]` markers, <200 chars): run `$impeccable teach`, then resume the user's original task with the fresh context. If the original task was `$impeccable craft`, resume into `$impeccable shape` before any implementation work. -**DO**: Use progressive disclosure. Start simple, reveal sophistication through interaction (basic options first, advanced behind expandable sections; hover states that reveal secondary actions) -**DO**: Design empty states that teach the interface, not just say "nothing here" -**DO**: Make every interactive surface feel intentional and responsive -**DON'T**: Repeat the same information (redundant headers, intros that restate the heading) -**DON'T**: Make every button primary. Use ghost buttons, text links, secondary styles; hierarchy matters +If DESIGN.md is missing: nudge once per session (*"Run `$impeccable document` for more on-brand output"*), then proceed. -### Responsive -→ *Consult [responsive reference](reference/responsive-design.md) for mobile-first, fluid design, and container queries.* +### 2. Register -**DO**: Use container queries (@container) for component-level responsiveness -**DO**: Adapt the interface for different contexts, not just shrink it -**DON'T**: Hide critical functionality on mobile. Adapt the interface, don't amputate it +Every design task is **brand** (marketing, landing, campaign, long-form content, portfolio: design IS the product) or **product** (app UI, admin, dashboard, tool: design SERVES the product). -### UX Writing -→ *Consult [ux-writing reference](reference/ux-writing.md) for labels, errors, and empty states.* +Identify before designing. Priority: (1) cue in the task itself ("landing page" vs "dashboard"); (2) the surface in focus (the page, file, or route being worked on); (3) `register` field in PRODUCT.md. First match wins. -**DO**: Make every word earn its place -**DON'T**: Repeat information users can already see +If PRODUCT.md lacks the `register` field (legacy), infer it once from its "Users" and "Product Purpose" sections, then cache the inferred value for the session. Suggest the user run `$impeccable teach` to add the field explicitly. ---- +Load the matching reference: [reference/brand.md](reference/brand.md) or [reference/product.md](reference/product.md). The shared design laws below apply to both. -## The AI Slop Test +## Shared design laws -**Critical quality check**: If you showed this interface to someone and said "AI made this," would they believe you immediately? If yes, that's the problem. +Apply to every design, both registers. Match implementation complexity to the aesthetic vision: maximalism needs elaborate code, minimalism needs precision. Interpret creatively. Vary across projects; never converge on the same choices. GPT is capable of extraordinary work. Don't hold back. -A distinctive interface should make someone ask "how was this made?" not "which AI made this?" +### Color -Review the DON'T guidelines above. They are the fingerprints of AI-generated work from 2024-2025. +- Use OKLCH. Reduce chroma as lightness approaches 0 or 100; high chroma at extremes looks garish. +- Never use `#000` or `#fff`. Tint every neutral toward the brand hue (chroma 0.005–0.01 is enough). +- Pick a **color strategy** before picking colors. Four steps on the commitment axis: + - **Restrained**: tinted neutrals + one accent ≤10%. Product default; brand minimalism. + - **Committed**: one saturated color carries 30–60% of the surface. Brand default for identity-driven pages. + - **Full palette**: 3–4 named roles, each used deliberately. Brand campaigns; product data viz. + - **Drenched**: the surface IS the color. Brand heroes, campaign pages. +- The "one accent ≤10%" rule is Restrained only. Committed / Full palette / Drenched exceed it on purpose. Don't collapse every design to Restrained by reflex. ---- +### Theme -## Implementation Principles +Dark vs. light is never a default. Not dark "because tools look cool dark." Not light "to be safe." -Match implementation complexity to the aesthetic vision. Maximalist designs need elaborate code with extensive animations and effects. Minimalist or refined designs need restraint, precision, and careful attention to spacing, typography, and subtle details. +Before choosing, write one sentence of physical scene: who uses this, where, under what ambient light, in what mood. If the sentence doesn't force the answer, it's not concrete enough. Add detail until it does. -Interpret creatively and make unexpected choices that feel genuinely designed for the context. No design should be the same. Vary between light and dark themes, different fonts, different aesthetics. NEVER converge on common choices across generations. +"Observability dashboard" does not force an answer. "SRE glancing at incident severity on a 27-inch monitor at 2am in a dim room" does. Run the sentence, not the category. -Remember: the model is capable of extraordinary creative work. Don't hold back. Show what can truly be created when thinking outside the box and committing fully to a distinctive vision. +### Typography ---- +- Cap body line length at 65–75ch. +- Hierarchy through scale + weight contrast (≥1.25 ratio between steps). Avoid flat scales. -## Craft Mode +### Layout -If this skill is invoked with the argument "craft" (e.g., `/impeccable craft [feature description]`), follow the [craft flow](reference/craft.md). Pass any additional arguments as the feature description. +- Vary spacing for rhythm. Same padding everywhere is monotony. +- Cards are the lazy answer. Use them only when they're truly the best affordance. Nested cards are always wrong. +- Don't wrap everything in a container. Most things don't need one. ---- +### Motion -## Teach Mode +- Don't animate CSS layout properties. +- Ease out with exponential curves (ease-out-quart / quint / expo). No bounce, no elastic. -If this skill is invoked with the argument "teach" (e.g., `/impeccable teach`), skip all design work above and instead run the teach flow below. This is a one-time setup that gathers design context for the project. +### Absolute bans -### Step 1: Explore the Codebase +Match-and-refuse. If you're about to write any of these, rewrite the element with different structure. -Before asking questions, thoroughly scan the project to discover what you can: +- **Side-stripe borders.** `border-left` or `border-right` greater than 1px as a colored accent on cards, list items, callouts, or alerts. Never intentional. Rewrite with full borders, background tints, leading numbers/icons, or nothing. +- **Gradient text.** `background-clip: text` combined with a gradient background. Decorative, never meaningful. Use a single solid color. Emphasis via weight or size. +- **Glassmorphism as default.** Blurs and glass cards used decoratively. Rare and purposeful, or nothing. +- **The hero-metric template.** Big number, small label, supporting stats, gradient accent. SaaS cliché. +- **Identical card grids.** Same-sized cards with icon + heading + text, repeated endlessly. +- **Modal as first thought.** Modals are usually laziness. Exhaust inline / progressive alternatives first. -- **README and docs**: Project purpose, target audience, any stated goals -- **Package.json / config files**: Tech stack, dependencies, existing design libraries -- **Existing components**: Current design patterns, spacing, typography in use -- **Brand assets**: Logos, favicons, color values already defined -- **Design tokens / CSS variables**: Existing color palettes, font stacks, spacing scales -- **Any style guides or brand documentation** +### Copy -Note what you've learned and what remains unclear. +- Every word earns its place. No restated headings, no intros that repeat the title. +- **No em dashes.** Use commas, colons, semicolons, periods, or parentheses. Also not `--`. -### Step 2: Ask UX-Focused Questions +### The AI slop test -ask the user directly to clarify what you cannot infer. Focus only on what you couldn't infer from the codebase: +If someone could look at this interface and say "AI made that" without doubt, it's failed. Cross-register failures are the absolute bans above. Register-specific failures live in each reference. -#### Users & Purpose -- Who uses this? What's their context when using it? -- What job are they trying to get done? -- What emotions should the interface evoke? (confidence, delight, calm, urgency, etc.) +**Category-reflex check.** Run at two altitudes; the second one catches what the first one misses. -#### Brand & Personality -- How would you describe the brand personality in 3 words? -- Any reference sites or apps that capture the right feel? What specifically about them? -- What should this explicitly NOT look like? Any anti-references? +- **First-order:** if someone could guess the theme + palette from the category alone ("observability → dark blue", "healthcare → white + teal", "finance → navy + gold", "crypto → neon on black"), it's the first training-data reflex. Rework the scene sentence and color strategy until the answer isn't obvious from the domain. +- **Second-order:** if someone could guess the aesthetic family from category-plus-anti-references ("AI workflow tool that's not SaaS-cream → editorial-typographic", "fintech that's not navy-and-gold → terminal-native dark mode"), it's the trap one tier deeper. The first reflex was avoided; the second wasn't. Rework until both answers are not obvious. The brand register's [reflex-reject aesthetic lanes](reference/brand.md) list catches the currently-saturated families. -#### Aesthetic Preferences -- Any strong preferences for visual direction? (minimal, bold, elegant, playful, technical, organic, etc.) -- Light mode, dark mode, or both? -- Any colors that must be used or avoided? +## Commands -#### Accessibility & Inclusion -- Specific accessibility requirements? (WCAG level, known user needs) -- Considerations for reduced motion, color blindness, or other accommodations? +| Command | Category | Description | Reference | +|---|---|---|---| +| `craft [feature]` | Build | Shape, then build a feature end-to-end | [reference/craft.md](reference/craft.md) | +| `shape [feature]` | Build | Plan UX/UI before writing code | [reference/shape.md](reference/shape.md) | +| `teach` | Build | Set up PRODUCT.md and DESIGN.md context | [reference/teach.md](reference/teach.md) | +| `document` | Build | Generate DESIGN.md from existing project code | [reference/document.md](reference/document.md) | +| `extract [target]` | Build | Pull reusable tokens and components into design system | [reference/extract.md](reference/extract.md) | +| `critique [target]` | Evaluate | UX design review with heuristic scoring | [reference/critique.md](reference/critique.md) | +| `audit [target]` | Evaluate | Technical quality checks (a11y, perf, responsive) | [reference/audit.md](reference/audit.md) | +| `polish [target]` | Refine | Final quality pass before shipping | [reference/polish.md](reference/polish.md) | +| `bolder [target]` | Refine | Amplify safe or bland designs | [reference/bolder.md](reference/bolder.md) | +| `quieter [target]` | Refine | Tone down aggressive or overstimulating designs | [reference/quieter.md](reference/quieter.md) | +| `distill [target]` | Refine | Strip to essence, remove complexity | [reference/distill.md](reference/distill.md) | +| `harden [target]` | Refine | Production-ready: errors, i18n, edge cases | [reference/harden.md](reference/harden.md) | +| `onboard [target]` | Refine | Design first-run flows, empty states, activation | [reference/onboard.md](reference/onboard.md) | +| `animate [target]` | Enhance | Add purposeful animations and motion | [reference/animate.md](reference/animate.md) | +| `colorize [target]` | Enhance | Add strategic color to monochromatic UIs | [reference/colorize.md](reference/colorize.md) | +| `typeset [target]` | Enhance | Improve typography hierarchy and fonts | [reference/typeset.md](reference/typeset.md) | +| `layout [target]` | Enhance | Fix spacing, rhythm, and visual hierarchy | [reference/layout.md](reference/layout.md) | +| `delight [target]` | Enhance | Add personality and memorable touches | [reference/delight.md](reference/delight.md) | +| `overdrive [target]` | Enhance | Push past conventional limits | [reference/overdrive.md](reference/overdrive.md) | +| `clarify [target]` | Fix | Improve UX copy, labels, and error messages | [reference/clarify.md](reference/clarify.md) | +| `adapt [target]` | Fix | Adapt for different devices and screen sizes | [reference/adapt.md](reference/adapt.md) | +| `optimize [target]` | Fix | Diagnose and fix UI performance | [reference/optimize.md](reference/optimize.md) | +| `live` | Iterate | Visual variant mode: pick elements in the browser, generate alternatives | [reference/live.md](reference/live.md) | -Skip questions where the answer is already clear from the codebase exploration. +Plus two management commands: `pin ` and `unpin `, detailed below. -### Step 3: Write Design Context +### Routing rules -Synthesize your findings and the user's answers into a `## Design Context` section: +1. **No argument**: render the table above as the user-facing command menu, grouped by category. Ask what they'd like to do. +2. **First word matches a command**: load its reference file and follow its instructions. Everything after the command name is the target. +3. **First word doesn't match**: general design invocation. Apply the setup steps, shared design laws, and the loaded register reference, using the full argument as context. -```markdown -## Design Context +Setup (context gathering, register) is already loaded by then; sub-commands don't re-invoke `$impeccable`. -### Users -[Who they are, their context, the job to be done] +If the first word is `craft`, setup still runs first, but [reference/craft.md](reference/craft.md) owns the rest of the flow. If setup invokes `teach` as a blocker, finish teach, refresh context, then resume the original command and target. -### Brand Personality -[Voice, tone, 3-word personality, emotional goals] +## Pin / Unpin -### Aesthetic Direction -[Visual tone, references, anti-references, theme] +**Pin** creates a standalone shortcut so `$` invokes `$impeccable ` directly. **Unpin** removes it. The script writes to every harness directory present in the project. -### Design Principles -[3-5 principles derived from the conversation that should guide all design decisions] +```bash +node .agents/skills/impeccable/scripts/pin.mjs ``` -Write this section to `.impeccable.md` in the project root. If the file already exists, update the Design Context section in place. - -Then ask the user directly to clarify what you cannot infer. whether they'd also like the Design Context appended to .github/copilot-instructions.md. If yes, append or update the section there as well. - -Confirm completion and summarize the key design principles that will now guide all future work. - ---- - -## Extract Mode - -If this skill is invoked with the argument "extract" (e.g., `/impeccable extract [target]`), follow the [extract flow](reference/extract.md). Pass any additional arguments as the extraction target. \ No newline at end of file +Valid `` is any command from the table above. Report the script's result concisely. Confirm the new shortcut on success, relay stderr verbatim on error. \ No newline at end of file diff --git a/.agents/skills/impeccable/agents/openai.yaml b/.agents/skills/impeccable/agents/openai.yaml new file mode 100644 index 0000000000000000000000000000000000000000..ee6cae7726ef85d3744c1b978608668a07aefeef --- /dev/null +++ b/.agents/skills/impeccable/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: Impeccable + short_description: Use when the user wants to design, redesign, shape, critique, audit, polish, clarify,... + default_prompt: Use Impeccable to redesign, critique, audit, or polish this frontend. \ No newline at end of file diff --git a/.gemini/skills/adapt/SKILL.md b/.agents/skills/impeccable/reference/adapt.md similarity index 83% rename from .gemini/skills/adapt/SKILL.md rename to .agents/skills/impeccable/reference/adapt.md index 35b00e3f91d0b1be5f56b6ca00e0cfed98df6355..21bb0255aa47e12909875d961d59037e66512ead 100644 --- a/.gemini/skills/adapt/SKILL.md +++ b/.agents/skills/impeccable/reference/adapt.md @@ -1,14 +1,7 @@ ---- -name: adapt -description: Adapt designs to work across different screen sizes, devices, contexts, or platforms. Implements breakpoints, fluid layouts, and touch targets. Use when the user mentions responsive design, mobile layouts, breakpoints, viewport adaptation, or cross-device compatibility. -version: 2.1.1 ---- - -Adapt existing designs to work effectively across different contexts - different screen sizes, devices, platforms, or use cases. +> **Additional context needed**: target platforms/devices and usage contexts. -## MANDATORY PREPARATION +Adapt an existing design to a different context: another screen size, device, platform, or use case. The trap is treating adaptation as scaling. The job is rethinking the experience for the new context. -Invoke /impeccable — it contains design principles, anti-patterns, and the **Context Gathering Protocol**. Follow the protocol before proceeding — if no design context exists yet, you MUST run /impeccable teach first. Additionally gather: target platforms/devices and usage contexts. --- @@ -34,7 +27,7 @@ Understand what needs adaptation and why: - What won't work? (Hover states on touch, tiny touch targets) - What's inappropriate? (Desktop patterns on mobile, mobile patterns on desktop) -**CRITICAL**: Adaptation is not just scaling - it's rethinking the experience for the new context. +**CRITICAL**: Adaptation is rethinking the experience for the new context, not scaling pixels. ## Plan Adaptation Strategy @@ -171,7 +164,7 @@ Choose appropriate breakpoints: - Persistent side navigation on desktop - Breadcrumbs on smaller screens for context -**IMPORTANT**: Test on real devices, not just browser DevTools. Device emulation is helpful but not perfect. +**IMPORTANT**: Test on real devices. Device emulation in DevTools is helpful but not perfect. **NEVER**: - Hide core functionality on mobile (if it matters, make it work) @@ -194,4 +187,4 @@ Test thoroughly across contexts: - **Edge cases**: Very small screens (320px), very large screens (4K) - **Slow connections**: Test on throttled network -Remember: You're a cross-platform design expert. Make experiences that feel native to each context while maintaining brand and functionality consistency. Adapt intentionally, test thoroughly. \ No newline at end of file +When the adaptation feels native to each context, hand off to `$impeccable polish` for the final pass. diff --git a/.agents/skills/impeccable/reference/animate.md b/.agents/skills/impeccable/reference/animate.md new file mode 100644 index 0000000000000000000000000000000000000000..48b5e268dd5f438a0f93135591bfd7aa3e2d83a9 --- /dev/null +++ b/.agents/skills/impeccable/reference/animate.md @@ -0,0 +1,175 @@ +> **Additional context needed**: performance constraints. + +Add motion that conveys state, gives feedback, and clarifies hierarchy. Cut motion that exists only for decoration. Animation fatigue is a real cost; spend the budget on the moments that need it. + +--- + +## Register + +Brand: orchestrated page-load sequences, staggered reveals, scroll-driven animation. Motion is part of the voice; one well-rehearsed entrance beats scattered micro-interactions. + +Product: 150–250 ms on most transitions. Motion conveys state: feedback, reveal, loading, transitions between views. No page-load choreography; users are in a task and won't wait for it. + +--- + +## Assess Animation Opportunities + +Analyze where motion would improve the experience: + +1. **Identify static areas**: + - **Missing feedback**: Actions without visual acknowledgment (button clicks, form submission, etc.) + - **Jarring transitions**: Instant state changes that feel abrupt (show/hide, page loads, route changes) + - **Unclear relationships**: Spatial or hierarchical relationships that aren't obvious + - **Lack of delight**: Functional but joyless interactions + - **Missed guidance**: Opportunities to direct attention or explain behavior + +2. **Understand the context**: + - What's the personality? (Playful vs serious, energetic vs calm) + - What's the performance budget? (Mobile-first? Complex page?) + - Who's the audience? (Motion-sensitive users? Power users who want speed?) + - What matters most? (One hero animation vs many micro-interactions?) + +If any of these are unclear from the codebase, STOP and use Codex's structured user-input/question tool when available; if unavailable, ask directly in chat to clarify what you cannot infer. + +**CRITICAL**: Respect `prefers-reduced-motion`. Always provide non-animated alternatives for users who need them. + +## Plan Animation Strategy + +Create a purposeful animation plan: + +- **Hero moment**: What's the ONE signature animation? (Page load? Hero section? Key interaction?) +- **Feedback layer**: Which interactions need acknowledgment? +- **Transition layer**: Which state changes need smoothing? +- **Delight layer**: Where can we surprise and delight? + +**IMPORTANT**: One well-orchestrated experience beats scattered animations everywhere. Focus on high-impact moments. + +## Implement Animations + +Add motion systematically across these categories: + +### Entrance Animations +- **Page load choreography**: Stagger element reveals (100-150ms delays), fade + slide combinations +- **Hero section**: Dramatic entrance for primary content (scale, parallax, or creative effects) +- **Content reveals**: Scroll-triggered animations using intersection observer +- **Modal/drawer entry**: Smooth slide + fade, backdrop fade, focus management + +### Micro-interactions +- **Button feedback**: + - Hover: Subtle scale (1.02-1.05), color shift, shadow increase + - Click: Quick scale down then up (0.95 → 1), ripple effect + - Loading: Spinner or pulse state +- **Form interactions**: + - Input focus: Border color transition, slight scale or glow + - Validation: Shake on error, check mark on success, smooth color transitions +- **Toggle switches**: Smooth slide + color transition (200-300ms) +- **Checkboxes/radio**: Check mark animation, ripple effect +- **Like/favorite**: Scale + rotation, particle effects, color transition + +### State Transitions +- **Show/hide**: Fade + slide (not instant), appropriate timing (200-300ms) +- **Expand/collapse**: Height transition with overflow handling, icon rotation +- **Loading states**: Skeleton screen fades, spinner animations, progress bars +- **Success/error**: Color transitions, icon animations, gentle scale pulse +- **Enable/disable**: Opacity transitions, cursor changes + +### Navigation & Flow +- **Page transitions**: Crossfade between routes, shared element transitions +- **Tab switching**: Slide indicator, content fade/slide +- **Carousel/slider**: Smooth transforms, snap points, momentum +- **Scroll effects**: Parallax layers, sticky headers with state changes, scroll progress indicators + +### Feedback & Guidance +- **Hover hints**: Tooltip fade-ins, cursor changes, element highlights +- **Drag & drop**: Lift effect (shadow + scale), drop zone highlights, smooth repositioning +- **Copy/paste**: Brief highlight flash on paste, "copied" confirmation +- **Focus flow**: Highlight path through form or workflow + +### Delight Moments +- **Empty states**: Subtle floating animations on illustrations +- **Completed actions**: Confetti, check mark flourish, success celebrations +- **Easter eggs**: Hidden interactions for discovery +- **Contextual animation**: Weather effects, time-of-day themes, seasonal touches + +## Technical Implementation + +Use appropriate techniques for each animation: + +### Timing & Easing + +**Durations by purpose:** +- **100-150ms**: Instant feedback (button press, toggle) +- **200-300ms**: State changes (hover, menu open) +- **300-500ms**: Layout changes (accordion, modal) +- **500-800ms**: Entrance animations (page load) + +**Easing curves (use these, not CSS defaults):** +```css +/* Recommended: natural deceleration */ +--ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1); /* Smooth */ +--ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1); /* Slightly snappier */ +--ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1); /* Confident, decisive */ + +/* AVOID: feel dated and tacky */ +/* bounce: cubic-bezier(0.34, 1.56, 0.64, 1); */ +/* elastic: cubic-bezier(0.68, -0.6, 0.32, 1.6); */ +``` + +**Exit animations are faster than entrances.** Use ~75% of enter duration. + +### CSS Animations +```css +/* Prefer for simple, declarative animations */ +- transitions for state changes +- @keyframes for complex sequences +- transform and opacity for reliable movement +- blur, filters, masks, clip paths, shadows, and color shifts for premium atmospheric effects when verified smooth +``` + +### JavaScript Animation +```javascript +/* Use for complex, interactive animations */ +- Web Animations API for programmatic control +- Framer Motion for React +- GSAP for complex sequences +``` + +### Performance +- **Motion materials**: Use transform/opacity for reliable movement, but use blur, filters, masks, shadows, and color shifts when they materially improve the effect +- **Layout safety**: Avoid casual animation of layout-driving properties (`width`, `height`, `top`, `left`, margins) +- **will-change**: Add sparingly for known expensive animations +- **Bound expensive effects**: Keep blur/filter/shadow areas small or isolated, use `contain` where appropriate +- **Monitor FPS**: Ensure 60fps on target devices + +### Accessibility +```css +@media (prefers-reduced-motion: reduce) { + * { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + } +} +``` + +**NEVER**: +- Use bounce or elastic easing curves; they feel dated and draw attention to the animation itself +- Animate layout properties casually (`width`, `height`, `top`, `left`, margins) when transform, FLIP, or grid-based techniques would work +- Use durations over 500ms for feedback (it feels laggy) +- Animate without purpose (every animation needs a reason) +- Ignore `prefers-reduced-motion` (this is an accessibility violation) +- Animate everything (animation fatigue makes interfaces feel exhausting) +- Block interaction during animations unless intentional + +## Verify Quality + +Test animations thoroughly: + +- **Smooth at 60fps**: No jank on target devices +- **Feels natural**: Easing curves feel organic, not robotic +- **Appropriate timing**: Not too fast (jarring) or too slow (laggy) +- **Reduced motion works**: Animations disabled or simplified appropriately +- **Doesn't block**: Users can interact during/after animations +- **Adds value**: Makes interface clearer or more delightful + +When the motion clarifies state instead of decorating it, hand off to `$impeccable polish` for the final pass. diff --git a/.pi/skills/audit/SKILL.md b/.agents/skills/impeccable/reference/audit.md similarity index 68% rename from .pi/skills/audit/SKILL.md rename to .agents/skills/impeccable/reference/audit.md index 7fddc7b2123474bd02e94a711929cbaa362b4dd9..10f5572fd2012267910ae74b75fadcfe0e234ba2 100644 --- a/.pi/skills/audit/SKILL.md +++ b/.agents/skills/impeccable/reference/audit.md @@ -1,16 +1,4 @@ ---- -name: audit -description: Run technical quality checks across accessibility, performance, theming, responsive design, and anti-patterns. Generates a scored report with P0-P3 severity ratings and actionable plan. Use when the user wants an accessibility check, performance audit, or technical quality review. -version: 2.1.1 ---- - -## MANDATORY PREPARATION - -Invoke /impeccable — it contains design principles, anti-patterns, and the **Context Gathering Protocol**. Follow the protocol before proceeding — if no design context exists yet, you MUST run /impeccable teach first. - ---- - -Run systematic **technical** quality checks and generate a comprehensive report. Don't fix issues — document them for other commands to address. +Run systematic **technical** quality checks and generate a comprehensive report. Don't fix issues; document them for other commands to address. This is a code-level audit, not a design critique. Check what's measurable and verifiable in the implementation. @@ -34,7 +22,7 @@ Run comprehensive checks across 5 dimensions. Score each dimension 0-4 using the **Check for**: - **Layout thrashing**: Reading/writing layout properties in loops -- **Expensive animations**: Animating layout properties (width, height, top, left) instead of transform/opacity +- **Expensive animations**: Casual layout-property animation, unbounded blur/filter/shadow effects, or effects that visibly drop frames - **Missing optimization**: Images without lazy loading, unoptimized assets, missing will-change - **Bundle size**: Unnecessary imports, unused dependencies - **Render performance**: Unnecessary re-renders, missing memoization @@ -64,7 +52,7 @@ Run comprehensive checks across 5 dimensions. Score each dimension 0-4 using the ### 5. Anti-Patterns (CRITICAL) -Check against ALL the **DON'T** guidelines in the impeccable skill. Look for AI slop tells (AI color palette, gradient text, glassmorphism, hero metrics, card grids, generic fonts) and general design anti-patterns (gray on color, nested cards, bounce easing, redundant copy). +Check against ALL the **DON'T** guidelines from the parent impeccable skill (already loaded in this context). Look for AI slop tells (AI color palette, gradient text, glassmorphism, hero metrics, card grids, generic fonts) and general design anti-patterns (gray on color, nested cards, bounce easing, redundant copy). **Score 0-4**: 0=AI slop gallery (5+ tells), 1=Heavy AI aesthetic (3-4 tells), 2=Some tells (1-2 noticeable), 3=Mostly clean (subtle issues only), 4=No AI tells (distinctive, intentional design) @@ -95,10 +83,10 @@ Check against ALL the **DON'T** guidelines in the impeccable skill. Look for AI ### Detailed Findings by Severity Tag every issue with **P0-P3 severity**: -- **P0 Blocking**: Prevents task completion — fix immediately -- **P1 Major**: Significant difficulty or WCAG AA violation — fix before release -- **P2 Minor**: Annoyance, workaround exists — fix in next pass -- **P3 Polish**: Nice-to-fix, no real user impact — fix if time permits +- **P0 Blocking**: Prevents task completion. Fix immediately +- **P1 Major**: Significant difficulty or WCAG AA violation. Fix before release +- **P2 Minor**: Annoyance, workaround exists. Fix in next pass +- **P3 Polish**: Nice-to-fix, no real user impact. Fix if time permits For each issue, document: - **[P?] Issue name** @@ -107,7 +95,7 @@ For each issue, document: - **Impact**: How it affects users - **WCAG/Standard**: Which standard it violates (if applicable) - **Recommendation**: How to fix it -- **Suggested command**: Which command to use (prefer: /animate, /quieter, /shape, /optimize, /adapt, /clarify, /layout, /distill, /delight, /audit, /harden, /polish, /bolder, /typeset, /critique, /colorize, /overdrive) +- **Suggested command**: Which command to use (prefer: $impeccable adapt, $impeccable animate, $impeccable audit, $impeccable bolder, $impeccable clarify, $impeccable colorize, $impeccable critique, $impeccable delight, $impeccable distill, $impeccable document, $impeccable harden, $impeccable layout, $impeccable onboard, $impeccable optimize, $impeccable overdrive, $impeccable polish, $impeccable quieter, $impeccable shape, $impeccable typeset) ### Patterns & Systemic Issues @@ -117,22 +105,22 @@ Identify recurring problems that indicate systemic gaps rather than one-off mist ### Positive Findings -Note what's working well — good practices to maintain and replicate. +Note what's working well: good practices to maintain and replicate. ## Recommended Actions List recommended commands in priority order (P0 first, then P1, then P2): -1. **[P?] `/command-name`** — Brief description (specific context from audit findings) -2. **[P?] `/command-name`** — Brief description (specific context) +1. **[P?] `$command-name`**: Brief description (specific context from audit findings) +2. **[P?] `$command-name`**: Brief description (specific context) -**Rules**: Only recommend commands from: /animate, /quieter, /shape, /optimize, /adapt, /clarify, /layout, /distill, /delight, /audit, /harden, /polish, /bolder, /typeset, /critique, /colorize, /overdrive. Map findings to the most appropriate command. End with `/polish` as the final step if any fixes were recommended. +**Rules**: Only recommend commands from: $impeccable adapt, $impeccable animate, $impeccable audit, $impeccable bolder, $impeccable clarify, $impeccable colorize, $impeccable critique, $impeccable delight, $impeccable distill, $impeccable document, $impeccable harden, $impeccable layout, $impeccable onboard, $impeccable optimize, $impeccable overdrive, $impeccable polish, $impeccable quieter, $impeccable shape, $impeccable typeset. Map findings to the most appropriate command. End with `$impeccable polish` as the final step if any fixes were recommended. After presenting the summary, tell the user: > You can ask me to run these one at a time, all at once, or in any order you prefer. > -> Re-run `/audit` after fixes to see your score improve. +> Re-run `$impeccable audit` after fixes to see your score improve. **IMPORTANT**: Be thorough but actionable. Too many P3 issues creates noise. Focus on what actually matters. @@ -143,4 +131,3 @@ After presenting the summary, tell the user: - Forget to prioritize (everything can't be P0) - Report false positives without verification -Remember: You're a technical quality auditor. Document systematically, prioritize ruthlessly, cite specific code locations, and provide clear paths to improvement. \ No newline at end of file diff --git a/.agents/skills/impeccable/reference/bolder.md b/.agents/skills/impeccable/reference/bolder.md new file mode 100644 index 0000000000000000000000000000000000000000..25e94d597511ac670f4e31fa8927f7b04878f9b3 --- /dev/null +++ b/.agents/skills/impeccable/reference/bolder.md @@ -0,0 +1,113 @@ +When asked for "bolder," AI defaults to the same tired tricks: cyan/purple gradients, glassmorphism, neon accents on dark backgrounds, gradient text on metrics. These are the opposite of bold. Reject them first, then increase visual impact and personality through stronger hierarchy, committed scale, and decisive type. + +--- + +## Register + +Brand: "bolder" means distinctive. Extreme scale, unexpected color, typographic risk, committed POV. + +Product: "bolder" rarely means theatrics; those undermine trust. It means stronger hierarchy, clearer weight contrast, one sharper accent, more committed density. The amplification is in clarity, not drama. + +--- + +## Assess Current State + +Analyze what makes the design feel too safe or boring: + +1. **Identify weakness sources**: + - **Generic choices**: System fonts, basic colors, standard layouts + - **Timid scale**: Everything is medium-sized with no drama + - **Low contrast**: Everything has similar visual weight + - **Static**: No motion, no energy, no life + - **Predictable**: Standard patterns with no surprises + - **Flat hierarchy**: Nothing stands out or commands attention + +2. **Understand the context**: + - What's the brand personality? (How far can we push?) + - What's the purpose? (Marketing can be bolder than financial dashboards) + - Who's the audience? (What will resonate?) + - What are the constraints? (Brand guidelines, accessibility, performance) + +If any of these are unclear from the codebase, STOP and use Codex's structured user-input/question tool when available; if unavailable, ask directly in chat to clarify what you cannot infer. + +**CRITICAL**: "Bolder" doesn't mean chaotic or garish. It means distinctive, memorable, and confident. Think intentional drama, not random chaos. + +**WARNING - AI SLOP TRAP**: Review ALL the DON'T guidelines from the parent impeccable skill (already loaded in this context) before proceeding. Bold means distinctive, not "more effects." + +## Plan Amplification + +Create a strategy to increase impact while maintaining coherence: + +- **Focal point**: What should be the hero moment? (Pick ONE, make it amazing) +- **Personality direction**: Maximalist chaos? Elegant drama? Playful energy? Dark moody? Choose a lane. +- **Risk budget**: How experimental can we be? Push boundaries within constraints. +- **Hierarchy amplification**: Make big things BIGGER, small things smaller (increase contrast) + +**IMPORTANT**: Bold design must still be usable. Impact without function is just decoration. + +## Amplify the Design + +Systematically increase impact across these dimensions: + +### Typography Amplification +- **Replace generic fonts**: Swap system fonts for distinctive choices (see the parent skill's typography guidelines and [typography.md](typography.md) for inspiration) +- **Extreme scale**: Create dramatic size jumps (3x-5x differences, not 1.5x) +- **Weight contrast**: Pair 900 weights with 200 weights, not 600 with 400 +- **Unexpected choices**: Variable fonts, display fonts for headlines, condensed/extended widths, monospace as intentional accent (not as lazy "dev tool" default) + +### Color Intensification +- **Increase saturation**: Shift to more vibrant, energetic colors (but not neon) +- **Bold palette**: Introduce unexpected color combinations. Avoid the purple-blue gradient AI slop +- **Dominant color strategy**: Let one bold color own 60% of the design +- **Sharp accents**: High-contrast accent colors that pop +- **Tinted neutrals**: Replace pure grays with tinted grays that harmonize with your palette +- **Rich gradients**: Intentional multi-stop gradients (not generic purple-to-blue) + +### Spatial Drama +- **Extreme scale jumps**: Make important elements 3-5x larger than surroundings +- **Break the grid**: Let hero elements escape containers and cross boundaries +- **Asymmetric layouts**: Replace centered, balanced layouts with tension-filled asymmetry +- **Generous space**: Use white space dramatically (100-200px gaps, not 20-40px) +- **Overlap**: Layer elements intentionally for depth + +### Visual Effects +- **Dramatic shadows**: Large, soft shadows for elevation (but not generic drop shadows on rounded rectangles) +- **Background treatments**: Mesh patterns, noise textures, geometric patterns, intentional gradients (not purple-to-blue) +- **Texture & depth**: Grain, halftone, duotone, layered elements. NOT glassmorphism (it's overused AI slop) +- **Borders & frames**: Thick borders, decorative frames, custom shapes (not rounded rectangles with colored border on one side) +- **Custom elements**: Illustrative elements, custom icons, decorative details that reinforce brand + +### Motion & Animation +- **Entrance choreography**: Staggered, dramatic page load animations with 50-100ms delays +- **Scroll effects**: Parallax, reveal animations, scroll-triggered sequences +- **Micro-interactions**: Satisfying hover effects, click feedback, state changes +- **Transitions**: Smooth, noticeable transitions using ease-out-quart/quint/expo (not bounce or elastic, which cheapen the effect) + +### Composition Boldness +- **Hero moments**: Create clear focal points with dramatic treatment +- **Diagonal flows**: Escape horizontal/vertical rigidity with diagonal arrangements +- **Full-bleed elements**: Use full viewport width/height for impact +- **Unexpected proportions**: Golden ratio? Throw it out. Try 70/30, 80/20 splits + +**NEVER**: +- Add effects randomly without purpose (chaos ≠ bold) +- Sacrifice readability for aesthetics (body text must be readable) +- Make everything bold (then nothing is bold; you need contrast) +- Ignore accessibility (bold design must still meet WCAG standards) +- Overwhelm with motion (animation fatigue is real) +- Copy trendy aesthetics blindly (bold means distinctive, not derivative) + +## Verify Quality + +Ensure amplification maintains usability and coherence: + +- **NOT AI slop**: Does this look like every other AI-generated "bold" design? If yes, start over. +- **Still functional**: Can users accomplish tasks without distraction? +- **Coherent**: Does everything feel intentional and unified? +- **Memorable**: Will users remember this experience? +- **Performant**: Do all these effects run smoothly? +- **Accessible**: Does it still meet accessibility standards? + +**The test**: If you showed this to someone and said "AI made this bolder," would they believe you immediately? If yes, you've failed. Bold means distinctive, not "more AI effects." + +When the result feels right, hand off to `$impeccable polish` for the final pass. diff --git a/.agents/skills/impeccable/reference/brand.md b/.agents/skills/impeccable/reference/brand.md new file mode 100644 index 0000000000000000000000000000000000000000..3d83a1cdcff6c137c28f706a4974ca1d009c4fb1 --- /dev/null +++ b/.agents/skills/impeccable/reference/brand.md @@ -0,0 +1,118 @@ +# Brand register + +When design IS the product: brand sites, landing pages, marketing surfaces, campaign pages, portfolios, long-form content, about pages. The deliverable is the design itself; a visitor's impression is the thing being made. + +The register spans every genre. A tech brand (Stripe, Linear, Vercel). A luxury brand (a hotel, a fashion house). A consumer product (a restaurant, a travel site, a CPG packaging page). A creative studio, an agency portfolio, a band's album page. They all share the stance (*communicate, not transact*) and diverge wildly in aesthetic. Don't collapse them into a single look. + +## The brand slop test + +If someone could look at this and say "AI made that" without hesitation, it's failed. The bar is distinctiveness; a visitor should ask "how was this made?", not "which AI made this?" + +Brand isn't a neutral register. AI-generated landing pages have flooded the internet, and average is no longer findable. Restraint without intent now reads as mediocre, not refined. Brand surfaces need a POV, a specific audience, a willingness to risk strangeness. Go big or go home. + +**The second slop test: aesthetic lane.** Before committing to moves, name the reference. A Klim-style specimen page is one lane; Stripe-minimal is another; Liquid-Death-acid-maximalism is another. Don't drift into editorial-magazine aesthetics on a brief that isn't editorial. A hiking brand with Cormorant italic drop caps has the wrong register within the register. + +Then the inverse test: in one sentence, describe what you're about to build the way a competitor would describe theirs. If that sentence fits the modal landing page in the category, restart. + +## Typography + +### Font selection procedure + +Every project. Never skip. + +1. Read the brief. Write three concrete brand-voice words. Not "modern" or "elegant," but "warm and mechanical and opinionated" or "calm and clinical and careful." Physical-object words. +2. List the three fonts you'd reach for by reflex. If any appear in the reflex-reject list below, reject them; they are training-data defaults and they create monoculture. +3. Browse a real catalog (Google Fonts, Pangram Pangram, Future Fonts, Adobe Fonts, ABC Dinamo, Klim, Velvetyne) with the three words in mind. Find the font for the brand as a *physical object*: a museum caption, a 1970s terminal manual, a fabric label, a cheap-newsprint children's book, a concert poster, a receipt from a mid-century diner. Reject the first thing that "looks designy." +4. Cross-check. "Elegant" is not necessarily serif. "Technical" is not necessarily sans. "Warm" is not Fraunces. If the final pick lines up with the original reflex, start over. + +### Reflex-reject list + +Training-data defaults. Ban list. Look further: + +Fraunces · Newsreader · Lora · Crimson · Crimson Pro · Crimson Text · Playfair Display · Cormorant · Cormorant Garamond · Syne · IBM Plex Mono · IBM Plex Sans · IBM Plex Serif · Space Mono · Space Grotesk · Inter · DM Sans · DM Serif Display · DM Serif Text · Outfit · Plus Jakarta Sans · Instrument Sans · Instrument Serif + +### Reflex-reject aesthetic lanes + +Parallel to the font list. Currently saturated aesthetic families that have flooded brand surfaces. If a brief lands in one of these lanes without a register reason that *requires* it (a literal magazine, a literal terminal, a literal industrial signage system), it's the second-order training reflex: the trap one tier deeper than picking a Fraunces font. Look further. + +- **Editorial-typographic.** Display serif (often italic) + small mono labels + ruled separators + monochromatic restraint. Klim-influenced, magazine-cover affectation. By 2026, every Stripe-adjacent and Notion-adjacent brand has landed here. The fingerprint: three rule-separated columns, an italic Fraunces / Recoleta / Newsreader headline, lowercase track-spaced metadata, no imagery. + +(More entries land here on the same cadence the font list updates. Brutalist-utility and acid-maximalism may join when they saturate. Removing entries when they fall back below saturation is also fine.) + +The reflex-reject lists apply to **new design choices**. When the existing brand has already committed to a font or a lane as part of its identity, identity-preservation wins; variants on an existing surface don't second-guess what's already shipping. The reflex-reject lists are for greenfield decisions and for departure-mode variants in [live.md](live.md). + +### Pairing and voice + +Distinctive + refined is the goal. The specific shape depends on the brand: + +- **Editorial / long-form / luxury**: display serif + sans body (a magazine shape). +- **Tech / dev tools / fintech**: one committed sans, usually; custom-tight tracking, strong weight contrast inside a single family. +- **Consumer / food / travel**: warmer pairings, often a humanist sans plus a script or display serif. +- **Creative studios / agencies**: rule-breaking welcome. Mono-only, or display-only, or custom-drawn type as voice. + +Two families minimum is the rule *only* when the voice needs it. A single well-chosen family with committed weight/size contrast is stronger than a timid display+body pair. + +Vary across projects. If the last brief was a serif-display landing page, this one isn't. + +### Scale + +Modular scale, fluid `clamp()` for headings, ≥1.25 ratio between steps. Flat scales (1.1× apart) read as uncommitted. + +Light text on dark backgrounds: add 0.05–0.1 to line-height. Light type reads as lighter weight and needs more breathing room. + +## Color + +Brand surfaces have permission for Committed, Full palette, and Drenched strategies. Use them. A single saturated color spread across a hero is not excess; it's voice. A beige-and-muted-slate landing page ignores the register. + +- Name a real reference before picking a strategy. "Klim Type Foundry #ff4500 orange drench", "Stripe purple-on-white restraint", "Liquid Death acid-green full palette", "Mailchimp yellow full palette", "Condé Nast Traveler muted navy restraint", "Vercel pure black monochrome". Unnamed ambition becomes beige. +- Palette IS voice. A calm brand and a restless brand should not share palette mechanics. +- When the strategy is Committed or Drenched, color carries the brand. Don't hedge with neutrals around the edges. Commit. +- Don't converge across projects. If the last brand surface was restrained-on-cream, this one is not. +- When a cultural-symbol palette is the obvious pull, reach past it. Let the cultural reading come from typography, imagery, and copy, not the palette. + +## Layout + +- Asymmetric compositions are one option. Break the grid intentionally for emphasis. +- Fluid spacing with `clamp()` that breathes on larger viewports. Vary for rhythm: generous separations, tight groupings. +- Alternative: a strict, visible grid as the voice (brutalist / Swiss / tech-spec aesthetics). Either asymmetric or rigorously-gridded can be "designed"; the failure mode is splitting the difference into a generic centered stack. +- Don't default to centering everything. Left-aligned with asymmetric layouts feels more designed; a strict grid reads as confident structure. A centered-stack hero with icon-title-subtitle cards reads as template. +- When cards ARE the right affordance, use `grid-template-columns: repeat(auto-fit, minmax(280px, 1fr))` for breakpoint-free responsiveness. + +## Imagery + +Brand surfaces lean on imagery. A restaurant, hotel, magazine, or product landing page without any imagery reads as incomplete, not as restrained. A solid-color rectangle where a hero image should go is worse than a representative stock photo. + +**When the brief implies imagery (restaurants, hotels, magazines, photography, hobbyist communities, food, travel, fashion, product), you must ship imagery.** Zero images is a bug, not a design choice. "Restraint" is not an excuse. If the approved comp or brief is image-led, ship real project assets, generated raster assets, or a credible canvas/SVG/WebGL scene. Do not replace photographic, architectural, product, or place imagery with generic CSS panels, decorative diagrams, cards, bullets, or copy. + +- **For greenfield work without local assets, use stock imagery.** Unsplash is the default. The URL shape is `https://images.unsplash.com/photo-{id}?auto=format&fit=crop&w=1600&q=80`. **Verify the URLs before referencing them.** If you have an image-search MCP, web-fetch tool, or browser access, use it to find real photo IDs and confirm they resolve. Guessed IDs (even ones that look real) often 404 and ship as broken-image placeholders. Without a verification path, pick fewer photos you're confident exist over more that you guessed; never substitute colored `
` placeholders. +- **Search for the brand's physical object**, not the generic category: "handmade pasta on a scratched wooden table" beats "Italian food"; "cypress trees above a limestone hotel facade at dusk" beats "luxury hotel". +- **One decisive photo beats five mediocre ones.** Hero imagery should commit to a mood; padding with more stock doesn't rescue an indecisive one. +- **Alt text is part of the voice.** "Coastal fettuccine, hand-cut, served on the terrace" beats "pasta dish". + +"Imagery" here is broader than stock photography: product screenshots, custom data visualizations, generated SVG, and canvas/WebGL scenes are all imagery. Text-only pages where typography alone carries the entire visual weight are the failure mode. + +## Motion + +- One well-orchestrated page-load with staggered reveals beats scattered micro-interactions, when the brand invites it. Tech-minimal brands often skip entrance motion entirely; the restraint is the voice. +- For collapsing/expanding sections, transition `grid-template-rows` rather than `height`. + +## Brand bans (on top of the shared absolute bans) + +- Monospace as lazy shorthand for "technical / developer." If the brand isn't technical, mono reads as costume. +- Large rounded-corner icons above every heading. Screams template. +- Single-family pages that picked the family by reflex, not voice. (A single family chosen deliberately is fine.) +- All-caps body copy. Reserve caps for short labels and headings. +- Timid palettes and average layouts. Safe = invisible. +- Zero imagery on a brief that implies imagery (restaurant, hotel, food, travel, fashion, photography, hobbyist). Colored blocks where a hero photo belongs. +- Defaulting to editorial-magazine aesthetics (display serif + italic + drop caps + broadsheet grid) on briefs that aren't magazine-shaped. Editorial is ONE aesthetic lane, not the default brand aesthetic. +- Repeated tiny uppercase tracked labels above every section heading. A single strong kicker can be voice; repeating it as section grammar is AI scaffolding unless it's a deliberate, named brand system. + +## Brand permissions + +Brand can afford things product can't. Take them. + +- Ambitious first-load motion. Reveals, scroll-triggered transitions, typographic choreography. +- Single-purpose viewports. One dominant idea per fold, long scroll, deliberate pacing. +- Typographic risk. Enormous display type, unexpected italic cuts, mixed cases, hand-drawn headlines, a single oversize word as a hero. +- Unexpected color strategies. Palette IS voice; a calm brand and a restless brand should not share palette mechanics. +- Art direction per section. Different sections can have different visual worlds if the narrative demands it. Consistency of voice beats consistency of treatment. diff --git a/.pi/skills/clarify/SKILL.md b/.agents/skills/impeccable/reference/clarify.md similarity index 84% rename from .pi/skills/clarify/SKILL.md rename to .agents/skills/impeccable/reference/clarify.md index 4685410901488cbd93076681e56cb8ea905ae581..07b9d8d26d3f7b0801c18acc8847c66608422a12 100644 --- a/.pi/skills/clarify/SKILL.md +++ b/.agents/skills/impeccable/reference/clarify.md @@ -1,14 +1,7 @@ ---- -name: clarify -description: Improve unclear UX copy, error messages, microcopy, labels, and instructions to make interfaces easier to understand. Use when the user mentions confusing text, unclear labels, bad error messages, hard-to-follow instructions, or wanting better UX writing. -version: 2.1.1 ---- - -Identify and improve unclear, confusing, or poorly written interface text to make the product easier to understand and use. +> **Additional context needed**: audience technical level and users' mental state in context. -## MANDATORY PREPARATION +Find the unclear, confusing, or poorly written interface text and rewrite it. Vague copy creates support tickets and abandonment; specific copy gets users through the task. -Invoke /impeccable — it contains design principles, anti-patterns, and the **Context Gathering Protocol**. Follow the protocol before proceeding — if no design context exists yet, you MUST run /impeccable teach first. Additionally gather: audience technical level and users' mental state in context. --- @@ -153,7 +146,7 @@ Every piece of copy should follow these rules: 2. **Be concise**: Cut unnecessary words (but don't sacrifice clarity) 3. **Be active**: "Save changes" not "Changes will be saved" 4. **Be human**: "Oops, something went wrong" not "System error encountered" -5. **Be helpful**: Tell users what to do, not just what happened +5. **Tell users what to do**, not just what happened 6. **Be consistent**: Use same terms throughout (don't vary for variety) **NEVER**: @@ -178,4 +171,4 @@ Test that copy improvements work: - **Consistency**: Does it match terminology elsewhere? - **Tone**: Is it appropriate for the situation? -Remember: You're a clarity expert with excellent communication skills. Write like you're explaining to a smart friend who's unfamiliar with the product. Be clear, be helpful, be human. \ No newline at end of file +When the copy reads cleanly, hand off to `$impeccable polish` for the final pass. diff --git a/.agents/skills/impeccable/reference/codex.md b/.agents/skills/impeccable/reference/codex.md new file mode 100644 index 0000000000000000000000000000000000000000..0b35f3e34564f4ba4e1601731e8719c669198a44 --- /dev/null +++ b/.agents/skills/impeccable/reference/codex.md @@ -0,0 +1,105 @@ +# Codex: Visual Direction & Asset Production + +This file is loaded by `$impeccable craft` when the harness has native image generation (currently Codex via `image_gen`). Other harnesses skip it. It covers the two craft steps that depend on real image generation: landing the visual direction, and producing the raster assets the implementation will compose. + +Read this *before* generating any images. The order matters, and the per-step user pauses are what keep generated imagery from drifting away from the brief. + +### Four stop points before code + +Steps A through D each end with the user. Do not advance past any of them on your own read of the situation. + +1. **STOP after Step A questions.** Wait for answers. +2. **STOP after Step B palette generation.** Wait for "confirm palette." +3. **STOP after Step C mocks.** Wait for direction approval or delegation. +4. **Only after Step D approves a direction** do you return to craft.md Step 4 and write code. + +Prior shape approval does **not** satisfy any of these. Shape's "confirm or override" advances you into Step A; it is not a substitute for it. + +## Step A: Explore Directions with the User + +Before generating anything, run a brief direction conversation grounded in the shape brief. + +**Step A is required even when shape just produced a confirmed brief.** The shape questions and Step A questions cover different ground: shape pins purpose, content, scope; Step A pins palette, atmosphere, and named visual references for the comps you're about to generate. The only time you can skip Step A is when the user has already answered these exact palette/atmosphere/reference questions in the same session. + +Ask **2-3 targeted questions** about visual lane, color strategy, atmosphere, and named anchor references. Don't enumerate generic menus; tie each question to the shape brief's answers. Example shape-grounded questions: + +- "Brief says 'editorial restraint, Klim-adjacent.' Are we closer to a quiet specimen page or a magazine-spread feel with hero imagery?" +- "Palette strategy from shape was 'Committed.' Want it warm-grounded (deep oxblood + cream) or cool-grounded (slate + paper white)?" + +**STOP and wait for answers.** These pin the palette before any pixel gets generated. Do not proceed to Step B until the user has responded. + +## Step B: Generate the Brand Palette First + +Generate **one** palette artifact before any mocks. This is a small, focused image: typography pairing on the chosen background, primary + accent color swatches, one signature ornament or motif. Single image, single pass. + +Why palette first: mocks generated against a vague color sense produce noise that drowns out the structural decisions. A confirmed palette is the first concrete contract for everything downstream. + +Show the palette to the user. Ask one question: "This is the palette I'm locking in for the mocks. Confirm, or call out what to shift?" + +**STOP and wait for confirmation.** Do not generate mocks against an unconfirmed palette. "Probably good enough" is the wrong call here; the palette is the contract for everything downstream. + +## Step C: Generate 1-3 Visual Mocks Against the Palette + +Once the palette is confirmed, generate **1 to 3** high-fidelity north-star comps. Each mock must use the confirmed palette and typography. Mocks differ in *structural* direction (hierarchy, topology, density, composition), not in color or motif. + +- Brand work: push visual identity, composition, mood, and signature motifs. +- Product work: push hierarchy, topology, density, tone, grounded in realistic product structure. +- Landing pages and long-form brand surfaces: show enough of the second fold to establish the system beyond the hero. + +Use the `image_gen` tool directly (or via the imagegen skill when available). Don't ask the user to install anything. + +## Step D: Approval Loop + +Show the comps. Ask what carries forward. Iterate until **one direction is approved** or the user explicitly delegates. + +**STOP and wait for the approval or the delegation.** Do not begin Step E or return to craft.md Step 4 until a single direction is named. If the user delegates, pick the strongest direction and explain it from the brief, not personal taste. + +Before moving to assets, summarize what to carry into code and what *not* to literalize from the mock. This is the handoff between visual exploration and semantic implementation. + +## Step E: Mock Fidelity Inventory + +Inventory the approved mock's major visible ingredients. For each, decide implementation: semantic HTML/CSS/SVG, generated raster, sourced raster, icon library, canvas/WebGL, or accepted omission. + +Common ingredients to inventory: + +- Hero silhouette and dominant composition +- Signature motifs (planets, devices, portraits, charts, route lines, insets, badges, etc.) +- Nav and primary CTA treatment +- Section sequence, especially the second fold +- Image-native content the concept depends on +- Typography, density, color/material treatment, motion cues + +Treat the mock as a north star, not a screenshot to trace. Don't rasterize core UI text. But if the live result lacks the mock's major ingredients, the implementation is wrong. + +If a photographic, architectural, product, or place-led mock becomes generic CSS scenery, decorative diagrams, bullets, or copy, stop and fix it. That's a broken implementation, not a harmless interpretation. + +Don't substitute a different hero composition or visual driver post-approval without user sign-off. + +## Step F: Asset Slicing via the Asset Producer + +Raster ingredients identified in Step E need clean production assets. Use the bundled `impeccable_asset_producer` subagent rather than producing inline. + +Spawn it as a scoped subagent. If you do not have explicit permission to use agents, stop and ask: + +```text +Asset production will work better as a scoped subagent job. Should I spawn the Impeccable asset producer subagent for this step? +``` + +Pass to the agent: + +- Approved mock path or screenshot reference +- Crop paths or a contact sheet with crop ids +- Output directory +- Required dimensions, format, transparency needs +- Avoid list +- Notes on what should remain semantic HTML/CSS/SVG instead of raster + +Attach image generation capability to the spawned agent when the harness supports it. Do **not** load image-generation reference material into the parent thread. + +Inline asset production is allowed only if the user declines subagents, the harness cannot spawn the authorized agent, or the user explicitly asks for single-thread mode. + +Prefer HTML/CSS/SVG/canvas when they can credibly reproduce an ingredient; reach for real, generated, or stock imagery when the mock or subject matter calls for actual visual content. + +## After This File + +Once Steps A through F are complete, return to `craft.md` Step 5 (Build to Production Quality). The implementation builds against the confirmed palette, approved mock, and the assets the producer wrote. diff --git a/.agents/skills/critique/reference/cognitive-load.md b/.agents/skills/impeccable/reference/cognitive-load.md similarity index 88% rename from .agents/skills/critique/reference/cognitive-load.md rename to .agents/skills/impeccable/reference/cognitive-load.md index 313df166b62d55cbe6bd9c117834259f1a1e08f3..48f8ad58bb2aa9e9b0aa00aea8eab2a35f780f40 100644 --- a/.agents/skills/critique/reference/cognitive-load.md +++ b/.agents/skills/impeccable/reference/cognitive-load.md @@ -6,17 +6,17 @@ Cognitive load is the total mental effort required to use an interface. Overload ## Three Types of Cognitive Load -### Intrinsic Load — The Task Itself +### Intrinsic Load: The Task Itself Complexity inherent to what the user is trying to do. You can't eliminate this, but you can structure it. **Manage it by**: - Breaking complex tasks into discrete steps - Providing scaffolding (templates, defaults, examples) -- Progressive disclosure — show what's needed now, hide the rest +- Progressive disclosure: show what's needed now, hide the rest - Grouping related decisions together -### Extraneous Load — Bad Design -Mental effort caused by poor design choices. **Eliminate this ruthlessly** — it's pure waste. +### Extraneous Load: Bad Design +Mental effort caused by poor design choices. **Eliminate this ruthlessly.** It's pure waste. **Common sources**: - Confusing navigation that requires mental mapping @@ -25,8 +25,8 @@ Mental effort caused by poor design choices. **Eliminate this ruthlessly** — i - Inconsistent patterns that prevent learning - Unnecessary steps between user intent and result -### Germane Load — Learning Effort -Mental effort spent building understanding. This is *good* cognitive load — it leads to mastery. +### Germane Load: Learning Effort +Mental effort spent building understanding. This is *good* cognitive load; it leads to mastery. **Support it by**: - Progressive disclosure that reveals complexity gradually @@ -58,9 +58,9 @@ Evaluate the interface against these 8 items: **Humans can hold ≤4 items in working memory at once** (Miller's Law revised by Cowan, 2001). At any decision point, count the number of distinct options, actions, or pieces of information a user must simultaneously consider: -- **≤4 items**: Within working memory limits — manageable -- **5–7 items**: Pushing the boundary — consider grouping or progressive disclosure -- **8+ items**: Overloaded — users will skip, misclick, or abandon +- **≤4 items**: Within working memory limits, manageable +- **5–7 items**: Pushing the boundary; consider grouping or progressive disclosure +- **8+ items**: Overloaded; users will skip, misclick, or abandon **Practical applications**: - Navigation menus: ≤5 top-level items (group the rest under clear categories) @@ -90,7 +90,7 @@ At any decision point, count the number of distinct options, actions, or pieces **Fix**: Use plain language. If domain terms are unavoidable, define them inline. ### 5. The Visual Noise Floor -**Problem**: Every element has the same visual weight — nothing stands out. +**Problem**: Every element has the same visual weight; nothing stands out. **Fix**: Establish clear hierarchy: one primary element, 2–3 secondary, everything else muted. ### 6. The Inconsistent Pattern diff --git a/.agents/skills/impeccable/reference/color-and-contrast.md b/.agents/skills/impeccable/reference/color-and-contrast.md index 88a15cce5de91be84a015d00ab921b3b64d9af4b..110c2ee47efdb2e290ce44cd67d501f9d12b1eb8 100644 --- a/.agents/skills/impeccable/reference/color-and-contrast.md +++ b/.agents/skills/impeccable/reference/color-and-contrast.md @@ -2,11 +2,11 @@ ## Color Spaces: Use OKLCH -**Stop using HSL.** Use OKLCH (or LCH) instead. It's perceptually uniform, meaning equal steps in lightness *look* equal—unlike HSL where 50% lightness in yellow looks bright while 50% in blue looks dark. +**Stop using HSL.** Use OKLCH (or LCH) instead. It's perceptually uniform, meaning equal steps in lightness *look* equal, unlike HSL where 50% lightness in yellow looks bright while 50% in blue looks dark. -The OKLCH function takes three components: `oklch(lightness chroma hue)` where lightness is 0-100%, chroma is roughly 0-0.4, and hue is 0-360. To build a primary color and its lighter / darker variants, hold the chroma+hue roughly constant and vary the lightness — but **reduce chroma as you approach white or black**, because high chroma at extreme lightness looks garish. +The OKLCH function takes three components: `oklch(lightness chroma hue)` where lightness is 0-100%, chroma is roughly 0-0.4, and hue is 0-360. To build a primary color and its lighter / darker variants, hold the chroma+hue roughly constant and vary the lightness, but **reduce chroma as you approach white or black**, because high chroma at extreme lightness looks garish. -The hue you pick is a brand decision and should not come from a default. Do not reach for blue (hue 250) or warm orange (hue 60) by reflex — those are the dominant AI-design defaults, not the right answer for any specific brand. +The hue you pick is a brand decision and should not come from a default. Do not reach for blue (hue 250) or warm orange (hue 60) by reflex; those are the dominant AI-design defaults, not the right answer for any specific brand. ## Building Functional Palettes @@ -36,8 +36,8 @@ A complete system needs: This rule is about **visual weight**, not pixel count: - **60%**: Neutral backgrounds, white space, base surfaces -- **30%**: Secondary colors—text, borders, inactive states -- **10%**: Accent—CTAs, highlights, focus states +- **30%**: Secondary colors: text, borders, inactive states +- **10%**: Accent: CTAs, highlights, focus states The common mistake: using the accent color everywhere because it's "the brand color." Accent colors work *because* they're rare. Overuse kills their power. @@ -59,15 +59,15 @@ The common mistake: using the accent color everywhere because it's "the brand co These commonly fail contrast or cause readability issues: - Light gray text on white (the #1 accessibility fail) -- **Gray text on any colored background**—gray looks washed out and dead on color. Use a darker shade of the background color, or transparency -- Red text on green background (or vice versa)—8% of men can't distinguish these +- **Gray text on any colored background**: gray looks washed out and dead on color. Use a darker shade of the background color, or transparency +- Red text on green background (or vice versa): 8% of men can't distinguish these - Blue text on red background (vibrates visually) - Yellow text on white (almost always fails) - Thin light text on images (unpredictable contrast) ### Never Use Pure Gray or Pure Black -Pure gray (`oklch(50% 0 0)`) and pure black (`#000`) don't exist in nature—real shadows and surfaces always have a color cast. Even a chroma of 0.005-0.01 is enough to feel natural without being obviously tinted. (See tinted neutrals example above.) +Pure gray (`oklch(50% 0 0)`) and pure black (`#000`) don't exist in nature; real shadows and surfaces always have a color cast. Even a chroma of 0.005-0.01 is enough to feel natural without being obviously tinted. (See tinted neutrals example above.) ### Testing @@ -88,13 +88,13 @@ You can't just swap colors. Dark mode requires different design decisions: | Shadows for depth | Lighter surfaces for depth (no shadows) | | Dark text on light | Light text on dark (reduce font weight) | | Vibrant accents | Desaturate accents slightly | -| White backgrounds | Never pure black—use dark gray (oklch 12-18%) | +| White backgrounds | Never pure black; use dark gray (oklch 12-18%) | -In dark mode, depth comes from surface lightness, not shadow. Build a 3-step surface scale where higher elevations are lighter (e.g. 15% / 20% / 25% lightness). Use the SAME hue and chroma as your brand color (whatever it is for THIS project — do not reach for blue) and only vary the lightness. Reduce body text weight slightly (e.g. 350 instead of 400) because light text on dark reads as heavier than dark text on light. +In dark mode, depth comes from surface lightness, not shadow. Build a 3-step surface scale where higher elevations are lighter (e.g. 15% / 20% / 25% lightness). Use the SAME hue and chroma as your brand color (whatever it is for THIS project; do not reach for blue) and only vary the lightness. Reduce body text weight slightly (e.g. 350 instead of 400) because light text on dark reads as heavier than dark text on light. ### Token Hierarchy -Use two layers: primitive tokens (`--blue-500`) and semantic tokens (`--color-primary: var(--blue-500)`). For dark mode, only redefine the semantic layer—primitives stay the same. +Use two layers: primitive tokens (`--blue-500`) and semantic tokens (`--color-primary: var(--blue-500)`). For dark mode, only redefine the semantic layer; primitives stay the same. ## Alpha Is A Design Smell diff --git a/.agents/skills/impeccable/reference/colorize.md b/.agents/skills/impeccable/reference/colorize.md new file mode 100644 index 0000000000000000000000000000000000000000..a6ddfb292d730c277fb60f94173eb5f90895ea3c --- /dev/null +++ b/.agents/skills/impeccable/reference/colorize.md @@ -0,0 +1,154 @@ +> **Additional context needed**: existing brand colors. + +Replace timid grayscale or single-accent designs with a strategic palette: pick a color strategy, choose a hue family that fits the brand, then apply color with intent. More color ≠ better. Strategic color beats rainbow vomit. + +--- + +## Register + +Brand: palette IS voice. Pick a color strategy first per SKILL.md (Restrained / Committed / Full palette / Drenched) and follow its dosage. Committed, Full palette, and Drenched deliberately exceed the ≤10% rule; that rule is Restrained only. Unexpected combinations are allowed; a dominant color can own the page when the chosen strategy calls for it. + +Product: semantic-first and almost always Restrained. Accent color is reserved for primary action, current selection, and state indicators. Not decoration. Every color has a consistent meaning across every screen. + +--- + +## Assess Color Opportunity + +Analyze the current state and identify opportunities: + +1. **Understand current state**: + - **Color absence**: Pure grayscale? Limited neutrals? One timid accent? + - **Missed opportunities**: Where could color add meaning, hierarchy, or delight? + - **Context**: What's appropriate for this domain and audience? + - **Brand**: Are there existing brand colors we should use? + +2. **Identify where color adds value**: + - **Semantic meaning**: Success (green), error (red), warning (yellow/orange), info (blue) + - **Hierarchy**: Drawing attention to important elements + - **Categorization**: Different sections, types, or states + - **Emotional tone**: Warmth, energy, trust, creativity + - **Wayfinding**: Helping users navigate and understand structure + - **Delight**: Moments of visual interest and personality + +If any of these are unclear from the codebase, STOP and use Codex's structured user-input/question tool when available; if unavailable, ask directly in chat to clarify what you cannot infer. + +**CRITICAL**: More color ≠ better. Strategic color beats rainbow vomit every time. Every color should have a purpose. + +## Plan Color Strategy + +Create a purposeful color introduction plan: + +- **Color palette**: What colors match the brand/context? (Choose 2-4 colors max beyond neutrals) +- **Dominant color**: Which color owns 60% of colored elements? +- **Accent colors**: Which colors provide contrast and highlights? (30% and 10%) +- **Application strategy**: Where does each color appear and why? + +**IMPORTANT**: Color should enhance hierarchy and meaning, not create chaos. Less is more when it matters more. + +## Introduce Color Strategically + +Add color systematically across these dimensions: + +### Semantic Color +- **State indicators**: + - Success: Green tones (emerald, forest, mint) + - Error: Red/pink tones (rose, crimson, coral) + - Warning: Orange/amber tones + - Info: Blue tones (sky, ocean, indigo) + - Neutral: Gray/slate for inactive states + +- **Status badges**: Colored backgrounds or borders for states (active, pending, completed, etc.) +- **Progress indicators**: Colored bars, rings, or charts showing completion or health + +### Accent Color Application +- **Primary actions**: Color the most important buttons/CTAs +- **Links**: Add color to clickable text (maintain accessibility) +- **Icons**: Colorize key icons for recognition and personality +- **Headers/titles**: Add color to section headers or key labels +- **Hover states**: Introduce color on interaction + +### Background & Surfaces +- **Tinted backgrounds**: Replace pure gray (`#f5f5f5`) with warm neutrals (`oklch(97% 0.01 60)`) or cool tints (`oklch(97% 0.01 250)`) +- **Colored sections**: Use subtle background colors to separate areas +- **Gradient backgrounds**: Add depth with subtle, intentional gradients (not generic purple-blue) +- **Cards & surfaces**: Tint cards or surfaces slightly for warmth + +**Use OKLCH for color**: It's perceptually uniform, meaning equal steps in lightness *look* equal. Great for generating harmonious scales. + +### Data Visualization +- **Charts & graphs**: Use color to encode categories or values +- **Heatmaps**: Color intensity shows density or importance +- **Comparison**: Color coding for different datasets or timeframes + +### Borders & Accents +- **Hairline borders**: 1px colored borders on full perimeter (not side-stripes; see the absolute ban on `border-left/right > 1px`) +- **Underlines**: Color underlines for emphasis or active states +- **Dividers**: Subtle colored dividers instead of gray lines +- **Focus rings**: Colored focus indicators matching brand +- **Surface tints**: A 4-8% background wash of the accent color instead of a stripe + +**NEVER**: `border-left` or `border-right` greater than 1px as a colored accent stripe. This is one of the three absolute bans in the parent skill. If you want to mark a card as "active" or "warning", use a full hairline border, a background tint, a leading glyph, or a numbered prefix. Not a side stripe. + +### Typography Color +- **Colored headings**: Use brand colors for section headings (maintain contrast) +- **Highlight text**: Color for emphasis or categories +- **Labels & tags**: Small colored labels for metadata or categories + +### Decorative Elements +- **Illustrations**: Add colored illustrations or icons +- **Shapes**: Geometric shapes in brand colors as background elements +- **Gradients**: Colorful gradient overlays or mesh backgrounds +- **Blobs/organic shapes**: Soft colored shapes for visual interest + +## Balance & Refinement + +Ensure color addition improves rather than overwhelms: + +### Maintain Hierarchy +- **Dominant color** (60%): Primary brand color or most used accent +- **Secondary color** (30%): Supporting color for variety +- **Accent color** (10%): High contrast for key moments +- **Neutrals** (remaining): Gray/black/white for structure + +### Accessibility +- **Contrast ratios**: Ensure WCAG compliance (4.5:1 for text, 3:1 for UI components) +- **Don't rely on color alone**: Use icons, labels, or patterns alongside color +- **Test for color blindness**: Verify red/green combinations work for all users + +### Cohesion +- **Consistent palette**: Use colors from defined palette, not arbitrary choices +- **Systematic application**: Same color meanings throughout (green always = success) +- **Temperature consistency**: Warm palette stays warm, cool stays cool + +**NEVER**: +- Use every color in the rainbow (choose 2-4 colors beyond neutrals) +- Apply color randomly without semantic meaning +- Put gray text on colored backgrounds. It looks washed out; use a darker shade of the background color or transparency instead +- Use pure gray for neutrals. Add subtle color tint (warm or cool) for depth +- Use pure black (`#000`) or pure white (`#fff`) for large areas +- Violate WCAG contrast requirements +- Use color as the only indicator (accessibility issue) +- Make everything colorful (defeats the purpose) +- Default to purple-blue gradients (AI slop aesthetic) + +## Verify Color Addition + +Test that colorization improves the experience: + +- **Better hierarchy**: Does color guide attention appropriately? +- **Clearer meaning**: Does color help users understand states/categories? +- **More engaging**: Does the interface feel warmer and more inviting? +- **Still accessible**: Do all color combinations meet WCAG standards? +- **Not overwhelming**: Is color balanced and purposeful? + +When the palette earns its place, hand off to `$impeccable polish` for the final pass. + +## Live-mode signature params + +When invoked from live mode, each variant MUST declare a `color-amount` param so the user can dial between a restrained accent and a drenched surface without regeneration. Author the variant's CSS against `var(--p-color-amount, 0.5)`, typically as the alpha multiplier on backgrounds, or as a scaling factor on the chroma axis in an OKLCH expression. 0 = neutral/monochrome, 1 = full saturation / dominant coverage. + +```json +{"id":"color-amount","kind":"range","min":0,"max":1,"step":0.05,"default":0.5,"label":"Color amount"} +``` + +Layer 1-2 variant-specific params on top: palette selection (`steps` with named options), temperature warmth, or tint vs. true color. See `reference/live.md` for the full params contract. diff --git a/.agents/skills/impeccable/reference/craft.md b/.agents/skills/impeccable/reference/craft.md index 8cddbc9db406e85de1781dce952b869af91bff79..831b08ab904e5c8799b3cce29a2b5689c522cf55 100644 --- a/.agents/skills/impeccable/reference/craft.md +++ b/.agents/skills/impeccable/reference/craft.md @@ -1,14 +1,56 @@ # Craft Flow -Build a feature with impeccable UX and UI quality through a structured process: shape the design, load the right references, then build and iterate visually until the result is delightful. +Build a feature with impeccable UX and UI quality: shape the design, land the visual direction, build real production code, inspect and improve in-browser until it meets a high-end studio bar. + +Before writing code, you need: PRODUCT.md loaded, register identified and the matching reference loaded, and a confirmed design direction for this task (either from `shape` or supplied by the user). PRODUCT.md is project context, not a task-specific brief. + +Treat any approved visual direction (generated mock or stated reference) as a concrete contract for composition, hierarchy, density, atmosphere, signature motifs, and distinctive visual moves. Don't let mocks replace structure, copy, accessibility, or state design. But if the live result lacks the approved direction's major ingredients, the implementation is wrong. + +### Gates: do not compress + +Craft has **multiple user gates**, not one. When the harness has native image generation (Codex via `image_gen`), the gate sequence before code is: + +1. **Shape brief confirmed** (Step 1) +2. **Direction questions answered** (codex.md Step A) +3. **Palette confirmed** (codex.md Step B) +4. **One mock direction approved or delegated** (codex.md Step D) + +You must stop at every gate. **Shape confirmation alone is NOT a green light to start coding.** It is the green light to begin codex.md Step A. Compressing gates 2 through 4 because the shape brief felt complete is the dominant failure mode of this flow. + +When the harness lacks native image generation, gates 2-4 collapse into the brief itself, and shape confirmation does advance straight to code. + +## Step 0: Project Foundation + +Before shape, before code: figure out what kind of project you're working in. + +Look at the working directory. Run `ls`. Check for: + +- An existing framework: `astro.config.mjs/ts`, `next.config.js/ts`, `nuxt.config.ts`, `svelte.config.js`, `vite.config.js/ts`, `package.json` with framework deps, `Cargo.toml` + Leptos/Yew, `Gemfile` + Rails. **If found, use it.** Do not start a parallel build, do not introduce a second framework, do not write to `dist/` or `build/` directly. Whatever pipeline the project has, respect it. +- An existing component library or design system: `src/components/`, `app/components/`, a `tokens.css` / `theme.ts`, an `astro.config` `integrations`. Read what's there before adding to it. +- An existing icon set: `lucide-react`, `@phosphor-icons/react`, `@iconify/*`, hand-rolled SVG sprites in `assets/icons/`. **Use what's already in the project**; don't introduce a second set. + +If the directory is empty (greenfield), don't pick a framework silently. Ask the user via the AskUserQuestion tool, with sensible defaults framed by the brief: + +```text +What should this be built on? + - Astro (default for content-led brand sites, landing pages, marketing surfaces) + - SvelteKit / Next.js / Nuxt (when the brief implies an app surface or significant interactivity) + - Single index.html (one-shot demo, prototype, or a deliberately framework-free experiment) +``` + +Default: Astro for brand briefs, the project's existing framework for product briefs. Ask once; don't re-ask mid-task. ## Step 1: Shape the Design -Run /shape, passing along whatever feature description the user provided. +Run $impeccable shape, passing along whatever feature description the user provided. Shape is **required** for craft; it is what produces a confirmed direction. + +Present the shape output and stop. Wait for the user to confirm, override, or course-correct before writing code. -Wait for the design brief to be fully confirmed before proceeding. The brief is your blueprint, and every implementation decision should trace back to it. +If the user already supplied a confirmed brief or ran shape separately, use it and skip this step. -If the user has already run /shape and has a confirmed design brief, skip this step and use the existing brief. +When the original prompt + PRODUCT.md already answer scope, content, and visual direction with no real ambiguity, the shape output can be **compact** (3-5 bullets stating what you're building and the visual lane, ending with one or two specific questions or "confirm or override"). The full 10-section structured brief is reserved for genuinely ambiguous, multi-screen, or stakeholder-heavy tasks. Don't pad a clear brief into a long one to look thorough; equally, don't skip the pause to look efficient. + +If the harness has native image generation (Codex), a compact shape's "confirm or override" advances to **Step 3 and the codex.md flow**, not to Step 4. Phrase the closing line accordingly: "Confirm or override; once we lock direction, I'll run a couple of palette and reference questions before generating any mocks." This stops the model from reading shape confirmation as code-green. ## Step 2: Load References @@ -24,47 +66,58 @@ Then add references based on the brief's needs: - Responsive requirements? Consult [responsive-design.md](responsive-design.md) - Heavy on copy, labels, or errors? Consult [ux-writing.md](ux-writing.md) -## Step 3: Build +## Step 3: Visual Direction & Assets (Harness-Gated) + +If the harness has **native image generation** (currently Codex via `image_gen`), this step is mandatory. **Stop and load [codex.md](codex.md)**. It covers palette generation, mock exploration, the approval loop, mock-fidelity inventory, and asset slicing via the `impeccable_asset_producer` subagent. Follow Steps A-F in that file, then return here for Step 4. + +If the harness lacks native image generation, **state in one line that the visual-direction-by-generation step is being skipped because the harness lacks native image generation, then proceed**. The one-line announcement is required; it forces a conscious decision instead of letting the step quietly evaporate. The brief is your only visual reference. Implement directly from it, treating any named anchor references and the brief's "Design Direction" as the contract. -Implement the feature following the design brief. Work in this order: +Whether you generated mocks or not: don't replace required imagery with generic cards, bullets, emoji, fake metrics, decorative CSS panels, or filler copy. Image-led briefs (restaurants, hotels, magazines, photography, hobbyist communities, food, travel, fashion, product) need real or sourced imagery in the build, not CSS scenery. -1. **Structure first**: HTML/semantic structure for the primary state. No styling yet. -2. **Layout and spacing**: Establish the spatial rhythm and visual hierarchy. -3. **Typography and color**: Apply the type scale and color system. -4. **Interactive states**: Hover, focus, active, disabled. -5. **Edge case states**: Empty, loading, error, overflow, first-run. -6. **Motion**: Purposeful transitions and animations (if appropriate). -7. **Responsive**: Adapt for different viewports. Don't just shrink; redesign for the context. +## Step 4: Build to Production Quality -### During Build -- Test with real (or realistic) data at every step, not placeholder text -- Check each state as you build it, not all at the end -- If you discover a design question, stop and ask rather than guessing -- Every visual choice should trace back to something in the design brief +**Precondition.** If Step 3 routed you to codex.md (native image generation available), Steps A through D in that file must be complete before any code: questions answered, palette confirmed, mocks generated, one direction approved or delegated. **Do not mention implementation, file paths, or patch plans until that's done.** A confirmed shape brief is not enough; the model that compressed those gates is the model that already failed this flow. -## Step 4: Visual Iteration +Implement the feature following the design brief. Build in passes so structure, visual system, states, motion/media, and responsive behavior each get deliberate attention. The list below is the definition of done, not inspiration. -**This step is critical.** Do not stop after the first implementation pass. +### Production bar -Open the result in a browser window. If browser automation tools are available, use them to navigate to the page and visually inspect the result. If not, ask the user to open it and provide feedback. +- **Real content.** No placeholder copy, placeholder images, dead links, fake controls, or unused scaffold at presentation time. +- **Preserve the approved mock's major ingredients.** Missing hero objects, world/product imagery, section structure, CTA/nav treatment, or distinctive motifs are blocking defects unless the user accepted the change. +- **Semantic first.** Real headings, landmarks, labels, form associations, button/link semantics, accessible names, state announcements where needed. +- **Deliberate spacing and alignment.** No default gaps, arbitrary margins, unbalanced whitespace, or accidental optical misalignment. +- **Intentional typography.** Chosen loading strategy, clear hierarchy, readable measure, stable line breaks, no overflow at any width. +- **Realistic state coverage.** Default, hover, focus-visible, active, disabled, loading, error, success, empty, overflow, long/short text, first-run. +- **Finished interaction quality.** Keyboard paths, touch targets, feedback timing, scroll behavior, state transitions, no hover-only functionality. +- **Coherent icon set.** Use the project's established set; otherwise pick one library or use accessible text. Don't mix. +- **Respect the build pipeline.** Edit source files and run the project's build (`npm run build` or equivalent). Don't write to `build/` / `dist/` / `.next/` with `cat`, heredoc, or Bash redirects; that skips asset hashing, image optimization, code splitting, and CSS extraction, and produces output the dev server won't serve. +- **Verify image URLs before referencing them.** Use image-search MCP or web-fetch when available; guessed photo IDs ship as broken-image placeholders. Without verification, prefer fewer images you're confident about. +- **Optimized imagery and media.** Correct dimensions, useful alt text, lazy loading below the fold, modern formats when practical, responsive `srcset`/`picture` for raster, no project-referenced asset left outside the workspace. +- **Premium motion.** Use atmospheric blur, filter, mask, shadow, reveal when they improve the experience. Avoid casual layout-property animation, bound expensive effects, verify smoothness in-browser, respect reduced motion, and avoid choreography that blocks task completion. +- **Maintainable.** Reusable local patterns, clear component boundaries, project conventions. No rasterized UI text or one-off hacks when a local pattern exists. +- **Technically clean.** Production build passes, no console errors, no avoidable layout shift, no needless dependencies, no broken asset paths. +- **Ask when uncertain.** If a discovery materially changes the brief or approved direction, stop and ask. Don't guess. -Iterate through these checks visually: +## Step 5: Iterate Visually -1. **Does it match the brief?** Compare the live result against every section of the design brief. Fix discrepancies. -2. **Does it pass the AI slop test?** If someone saw this and said "AI made this," would they believe it immediately? If yes, it needs more design intention. -3. **Check against impeccable's DON'T guidelines.** Fix any anti-pattern violations. -4. **Check every state.** Navigate through empty, error, loading, and edge case states. Each one should feel intentional, not like an afterthought. -5. **Check responsive.** Resize the viewport. Does it adapt well or just shrink? -6. **Check the details.** Spacing consistency, type hierarchy clarity, color contrast, interactive feedback, motion timing. +Look at what you built like a designer would. Your eyes are whatever the harness gives you: a connected browser, a screenshotting tool, Playwright, or asking the user. Use them for responsive testing (mobile, tablet, desktop minimum) and general visual validation. -After each round of fixes, visually verify again. **Repeat until you would be proud to show this to the user.** The bar is not "it works"; the bar is "this delights." +If your tool returns a file path, read the PNG back into the conversation. A screenshot you didn't read doesn't count. -## Step 5: Present +For long-form brand surfaces, inspect major sections individually. Thumbnails hide spacing, clipping, and cascade defects. + +After the first pass, write an honest critique against the brief, the approved mock's major ingredients (hero silhouette, motifs, imagery, nav/CTA, density), and impeccable's DON'Ts. Patch material defects and re-inspect. **Don't invent defects to demonstrate iteration.** A confident "first pass clean, shipping" beats a fake fix. + +Actively check: responsive behavior (composes, not shrinks), every state (empty / error / loading / edge), craft details (spacing, alignment, hierarchy, contrast, motion timing, focus), performance basics. The exit bar: defensible in a high-end studio review. + +Detector or QA output is defect evidence only; never proof the work is finished. + +## Step 6: Present Present the result to the user: - Show the feature in its primary state +- Summarize the browser/viewports checked and the most important fixes made after inspection - Walk through the key states (empty, error, responsive) -- Explain design decisions that connect back to the design brief +- Explain design decisions that connect back to the design brief and, when used, the chosen north-star mock. Include any accepted deviations from the mock; do not hide unimplemented mock ingredients. +- Note any remaining limitations or follow-up risks honestly - Ask: "What's working? What isn't?" - -Iterate based on feedback. Good design is rarely right on the first pass. diff --git a/.agents/skills/impeccable/reference/critique.md b/.agents/skills/impeccable/reference/critique.md new file mode 100644 index 0000000000000000000000000000000000000000..4e84fcb5554e4d03566690f16e80125abd807101 --- /dev/null +++ b/.agents/skills/impeccable/reference/critique.md @@ -0,0 +1,259 @@ +### Purpose + +Resolve one stable target, run two independent assessments, synthesize a design critique, persist a snapshot, and ask the user what to improve next. The chat response is the primary deliverable; the snapshot is an archive/backlog for future commands. + +### Hard Invariants + +- Assessment A (design review) and Assessment B (detector/browser evidence) are both required. +- Assessment A must finish before detector findings enter the parent synthesis context. Detector output is deterministic, but it still anchors judgment. +- If sub-agents are unavailable, fall back sequentially: finish and record Assessment A first, then run Assessment B, then synthesize. +- A skipped detector is a failed critique run unless `detect.mjs` is missing or crashes after a real attempt. +- Viewable targets require browser inspection when available. +- Any local server started only for critique visualization must run in the background, have a recorded stop method, and be stopped before final reporting unless the user asks to keep it. +- Do not claim a user-visible overlay exists unless script injection succeeded and the detector ran in the page. + +### Setup + +1. **Resolve the target** to a concrete file path or URL. Prefer a source path over a dev-server URL when both identify the same surface; ports drift, paths do not. + - "the homepage" -> `site/pages/index.astro` or `index.html` + - "the settings modal" -> the primary component file + - "this page" -> the current URL or source file +2. **Compute the slug**: + ```bash + node .agents/skills/impeccable/scripts/critique-storage.mjs slug "" + ``` + Keep it. If the command exits non-zero, skip persistence and trend for this run, but continue the critique. +3. **Read `.impeccable/critique/ignore.md`** if it exists. Drop matching findings silently; it is the only prior-run input critique consumes. + +### Assessment Orchestration + +Delegate Assessment A and Assessment B to separate sub-agents when possible. They must not see each other's output. Do not show findings to the user until synthesis. + +Codex sub-agent gate: +- If `spawn_agent` is exposed and the user explicitly allowed sub-agents, delegation, or parallel agent work, spawn A and B immediately. +- If `spawn_agent` is exposed but the user did not explicitly allow sub-agents, ask exactly once: "Impeccable critique is designed to run two independent sub-agents for an unanchored assessment. May I use sub-agents for this critique?" Then stop until the user answers. +- If allowed, spawn A and B. If declined, run sequentially and report `Assessment independence: degraded (sub-agents declined by user)`. +- If `spawn_agent` is not exposed, do not ask; run sequentially and report `Assessment independence: degraded (spawn_agent unavailable in this session)`. +- If spawning fails after permission, run sequentially and report `Assessment independence: degraded (sub-agent spawn failed: )`. +Prefer `fork_context: false` with self-contained prompts containing cwd, target, live URL, references, product context, and output contract. If using `fork_context: true`, omit `agent_type`, `model`, and `reasoning_effort`. + +If browser automation is available, each assessment creates its own new tab. Never reuse an existing tab, even if it is already at the right URL. + +### Assessment A: Design Review + +Read relevant source files and visually inspect the live page when browser automation is available. Think like a design director. + +Evaluate: +- **AI slop**: Would someone believe "AI made this" immediately? Check all DON'T guidance from the parent Impeccable skill. +- **Holistic design**: hierarchy, IA, emotional fit, discoverability, composition, typography, color, accessibility, states, copy, and edge cases. +- **Cognitive load**: consult [cognitive-load](cognitive-load.md); report checklist failures and decision points with >4 visible options. +- **Emotional journey**: peak-end rule, emotional valleys, reassurance at high-stakes moments. +- **Nielsen heuristics**: consult [heuristics-scoring](heuristics-scoring.md); score all 10 heuristics 0-4. + +Return: AI slop verdict, heuristic scores, cognitive load, emotional journey, 2-3 strengths, 3-5 priority issues, persona red flags, minor observations, and provocative questions. + +### Assessment B: Detector + Browser Evidence + +Run the bundled detector and browser visualization evidence. Assessment B is mandatory and must remain isolated from Assessment A until both are complete. + +CLI scan: +```bash +node .agents/skills/impeccable/scripts/detect.mjs --json [--fast] [target] +``` + +- Pass markup files/directories as `[target]`; do not pass CSS-only files. +- For URLs, skip CLI scan and use browser visualization. +- For 200+ scannable files, use `--fast`; for 500+, narrow scope or ask. +- Exit code 0 = clean; 2 = findings. +- If the detector entrypoint is missing or fails to load, report deterministic scan unavailable and continue with browser/manual review. + +Browser visualization is required for a viewable target when browser automation is available. Use a localhost dev/static URL for local files; avoid `file://` unless the available browser explicitly supports this workflow. Overlay flow: + +1. Create a fresh tab and navigate. +2. Preflight mutable injection by setting `document.title` and appending a ` - * Re-scan: window.impeccableScan() - * - * Exit codes: 0 = clean, 2 = findings + * Usage: + * Re-scan: window.impeccableScan() */ - -// ─── Environment ──────────────────────────────────────────────────────────── - -const IS_BROWSER = typeof window !== 'undefined'; -const IS_NODE = !IS_BROWSER; - -// @browser-strip-start -let fs, path; -if (!IS_BROWSER) { - fs = (await import('node:fs')).default; - path = (await import('node:path')).default; -} -// @browser-strip-end - +(function () { +if (typeof window === 'undefined') return; +// --- cli/engine/shared/constants.mjs --- // ─── Section 1: Constants ─────────────────────────────────────────────────── const SAFE_TAGS = new Set([ @@ -56,7 +35,13 @@ const BORDER_SAFE_TAGS = new Set( ); const OVERUSED_FONTS = new Set([ + // Older monoculture (still ubiquitous): 'inter', 'roboto', 'open sans', 'lato', 'montserrat', 'arial', 'helvetica', + // Newer monoculture (the Anthropic-skill / Vercel / GitHub default wave): + 'fraunces', 'instrument sans', + 'geist', 'geist sans', 'geist mono', + 'mona sans', + 'plus jakarta sans', 'space grotesk', 'recoleta', ]); // Brand-associated fonts: don't flag these as "overused" on the brand's own domains. @@ -65,10 +50,16 @@ const GOOGLE_DOMAINS = [ 'google.com', 'youtube.com', 'android.com', 'chromium.org', 'chrome.com', 'web.dev', 'gstatic.com', 'firebase.google.com', ]; +const VERCEL_DOMAINS = ['vercel.com', 'nextjs.org', 'v0.app']; +const GITHUB_DOMAINS = ['github.com', 'githubnext.com']; const BRAND_FONT_DOMAINS = { 'roboto': GOOGLE_DOMAINS, 'google sans': GOOGLE_DOMAINS, 'product sans': GOOGLE_DOMAINS, + 'geist': VERCEL_DOMAINS, + 'geist sans': VERCEL_DOMAINS, + 'geist mono': VERCEL_DOMAINS, + 'mona sans': GITHUB_DOMAINS, }; function isBrandFontOnOwnDomain(font) { @@ -86,6 +77,29 @@ const GENERIC_FONTS = new Set([ 'inherit', 'initial', 'unset', 'revert', ]); +// WCAG large text thresholds are defined in points: 18pt normal text and +// 14pt bold text. Browsers expose font-size in CSS pixels at 96px per inch. +const WCAG_LARGE_TEXT_PX = 18 * (96 / 72); +const WCAG_LARGE_BOLD_TEXT_PX = 14 * (96 / 72); + +// Serif faces that show up in italic-display heroes. The rule also fires when +// the primary face is unknown but the stack ends in the generic `serif` token, +// which catches custom/private faces with a serif fallback. +const KNOWN_SERIF_FONTS = new Set([ + 'fraunces', 'recoleta', 'newsreader', 'playfair display', 'playfair', + 'cormorant', 'cormorant garamond', 'garamond', 'eb garamond', + 'tiempos', 'tiempos headline', 'tiempos text', + 'lora', 'vollkorn', 'spectral', + 'source serif pro', 'source serif 4', 'source serif', + 'ibm plex serif', 'merriweather', + 'libre caslon', 'libre baskerville', 'baskerville', + 'georgia', 'times new roman', 'times', + 'dm serif display', 'dm serif text', + 'instrument serif', 'gt sectra', 'ogg', 'canela', + 'freight display', 'freight text', +]); + +// --- cli/engine/registry/antipatterns.mjs --- const ANTIPATTERNS = [ // ── AI slop: tells that something was AI-generated ── { @@ -111,7 +125,7 @@ const ANTIPATTERNS = [ category: 'slop', name: 'Overused font', description: - 'Inter, Roboto, Open Sans, Lato, Montserrat, and Arial are used on millions of sites. Choose a distinctive font that gives your interface personality.', + 'Inter, Roboto, Fraunces, Geist, Plus Jakarta Sans, and Space Grotesk are used on so many sites they no longer feel distinctive. Each new wave of AI-generated UIs converges on the same handful of faces. Choose a face that gives your interface personality.', skillSection: 'Typography', skillGuideline: 'overused fonts like Inter', }, @@ -205,6 +219,34 @@ const ANTIPATTERNS = [ skillSection: 'Typography', skillGuideline: 'large icons with rounded corners above every heading', }, + { + id: 'italic-serif-display', + category: 'slop', + name: 'Italic serif display headline', + description: + 'Oversized italic serif (Fraunces, Recoleta, Playfair, Newsreader-italic) as the primary hero headline reads as taste in isolation but has become the universal AI-startup landing page hero. Set roman, or move to a non-serif display face. Editorial / magazine register may legitimately want this — judge by context.', + skillSection: 'Typography', + skillGuideline: 'oversized italic serif as the hero headline', + }, + { + id: 'hero-eyebrow-chip', + category: 'slop', + name: 'Hero eyebrow / pill chip', + description: + 'A tiny uppercase letter-spaced label sitting immediately above an oversized hero headline — or the same shape rendered as a pill chip — is now the default AI SaaS hero. Drop the eyebrow, integrate the kicker into the headline, or run it as a navigation breadcrumb instead.', + skillSection: 'Typography', + skillGuideline: 'tiny uppercase tracked label above the hero headline', + }, + { + id: 'repeated-section-kickers', + category: 'slop', + severity: 'advisory', + name: 'Repeated section kicker labels', + description: + 'Repeating tiny uppercase tracked labels above section headings turns a brand page into AI editorial scaffolding. Replace them with stronger structure, artifacts, imagery, or a deliberate brand system.', + skillSection: 'Typography', + skillGuideline: 'repeated eyebrow or kicker labels as section scaffolding', + }, // ── Quality: general design and accessibility issues ── { @@ -257,6 +299,13 @@ const ANTIPATTERNS = [ description: 'Text is too close to the edge of its container. Add at least 8px (ideally 12-16px) of padding inside bordered or colored containers.', }, + { + id: 'body-text-viewport-edge', + category: 'quality', + name: 'Body text touching viewport edge', + description: + 'Body paragraphs render flush against the left or right viewport edge with no container providing horizontal padding. Wrap content in a container with at least 16px (ideally 24-32px) of horizontal padding, or apply max-width with mx-auto.', + }, { id: 'tight-leading', category: 'quality', @@ -303,6 +352,7 @@ const ANTIPATTERNS = [ }, ]; +// --- cli/engine/shared/color.mjs --- // ─── Section 2: Color Utilities ───────────────────────────────────────────── function isNeutralColor(color) { @@ -318,19 +368,19 @@ function isNeutralColor(color) { // oklch chroma is ~0–0.4 in sRGB gamut; >= 0.02 reads as tinted, not gray. // lch chroma is ~0–150; >= 3 reads as tinted. jsdom emits both formats // literally (it does NOT convert them to rgb). - const oklch = color.match(/oklch\(\s*[\d.%-]+\s+([\d.-]+)/i); + const oklch = color.match(/oklch\(\s*[\d.]+%?\s*([\d.-]+)/i); if (oklch) return parseFloat(oklch[1]) < 0.02; - const lch = color.match(/lch\(\s*[\d.%-]+\s+([\d.-]+)/i); + const lch = color.match(/lch\(\s*[\d.]+%?\s*([\d.-]+)/i); if (lch) return parseFloat(lch[1]) < 3; // oklab()/lab() — a and b are signed axes; chroma = sqrt(a² + b²). // oklab a/b are ~-0.4..0.4, threshold 0.02. lab a/b are ~-128..127, threshold 3. - const oklab = color.match(/oklab\(\s*[\d.%-]+\s+([\d.-]+)\s+([\d.-]+)/i); + const oklab = color.match(/oklab\(\s*[\d.]+%?\s*([\d.-]+)\s+([\d.-]+)/i); if (oklab) { const a = parseFloat(oklab[1]), b = parseFloat(oklab[2]); return Math.hypot(a, b) < 0.02; } - const lab = color.match(/lab\(\s*[\d.%-]+\s+([\d.-]+)\s+([\d.-]+)/i); + const lab = color.match(/lab\(\s*[\d.]+%?\s*([\d.-]+)\s+([\d.-]+)/i); if (lab) { const a = parseFloat(lab[1]), b = parseFloat(lab[2]); return Math.hypot(a, b) < 3; @@ -417,6 +467,9 @@ function colorToHex(c) { return '#' + [c.r, c.g, c.b].map(v => v.toString(16).padStart(2, '0')).join(''); } +// --- cli/engine/rules/checks.mjs --- +const DETECTOR_IS_BROWSER = typeof window !== 'undefined'; + // ─── Section 3: Pure Detection ────────────────────────────────────────────── function checkBorders(tag, widths, colors, radius) { @@ -460,7 +513,18 @@ function isEmojiOnlyText(text) { function checkColors(opts) { const { tag, textColor, bgColor, effectiveBg, effectiveBgStops, fontSize, fontWeight, hasDirectText, isEmojiOnly, bgClip, bgImage, classList } = opts; - if (SAFE_TAGS.has(tag)) return []; + if (SAFE_TAGS.has(tag)) { + // Exception for and -
- -
- Inter font - Purple gradient - Generic copy - Cards on cards -
- - -
- After -
-

Introducing

-

Thoughtful Design

-

Every element serves a purpose. Hierarchy guides the eye. Whitespace breathes.

- -
-
- -
- -
-
- - Generic AI Output -
-
- - With Design Skills -
-
- - - - - -
- - -
-
- 01 -

The Foundation

-
-
-

Before commands, before detection, Impeccable teaches your AI real design. Deep reference knowledge across 7 dimensions, loaded every time your AI writes code.

- -
- -
- -
-

Run /impeccable teach once to set your project's design context. Every command benefits.

-
-
-
- - -
- -
- 02 -

The Language

-
-
-

18 commands form a shared vocabulary between you and your AI. Each one encodes a specific design discipline, so you can steer with precision.

- -
- -
- - - -
-
-

Pick any command to see it in action. View cheatsheet →

-
- -
-
-
- - -
-
- 03 -

The Antidote

-
-
-

Every AI model learned from the same templates. Without intervention, they all produce the same predictable mistakes. Impeccable names them, detects them, and teaches the AI to avoid them.

- - - - - -
-
- - -
-
- 04 -

Visual Mode

-
-
-

See design issues highlighted directly on the page. No screenshots, no guesswork. Impeccable’s overlay shows you exactly what’s wrong and where.

- -
-
-
- - - - Live detection overlay -
- -
-
-
- 25 deterministic checks -

No LLM needed. Pattern matching catches purple gradients, overused fonts, nested cards, low contrast, and more.

-
-
- Three ways to use it -

The Chrome extension on any site, embedded in /critique during an AI design review, or standalone via npx impeccable live.

-
- - Impeccable Chrome extension panel listing detected anti-patterns -
- Available now - Chrome extension - Install from Chrome Web Store → -
-
-
-
-
-
- - -
-
- 05 -

Get Started

-
- - -
-
-

1Install the skills Recommended

-

18 commands that steer your AI toward better design, in real time. The full Impeccable experience.

- -
-
-
- - - -
-
-
-
- $ - npx skills add pbakaus/impeccable - -
- Works with Cursor, Claude Code, Gemini CLI, Codex CLI, and more. -
-
-
-
- -
- Then run /impeccable teach to set up your project's design context. -
-
- - -
- Other install methods - -
- Claude Code plugin -
- $ - /plugin marketplace add pbakaus/impeccable - -
- Then open /plugin in Claude Code -
- -
- Manual download all 11 providers - -
-
-
- - -
- -
- -

2Add the CLI Beta

- -
-
-

Scan any file, directory, or live URL for anti-patterns from the terminal. Catches gradient text, AI color palettes, nested cards, low contrast, and 20+ more rules across HTML, CSS, JSX/TSX, Vue, and Svelte. Use it in CI pipelines, pre-commit hooks, or one-off audits to keep AI slop out of production.

- -
-
- $ - npm i -g impeccable - -
- Or use npx impeccable detect src/ directly without installing. -
- - -
-
- - -
- -

3Browser extension

- -
-
-

Click the toolbar icon on any page and every anti-pattern lights up right where it lives: gradient text, purple palettes, nested cards, tiny body text, and the rest. Works on your localhost, staging, production, or anyone else's site. Great for spot-checking competitors, reviewing PRs visually, or just browsing the web with a sharper eye.

- -
-
- - -
- -

4Stay updated

- -
-
-

Keep skills current and follow along with new commands, anti-patterns, and the design thinking behind Impeccable.

- -
-
- $ - npx impeccable skills update - -
- Run periodically to pull the latest skill definitions. -
- - -
-
-
-
- - -
- -
-
- 06 -

What's New

-
- -
-
-
- v2.1 - April 9, 2026 -
-
    -
  • Streamlined from 21 to 18 commands. Removed overlap and confusion: /arrange renamed to /layout, /normalize merged into /polish (design system alignment is now part of the final pass), /onboard merged into /harden (empty states and first-run experiences are part of production readiness), and /extract became /impeccable extract (a sub-mode alongside craft and teach). Every remaining command has a clearly distinct job.
  • -
  • Automatic cleanup of deprecated skills. On first load after updating, the skill detects and removes leftover files from renamed or merged commands. No manual cleanup needed.
  • -
-
- -
-
- v2.0 - April 8, 2026 -
-
    -
  • Renamed frontend-design to impeccable. The core skill now shares its name with the project, and the teach subcommand moved from /teach-impeccable to /impeccable teach. One skill, one namespace.
  • -
  • Data-driven skill rewrite. The core skill was rebuilt against an internal eval framework that runs the same brief through frontier models with and without the skill loaded, then measures how much the output collapses into monoculture. The result: dramatically more font and color diversity, sharper overall design quality, and much stronger Codex support. The biggest unlock was an anti-attractor procedure that forces the model to enumerate and reject its reflex defaults before picking. Validated on gpt-5.4 and Qwen 3.6 Plus across 15 niches.
  • -
  • Anti-pattern detection engine. 25 deterministic rules across typography, color, layout, motion, and quality. Handles oklch, oklab, lch, and lab color formats, CSS variables inside border shorthands, gradient-backed text, and emoji-only nodes.
  • -
  • CLI: npx impeccable detect. Scans HTML, CSS, JSX/TSX, Vue, Svelte, and CSS-in-JS. Framework detection, multi-file import tracking, Puppeteer-backed live URL scanning, CI-ready JSON output, and a --fast regex mode for huge codebases.
  • -
  • Chrome DevTools extension. One-click detection on any page: yours, staging, production, or someone else's. Reads live computed styles, surfaces findings in an interactive panel, and highlights elements on the page. In Chrome Web Store review.
  • -
  • /critique got teeth. Persona sub-agents review in parallel, score against Nielsen's heuristics, run the detector automatically, and open a live browser overlay so you can walk each finding in place.
  • -
  • New ways to create with Impeccable. /shape runs a structured discovery interview about purpose, audience, and goals, then produces a design brief before any code is written. /impeccable craft chains that brief straight into the full implementation flow so you ship a designed feature instead of a reflex card grid.
  • -
  • New docs site. Top-level Docs, Anti-Patterns, and Visual Mode sections. 18 per-skill pages with before/after demos and the canonical SKILL.md inline, two tutorials, and 38 rule cards with inline visual examples.
  • -
  • New harness: Rovo Dev. 11 supported AI tools total.
  • -
-
- -
- View older releases -
-
-
- v1.6.0 - March 18, 2026 -
-
    -
  • New provider: Trae (China + International)
  • -
  • /critique now scores against Nielsen's 10 heuristics, tests with persona archetypes, and assesses cognitive load
  • -
  • /audit now scores 5 dimensions with P0-P3 severity ratings and structured action plans
  • -
  • Improved skill descriptions for better agent auto-discovery
  • -
  • Fixed invalid YAML frontmatter that broke GitHub preview and Codex loading (#67)
  • -
  • Codex CLI now uses correct $ prefix for command references
  • -
-
- -
-
- v1.5.1 - March 17, 2026 -
-
    -
  • /typeset now recommends fixed type scales for app UIs, reserving fluid typography for marketing/content pages
  • -
-
- -
-
- v1.5.0 - March 16, 2026 -
-
    -
  • 3 new skills: /typeset (fix typography), /arrange (fix layout & spacing), /overdrive (technically extraordinary effects, beta)
  • -
  • Skills now auto-gather design context via .impeccable.md. Run /teach-impeccable once, all skills benefit
  • -
  • Deep linking to commands (#cmd-overdrive, etc.)
  • -
-
- -
-
- v1.3.0 - March 12, 2026 -
-
    -
  • Added OpenCode provider support
  • -
  • Added Pi provider support
  • -
  • Recategorized /onboard as an enhancement command
  • -
-
- -
-
- v1.2.0 - March 5, 2026 -
-
    -
  • Added Kiro support (.kiro/skills/)
  • -
  • Restored prefix toggle: download i- prefixed bundles to avoid naming conflicts
  • -
  • Audit and critique skills only suggest real, installed commands
  • -
-
- -
-
- v1.1.0 - March 4, 2026 -
-
    -
  • Unified skills architecture: commands are now skills with user-invocable: true
  • -
  • Added VS Code Copilot and Google Antigravity support (.agents/skills/)
  • -
  • New install flow: npx skills add as primary, universal ZIP as fallback
  • -
  • Added universal ZIP containing all 5 provider directories
  • -
  • Renamed /simplify to /distill to avoid Claude Code conflict
  • -
-
- -
-
- v1.0.0 - February 28, 2026 -
-
    -
  • Initial release with enhanced frontend-design skill
  • -
  • 17 design commands: /polish, /audit, /distill, /bolder, and more
  • -
  • Support for Cursor, Claude Code, Gemini CLI, and Codex CLI
  • -
  • Interactive command cheatsheet
  • -
-
-
-
-
- -
- - -
-
- 07 -

Frequently Asked Questions

-
- -
-
- Where do I put the downloaded files? -
-

The easiest way is npx skills add pbakaus/impeccable, which auto-detects your AI harness and places files correctly.

-

If you downloaded the universal ZIP, extract it to your project root (same level as your package.json or src/ folder). It creates hidden folders for each supported tool: .cursor/, .claude/, .gemini/, .codex/, and .agents/.

-

Project-level installation takes precedence and lets you version control your skills.

-
-
- -
- How do I update to the latest version? -
-

Run npx impeccable skills update from your project root. It downloads the latest skills, cleans up deprecated files, and preserves any prefix you use.

-
    -
  • Alternative: npx skills add pbakaus/impeccable re-installs from scratch.
  • -
  • Claude Code plugin: Open /plugin, go to the Discover tab.
  • -
  • Manual ZIP: Download from above and extract to the project root.
  • -
-

Your .impeccable.md context file is never overwritten.

-
-
- -
- Commands or skills aren't appearing. What do I do? -
-

For commands: Type / in your AI harness and look for commands like /audit, /polish, etc. If they don't appear, double-check the files are in the correct location.

-

For skills: Skills are applied automatically when relevant. To verify, explicitly mention "use the impeccable skill" in your prompt. This forces the AI to acknowledge and apply it.

-

Tool-specific setup:

-
    -
  • Cursor: Requires Nightly channel + Agent Skills enabled in Settings → Rules
  • -
  • Gemini CLI: Requires @google/gemini-cli@preview + Skills enabled via /settings
  • -
-
-
- -
- I'm new to AI harnesses. Where do I start? -
-

Skills and commands are intermediate features. If you're just getting started, learn the basics first:

- -

Once you're comfortable with basic prompting and code generation, come back and give Impeccable a try.

-
-
- -
- Is Impeccable free? -
-

Yes. Everything is Apache 2.0: skills, commands, CLI, and the detection engine. Fully open source, free for everyone.

-
-
-
-
-
- - -
-
-
-

Work with me

-

Impeccable is built by Renaissance Geek. I work with enterprise teams on large-scale rollouts, custom integrations, and training for designers and developers. If you're a frontier lab, design tool company, or enterprise looking to raise the bar on AI-generated design, let's talk.

-
- -
-
-
- - - - - - diff --git a/public/js/generated/counts.js b/public/js/generated/counts.js deleted file mode 100644 index 397efb84cfee19ffe1cac1d6abea5ad3cbbc4b24..0000000000000000000000000000000000000000 --- a/public/js/generated/counts.js +++ /dev/null @@ -1,3 +0,0 @@ -// GENERATED by build.js — do not edit -export const COMMAND_COUNT = 18; -export const DETECTION_COUNT = 25; diff --git a/public/privacy.html b/public/privacy.html deleted file mode 100644 index 6944106c6bdea28143369dffc06520e54a59e14f..0000000000000000000000000000000000000000 --- a/public/privacy.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - Privacy Policy - Impeccable - - - - - - - - - - - - -
-

Privacy Policy

-

Last updated: April 6, 2026

- -

What Impeccable is

-

Impeccable is an open-source collection of agent skills (text files) that run locally in your AI coding tool. The skills themselves collect no data, make no network requests, and have no analytics.

- -

Website analytics

-

The Impeccable website (impeccable.style) uses Google Analytics to understand traffic patterns (page views, referrers, country). No personal information is collected beyond what Google Analytics provides by default. No cookies are used for advertising.

- -

Downloads

-

When you download a skill bundle from the website, we log the download event (which bundle, timestamp) for usage statistics. No personal information is attached to these logs.

- -

Claude Code Plugin

-

When installed as a Claude Code plugin, Impeccable runs entirely within your local Claude Code session. No data is sent to Impeccable's servers. Anthropic's own privacy policy governs the Claude Code application itself.

- -

Chrome Extension

-

The Impeccable Chrome DevTools extension runs entirely in your browser. All anti-pattern detection happens locally on the page you are inspecting. No page content, URLs, or detection results are ever sent to any external server.

-

The extension stores your rule preferences (which detections are enabled or disabled) using Chrome's built-in sync storage (chrome.storage.sync), which syncs settings across your Chrome instances via your Google account. No other data is stored or transmitted.

-

The extension requests the following permissions:

-
    -
  • activeTab / scripting - to inject the detector script into the page you are inspecting
  • -
  • storage - to save your rule preferences
  • -
  • webNavigation - to re-scan automatically when you navigate to a new page
  • -
  • Host permissions (all URLs) - so the detector can run on any website you choose to inspect
  • -
- -

GitHub

-

The source code is hosted on GitHub. Interactions with the repository (issues, pull requests, stars) are governed by GitHub's privacy policy.

- -

Contact

-

Questions about this policy? Open an issue on GitHub or reach out to @pbakaus.

-
- - diff --git a/public/sitemap.xml b/public/sitemap.xml deleted file mode 100644 index 8cc157893ceae2494d87a1426d0bad0d19079dc5..0000000000000000000000000000000000000000 --- a/public/sitemap.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - https://impeccable.style/ - 2026-04-08 - weekly - 1.0 - - - https://impeccable.style/cheatsheet - 2026-04-08 - monthly - 0.7 - - - https://impeccable.style/gallery - 2026-04-08 - monthly - 0.7 - - - - - https://impeccable.style/skills - 2026-04-08 - weekly - 0.9 - - - https://impeccable.style/anti-patterns - 2026-04-08 - weekly - 0.9 - - - https://impeccable.style/tutorials - 2026-04-08 - weekly - 0.9 - - - - https://impeccable.style/skills/adapt2026-04-080.8 - https://impeccable.style/skills/animate2026-04-080.8 - https://impeccable.style/skills/arrange2026-04-080.8 - https://impeccable.style/skills/audit2026-04-080.8 - https://impeccable.style/skills/bolder2026-04-080.8 - https://impeccable.style/skills/clarify2026-04-080.8 - https://impeccable.style/skills/colorize2026-04-080.8 - https://impeccable.style/skills/critique2026-04-080.8 - https://impeccable.style/skills/delight2026-04-080.8 - https://impeccable.style/skills/distill2026-04-080.8 - https://impeccable.style/skills/extract2026-04-080.8 - https://impeccable.style/skills/harden2026-04-080.8 - https://impeccable.style/skills/impeccable2026-04-080.8 - https://impeccable.style/skills/normalize2026-04-080.8 - https://impeccable.style/skills/onboard2026-04-080.8 - https://impeccable.style/skills/optimize2026-04-080.8 - https://impeccable.style/skills/overdrive2026-04-080.8 - https://impeccable.style/skills/polish2026-04-080.8 - https://impeccable.style/skills/quieter2026-04-080.8 - https://impeccable.style/skills/shape2026-04-080.8 - https://impeccable.style/skills/typeset2026-04-080.8 - - - https://impeccable.style/tutorials/getting-started2026-04-080.8 - https://impeccable.style/tutorials/critique-with-overlay2026-04-080.8 - diff --git a/scripts/benchmark-detector.mjs b/scripts/benchmark-detector.mjs new file mode 100644 index 0000000000000000000000000000000000000000..1e43cff4a758d2b0e771fbd13f07f1bad7fc69e4 --- /dev/null +++ b/scripts/benchmark-detector.mjs @@ -0,0 +1,583 @@ +#!/usr/bin/env node + +import fs from 'node:fs'; +import http from 'node:http'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +import { + createBrowserDetector, + createDetectorProfile, + detectHtml, + detectText, + detectUrl, + summarizeDetectorProfile, + walkDir, +} from '../cli/engine/detect-antipatterns.mjs'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const ROOT = path.resolve(__dirname, '..'); +const FIXTURES = path.join(ROOT, 'tests', 'fixtures', 'antipatterns'); +const BROWSER_FIXTURES = [ + 'cramped-padding.html', + 'quality.html', + 'body-text-viewport-edge.html', +]; + +const MIME = { + '.html': 'text/html; charset=utf-8', + '.js': 'text/javascript; charset=utf-8', + '.css': 'text/css; charset=utf-8', + '.svg': 'image/svg+xml', + '.png': 'image/png', + '.jpg': 'image/jpeg', + '.jpeg': 'image/jpeg', +}; + +function parseArgs(argv) { + const args = { + browser: false, + json: false, + out: null, + quick: false, + }; + for (let i = 0; i < argv.length; i++) { + const arg = argv[i]; + if (arg === '--browser') args.browser = true; + else if (arg === '--json') args.json = true; + else if (arg === '--quick') args.quick = true; + else if (arg === '--out') args.out = argv[++i] || null; + else if (arg.startsWith('--out=')) args.out = arg.slice('--out='.length); + else if (arg === '--help') { + printUsage(); + process.exit(0); + } + } + return args; +} + +function printUsage() { + console.log(`Usage: node scripts/benchmark-detector.mjs [options] + +Options: + --quick Run a small smoke benchmark subset + --browser Include browser-backed URL benchmarks + --json Print the benchmark report as JSON + --out FILE Write the benchmark report JSON to FILE + --help Show this help message`); +} + +function nowMs() { + return typeof performance !== 'undefined' && performance.now + ? performance.now() + : Date.now(); +} + +function roundMs(value) { + return Number(value.toFixed(3)); +} + +function isHtml(filePath) { + const ext = path.extname(filePath).toLowerCase(); + return ext === '.html' || ext === '.htm'; +} + +function rel(filePath) { + return path.relative(ROOT, filePath); +} + +function addEvent(profile, event) { + profile.events.push({ + engine: event.engine || 'unknown', + phase: event.phase || 'unknown', + ruleId: event.ruleId || 'unknown', + target: event.target || '', + ms: Number.isFinite(event.ms) ? event.ms : 0, + findings: Number.isFinite(event.findings) ? event.findings : 0, + }); +} + +async function measureCase({ name, engine, mode, target, run }) { + const profile = createDetectorProfile(); + const started = nowMs(); + try { + const result = await run(profile); + const findings = Array.isArray(result) + ? result.length + : (Number.isFinite(result?.findings) ? result.findings : 0); + return { + name, + engine, + mode, + target, + status: 'ok', + totalMs: roundMs(nowMs() - started), + findings, + profile: summarizeDetectorProfile(profile), + events: profile.events, + }; + } catch (err) { + return { + name, + engine, + mode, + target, + status: 'failed', + totalMs: roundMs(nowMs() - started), + findings: 0, + error: err?.message || String(err), + profile: summarizeDetectorProfile(profile), + events: profile.events, + }; + } +} + +function skippedCase({ name, engine, mode, target, reason }) { + return { + name, + engine, + mode, + target, + status: 'skipped', + totalMs: 0, + findings: 0, + skipReason: reason, + profile: [], + events: [], + }; +} + +async function scanDirectory(files, fastMode, profile) { + const findings = []; + for (const file of files) { + if (!fastMode && isHtml(file)) { + findings.push(...await detectHtml(file, { profile })); + } else { + const content = fs.readFileSync(file, 'utf-8'); + findings.push(...detectText(content, file, { profile })); + } + } + return findings; +} + +function selectQuickFiles(files, predicate, preferredNames) { + const preferred = preferredNames + .map(name => files.find(file => path.basename(file) === name)) + .filter(Boolean); + const fallback = files.filter(predicate).slice(0, preferredNames.length || 2); + return preferred.length ? preferred : fallback; +} + +async function runFileBenchmarks(args) { + const files = walkDir(FIXTURES).sort(); + const htmlFiles = files.filter(isHtml); + const textFiles = files.filter(file => !isHtml(file)); + const selectedText = args.quick + ? textFiles.slice(0, 2) + : textFiles; + const selectedHtml = args.quick + ? selectQuickFiles(htmlFiles, isHtml, ['color.html', 'quality.html']) + : htmlFiles; + const directoryFiles = args.quick + ? [...selectedHtml, ...selectedText].sort() + : files; + + const cases = []; + for (const file of selectedText) { + cases.push(await measureCase({ + name: `detectText:${rel(file)}`, + engine: 'regex', + mode: 'file', + target: rel(file), + run: (profile) => detectText(fs.readFileSync(file, 'utf-8'), file, { profile }), + })); + } + + for (const file of selectedHtml) { + cases.push(await measureCase({ + name: `detectHtml:${rel(file)}`, + engine: 'static-html', + mode: 'file', + target: rel(file), + run: (profile) => detectHtml(file, { profile }), + })); + } + + cases.push(await measureCase({ + name: args.quick ? 'directory-default:quick-fixtures' : 'directory-default:all-fixtures', + engine: 'mixed', + mode: 'directory-default', + target: rel(FIXTURES), + run: (profile) => scanDirectory(directoryFiles, false, profile), + })); + + cases.push(await measureCase({ + name: args.quick ? 'directory-fast:quick-fixtures' : 'directory-fast:all-fixtures', + engine: 'regex', + mode: 'directory-fast', + target: rel(FIXTURES), + run: (profile) => scanDirectory(directoryFiles, true, profile), + })); + + return cases; +} + +function startFixtureServer() { + const server = http.createServer((req, res) => { + let filePath; + const urlPath = req.url?.split('?')[0] || '/'; + if (urlPath.startsWith('/fixtures/')) { + filePath = path.join(ROOT, 'tests', urlPath); + } else if (urlPath === '/js/detect-antipatterns-browser.js') { + filePath = path.join(ROOT, 'cli', 'engine', 'detect-antipatterns-browser.js'); + } else { + res.writeHead(404).end(); + return; + } + try { + const body = fs.readFileSync(filePath); + const ext = path.extname(filePath).toLowerCase(); + res.writeHead(200, { 'Content-Type': MIME[ext] || 'application/octet-stream' }); + res.end(body); + } catch { + res.writeHead(404).end(); + } + }); + + return new Promise((resolve, reject) => { + server.once('error', reject); + server.listen(0, '127.0.0.1', () => { + server.off('error', reject); + const address = server.address(); + resolve({ + server, + baseUrl: `http://127.0.0.1:${address.port}`, + }); + }); + }); +} + +async function closeServer(server) { + await new Promise(resolve => server.close(resolve)); +} + +async function runBrowserBenchmarks(args) { + let serverInfo; + try { + serverInfo = await startFixtureServer(); + } catch (err) { + return [ + skippedCase({ + name: 'browser:fixtures', + engine: 'browser', + mode: 'browser', + target: 'localhost', + reason: `localhost fixture server unavailable: ${err?.message || err}`, + }), + ]; + } + + const cases = []; + const browserFiles = args.quick ? ['quality.html'] : BROWSER_FIXTURES; + + try { + for (const fileName of browserFiles) { + const url = `${serverInfo.baseUrl}/fixtures/antipatterns/${fileName}`; + const fresh = await measureCase({ + name: `detectUrl:fresh-load:${fileName}`, + engine: 'browser', + mode: 'fresh-load', + target: url, + run: (profile) => detectUrl(url, { profile, waitUntil: 'load', settleMs: 100 }), + }); + if (fresh.status === 'failed' && /Could not find Chrome|Failed to launch|executable|spawn|puppeteer/i.test(fresh.error || '')) { + cases.push(skippedCase({ + name: `detectUrl:fresh-load:${fileName}`, + engine: 'browser', + mode: 'fresh-load', + target: url, + reason: `Chromium unavailable: ${fresh.error}`, + })); + } else { + cases.push(fresh); + } + } + + const visualContrastUrl = `${serverInfo.baseUrl}/fixtures/antipatterns/visual-contrast.html`; + cases.push(await measureCase({ + name: 'detectUrl:visual-contrast', + engine: 'browser', + mode: 'visual-contrast', + target: visualContrastUrl, + run: (profile) => detectUrl(visualContrastUrl, { + profile, + waitUntil: 'load', + settleMs: 0, + visualContrast: true, + }), + })); + + cases.push(await measureCase({ + name: 'detectUrl:warm-load', + engine: 'browser', + mode: 'warm-load', + target: serverInfo.baseUrl, + run: async (profile) => { + const detector = await createBrowserDetector({ waitUntil: 'load', settleMs: 100 }); + const findings = []; + try { + for (const fileName of browserFiles) { + const url = `${serverInfo.baseUrl}/fixtures/antipatterns/${fileName}`; + findings.push(...await detector.detectUrl(url, { profile })); + } + } finally { + await detector.close(); + } + return findings; + }, + })); + + cases.push(await measureCase({ + name: 'detectUrl:warm-networkidle0', + engine: 'browser', + mode: 'warm-networkidle0', + target: serverInfo.baseUrl, + run: async (profile) => { + const detector = await createBrowserDetector({ waitUntil: 'load', settleMs: 100 }); + const findings = []; + try { + for (const fileName of browserFiles) { + const url = `${serverInfo.baseUrl}/fixtures/antipatterns/${fileName}`; + findings.push(...await detector.detectUrl(url, { + profile, + waitUntil: 'networkidle0', + settleMs: 0, + })); + } + } finally { + await detector.close(); + } + return findings; + }, + })); + + let puppeteer; + try { + puppeteer = await import('puppeteer'); + } catch (err) { + cases.push(skippedCase({ + name: 'browser:pure-vs-overlay', + engine: 'browser', + mode: 'pure-vs-overlay', + target: serverInfo.baseUrl, + reason: `puppeteer unavailable: ${err?.message || err}`, + })); + return cases; + } + + cases.push(await measureCase({ + name: 'browser:pure-vs-overlay', + engine: 'browser', + mode: 'pure-vs-overlay', + target: serverInfo.baseUrl, + run: async (profile) => { + let browser; + const launchStarted = nowMs(); + try { + browser = await puppeteer.default.launch({ + headless: true, + args: process.env.CI ? ['--no-sandbox', '--disable-setuid-sandbox'] : [], + }); + addEvent(profile, { + engine: 'browser', + phase: 'load', + ruleId: 'launch-browser-overlay-bench', + target: serverInfo.baseUrl, + ms: nowMs() - launchStarted, + }); + } catch (err) { + throw new Error(`Chromium unavailable: ${err?.message || err}`); + } + + let findings = []; + try { + const page = await browser.newPage(); + const url = `${serverInfo.baseUrl}/fixtures/antipatterns/${browserFiles[0]}`; + const browserScript = fs.readFileSync(path.join(ROOT, 'cli', 'engine', 'detect-antipatterns-browser.js'), 'utf-8'); + await page.setViewport({ width: 1280, height: 800 }); + await page.goto(url, { waitUntil: 'load', timeout: 30000 }); + await new Promise(resolve => setTimeout(resolve, 100)); + await page.evaluate(() => { window.__IMPECCABLE_CONFIG__ = { autoScan: false }; }); + await page.evaluate(browserScript); + const pureStarted = nowMs(); + findings = await page.evaluate(() => { + const serialized = window.impeccableDetect({ decorate: false, serialize: true }); + return serialized.flatMap(({ findings }) => findings.map(f => ({ id: f.type, snippet: f.detail }))); + }); + addEvent(profile, { + engine: 'browser', + phase: 'scan', + ruleId: 'pure-detect', + target: url, + ms: nowMs() - pureStarted, + findings: findings.length, + }); + const overlayStarted = nowMs(); + const overlayGroupCount = await page.evaluate(() => window.impeccableScan().length); + addEvent(profile, { + engine: 'browser', + phase: 'scan', + ruleId: 'overlay-scan', + target: url, + ms: nowMs() - overlayStarted, + findings: overlayGroupCount, + }); + await page.close().catch(() => {}); + } finally { + const closeStarted = nowMs(); + await browser.close().catch(() => {}); + addEvent(profile, { + engine: 'browser', + phase: 'load', + ruleId: 'close-browser-overlay-bench', + target: serverInfo.baseUrl, + ms: nowMs() - closeStarted, + }); + } + return findings; + }, + })); + } finally { + await closeServer(serverInfo.server); + } + + return cases.map(testCase => { + if (testCase.engine === 'browser' && testCase.status === 'failed' && /Chromium unavailable|Failed to launch|Could not find Chrome|executable|spawn|puppeteer/i.test(testCase.error || '')) { + return skippedCase({ + name: testCase.name, + engine: testCase.engine, + mode: testCase.mode, + target: testCase.target, + reason: testCase.error, + }); + } + return testCase; + }); +} + +function aggregateEvents(cases) { + const profile = createDetectorProfile(); + for (const testCase of cases) { + if (Array.isArray(testCase.events)) profile.events.push(...testCase.events); + } + return summarizeDetectorProfile(profile); +} + +function makeReport(args, cases) { + const summary = aggregateEvents(cases); + return { + version: 1, + createdAt: new Date().toISOString(), + cwd: ROOT, + quick: args.quick, + browser: args.browser, + cases: cases.map(({ events, ...testCase }) => testCase), + summary, + }; +} + +function pad(value, width) { + const str = String(value); + if (str.length >= width) return str.slice(0, width); + return str + ' '.repeat(width - str.length); +} + +function printRows(rows, columns) { + const header = columns.map(col => pad(col.label, col.width)).join(' '); + console.log(header); + console.log(columns.map(col => '-'.repeat(col.width)).join(' ')); + for (const row of rows) { + console.log(columns.map(col => pad(row[col.key] ?? '', col.width)).join(' ')); + } +} + +function printConsoleReport(report) { + console.log(`Detector benchmark ${report.quick ? '(quick)' : '(full)'}`); + console.log(`Cases: ${report.cases.length}`); + const caseRows = report.cases.map(testCase => ({ + status: testCase.status, + engine: testCase.engine, + mode: testCase.mode, + totalMs: testCase.totalMs, + findings: testCase.findings, + target: testCase.target, + })); + printRows(caseRows, [ + { key: 'status', label: 'Status', width: 8 }, + { key: 'engine', label: 'Engine', width: 12 }, + { key: 'mode', label: 'Mode', width: 20 }, + { key: 'totalMs', label: 'Total ms', width: 10 }, + { key: 'findings', label: 'Findings', width: 8 }, + { key: 'target', label: 'Target', width: 60 }, + ]); + + const skipped = report.cases.filter(testCase => testCase.status === 'skipped'); + for (const testCase of skipped) { + console.log(`Skipped ${testCase.name}: ${testCase.skipReason}`); + } + + console.log('\nSlowest profile groups'); + const slowRows = report.summary.slice(0, 20).map(item => ({ + engine: item.engine, + phase: item.phase, + ruleId: item.ruleId, + calls: item.calls, + totalMs: item.totalMs, + avgMs: item.avgMs, + p95: item.p95, + findings: item.findings, + target: item.target, + })); + printRows(slowRows, [ + { key: 'engine', label: 'Engine', width: 12 }, + { key: 'phase', label: 'Phase', width: 14 }, + { key: 'ruleId', label: 'Rule', width: 28 }, + { key: 'calls', label: 'Calls', width: 8 }, + { key: 'totalMs', label: 'Total ms', width: 10 }, + { key: 'avgMs', label: 'Avg ms', width: 8 }, + { key: 'p95', label: 'P95', width: 8 }, + { key: 'findings', label: 'Finds', width: 7 }, + { key: 'target', label: 'Target', width: 45 }, + ]); +} + +async function main() { + const args = parseArgs(process.argv.slice(2)); + const cases = [ + ...await runFileBenchmarks(args), + ]; + if (args.browser) { + cases.push(...await runBrowserBenchmarks(args)); + } + + const report = makeReport(args, cases); + const json = JSON.stringify(report, null, 2); + if (args.out) { + fs.writeFileSync(path.resolve(args.out), json + '\n'); + } + if (args.json) { + process.stdout.write(json + '\n'); + } else { + printConsoleReport(report); + if (args.out) console.log(`\nWrote JSON report to ${path.resolve(args.out)}`); + } + + if (report.cases.some(testCase => testCase.status === 'failed')) { + process.exitCode = 1; + } +} + +main().catch(err => { + console.error(err?.stack || err?.message || err); + process.exit(1); +}); diff --git a/scripts/build-browser-detector.js b/scripts/build-browser-detector.js index b2ad5ba95111ad6e5e5f9fe5599398264d8a7d41..ef6e8a1e76f8574b116ebb87a708c5deb3fb475b 100644 --- a/scripts/build-browser-detector.js +++ b/scripts/build-browser-detector.js @@ -1,8 +1,8 @@ #!/usr/bin/env node /** - * Generates src/detect-antipatterns-browser.js - * by stripping Node-specific sections from the universal source and wrapping in an IIFE. + * Generates cli/engine/detect-antipatterns-browser.js + * by concatenating the browser-safe detector modules and wrapping them in an IIFE. * * Run: node scripts/build-browser-detector.js */ @@ -14,24 +14,36 @@ import { fileURLToPath } from 'url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const ROOT = path.resolve(__dirname, '..'); -const SOURCE = path.join(ROOT, 'src/detect-antipatterns.mjs'); -const OUTPUT = path.join(ROOT, 'src/detect-antipatterns-browser.js'); - -let code = fs.readFileSync(SOURCE, 'utf-8'); - -// Strip shebang -code = code.replace(/^#!.*\n/, ''); -// Strip sections between @browser-strip-start / @browser-strip-end markers -code = code.replace(/^\/\/ @browser-strip-start\n[\s\S]*?^\/\/ @browser-strip-end\n?/gm, ''); -// Set IS_BROWSER = true (dead-code eliminates Node paths) -code = code.replace(/^const IS_BROWSER = .*$/m, 'const IS_BROWSER = true;'); +const MODULES = [ + 'cli/engine/shared/constants.mjs', + 'cli/engine/registry/antipatterns.mjs', + 'cli/engine/shared/color.mjs', + 'cli/engine/rules/checks.mjs', + 'cli/engine/browser/injected/index.mjs', +]; +const OUTPUT = path.join(ROOT, 'cli/engine/detect-antipatterns-browser.js'); +const SITE_OUTPUT = path.join(ROOT, 'site/public/js/detect-antipatterns-browser.js'); + +function browserSafeModule(relPath) { + let code = fs.readFileSync(path.join(ROOT, relPath), 'utf-8'); + if (relPath === 'cli/engine/registry/antipatterns.mjs') { + const match = code.match(/const ANTIPATTERNS = \[[\s\S]*?\n\];/); + if (!match) throw new Error('Could not extract browser antipattern registry'); + code = match[0]; + } + code = code.replace(/^import[\s\S]*?;\n/gm, ''); + code = code.replace(/^export\s+\{[\s\S]*?^};\n?/gm, ''); + return `// --- ${relPath} ---\n${code.trim()}\n`; +} + +const code = MODULES.map(browserSafeModule).join('\n'); const output = `/** * Anti-Pattern Browser Detector for Impeccable * Copyright (c) 2026 Paul Bakaus * SPDX-License-Identifier: Apache-2.0 * - * GENERATED -- do not edit. Source: detect-antipatterns.mjs + * GENERATED -- do not edit. Source: cli/engine/browser/injected/index.mjs * Rebuild: node scripts/build-browser-detector.js * * Usage: @@ -44,4 +56,7 @@ ${code} `; fs.writeFileSync(OUTPUT, output); +fs.mkdirSync(path.dirname(SITE_OUTPUT), { recursive: true }); +fs.writeFileSync(SITE_OUTPUT, output); console.log(`Generated ${path.relative(ROOT, OUTPUT)} (${(output.length / 1024).toFixed(1)} KB)`); +console.log(`Generated ${path.relative(ROOT, SITE_OUTPUT)} (${(output.length / 1024).toFixed(1)} KB)`); diff --git a/scripts/build-extension.js b/scripts/build-extension.js index 252fc3fdc456ab32e200678451b93541c126aae3..65d693de8abd846f6243eb07aaaa9181fc5d23c0 100644 --- a/scripts/build-extension.js +++ b/scripts/build-extension.js @@ -13,32 +13,44 @@ import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; +import { ANTIPATTERNS } from '../cli/engine/registry/antipatterns.mjs'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const ROOT = path.resolve(__dirname, '..'); const EXT_DIR = path.join(ROOT, 'extension'); -const SOURCE = path.join(ROOT, 'src/detect-antipatterns.mjs'); +const BROWSER_MODULES = [ + 'cli/engine/shared/constants.mjs', + 'cli/engine/registry/antipatterns.mjs', + 'cli/engine/shared/color.mjs', + 'cli/engine/rules/checks.mjs', + 'cli/engine/browser/injected/index.mjs', +]; const DETECTOR_OUTPUT = path.join(EXT_DIR, 'detector/detect.js'); const AP_OUTPUT = path.join(EXT_DIR, 'detector/antipatterns.json'); -let code = fs.readFileSync(SOURCE, 'utf-8'); +function browserSafeModule(relPath) { + let code = fs.readFileSync(path.join(ROOT, relPath), 'utf-8'); + if (relPath === 'cli/engine/registry/antipatterns.mjs') { + const match = code.match(/const ANTIPATTERNS = \[[\s\S]*?\n\];/); + if (!match) throw new Error('Could not extract browser antipattern registry'); + code = match[0]; + } + code = code.replace(/^import[\s\S]*?;\n/gm, ''); + code = code.replace(/^export\s+\{[\s\S]*?^};\n?/gm, ''); + return `// --- ${relPath} ---\n${code.trim()}\n`; +} -// --- 1. Build detector --- +const code = BROWSER_MODULES.map(browserSafeModule).join('\n'); -// Strip shebang -code = code.replace(/^#!.*\n/, ''); -// Strip sections between @browser-strip-start / @browser-strip-end markers -code = code.replace(/^\/\/ @browser-strip-start\n[\s\S]*?^\/\/ @browser-strip-end\n?/gm, ''); -// Set IS_BROWSER = true (dead-code eliminates Node paths) -code = code.replace(/^const IS_BROWSER = .*$/m, 'const IS_BROWSER = true;'); +// --- 1. Build detector --- const output = `/** * Anti-Pattern Browser Detector for Impeccable (Extension Variant) * Copyright (c) 2026 Paul Bakaus * SPDX-License-Identifier: Apache-2.0 * - * GENERATED -- do not edit. Source: detect-antipatterns.mjs + * GENERATED -- do not edit. Source: cli/engine/browser/injected/index.mjs * Rebuild: node scripts/build-extension.js */ (function () { @@ -53,22 +65,16 @@ console.log(`Generated ${path.relative(ROOT, DETECTOR_OUTPUT)} (${(output.length // --- 2. Extract antipatterns.json --- -const rawSource = fs.readFileSync(SOURCE, 'utf-8'); -const apMatch = rawSource.match(/const ANTIPATTERNS = \[([\s\S]*?)\n\];/); -if (apMatch) { - // Convert JS object literals to JSON. Include description so the - // devtools panel can show the full rule explanation in tooltips — - // previously this dropped description and the panel had nothing to display. - const antipatterns = new Function(`return [${apMatch[1]}]`)(); - const apJson = antipatterns.map(({ id, name, category, description }) => ({ - id, - name, - category: category || 'quality', - description: description || '', - })); - fs.writeFileSync(AP_OUTPUT, JSON.stringify(apJson, null, 2) + '\n'); - console.log(`Generated ${path.relative(ROOT, AP_OUTPUT)} (${antipatterns.length} rules)`); -} +// Include description so the devtools panel can show the full rule explanation +// in tooltips. +const apJson = ANTIPATTERNS.map(({ id, name, category, description }) => ({ + id, + name, + category: category || 'quality', + description: description || '', +})); +fs.writeFileSync(AP_OUTPUT, JSON.stringify(apJson, null, 2) + '\n'); +console.log(`Generated ${path.relative(ROOT, AP_OUTPUT)} (${ANTIPATTERNS.length} rules)`); // --- 3. Zip packaging --- diff --git a/scripts/build-sub-pages.js b/scripts/build-sub-pages.js deleted file mode 100644 index a8f8b7eae61a2d9738a905ec967ff5445e217368..0000000000000000000000000000000000000000 --- a/scripts/build-sub-pages.js +++ /dev/null @@ -1,735 +0,0 @@ -/** - * Generate static HTML files for /skills, /anti-patterns, /tutorials. - * - * Called from both scripts/build.js (before buildStaticSite) and - * server/index.js (at module load), so dev and prod share the same - * code path and output shape. - * - * Output lives under public/skills/, public/anti-patterns/, - * public/tutorials/, all gitignored. Bun's HTML loader picks them up - * the same way it picks up the hand-authored pages. - */ - -import fs from 'node:fs'; -import path from 'node:path'; -import { - buildSubPageData, - CATEGORY_ORDER, - CATEGORY_LABELS, - CATEGORY_DESCRIPTIONS, - LAYER_LABELS, - LAYER_DESCRIPTIONS, - GALLERY_ITEMS, -} from './lib/sub-pages-data.js'; -import { renderMarkdown, slugify } from './lib/render-markdown.js'; -import { renderPage } from './lib/render-page.js'; - -function escapeHtml(str) { - return String(str || '') - .replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); -} - -/** - * Render the before/after split-compare demo block for a skill. - * Returns '' when the skill has no demo data (e.g. /shape). - */ -function renderSkillDemo(skill) { - if (!skill.demo) return ''; - const { before, after, caption } = skill.demo; - return ` -
-
-

Drag or hover to compare

-
-
-
${before}
-
-
-
${after || before}
-
-
-
-
- Before - ${caption ? `

${escapeHtml(caption)}

` : ''} - After -
-
-
`; -} - -/** - * Render one skill detail page HTML body (without the site shell). - */ -function renderSkillDetail(skill, knownSkillIds) { - const bodyHtml = renderMarkdown(skill.body, { - knownSkillIds, - currentSkillId: skill.id, - }); - - const editorialHtml = skill.editorial - ? renderMarkdown(skill.editorial.body, { knownSkillIds, currentSkillId: skill.id }) - : ''; - - const demoHtml = renderSkillDemo(skill); - - const tagline = skill.editorial?.frontmatter?.tagline || skill.description; - const categoryLabel = CATEGORY_LABELS[skill.category] || skill.category; - - // Reference files as collapsible
blocks - let referencesHtml = ''; - if (skill.references && skill.references.length > 0) { - const refs = skill.references - .map((ref) => { - const slug = slugify(ref.name); - const refBody = renderMarkdown(ref.content, { - knownSkillIds, - currentSkillId: skill.id, - }); - const title = ref.name - .split('-') - .map((w) => w.charAt(0).toUpperCase() + w.slice(1)) - .join(' '); - return ` -
- Reference${escapeHtml(title)} -
-${refBody} -
-
`; - }) - .join('\n'); - referencesHtml = ` -
-

Deeper reference

- ${refs} -
`; - } - - const metaStrip = ` -
- ${escapeHtml(categoryLabel)} - User-invocable - ${skill.argumentHint ? `${escapeHtml(skill.argumentHint)}` : ''} -
`; - - const hasDemo = demoHtml.trim().length > 0; - - return ` -
-
-
-

Skills / ${escapeHtml(categoryLabel)}

-

/${escapeHtml(skill.id)}

-

${escapeHtml(tagline)}

- ${metaStrip} -
- ${demoHtml} -
- - ${editorialHtml ? `
\n${editorialHtml}\n
` : ''} - -
-
- SKILL.md - The canonical skill definition your AI harness loads. -
-
-${bodyHtml} -
-
- - ${referencesHtml} -
-`; -} - -/** - * Render the unified Docs sidebar used across /skills and /tutorials. - * Shows every skill grouped by category, then tutorials as a final - * group. Pass the current page identifier so we can mark it: - * - * { kind: 'skill', id: 'polish' } - * { kind: 'tutorial', slug: 'getting-started' } - * null (no current page) - */ -function renderDocsSidebar(skillsByCategory, tutorials, current = null) { - // Label the toggle button with the current page so mobile users know - // where they are at a glance, then open the menu to switch. - let currentLabel = 'Docs menu'; - if (current?.kind === 'skill') { - currentLabel = `/${current.id}`; - } else if (current?.kind === 'tutorial') { - const t = tutorials.find((x) => x.slug === current.slug); - if (t) currentLabel = t.title; - } - - let html = ` -`; - return html; -} - -/** - * Render the /skills overview main column content (not the sidebar). - * This is the orientation piece: what skills are, how to pick one, - * the six categories explained with inline cross-links to detail pages. - */ -function renderSkillsOverviewMain(skillsByCategory) { - const totalSkills = Object.values(skillsByCategory).reduce( - (sum, list) => sum + list.length, - 0, - ); - - let categoriesHtml = ''; - for (const category of CATEGORY_ORDER) { - const list = skillsByCategory[category] || []; - if (list.length === 0) continue; - - const skillChips = list - .map( - (s) => - `/${escapeHtml(s.id)}`, - ) - .join(''); - - categoriesHtml += ` -
-
-

${escapeHtml(CATEGORY_LABELS[category])}

-

${list.length} ${list.length === 1 ? 'skill' : 'skills'}

-
-

${escapeHtml(CATEGORY_DESCRIPTIONS[category])}

-
-${skillChips} -
-
-`; - } - - return ` -
-
-

${totalSkills} commands

-

Skills

-

One skill, /impeccable, teaches your AI design. Eighteen commands steer the result. Each command does one job with an opinion about what good looks like.

-
- -
-

How to pick one

-

Skills are named after the intent you bring to them. Reviewing something? /critique or /audit. Fixing type? /typeset. Last-mile pass before shipping? /polish. The categories below group skills by the job.

-
- -
-${categoriesHtml} -
-
`; -} - -/** - * Wrap sidebar + main content in the docs-browser layout shell. - */ -function wrapInDocsLayout(sidebarHtml, mainHtml) { - return ` -
- ${sidebarHtml} -
-${mainHtml} -
-
`; -} - -/** - * Group anti-pattern rules by skill section. - * Rules without a skillSection fall into a 'General quality' bucket. - */ -function groupRulesBySection(rules) { - // Canonical ordering. Additional sections referenced by rules (e.g. - // 'Interaction', 'Responsive' from LLM-only entries) are appended to - // the end, before 'General quality', so every rule renders. - const primaryOrder = [ - 'Visual Details', - 'Typography', - 'Color & Contrast', - 'Layout & Space', - 'Motion', - 'Interaction', - 'Responsive', - ]; - const bySection = {}; - for (const name of primaryOrder) bySection[name] = []; - bySection['General quality'] = []; - - for (const rule of rules) { - const section = rule.skillSection || 'General quality'; - if (!bySection[section]) bySection[section] = []; - bySection[section].push(rule); - } - - // Sort each bucket: slop first (they're the named tells), then quality. - for (const name of Object.keys(bySection)) { - bySection[name].sort((a, b) => { - if (a.category !== b.category) return a.category === 'slop' ? -1 : 1; - return a.name.localeCompare(b.name); - }); - } - - // Final render order: primary sections first, then any extras that - // rules introduced, then General quality last. - const order = [...primaryOrder]; - for (const name of Object.keys(bySection)) { - if (!order.includes(name) && name !== 'General quality') { - order.push(name); - } - } - order.push('General quality'); - - return { order, bySection }; -} - -/** - * Render the anti-patterns sidebar: a table of contents of rule sections - * with per-section rule counts. Every entry anchor-jumps to the section - * in the main column. - */ -function renderAntiPatternsSidebar(grouped) { - const entries = grouped.order - .filter((section) => grouped.bySection[section]?.length > 0) - .map((section) => { - const slug = slugify(section); - const count = grouped.bySection[section].length; - return `
  • ${escapeHtml(section)}${count}
  • `; - }) - .join('\n'); - - return ` -`; -} - -/** - * Render one rule card inside the anti-patterns main column. - */ -function renderRuleCard(rule) { - const categoryLabel = rule.category === 'slop' ? 'AI slop' : 'Quality'; - const layer = rule.layer || 'cli'; - const layerLabel = LAYER_LABELS[layer] || layer; - const layerTitle = LAYER_DESCRIPTIONS[layer] || ''; - const skillLink = rule.skillSection - ? `See in /impeccable` - : ''; - const visual = rule.visual - ? `` - : ''; - return ` -
    - ${visual} -
    -
    - ${categoryLabel} - ${escapeHtml(layerLabel)} -
    -

    ${escapeHtml(rule.name)}

    -

    ${escapeHtml(rule.description)}

    - ${skillLink} -
    -
    `; -} - -function escapeAttr(str) { - return String(str || '').replace(/"/g, '"'); -} - -/** - * Render the /tutorials index main content. - */ -function renderTutorialsIndexMain(tutorials) { - const cards = tutorials - .map( - (t) => ` - - ${String(t.order).padStart(2, '0')} -
    -

    ${escapeHtml(t.title)}

    -

    ${escapeHtml(t.tagline || t.description)}

    -
    - -
    `, - ) - .join('\n'); - - return ` -
    -
    -

    ${tutorials.length} walk-throughs

    -

    Tutorials

    -

    Short, opinionated walk-throughs of the highest-leverage workflows. Each one takes around ten minutes and ends with something working in your project.

    -
    - -
    -${cards} -
    -
    `; -} - -/** - * Render the /visual-mode page main content. - * - * Single-column layout, no sidebar. Editorial header, live iframe embed - * of the detector running on a synthetic slop page, three-card section - * explaining the invocation methods, then a grid of real specimens the - * user can click into to see the overlay on a different page. - */ -function renderVisualModeMain() { - const specimenCards = GALLERY_ITEMS.map( - (item) => ` - - - - `, - ).join('\n'); - - return ` -
    -
    -

    Live detection overlay

    -

    Visual Mode

    -

    See every anti-pattern flagged directly on the page. No screenshots, no JSON to map back to line numbers. The overlay draws an outline and a label on every element the detector catches, so you fix them in place.

    -
    - -
    -
    -
    - - - - Live on a synthetic slop page -
    - -
    -

    Hover or tap any outlined element to see which rule fired.

    -
    - -
    -

    Three ways to run it

    -
    -
    -

    Inside /critique

    -

    /critique

    -

    The design review skill opens the overlay automatically during its browser assessment pass. You get the deterministic findings highlighted in place while the LLM runs its separate heuristic review.

    -
    -
    -

    Standalone CLI

    -

    npx impeccable live

    -

    Starts a local server that serves the detector script. Inject it into any page via a <script> tag to see the overlay. Works on your own dev server, a staging URL, or anyone's live page.

    -
    - -
    -
    - - -
    `; -} - -/** - * Render a tutorial detail page main content. - */ -function renderTutorialDetail(tutorial, knownSkillIds) { - const bodyHtml = renderMarkdown(tutorial.body, { knownSkillIds }); - return ` -
    -
    -

    Tutorials / ${String(tutorial.order).padStart(2, '0')}

    -

    ${escapeHtml(tutorial.title)}

    - ${tutorial.tagline ? `

    ${escapeHtml(tutorial.tagline)}

    ` : ''} -
    - -
    -${bodyHtml} -
    -
    `; -} - -/** - * Render the /anti-patterns main column content. - */ -function renderAntiPatternsMain(grouped, totalRules) { - let sectionsHtml = ''; - for (const section of grouped.order) { - const rules = grouped.bySection[section] || []; - if (rules.length === 0) continue; - const slug = slugify(section); - sectionsHtml += ` -
    -
    -

    ${escapeHtml(section)}

    -

    ${rules.length} ${rules.length === 1 ? 'rule' : 'rules'}

    -
    -
    -${rules.map(renderRuleCard).join('\n')} -
    -
    `; - } - - const detectedCount = grouped.order - .flatMap((s) => grouped.bySection[s] || []) - .filter((r) => r.layer !== 'llm').length; - const llmCount = totalRules - detectedCount; - - return ` -
    -
    -

    ${totalRules} rules

    -

    Anti-patterns

    -

    The full catalog of patterns /impeccable teaches against. ${detectedCount} are caught by a deterministic detector (npx impeccable detect or the browser extension). ${llmCount} can only be flagged by /critique's LLM review pass. Want to see them live on real pages? Try Visual Mode.

    -
    - -
    - - How to read this - - -
    -

    AI slop rules flag the visible tells of AI-generated UIs. Quality rules flag general design mistakes that are not AI-specific but still hurt the work. Each rule also shows how it is detected:

    -
    -
    CLI
    Deterministic. Runs from npx impeccable detect on files, no browser required.
    -
    Browser
    Deterministic, but needs real browser layout. Runs via the browser extension or Puppeteer, not the plain CLI.
    -
    LLM only
    No deterministic detector. Caught by /critique during its LLM design review.
    -
    -
    -
    - -
    -${sectionsHtml} -
    -
    `; -} - -/** - * Entry point. Generates all sub-page HTML files. - * - * @param {string} rootDir - * @returns {Promise<{ files: string[] }>} list of generated file paths (absolute) - */ -export async function generateSubPages(rootDir) { - const data = await buildSubPageData(rootDir); - const outDirs = { - skills: path.join(rootDir, 'public/skills'), - antiPatterns: path.join(rootDir, 'public/anti-patterns'), - tutorials: path.join(rootDir, 'public/tutorials'), - visualMode: path.join(rootDir, 'public/visual-mode'), - }; - - // Fresh output dirs each time so stale files don't linger. - for (const dir of Object.values(outDirs)) { - if (fs.existsSync(dir)) fs.rmSync(dir, { recursive: true, force: true }); - fs.mkdirSync(dir, { recursive: true }); - } - - const generated = []; - - // Skills index: docs-browser layout with unified sidebar. - { - const sidebar = renderDocsSidebar(data.skillsByCategory, data.tutorials, null); - const main = renderSkillsOverviewMain(data.skillsByCategory); - const html = renderPage({ - title: 'Skills | Impeccable', - description: - '18 commands that teach your AI harness how to design. Browse by category: create, evaluate, refine, simplify, harden.', - bodyHtml: wrapInDocsLayout(sidebar, main), - activeNav: 'docs', - canonicalPath: '/skills', - bodyClass: 'sub-page skills-layout-page', - }); - const out = path.join(outDirs.skills, 'index.html'); - fs.writeFileSync(out, html, 'utf-8'); - generated.push(out); - } - - // Skills detail pages: same docs-browser shell as the overview. - for (const skill of data.skills) { - const sidebar = renderDocsSidebar(data.skillsByCategory, data.tutorials, { kind: 'skill', id: skill.id }); - const main = renderSkillDetail(skill, data.knownSkillIds); - const title = `/${skill.id} | Impeccable`; - const description = skill.editorial?.frontmatter?.tagline || skill.description; - const html = renderPage({ - title, - description, - bodyHtml: wrapInDocsLayout(sidebar, main), - activeNav: 'docs', - canonicalPath: `/skills/${skill.id}`, - bodyClass: 'sub-page skills-layout-page', - }); - const out = path.join(outDirs.skills, `${skill.id}.html`); - fs.writeFileSync(out, html, 'utf-8'); - generated.push(out); - } - - // Anti-patterns index: single page, docs-browser shell with TOC sidebar. - { - const grouped = groupRulesBySection(data.rules); - const sidebar = renderAntiPatternsSidebar(grouped); - const main = renderAntiPatternsMain(grouped, data.rules.length); - const html = renderPage({ - title: 'Anti-patterns | Impeccable', - description: `${data.rules.length} deterministic detection rules that flag the visible tells of AI-generated interfaces and common quality issues. Used by npx impeccable detect and the browser extension.`, - bodyHtml: wrapInDocsLayout(sidebar, main), - activeNav: 'anti-patterns', - canonicalPath: '/anti-patterns', - bodyClass: 'sub-page skills-layout-page anti-patterns-page', - }); - const out = path.join(outDirs.antiPatterns, 'index.html'); - fs.writeFileSync(out, html, 'utf-8'); - generated.push(out); - } - - // Tutorials index (under the unified Docs umbrella). - if (data.tutorials.length > 0) { - const sidebar = renderDocsSidebar(data.skillsByCategory, data.tutorials, null); - const main = renderTutorialsIndexMain(data.tutorials); - const html = renderPage({ - title: 'Tutorials | Impeccable', - description: `${data.tutorials.length} short, opinionated walk-throughs of the highest-leverage Impeccable workflows.`, - bodyHtml: wrapInDocsLayout(sidebar, main), - activeNav: 'docs', - canonicalPath: '/tutorials', - bodyClass: 'sub-page skills-layout-page tutorials-page', - }); - const out = path.join(outDirs.tutorials, 'index.html'); - fs.writeFileSync(out, html, 'utf-8'); - generated.push(out); - } - - // Visual Mode: single standalone page, no sidebar, single-column layout. - { - const html = renderPage({ - title: 'Visual Mode | Impeccable', - description: - 'See every anti-pattern flagged directly on the page. Live detection overlay from Impeccable, available via /critique, npx impeccable live, or the upcoming Chrome extension.', - bodyHtml: renderVisualModeMain(), - activeNav: 'visual-mode', - canonicalPath: '/visual-mode', - bodyClass: 'sub-page visual-mode-page-body', - }); - const out = path.join(outDirs.visualMode, 'index.html'); - fs.writeFileSync(out, html, 'utf-8'); - generated.push(out); - } - - // Tutorial detail pages. - for (const tutorial of data.tutorials) { - const sidebar = renderDocsSidebar(data.skillsByCategory, data.tutorials, { kind: 'tutorial', slug: tutorial.slug }); - const main = renderTutorialDetail(tutorial, data.knownSkillIds); - const html = renderPage({ - title: `${tutorial.title} | Tutorials | Impeccable`, - description: tutorial.description || tutorial.tagline || '', - bodyHtml: wrapInDocsLayout(sidebar, main), - activeNav: 'docs', - canonicalPath: `/tutorials/${tutorial.slug}`, - bodyClass: 'sub-page skills-layout-page tutorials-page', - }); - const out = path.join(outDirs.tutorials, `${tutorial.slug}.html`); - fs.writeFileSync(out, html, 'utf-8'); - generated.push(out); - } - - return { files: generated }; -} diff --git a/scripts/build.js b/scripts/build.js index 4668d3cd4f356074647446e4f248c47eacbcf681..4934ed03d4082a2f0f8878a43f1ccabffc846d1d 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -7,8 +7,9 @@ * - Cursor: .cursor/skills/ * - Claude Code: .claude/skills/ * - Gemini: .gemini/skills/ - * - Codex: .codex/skills/ - * - Agents: .agents/skills/ (VS Code Copilot + Antigravity) + * - Codex: dist/codex/ only (OpenAI-metadata bundle; not synced to repo root) + * - Agents: .agents/skills/ (Codex repo/user installs) + * - GitHub: .github/skills/ (GitHub Copilot) * * Also assembles a universal ZIP containing all providers, * and builds Tailwind CSS for production deployment. @@ -17,35 +18,42 @@ import path from 'path'; import fs from 'fs'; import { fileURLToPath } from 'url'; -import { readSourceFiles, readPatterns } from './lib/utils.js'; +import { readSourceFiles, readPatterns, stashPerProjectArtifacts, restorePerProjectArtifacts } from './lib/utils.js'; import { createTransformer, PROVIDERS } from './lib/transformers/index.js'; import { createAllZips } from './lib/zip.js'; -import { generateSubPages } from './build-sub-pages.js'; +import { ANTIPATTERNS } from '../cli/engine/registry/antipatterns.mjs'; +// Sub-page generation is now handled by Astro content collections. /** - * Generate authoritative counts from source data and write to public/js/generated/counts.js. + * Generate authoritative counts from source data and write to site/public/js/generated/counts.js. * Also validates that key HTML files reference the correct numbers. */ function generateCounts(rootDir, skills, buildDir) { - // Count active (non-deprecated) user-invocable commands - const activeCommands = skills.filter(s => { - if (!s.userInvocable) return false; - const content = fs.readFileSync(s.filePath, 'utf-8'); - return !content.includes('DEPRECATED'); - }); - const commandCount = activeCommands.length; - - // Count detection rules from impeccable package - const detectPkgPath = path.join(rootDir, 'src/detect-antipatterns.mjs'); - const detectorSrc = fs.readFileSync(detectPkgPath, 'utf-8'); - const ruleIds = new Set(); - for (const match of detectorSrc.matchAll(/^\s+id: '([^']+)'/gm)) { - ruleIds.add(match[1]); + // Count active commands. After the v3.0 consolidation, commands are sub-commands + // of /impeccable. Count them from the command router table in SKILL.md. + const impeccableSkill = skills.find(s => s.name === 'impeccable'); + let commandCount; + if (impeccableSkill) { + // Count lines in the command table that start with | `...` | — tolerant + // of argument hints inside the backticks (e.g. `craft [feature]`) and of + // multi-word commands (e.g. `pin `). + const routerMatches = impeccableSkill.body.match(/^\| `[^`]+` \|/gm); + commandCount = routerMatches ? routerMatches.length : 0; + } else { + // Fallback: count user-invocable skills + const activeCommands = skills.filter(s => { + if (!s.userInvocable) return false; + const content = fs.readFileSync(s.filePath, 'utf-8'); + return !content.includes('DEPRECATED'); + }); + commandCount = activeCommands.length; } - const detectionCount = ruleIds.size; + + // Count detection rules from the detector registry. + const detectionCount = new Set(ANTIPATTERNS.map(rule => rule.id)).size; // Write generated counts module - const genDir = path.join(rootDir, 'public/js/generated'); + const genDir = path.join(rootDir, 'site/public/js/generated'); fs.mkdirSync(genDir, { recursive: true }); fs.writeFileSync(path.join(genDir, 'counts.js'), `// GENERATED by build.js — do not edit\n` + @@ -55,8 +63,7 @@ function generateCounts(rootDir, skills, buildDir) { // Validate counts in key files const filesToCheck = [ - 'public/index.html', - 'public/cheatsheet.html', + 'site/pages/index.astro', 'README.md', 'NOTICE.md', 'AGENTS.md', @@ -73,7 +80,7 @@ function generateCounts(rootDir, skills, buildDir) { // Check for stale command counts (look for "N commands" or "N skills" patterns) // Strip changelog list content to avoid flagging historical counts const strippedContent = content.replace(/
      [\s\S]*?<\/ul>/g, ''); - const countPattern = /\b(\d+)\s+(design\s+)?(commands|skills|steering commands)/gi; + const countPattern = /\b(\d+)\s+(design\s+)?(commands|sub-commands|skills|steering commands)/gi; for (const match of strippedContent.matchAll(countPattern)) { const num = parseInt(match[1]); // Allow 1 (for "1 skill") and the correct count @@ -83,9 +90,11 @@ function generateCounts(rootDir, skills, buildDir) { } } - // Check for stale detection counts + // Check for stale detection counts. Use the changelog-stripped content + // so historical counts in changelog entries (e.g. "28 rules" from an + // older release) don't flag against the current detector total. const detectPattern = /\b(\d+)\s+(deterministic\s+)?(checks|patterns|rules|detections)/gi; - for (const match of content.matchAll(detectPattern)) { + for (const match of strippedContent.matchAll(detectPattern)) { const num = parseInt(match[1]); if (num !== detectionCount && num > 10) { // ignore small numbers like "3 patterns" console.error(` ❌ ${relPath}: found "${match[0]}" but detection count is ${detectionCount}`); @@ -102,87 +111,96 @@ function generateCounts(rootDir, skills, buildDir) { return errors; } -/** - * Cross-validate that every detection rule with a `skillGuideline` has a - * matching DON'T line in the right section of source/skills/impeccable/SKILL.md. - * - * This is the linchpin of the single-source-of-truth design: it catches drift - * between the engine's ANTIPATTERNS and the human-written DO/DON'T prose. - * - * Returns the number of validation errors. Build fails if > 0. - */ -function validateAntipatternRules(rootDir) { - const detectPath = path.join(rootDir, 'src/detect-antipatterns.mjs'); - const src = fs.readFileSync(detectPath, 'utf-8'); - const apMatch = src.match(/const ANTIPATTERNS = \[([\s\S]*?)\n\];/); - if (!apMatch) { - console.error(' ❌ Could not extract ANTIPATTERNS from detect-antipatterns.mjs'); - return 1; - } - const antipatterns = new Function(`return [${apMatch[1]}]`)(); - const { antipatterns: skillSections } = readPatterns(rootDir); - - // Build section -> joined-DON'T-text lookup for substring matching. - // Lowercased for case-insensitive matching: my XML refactor uses sentence- - // case "DO NOT nest cards" while the rules' skillGuideline strings are - // sentence-cased "Nest cards inside cards" (a fragment from the original - // markdown bullet "**DON'T**: Nest cards inside cards."). - const sectionText = {}; - for (const section of skillSections) { - sectionText[section.name] = section.items.join('\n').toLowerCase(); - } - +function validateSkillFrontmatter(skills) { let errors = 0; - let validated = 0; - for (const rule of antipatterns) { - if (!rule.skillGuideline) continue; - if (!rule.skillSection) { - console.error(` ❌ Rule '${rule.id}' declares skillGuideline but no skillSection`); - errors++; - continue; - } - const text = sectionText[rule.skillSection]; - if (!text) { - console.error(` ❌ Rule '${rule.id}': skillSection '${rule.skillSection}' has no DON'T lines in source/skills/impeccable/SKILL.md`); - errors++; - continue; - } - if (!text.includes(rule.skillGuideline.toLowerCase())) { - console.error(` ❌ Rule '${rule.id}': skillGuideline '${rule.skillGuideline}' not found in any DON'T of section '${rule.skillSection}' in source/skills/impeccable/SKILL.md`); + + for (const skill of skills) { + if (skill.description && skill.description.length > 1024) { + console.error(`❌ ${skill.filePath}: invalid description: exceeds maximum length of 1024 characters (${skill.description.length})`); errors++; - continue; } - validated++; } - if (errors > 0) { - console.error(`\n❌ ${errors} anti-pattern rule(s) drift between src/detect-antipatterns.mjs and source/skills/impeccable/SKILL.md`); - } else { - console.log(`✓ Validated ${validated}/${antipatterns.length} anti-pattern rules against impeccable SKILL.md`); - } return errors; } /** - * Scan user-facing copy for em dashes (— or —). - * Em dashes in project copy are a known anti-pattern here; flag them loudly. - * Only scans files where we author copy, not vendored or generated output. + * Scan user-facing copy for AI-prose anti-patterns: + * - em dashes (— or —) + * - double-hyphen substitutes (` -- `) + * - denylisted phrases that read as AI tells in marketing copy + * + * The denylist is the editorial brief in STYLE.md, enforced. Each rule has a + * rationale that prints with the failure so the next author understands why. * - * Returns the number of occurrences found. + * Scope: every surface a reader sees. Not skill/, where + * LLM-facing reference instructions can use technical phrasings the marketing + * copy can't. + * + * Returns the number of occurrences found. Build fails if > 0. */ -function validateNoEmDashes(rootDir) { +function validateProse(rootDir) { const targets = [ - 'content/site', - 'public/index.html', - 'public/cheatsheet.html', - 'public/privacy.html', - 'scripts/build-sub-pages.js', - 'scripts/lib/sub-pages-data.js', + 'site/components', + 'site/content', + 'site/layouts', + 'site/pages', + 'README.md', + 'README.npm.md', ]; - const extensions = new Set(['.html', '.md', '.js', '.mjs', '.css']); + const extensions = new Set(['.html', '.md', '.js', '.mjs', '.css', '.astro']); const emDashPatterns = [/—/g, /—/gi, /—/gi, /—/gi]; + // Phrase rules: { re, rationale }. Add to STYLE.md when adding here. + const phraseRules = [ + { re: /\bload-bearing\b/i, rationale: 'AI tell. Stolen-engineer diction; almost always vague. Name what the thing actually does.' }, + { re: /\bhighest-leverage\b/i, rationale: 'AI tell. Vague claim of impact. Say what specifically pays off.' }, + { re: /\bbiggest unlock\b/i, rationale: 'AI tell. Marketing-speak. Describe the actual change.' }, + { re: /\breflex defaults?\b/i, rationale: 'Internal jargon leaking into user-facing copy. Say "instincts" or "first guesses".' }, + { re: /\bcollapses? into monoculture\b/i, rationale: 'Internal eval-speak. Describe what actually went wrong.' }, + { re: /\bdata-driven\b/i, rationale: 'Empty marketing adjective. Cite the data instead.' }, + { re: /\bseamless(?:ly)?\b/i, rationale: 'Hollow positive. Say what specifically works without friction.' }, + { re: /\brobust(?:ness)?\b/i, rationale: 'Hollow positive. Cite the failure mode it handles.' }, + { re: /\bdelves?\b|\bdelved\b|\bdelving\b/i, rationale: 'Top AI tell. Use "explore", "look at", or just delete.' }, + { re: /\belevate(?:s|d)?\b/i, rationale: 'Marketing verb. Use the specific verb (improve, raise, sharpen).' }, + { re: /\bempower(?:s|ed|ing)?\b/i, rationale: 'Marketing verb. Use "let you" or "make possible".' }, + { re: /\bunderscore(?:s|d)?\b/i, rationale: 'AI tell. Use "show" or "make clear".' }, + { re: /\bpivotal\b/i, rationale: 'Hollow positive. Use "central", "key", or describe the role.' }, + { re: /\bin today's\b/i, rationale: 'Throat-clearing opener. Cut the clause; start at the point.' }, + { re: /\bgone are the days\b/i, rationale: 'Throat-clearing. Make the point directly.' }, + { re: /\bwhether you're\b/i, rationale: 'Audience-pandering. Pick one reader; write to them.' }, + { re: /\blet's dive in\b/i, rationale: 'Throat-clearing. Just start.' }, + { re: /\bin summary\b|\bin conclusion\b/i, rationale: 'Summarizing closer. End on the strongest sentence; trust the reader.' }, + { re: /\bmoreover\b|\bfurthermore\b/i, rationale: 'Transition crutch on a metronome. Drop, or use "also".' }, + { re: /\btapestry\b/i, rationale: 'AI scenery noun. Cut.' }, + ]; let errors = 0; + const checkLine = (line, rel, lineNum) => { + for (const re of emDashPatterns) { + if (re.test(line)) { + console.error(` ❌ ${rel}:${lineNum}: em dash → ${line.trim().slice(0, 120)}`); + console.error(` Use commas, colons, semicolons, periods, or parentheses.`); + errors++; + re.lastIndex = 0; + break; + } + re.lastIndex = 0; + } + if (/ -- /.test(line)) { + console.error(` ❌ ${rel}:${lineNum}: \` -- \` em-dash substitute → ${line.trim().slice(0, 120)}`); + console.error(` Worse than the em dash. Pick real punctuation.`); + errors++; + } + for (const rule of phraseRules) { + if (rule.re.test(line)) { + const matched = line.match(rule.re)?.[0] ?? ''; + console.error(` ❌ ${rel}:${lineNum}: "${matched}" → ${line.trim().slice(0, 120)}`); + console.error(` ${rule.rationale}`); + errors++; + } + } + }; + const scan = (absPath, rel) => { const stat = fs.statSync(absPath); if (stat.isDirectory()) { @@ -194,16 +212,7 @@ function validateNoEmDashes(rootDir) { if (!extensions.has(path.extname(absPath))) return; const src = fs.readFileSync(absPath, 'utf-8'); const lines = src.split('\n'); - lines.forEach((line, i) => { - for (const re of emDashPatterns) { - if (re.test(line)) { - console.error(` ❌ ${rel}:${i + 1}: em dash in copy → ${line.trim().slice(0, 120)}`); - errors++; - break; - } - re.lastIndex = 0; - } - }); + lines.forEach((line, i) => checkLine(line, rel, i + 1)); }; for (const target of targets) { @@ -212,46 +221,116 @@ function validateNoEmDashes(rootDir) { } if (errors === 0) { - console.log(`✓ No em dashes in project copy`); + console.log(`✓ Prose validator: no AI tells in user-facing copy`); } else { - console.error(`\n❌ ${errors} em dash(es) in project copy. Use commas, colons, or parentheses.`); + console.error(`\n❌ ${errors} prose issue(s) in user-facing copy. See STYLE.md for the rules.`); } return errors; } /** - * Validate that every hand-authored HTML page carries the shared site header. - * The partial is stamped with `` so drift is loud. + * Narrow prose check for the impeccable skill source. * - * Returns the number of validation errors. Build fails if > 0. + * The full validateProse rules don't fit LLM-facing reference instructions: + * the hardening repetition and triadic checklists those files use exist on + * purpose, and the structural-prose rules in STYLE.md require human judgment. + * This validator only enforces the mechanical wins: em dashes (which are + * pure punctuation laziness regardless of audience) and the small handful + * of denylisted phrases that have no technical reading. Em-dash creep is the + * only thing likely to come back at scale once humans stop watching. + * + * Returns the number of occurrences found. Build fails if > 0. */ -function validateSiteHeader(rootDir) { - const pages = [ - 'public/index.html', - 'public/cheatsheet.html', - 'public/privacy.html', +function validateSkillProse(rootDir) { + const target = 'skill'; + const extensions = new Set(['.md']); + const emDashPatterns = [/—/g, /—/gi, /—/gi, /—/gi]; + // Tighter than validateProse: only the rules that have no technical reading. + // Skipping `data-driven` here would be a mistake (it slipped through twice + // in live.md before this pass); but `seamless`, `robust`, etc. have + // legitimate technical uses elsewhere we may want to allow. + const phraseRules = [ + { re: /\bload-bearing\b/i, rationale: 'AI tell. Name what the thing actually does.' }, + { re: /\bhighest-leverage\b/i, rationale: 'AI tell. Say what specifically pays off.' }, + { re: /\bbiggest unlock\b/i, rationale: 'Marketing-speak. Describe the actual change.' }, + { re: /\breflex defaults?\b/i, rationale: 'Internal jargon. Say "instincts" or "first guesses".' }, + { re: /\bcollapses? into monoculture\b/i, rationale: 'Eval-speak. Describe what actually went wrong.' }, + { re: /\bdata-driven\b/i, rationale: 'Empty marketing adjective. Cite the data instead.' }, + { re: /\bdelves?\b|\bdelved\b|\bdelving\b/i, rationale: 'Top AI tell. Use "explore" or "look at".' }, + { re: /\btapestry\b/i, rationale: 'AI scenery noun. Cut.' }, + { re: /\bin today's\b/i, rationale: 'Throat-clearing opener. Start at the point.' }, + { re: /\bgone are the days\b/i, rationale: 'Throat-clearing. Make the point directly.' }, + { re: /\blet's dive in\b/i, rationale: 'Throat-clearing. Just start.' }, + { re: /\bin summary\b|\bin conclusion\b/i, rationale: 'Summarizing closer. End on the strongest sentence.' }, ]; - const marker = ''; let errors = 0; - for (const rel of pages) { - const full = path.join(rootDir, rel); - if (!fs.existsSync(full)) { - console.error(` ❌ ${rel} is missing`); - errors++; - continue; + + const checkLine = (line, rel, lineNum) => { + for (const re of emDashPatterns) { + if (re.test(line)) { + console.error(` ❌ ${rel}:${lineNum}: em dash → ${line.trim().slice(0, 120)}`); + console.error(` Use commas, colons, semicolons, periods, or parentheses.`); + errors++; + re.lastIndex = 0; + break; + } + re.lastIndex = 0; } - const src = fs.readFileSync(full, 'utf-8'); - if (!src.includes(marker)) { - console.error(` ❌ ${rel} is missing the shared site header marker '${marker}'`); + if (/ -- /.test(line)) { + console.error(` ❌ ${rel}:${lineNum}: \` -- \` em-dash substitute → ${line.trim().slice(0, 120)}`); + console.error(` Worse than the em dash. Pick real punctuation.`); errors++; } - } + for (const rule of phraseRules) { + if (rule.re.test(line)) { + const matched = line.match(rule.re)?.[0] ?? ''; + console.error(` ❌ ${rel}:${lineNum}: "${matched}" → ${line.trim().slice(0, 120)}`); + console.error(` ${rule.rationale}`); + errors++; + } + } + }; + + const scan = (absPath, rel) => { + const stat = fs.statSync(absPath); + if (stat.isDirectory()) { + for (const entry of fs.readdirSync(absPath)) { + scan(path.join(absPath, entry), path.join(rel, entry)); + } + return; + } + if (!extensions.has(path.extname(absPath))) return; + const src = fs.readFileSync(absPath, 'utf-8'); + const lines = src.split('\n'); + lines.forEach((line, i) => checkLine(line, rel, i + 1)); + }; + + const full = path.join(rootDir, target); + if (fs.existsSync(full)) scan(full, target); + if (errors === 0) { - console.log(`✓ Validated site header on ${pages.length} hand-authored pages`); + console.log(`✓ Skill prose validator: skill/ is clean`); + } else { + console.error(`\n❌ ${errors} prose issue(s) in skill/. See STYLE.md.`); } return errors; } +/** + * Validate that every hand-authored HTML page carries the shared site header. + * The partial is stamped with `` so drift is loud. + * + * Returns the number of validation errors. Build fails if > 0. + */ +function validateSiteHeader(_rootDir) { + // With Astro, the shared header is a component (site/components/Header.astro). + // There's nothing to validate per-page — the component is imported by Base.astro + // and rendered identically everywhere. This function is kept as a no-op so the + // call site doesn't need to change. + console.log('✓ Site header is a shared Astro component (no per-page validation needed)'); + return 0; +} + /** * Copy directory recursively */ @@ -274,105 +353,13 @@ const __dirname = path.dirname(__filename); const ROOT_DIR = path.resolve(__dirname, '..'); const DIST_DIR = path.join(ROOT_DIR, 'dist'); -/** - * Build static site using Bun's HTML bundler - * Bun's HTML loader resolves and inlines CSS @imports. - */ -async function buildStaticSite(extraEntrypoints = []) { - const entrypoints = [ - path.join(ROOT_DIR, 'public', 'index.html'), - path.join(ROOT_DIR, 'public', 'cheatsheet.html'), - path.join(ROOT_DIR, 'public', 'privacy.html'), - ...extraEntrypoints, - ]; - const outdir = path.join(ROOT_DIR, 'build'); - - console.log(`📦 Building static site with Bun (${entrypoints.length} HTML entries)...`); - - try { - const result = await Bun.build({ - entrypoints: entrypoints, - outdir: outdir, - minify: true, - sourcemap: 'linked', - // Older Bun versions (e.g. the one Cloudflare Pages ships) don't dedupe - // shared CSS/JS chunks across HTML entrypoints — every entry tries to - // emit its own copy, and three different sub-pages all named index.html - // (under skills/, tutorials/, anti-patterns/) collide on the same - // chunk filename. Including [dir] in the chunk template scopes each - // chunk to its entry's directory so the names stay unique even when - // dedupe is off. Local Bun still emits a single shared chunk; CF Bun - // emits one per entry but each lands in its own directory. - naming: { - entry: '[dir]/[name].[ext]', - chunk: '[dir]/[name]-[hash].[ext]', - asset: '[dir]/[name]-[hash].[ext]', - }, - }); - - if (!result.success) { - console.error('Build failed:'); - for (const log of result.logs) { - console.error(log.message || log); - if (log.position) { - console.error(` at ${log.position.file}:${log.position.line}:${log.position.column}`); - } - } - process.exit(1); - } - - // Calculate total size - const totalSize = result.outputs.reduce((sum, o) => sum + o.size, 0); - const htmlFiles = result.outputs.filter(o => o.path.endsWith('.html')); - const jsFiles = result.outputs.filter(o => o.path.endsWith('.js')); - const cssFiles = result.outputs.filter(o => o.path.endsWith('.css')); - - // When entrypoints span multiple depths under public/ (e.g. public/index.html - // + public/skills/polish.html), Bun's HTML loader preserves the full public/ - // prefix in the output tree. Flatten build/public/* up to build/*. - const nestedPublic = path.join(outdir, 'public'); - if (fs.existsSync(nestedPublic)) { - for (const entry of fs.readdirSync(nestedPublic, { withFileTypes: true })) { - const from = path.join(nestedPublic, entry.name); - const to = path.join(outdir, entry.name); - if (fs.existsSync(to)) fs.rmSync(to, { recursive: true, force: true }); - fs.renameSync(from, to); - } - fs.rmdirSync(nestedPublic); - } - - console.log(`✓ Static site built to ./build/`); - console.log(` HTML: ${htmlFiles.length} file(s)`); - console.log(` JS: ${jsFiles.length} file(s) (${(jsFiles.reduce((s, f) => s + f.size, 0) / 1024).toFixed(1)} KB)`); - console.log(` CSS: ${cssFiles.length} file(s) (${(cssFiles.reduce((s, f) => s + f.size, 0) / 1024).toFixed(1)} KB)`); - console.log(` Total: ${(totalSize / 1024).toFixed(1)} KB\n`); - - return result; - } catch (error) { - // Bun's build aggregator errors expose details on `error.errors` (an - // array of resolution / parse failures), not `error.stack`. Print - // both so CI logs surface the real cause instead of "undefined". - console.error('Failed to build static site:', error.message); - if (error.errors?.length) { - for (const e of error.errors) { - console.error(' -', e.message || e); - } - } - if (error.logs?.length) { - for (const log of error.logs) { - console.error(log.message || log); - } - } - if (error.stack) console.error(error.stack); - process.exit(1); - } -} +// buildStaticSite (Bun HTML bundler) removed — now handled by Astro. /** * Assemble universal directory from all provider outputs */ -function assembleUniversal(distDir, suffix = '') { - const universalDir = path.join(distDir, `universal${suffix}`); +function assembleUniversal(distDir) { + const universalDir = path.join(distDir, 'universal'); // Clean and recreate if (fs.existsSync(universalDir)) { @@ -382,7 +369,7 @@ function assembleUniversal(distDir, suffix = '') { const providerConfigs = Object.values(PROVIDERS); for (const { provider, configDir } of providerConfigs) { - const src = path.join(distDir, `${provider}${suffix}`, configDir); + const src = path.join(distDir, provider, configDir); const dest = path.join(universalDir, configDir); if (fs.existsSync(src)) { copyDirSync(src, dest); @@ -391,30 +378,30 @@ function assembleUniversal(distDir, suffix = '') { // Add a visible README so macOS users don't see an empty folder // (all provider dirs are dotfiles, hidden by default in Finder) - const prefixNote = suffix ? '\nSkills in this bundle are prefixed with i- (e.g. /i-audit) to avoid conflicts.\n' : ''; fs.writeFileSync(path.join(universalDir, 'README.txt'), -`Impeccable — Design fluency for AI harnesses +`Impeccable. Design fluency for AI harnesses. https://impeccable.style -${prefixNote} + This folder contains skills for all supported tools: - .cursor/ → Cursor - .claude/ → Claude Code - .gemini/ → Gemini CLI - .codex/ → Codex CLI - .agents/ → VS Code Copilot, Antigravity - .kiro/ → Kiro - .opencode/ → OpenCode - .pi/ → Pi - .trae-cn/ → Trae China - .trae/ → Trae International + .cursor/ -> Cursor + .claude/ -> Claude Code + .gemini/ -> Gemini CLI + .codex/ -> Codex custom agents (Codex skills use .agents/) + .agents/ -> Codex CLI + .github/ -> GitHub Copilot + .kiro/ -> Kiro + .opencode/ -> OpenCode + .pi/ -> Pi + .trae-cn/ -> Trae China + .trae/ -> Trae International To install, copy the relevant folder(s) into your project root. -These are hidden folders (dotfiles) — press Cmd+Shift+. in Finder to see them. +For Codex, repo and user skill installs come from .agents/skills. +These are hidden folders (dotfiles). Press Cmd+Shift+. in Finder to see them. `); - const label = suffix ? ' (prefixed)' : ''; - console.log(`✓ Assembled universal${label} directory (${providerConfigs.length} providers)`); + console.log(`✓ Assembled universal directory (${providerConfigs.length} providers)`); } /** @@ -435,8 +422,49 @@ function generateApiData(buildDir, skills, patterns) { })); fs.writeFileSync(path.join(apiDir, 'skills.json'), JSON.stringify(skillsData)); - // commands.json (user-invocable skills only) - const commandsData = skillsData.filter(s => s.userInvocable); + // commands.json - after v3.0 consolidation, commands are sub-commands of + // /impeccable. Load them from command-metadata.json and include the root + // impeccable skill itself so UI surfaces like the cheatsheet can list them. + // Each entry also picks up a short `tagline` from its editorial file + // (site/content/skills/.md) when one exists. Taglines are used by UI + // surfaces that need a human-friendly one-liner, while `description` stays + // optimized for auto-trigger keyword matching in the AI harness. + const readTagline = (id) => { + const editorialPath = path.join(ROOT_DIR, 'site/content/skills', `${id}.md`); + if (!fs.existsSync(editorialPath)) return null; + const raw = fs.readFileSync(editorialPath, 'utf-8'); + const match = raw.match(/^---\n([\s\S]*?)\n---/); + if (!match) return null; + const taglineMatch = match[1].match(/tagline:\s*"([^"]+)"/); + return taglineMatch ? taglineMatch[1] : null; + }; + + const metadataPath = path.join(ROOT_DIR, 'skill/scripts/command-metadata.json'); + if (!fs.existsSync(metadataPath)) { + throw new Error(`command-metadata.json is missing at ${metadataPath}. This file is required to generate the commands API.`); + } + const impeccable = skills.find(s => s.name === 'impeccable'); + if (!impeccable) { + throw new Error('impeccable skill not found at skill/SKILL.md. The build system expects exactly one skill at that path.'); + } + + const metadata = JSON.parse(fs.readFileSync(metadataPath, 'utf-8')); + const commandsData = [ + { + id: 'impeccable', + name: 'impeccable', + description: impeccable.description, + tagline: readTagline('impeccable'), + userInvocable: true, + }, + ...Object.entries(metadata).map(([id, meta]) => ({ + id, + name: id, + description: meta.description, + tagline: readTagline(id), + userInvocable: true, + })), + ]; fs.writeFileSync(path.join(apiDir, 'commands.json'), JSON.stringify(commandsData)); // patterns.json @@ -454,7 +482,8 @@ function generateApiData(buildDir, skills, patterns) { ); } - console.log(`✓ Generated static API data (${skillsData.length} skills, ${commandsData.length} commands)`); + const skillWord = skillsData.length === 1 ? 'skill' : 'skills'; + console.log(`✓ Generated static API data (${skillsData.length} ${skillWord}, ${commandsData.length} commands)`); } /** @@ -523,12 +552,22 @@ function generateCFConfig(buildDir) { `; fs.writeFileSync(path.join(buildDir, '_headers'), headers); - // _redirects: rewrite JSON API routes to static files (200 = rewrite, not redirect) + // _redirects: rewrite JSON API routes to static files (200 = rewrite, not redirect). + // Plus permanent redirects for legacy URLs. const redirects = `/api/skills /_data/api/skills.json 200 /api/commands /_data/api/commands.json 200 /api/patterns /_data/api/patterns.json 200 /api/command-source/:id /_data/api/command-source/:id.json 200 -/gallery /visual-mode#try-it-live 301 +/gallery /slop#try-it-live 301 +/cheatsheet /docs 301 +/skills /docs 301 +/skills/:id /docs/:id 301 +/anti-patterns /slop#catalog 301 +/visual-mode /slop#see-it 301 +/neon-mirai /neo-mirai/ 301 +/neon-mirai/ /neo-mirai/ 301 +/cases/neon-mirai /cases/neo-mirai 301 +/cases/neon-mirai/ /cases/neo-mirai 301 `; fs.writeFileSync(path.join(buildDir, '_redirects'), redirects); @@ -550,77 +589,85 @@ function generateCFConfig(buildDir) { async function build() { console.log('🔨 Building cross-provider design skills...\n'); - // Pre-generate sub-pages (skills, anti-patterns, tutorials) from source - console.log('📝 Generating sub-pages...'); - const { files: subPageFiles } = await generateSubPages(ROOT_DIR); - console.log(`✓ Generated ${subPageFiles.length} sub-page(s)\n`); - - // Bundle HTML, JS, and CSS with Bun (including generated sub-pages) - await buildStaticSite(subPageFiles); - - // Copy root-level static assets that need stable (unhashed) URLs - const staticAssets = ['og-image.jpg', 'robots.txt', 'sitemap.xml', 'favicon.svg', 'apple-touch-icon.png']; - const buildDir = path.join(ROOT_DIR, 'build'); - for (const asset of staticAssets) { - const src = path.join(ROOT_DIR, 'public', asset); - if (fs.existsSync(src)) { - fs.copyFileSync(src, path.join(buildDir, asset)); - } - } - - // Copy antipattern examples (self-contained HTML, not Bun entrypoints) - const examplesDir = path.join(ROOT_DIR, 'public', 'antipattern-examples'); - if (fs.existsSync(examplesDir)) { - copyDirSync(examplesDir, path.join(buildDir, 'antipattern-examples')); - } + // Sub-page generation, HTML bundling, and static-asset copying are now + // handled by Astro (bun run build:site). This script focuses on skills, + // API data, and Cloudflare config. - // Copy browser detector script (referenced by antipattern examples at /js/...) - const detectorSrc = path.join(ROOT_DIR, 'src', 'detect-antipatterns-browser.js'); + // Copy browser detector to site/public/js/ so the antipattern examples can + // reference it (Astro serves site/public/ as-is). + const detectorSrc = path.join(ROOT_DIR, 'cli', 'engine', 'detect-antipatterns-browser.js'); if (fs.existsSync(detectorSrc)) { - const jsDir = path.join(buildDir, 'js'); + const jsDir = path.join(ROOT_DIR, 'site', 'public', 'js'); fs.mkdirSync(jsDir, { recursive: true }); fs.copyFileSync(detectorSrc, path.join(jsDir, 'detect-antipatterns-browser.js')); } + const buildDir = path.join(ROOT_DIR, 'build'); + // Read source files (unified skills architecture) const { skills } = readSourceFiles(ROOT_DIR); const patterns = readPatterns(ROOT_DIR); const userInvocableCount = skills.filter(s => s.userInvocable).length; console.log(`📖 Read ${skills.length} skills (${userInvocableCount} user-invocable) and ${patterns.patterns.length + patterns.antipatterns.length} pattern categories\n`); + const frontmatterErrors = validateSkillFrontmatter(skills); + if (frontmatterErrors > 0) { + process.exit(1); + } + // Read skills version from plugin.json const pluginJson = JSON.parse(fs.readFileSync(path.join(ROOT_DIR, '.claude-plugin/plugin.json'), 'utf-8')); const skillsVersion = pluginJson.version; - // Transform for each provider (unprefixed + prefixed) + // Transform for each provider for (const config of Object.values(PROVIDERS)) { const transform = createTransformer(config); transform(skills, DIST_DIR, { skillsVersion }); - transform(skills, DIST_DIR, { prefix: 'i-', outputSuffix: '-prefixed', skillsVersion }); } - // Assemble universal directory (unprefixed and prefixed) + // Assemble universal directory assembleUniversal(DIST_DIR); - assembleUniversal(DIST_DIR, '-prefixed'); // Create ZIP bundles (individual + universal) await createAllZips(DIST_DIR); // Generate static API data and Cloudflare Pages config - generateApiData(buildDir, skills, patterns); - copyDistToBuild(DIST_DIR, buildDir); - generateCFConfig(buildDir); - - // Copy all provider outputs to project root for local testing - const syncConfigs = Object.values(PROVIDERS); + // Write API data and CF config to site/public/ so Astro copies them to build/. + // Astro wipes build/ before writing, so anything written directly to build/ + // during build:skills would be destroyed when build:site runs. + const publicDir = path.join(ROOT_DIR, 'site', 'public'); + generateApiData(publicDir, skills, patterns); + generateCFConfig(publicDir); + + // Copy all provider outputs to project root for local testing. + // `.codex/` is intentionally excluded: Codex no longer consumes that layout; keep + // generated bundles under dist/ only. + const syncConfigs = Object.values(PROVIDERS).filter(({ configDir }) => configDir !== '.codex'); for (const { provider, configDir } of syncConfigs) { const skillsSrc = path.join(DIST_DIR, provider, configDir, 'skills'); const skillsDest = path.join(ROOT_DIR, configDir, 'skills'); if (fs.existsSync(skillsSrc)) { + // Preserve legacy per-project script artifacts (e.g. live-mode config.json) + // across the rm + recopy. The build intentionally doesn't ship them, + // so without this the sync destroys local state on every rebuild. + const stashed = stashPerProjectArtifacts(skillsDest); if (fs.existsSync(skillsDest)) fs.rmSync(skillsDest, { recursive: true }); copyDirSync(skillsSrc, skillsDest); + restorePerProjectArtifacts(skillsDest, stashed); + } + } + + for (const { provider, configDir, agentFormat } of Object.values(PROVIDERS)) { + if (!agentFormat) continue; + + const agentsSrc = path.join(DIST_DIR, provider, configDir, 'agents'); + const agentsDest = path.join(ROOT_DIR, configDir, 'agents'); + + if (fs.existsSync(agentsDest)) fs.rmSync(agentsDest, { recursive: true, force: true }); + if (fs.existsSync(agentsSrc)) { + copyDirSync(agentsSrc, agentsDest); } } @@ -630,6 +677,10 @@ async function build() { const deprecatedLocalSkills = [ 'frontend-design', 'teach-impeccable', 'arrange', 'normalize', 'onboard', 'extract', + // v3.0 consolidation: standalone skills -> /impeccable sub-commands + 'adapt', 'animate', 'audit', 'bolder', 'clarify', 'colorize', + 'critique', 'delight', 'distill', 'harden', 'layout', 'optimize', + 'overdrive', 'polish', 'quieter', 'shape', 'typeset', ]; for (const { configDir } of syncConfigs) { for (const name of deprecatedLocalSkills) { @@ -640,20 +691,70 @@ async function build() { console.log(`📋 Synced skills to: ${syncConfigs.map(p => p.configDir).join(', ')}`); + // Build the Claude Code plugin subtree at ./plugin/. + // The Claude Code marketplace is configured with `source: "./plugin"`, so + // the plugin cache only copies this slim directory (~0.3 MB) instead of + // the entire monorepo (~291 MB on the previous "./" source). The harness + // dirs above stay where they are because `npx skills add pbakaus/impeccable` + // reads them directly from the GitHub repo at install time. + const pluginRoot = path.join(ROOT_DIR, 'plugin'); + const pluginManifestDir = path.join(pluginRoot, '.claude-plugin'); + const pluginSkillsDir = path.join(pluginRoot, 'skills'); + const pluginAgentsDir = path.join(pluginRoot, 'agents'); + if (fs.existsSync(pluginManifestDir)) fs.rmSync(pluginManifestDir, { recursive: true }); + if (fs.existsSync(pluginSkillsDir)) fs.rmSync(pluginSkillsDir, { recursive: true }); + if (fs.existsSync(pluginAgentsDir)) fs.rmSync(pluginAgentsDir, { recursive: true }); + + const rootManifest = JSON.parse(fs.readFileSync(path.join(ROOT_DIR, '.claude-plugin/plugin.json'), 'utf-8')); + const claudeAgentsSrc = path.join(DIST_DIR, 'claude-code', '.claude', 'agents'); + const pluginAgentEntries = fs.existsSync(claudeAgentsSrc) + ? fs.readdirSync(claudeAgentsSrc) + .filter(file => file.endsWith('.md')) + .sort() + .map(file => `./agents/${file}`) + : []; + // Trailing slash on the skills path matches the documented schema in + // code.claude.com/docs/en/plugins-reference. Issue #86 has 3 reporters + // converging on "add trailing slash to fix slash commands not registering"; + // the docs schema example consistently uses `"./custom/skills/"` form. + const pluginManifest = { ...rootManifest, skills: './skills/' }; + if (pluginAgentEntries.length) { + pluginManifest.agents = pluginAgentEntries; + } else { + delete pluginManifest.agents; + } + fs.mkdirSync(pluginManifestDir, { recursive: true }); + fs.writeFileSync( + path.join(pluginManifestDir, 'plugin.json'), + JSON.stringify(pluginManifest, null, 2) + '\n', + ); + + const claudeSkillsSrc = path.join(DIST_DIR, 'claude-code', '.claude', 'skills', 'impeccable'); + if (fs.existsSync(claudeSkillsSrc)) { + fs.mkdirSync(pluginSkillsDir, { recursive: true }); + copyDirSync(claudeSkillsSrc, path.join(pluginSkillsDir, 'impeccable')); + } + + if (fs.existsSync(claudeAgentsSrc)) { + copyDirSync(claudeAgentsSrc, pluginAgentsDir); + } + + console.log('📦 Built Claude Code plugin subtree at ./plugin/'); // Generate authoritative counts and validate references const countErrors = generateCounts(ROOT_DIR, skills, buildDir); - // Cross-validate engine rules against impeccable SKILL.md DON'Ts - const validationErrors = validateAntipatternRules(ROOT_DIR); - // Verify every hand-authored HTML page carries the shared site header const headerErrors = validateSiteHeader(ROOT_DIR); - // Scan user-facing copy for em dashes - const emDashErrors = validateNoEmDashes(ROOT_DIR); + // Scan user-facing copy for AI tells (em dashes, marketing fluff, denylisted phrases) + const proseErrors = validateProse(ROOT_DIR); + + // Narrow scan of LLM-facing skill instructions: em dashes + a tighter denylist + // that has no technical reading. Hardening repetition is intentionally allowed. + const skillProseErrors = validateSkillProse(ROOT_DIR); - if (countErrors > 0 || validationErrors > 0 || headerErrors > 0 || emDashErrors > 0) { + if (countErrors > 0 || headerErrors > 0 || proseErrors > 0 || skillProseErrors > 0) { process.exit(1); } diff --git a/scripts/generate-og-image.js b/scripts/generate-og-image.js index 3aa6474d96fbc90da0a0230752bc7eaa2522d499..e225364250dabb80ea657c8bcfd3740484f188a5 100644 --- a/scripts/generate-og-image.js +++ b/scripts/generate-og-image.js @@ -19,7 +19,7 @@ import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const ROOT_DIR = path.resolve(__dirname, '..'); -const OUTPUT_PATH = path.join(ROOT_DIR, 'public', 'og-image.jpg'); +const OUTPUT_PATH = path.join(ROOT_DIR, 'site', 'public', 'og-image.jpg'); const EXTENSION_IMAGE_PATH = path.join( ROOT_DIR, 'public', @@ -27,29 +27,15 @@ const EXTENSION_IMAGE_PATH = path.join( 'extension-detection.png', ); -// Count user-invocable, non-deprecated skills from source/skills/ -// (In v2.0, commands and skills were unified — every command is a skill.) +// Count sub-commands from skill/scripts/command-metadata.json (the post-v3.0 +// single source of truth). Commands and skills were unified in v2.0; v3.0 +// then collapsed to a single user-invocable skill (`impeccable`) with +// sub-commands listed in command-metadata.json. function getCommandCount() { - const skillsDir = path.join(ROOT_DIR, 'source', 'skills'); - if (!fs.existsSync(skillsDir)) return 0; - - let count = 0; - for (const entry of fs.readdirSync(skillsDir, { withFileTypes: true })) { - if (!entry.isDirectory()) continue; - const skillFile = path.join(skillsDir, entry.name, 'SKILL.md'); - if (!fs.existsSync(skillFile)) continue; - - const content = fs.readFileSync(skillFile, 'utf8'); - const fm = content.match(/^---\n([\s\S]*?)\n---/); - if (!fm) continue; - - const frontmatter = fm[1]; - const isUserInvocable = /^user-invocable:\s*true\s*$/m.test(frontmatter); - const isDeprecated = /^description:\s*["']?DEPRECATED/mi.test(frontmatter); - - if (isUserInvocable && !isDeprecated) count++; - } - return count; + const metadataPath = path.join(ROOT_DIR, 'skill', 'scripts', 'command-metadata.json'); + if (!fs.existsSync(metadataPath)) return 0; + const metadata = JSON.parse(fs.readFileSync(metadataPath, 'utf8')); + return Object.keys(metadata).length; } // Load extension screenshot as base64 data URL so setContent is self-contained diff --git a/scripts/lib/render-markdown.js b/scripts/lib/render-markdown.js deleted file mode 100644 index 41a4116ad1143ebb1abaaab7ac74924789d45e1a..0000000000000000000000000000000000000000 --- a/scripts/lib/render-markdown.js +++ /dev/null @@ -1,156 +0,0 @@ -/** - * Markdown → HTML rendering for sub-pages. - * - * Wraps `marked` with a custom link renderer that resolves cross-references - * between skill bodies and their references, and emits stable heading slugs - * so anti-pattern → skill section anchors work. - * - * Skeleton in commit 1. Link resolution and heading slugger are wired up in - * commit 3 (skills generator) when the data model lands. - */ - -import { marked } from 'marked'; - -/** - * Slugify a heading text into a stable anchor id. - * Matches the convention: lowercase, strip non-alphanum, spaces → dashes. - * - * @param {string} text - * @returns {string} - */ -export function slugify(text) { - return String(text) - .toLowerCase() - .trim() - .replace(/[^\w\s-]/g, '') - .replace(/[\s_]+/g, '-') - .replace(/^-+|-+$/g, ''); -} - -/** - * Build a marked renderer configured for impeccable's skill/tutorial bodies. - * - * @param {object} opts - * @param {Set} [opts.knownSkillIds] - slugs of skills the site knows about; unknown /name mentions render as plain text - * @param {string} [opts.currentSkillId] - when rendering a skill body, resolve `reference/foo.md` to `#reference-foo` on the current page - * @returns {import('marked').Renderer} - */ -export function createRenderer({ knownSkillIds = new Set(), currentSkillId = null } = {}) { - const renderer = new marked.Renderer(); - - // Heading slugger — stable ids so we can anchor-link from elsewhere. - // Supports {#custom-id} suffix (kramdown/pandoc style) for explicit anchors. - renderer.heading = ({ tokens, depth }) => { - const raw = tokens.map((t) => t.raw || '').join(''); - const customIdMatch = raw.match(/\s*\{#([a-z0-9_-]+)\}\s*$/i); - let id, text; - if (customIdMatch) { - id = customIdMatch[1]; - // Strip the {#id} suffix from the rendered text - const cleanRaw = raw.slice(0, customIdMatch.index); - text = renderer.parser.parseInline(marked.lexer(cleanRaw, { gfm: true })[0]?.tokens || tokens); - } else { - id = slugify(raw); - text = renderer.parser.parseInline(tokens); - } - return `${text}\n`; - }; - - // Link resolver. - renderer.link = ({ href, title, tokens }) => { - const text = renderer.parser.parseInline(tokens); - const resolved = resolveHref(href, { knownSkillIds, currentSkillId }); - const titleAttr = title ? ` title="${escapeAttr(title)}"` : ''; - const relAttr = resolved.external ? ' target="_blank" rel="noopener"' : ''; - return `${text}`; - }; - - // Fenced code blocks — minimal glass-terminal styling, no syntax highlighter in v1. - // Wrapped in a container with a copy button; click handling lives in the - // page-level inline script added by render-page.js. - renderer.code = ({ text, lang }) => { - const langClass = lang ? ` code-block--${escapeAttr(lang)}` : ''; - const copyValue = escapeAttr(text); - return `
      ${escapeHtml(text)}
      \n`; - }; - - return renderer; -} - -/** - * Resolve a markdown link href against the site's URL scheme. - * - * - `http(s)://…` → unchanged, external - * - `reference/foo.md` → `#reference-foo` on current skill page - * - `/skill-id` (known) → `/skills/skill-id` - * - `#anchor` → unchanged (in-page anchor) - * - anything else → unchanged (will be caught by build warnings later) - * - * @param {string} href - * @param {{ knownSkillIds: Set, currentSkillId: string|null }} ctx - * @returns {{ href: string, external: boolean }} - */ -function resolveHref(href, { knownSkillIds, currentSkillId }) { - if (!href) return { href: '', external: false }; - - // External links - if (/^https?:\/\//i.test(href) || /^mailto:/i.test(href)) { - return { href, external: true }; - } - - // In-page anchor - if (href.startsWith('#')) { - return { href, external: false }; - } - - // reference/foo.md → #reference-foo on the current skill page - const refMatch = href.match(/^reference\/([a-z0-9-]+)\.md$/i); - if (refMatch && currentSkillId) { - return { href: `#reference-${refMatch[1].toLowerCase()}`, external: false }; - } - - // /skill-id mentioned in prose (e.g. "run /polish") - const slashMatch = href.match(/^\/([a-z0-9-]+)$/i); - if (slashMatch && knownSkillIds.has(slashMatch[1])) { - return { href: `/skills/${slashMatch[1]}`, external: false }; - } - - // [text](other-skill) → /skills/other-skill - if (/^[a-z0-9-]+$/i.test(href) && knownSkillIds.has(href)) { - return { href: `/skills/${href}`, external: false }; - } - - // Unknown — pass through. Generator can warn separately. - return { href, external: false }; -} - -/** - * Render a markdown string to HTML. - * - * @param {string} markdown - * @param {object} [opts] - * @param {Set} [opts.knownSkillIds] - * @param {string} [opts.currentSkillId] - * @returns {string} HTML - */ -export function renderMarkdown(markdown, opts = {}) { - const renderer = createRenderer(opts); - return marked.parse(markdown, { - renderer, - gfm: true, - breaks: false, - }); -} - -function escapeHtml(str) { - return String(str) - .replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); -} - -function escapeAttr(str) { - return String(str).replace(/"/g, '"'); -} diff --git a/scripts/lib/render-page.js b/scripts/lib/render-page.js deleted file mode 100644 index ece3c2a7928f4ed7283f16c220f51e2c4cdfb154..0000000000000000000000000000000000000000 --- a/scripts/lib/render-page.js +++ /dev/null @@ -1,247 +0,0 @@ -/** - * Page template wrapper for generated sub-pages. - * - * Reads the shared site header partial once and wraps content bodies with - * a minimal HTML scaffold that imports tokens.css + sub-pages.css. - * - * Used by scripts/build-sub-pages.js (wired up in commit 3). - */ - -import fs from 'node:fs'; -import path from 'node:path'; -import { fileURLToPath } from 'node:url'; - -const __dirname = path.dirname(fileURLToPath(import.meta.url)); -const ROOT_DIR = path.resolve(__dirname, '..', '..'); -const HEADER_PARTIAL = path.join(ROOT_DIR, 'content', 'site', 'partials', 'header.html'); - -let cachedHeader = null; - -/** - * Read the shared site header partial. - * Cached after first read. - */ -export function readHeaderPartial() { - if (cachedHeader === null) { - cachedHeader = fs.readFileSync(HEADER_PARTIAL, 'utf8').trim(); - } - return cachedHeader; -} - -/** - * Mark a nav item as current by adding aria-current="page" and removing - * the default nav href state. Matches on `data-nav="{activeNav}"`. - * - * @param {string} headerHtml - * @param {string} activeNav - one of: home, skills, anti-patterns, tutorials, gallery, github - * @returns {string} - */ -export function applyActiveNav(headerHtml, activeNav) { - if (!activeNav) return headerHtml; - return headerHtml.replace( - new RegExp(`data-nav="${activeNav}"`, 'g'), - `data-nav="${activeNav}" aria-current="page"`, - ); -} - -/** - * Wrap body HTML in a full page shell. - * - * @param {object} opts - * @param {string} opts.title - text - * @param {string} opts.description - meta description - * @param {string} opts.bodyHtml - main content HTML (will be placed inside <main>) - * @param {string} [opts.activeNav] - which nav item to mark current - * @param {string} [opts.canonicalPath] - relative URL path for <link rel="canonical"> - * @param {string} [opts.extraHead] - raw HTML to inject into <head> - * @param {string} [opts.bodyClass] - optional class on <body> - * @param {number} [opts.assetDepth] - how many `..` to prepend for Bun's HTML loader to resolve on-disk paths. 1 = page is one dir deep under public/ (e.g. public/skills/polish.html). Defaults to 1. - * @returns {string} full HTML document - */ -export function renderPage({ - title, - description, - bodyHtml, - activeNav, - canonicalPath, - extraHead = '', - bodyClass = 'sub-page', - assetDepth = 1, -}) { - const header = applyActiveNav(readHeaderPartial(), activeNav); - const safeTitle = escapeHtml(title); - const safeDesc = escapeAttr(description || ''); - const canonical = canonicalPath - ? `<link rel="canonical" href="https://impeccable.style${canonicalPath}">` - : ''; - - // Relative prefix for on-disk resolution by Bun's HTML loader. - // Bun rewrites these to hashed absolute URLs at build time, so runtime - // serving works regardless of the request path. - const rel = assetDepth > 0 ? '../'.repeat(assetDepth) : './'; - - return `<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>${safeTitle} - - - ${canonical} - - - - - - ${extraHead} - - - - ${header} -
      -${bodyHtml} -
      - - - -`; -} - -function escapeHtml(str) { - return String(str || '') - .replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); -} - -function escapeAttr(str) { - return String(str || '').replace(/"/g, '"'); -} diff --git a/scripts/lib/sub-pages-data.js b/scripts/lib/sub-pages-data.js index 61246f932bd7cac6c22f0305151c168392e90e44..f61ac59d0160db288580568d73ef2a8981935a9c 100644 --- a/scripts/lib/sub-pages-data.js +++ b/scripts/lib/sub-pages-data.js @@ -3,29 +3,30 @@ * generators. * * Single source of truth: - * - source/skills/{id}/SKILL.md → skill frontmatter + body - * - source/skills/{id}/reference/*.md → skill reference files - * - src/detect-antipatterns.mjs → ANTIPATTERNS array (parsed) - * - content/site/skills/{id}.md → optional editorial wrapper - * - content/site/tutorials/{slug}.md → full tutorial content + * - skill/SKILL.md → skill frontmatter + body + * - skill/reference/*.md → skill reference files + * - cli/engine/registry/antipatterns.mjs → ANTIPATTERNS registry + * - site/content/skills/{id}.md → optional editorial wrapper + * - site/content/tutorials/{slug}.md → full tutorial content */ import fs from 'node:fs'; import path from 'node:path'; import { pathToFileURL } from 'node:url'; -import { readSourceFiles, parseFrontmatter } from './utils.js'; +import { readSourceFiles, parseFrontmatter, replacePlaceholders } from './utils.js'; +import { ANTIPATTERNS } from '../../cli/engine/registry/antipatterns.mjs'; import { DETECTION_LAYERS, VISUAL_EXAMPLES, LLM_ONLY_RULES, GALLERY_ITEMS, -} from '../../content/site/anti-patterns-catalog.js'; +} from '../../site/data/anti-patterns-catalog.js'; export { LAYER_LABELS, LAYER_DESCRIPTIONS, GALLERY_ITEMS, -} from '../../content/site/anti-patterns-catalog.js'; +} from '../../site/data/anti-patterns-catalog.js'; /** * Skills that should be excluded from the index and not get a detail page. @@ -36,8 +37,6 @@ const EXCLUDED_SKILLS = new Set([ 'teach-impeccable', // deprecated, folded into /impeccable teach 'arrange', // renamed to layout 'normalize', // merged into /polish - 'onboard', // merged into /harden - 'extract', // merged into /impeccable extract ]); /** @@ -45,9 +44,10 @@ const EXCLUDED_SKILLS = new Set([ * Mirrors public/js/data.js commandCategories. Validated below: the * generator fails if any user-invocable skill is missing from this map. */ -const SKILL_CATEGORIES = { +export const SKILL_CATEGORIES = { // CREATE - build something new impeccable: 'create', + craft: 'create', shape: 'create', // EVALUATE - review and assess critique: 'evaluate', @@ -69,9 +69,15 @@ const SKILL_CATEGORIES = { polish: 'harden', optimize: 'harden', harden: 'harden', + onboard: 'harden', + // SYSTEM - setup and tooling + teach: 'system', + document: 'system', + extract: 'system', + live: 'system', }; -export const CATEGORY_ORDER = ['create', 'evaluate', 'refine', 'simplify', 'harden']; +export const CATEGORY_ORDER = ['create', 'evaluate', 'refine', 'simplify', 'harden', 'system']; export const CATEGORY_LABELS = { create: 'Create', @@ -92,19 +98,51 @@ export const CATEGORY_DESCRIPTIONS = { }; /** - * Parse the ANTIPATTERNS array out of src/detect-antipatterns.mjs. - * Mirrors the trick in scripts/build.js validateAntipatternRules() so we - * don't have to run the browser-only module. + * How commands relate to each other. Mirrors public/js/data.js so the server + * can render the docs overview without loading the client bundle. + * + * - leadsTo: commands that typically follow this one (used for evaluators) + * - pairs: the inverse counterpart (bolder <-> quieter) + * - combinesWith: commands that work well alongside this one + */ +export const COMMAND_RELATIONSHIPS = { + // Create + craft: { combinesWith: ['shape'] }, + shape: { combinesWith: ['craft'] }, + // Evaluate (these are the "diagnostics" that lead to fixes) + audit: { leadsTo: ['harden', 'optimize', 'adapt', 'clarify'] }, + critique: { leadsTo: ['polish', 'distill', 'bolder', 'quieter', 'typeset', 'layout'] }, + // Refine + typeset: { combinesWith: ['bolder', 'polish'] }, + layout: { combinesWith: ['distill', 'adapt'] }, + colorize: { combinesWith: ['bolder', 'delight'] }, + animate: { combinesWith: ['delight'] }, + delight: { combinesWith: ['bolder', 'animate'] }, + bolder: { pairs: 'quieter' }, + quieter: { pairs: 'bolder' }, + overdrive: { combinesWith: ['animate', 'delight'] }, + // Simplify + distill: { combinesWith: ['quieter', 'polish'] }, + clarify: { combinesWith: ['polish', 'adapt'] }, + adapt: { combinesWith: ['polish', 'clarify'] }, + // Harden + polish: {}, + optimize: {}, + harden: { combinesWith: ['optimize'] }, + onboard: { combinesWith: ['clarify', 'delight'] }, + // System + teach: { combinesWith: ['document'] }, + document: { combinesWith: ['teach', 'extract'] }, + extract: { combinesWith: ['document'] }, + live: {}, +}; + +/** + * Read the detector rule registry. */ export function readAntipatternRules(rootDir) { - const detectPath = path.join(rootDir, 'src/detect-antipatterns.mjs'); - const src = fs.readFileSync(detectPath, 'utf-8'); - const match = src.match(/const ANTIPATTERNS = \[([\s\S]*?)\n\];/); - if (!match) { - throw new Error(`Could not extract ANTIPATTERNS from ${detectPath}`); - } - // eslint-disable-next-line no-new-func - return new Function(`return [${match[1]}]`)(); + void rootDir; + return ANTIPATTERNS.slice(); } /** @@ -125,7 +163,7 @@ export function readEditorialWrapper(contentDir, kind, slug) { * should treat a missing entry as "no demo". */ export async function loadCommandDemos(rootDir) { - const demosDir = path.join(rootDir, 'public/js/demos/commands'); + const demosDir = path.join(rootDir, 'site/public/js/demos/commands'); if (!fs.existsSync(demosDir)) return {}; const demos = {}; @@ -165,31 +203,79 @@ export async function loadCommandDemos(rootDir) { */ export async function buildSubPageData(rootDir) { const { skills: rawSkills } = readSourceFiles(rootDir); - const contentDir = path.join(rootDir, 'content/site'); + const contentDir = path.join(rootDir, 'site/content'); const commandDemos = await loadCommandDemos(rootDir); - // Filter to user-invocable, non-deprecated skills. - const skills = rawSkills - .filter((s) => s.userInvocable && !EXCLUDED_SKILLS.has(s.name)) - .map((s) => { - const category = SKILL_CATEGORIES[s.name]; - const editorial = readEditorialWrapper(contentDir, 'skills', s.name); - const demo = commandDemos[s.name] || null; - return { - id: s.name, - name: s.name, - description: s.description, - argumentHint: s.argumentHint, - category, - body: s.body, - references: s.references, - editorial, // may be null - demo, // may be null (e.g. /shape has no demo) - }; - }) - .sort((a, b) => a.name.localeCompare(b.name)); - - // Validate the category map covers every user-invocable skill. + // After the v3.0 consolidation there's only one source skill (impeccable). + // Its reference/ directory holds one file per command (audit.md, polish.md, ...). + // We synthesize a virtual skill entry for each sub-command so the sub-page + // generators can keep rendering per-command pages, index cards, etc. + const impeccableSkill = rawSkills.find((s) => s.name === 'impeccable'); + const metadataPath = path.join(rootDir, 'skill/scripts/command-metadata.json'); + let commandMetadata = {}; + if (fs.existsSync(metadataPath)) { + commandMetadata = JSON.parse(fs.readFileSync(metadataPath, 'utf-8')); + } + + // Reference files and skill bodies use {{command_prefix}} placeholders that + // are normally replaced by the provider transformer at build time. For web + // rendering, resolve them here using the claude-code provider as the canonical + // form ("/" prefix). The list of all command names includes the root skill + // plus all sub-commands from metadata so cross-references render correctly. + const allCommandNames = ['impeccable', ...Object.keys(commandMetadata)]; + const resolvePlaceholders = (content) => + replacePlaceholders(content, 'claude-code', [], allCommandNames); + + const skills = []; + + // 1. The root impeccable skill itself. + if (impeccableSkill && !EXCLUDED_SKILLS.has(impeccableSkill.name)) { + const editorial = readEditorialWrapper(contentDir, 'skills', 'impeccable'); + const demo = commandDemos['impeccable'] || null; + skills.push({ + id: 'impeccable', + name: 'impeccable', + description: impeccableSkill.description, + argumentHint: impeccableSkill.argumentHint, + category: SKILL_CATEGORIES['impeccable'], + body: resolvePlaceholders(impeccableSkill.body), + references: (impeccableSkill.references || []).map((r) => ({ + ...r, + content: resolvePlaceholders(r.content), + })), + editorial, + demo, + isSubCommand: false, + }); + } + + // 2. One virtual entry per sub-command, body sourced from its reference file. + if (impeccableSkill) { + for (const [cmdId, meta] of Object.entries(commandMetadata)) { + if (EXCLUDED_SKILLS.has(cmdId)) continue; + const refFile = impeccableSkill.references?.find((r) => r.name === cmdId); + if (!refFile) continue; // no reference file = no page + + const editorial = readEditorialWrapper(contentDir, 'skills', cmdId); + const demo = commandDemos[cmdId] || null; + skills.push({ + id: cmdId, + name: cmdId, + description: meta.description, + argumentHint: meta.argumentHint, + category: SKILL_CATEGORIES[cmdId], + body: resolvePlaceholders(refFile.content), + references: [], // sub-commands don't have their own references + editorial, + demo, + isSubCommand: true, + }); + } + } + + skills.sort((a, b) => a.name.localeCompare(b.name)); + + // Validate the category map covers every skill entry. const missing = skills.filter((s) => !s.category).map((s) => s.id); if (missing.length > 0) { throw new Error( @@ -217,7 +303,7 @@ export async function buildSubPageData(rootDir) { })); const rules = [...detectedRules, ...llmRules]; - // Tutorials: each required file in content/site/tutorials/. + // Tutorials: each required file in site/content/tutorials/. const tutorialsDir = path.join(contentDir, 'tutorials'); const tutorials = []; if (fs.existsSync(tutorialsDir)) { diff --git a/scripts/lib/transformers/factory.js b/scripts/lib/transformers/factory.js index 3b33064c71065f7a5d24835fef2720d44680a5ca..787ca60848cc4d3281a8f652fdafbc9a76f2549f 100644 --- a/scripts/lib/transformers/factory.js +++ b/scripts/lib/transformers/factory.js @@ -1,5 +1,14 @@ import path from 'path'; -import { cleanDir, ensureDir, writeFile, generateYamlFrontmatter, replacePlaceholders, prefixSkillReferences, PROVIDER_PLACEHOLDERS } from '../utils.js'; +import { + cleanDir, + ensureDir, + writeFile, + generateYamlFrontmatter, + generateYamlDocument, + replacePlaceholders, + compileProviderBlocks, +} from '../utils.js'; +import { SKILL_CATEGORIES, CATEGORY_ORDER } from '../sub-pages-data.js'; /** * Map from frontmatter field name to extraction spec. @@ -39,6 +48,97 @@ const FIELD_SPECS = { }, }; +function humanizeSkillName(name) { + return name + .split('-') + .map(part => part.charAt(0).toUpperCase() + part.slice(1)) + .join(' '); +} + +function summarizeDescription(description, maxLength = 88) { + if (!description || description.length <= maxLength) return description; + const clipped = description.slice(0, maxLength - 1); + const lastSpace = clipped.lastIndexOf(' '); + return `${(lastSpace > 48 ? clipped.slice(0, lastSpace) : clipped).trimEnd()}...`; +} + +function buildOpenAIMetadata(skill) { + const displayName = humanizeSkillName(skill.name); + return { + interface: { + display_name: displayName, + short_description: summarizeDescription(skill.description), + default_prompt: `Use ${displayName} to redesign, critique, audit, or polish this frontend.`, + }, + }; +} + +function formatTomlString(value) { + return JSON.stringify(String(value)); +} + +function formatTomlMultiline(value) { + const normalized = String(value).trim().replace(/\r\n/g, '\n'); + if (!normalized.includes("'''")) { + return `'''\n${normalized}\n'''`; + } + return `"""\n${normalized.replace(/\\/g, '\\\\').replace(/"""/g, '\\"""')}\n"""`; +} + +function formatTomlArray(values) { + return `[${values.map(formatTomlString).join(', ')}]`; +} + +function buildCodexAgent(agent, body) { + const lines = [ + `name = ${formatTomlString(agent.codexName || agent.name.replace(/-/g, '_'))}`, + `description = ${formatTomlString(agent.description)}`, + ]; + + if (agent.effort) { + lines.push(`model_reasoning_effort = ${formatTomlString(agent.effort)}`); + } + + if (agent.nicknameCandidates?.length) { + lines.push(`nickname_candidates = ${formatTomlArray(agent.nicknameCandidates)}`); + } + + lines.push(`developer_instructions = ${formatTomlMultiline(body)}`); + return `${lines.join('\n')}\n`; +} + +function buildClaudeAgent(agent, body) { + const frontmatter = { + name: agent.claudeName || agent.name, + description: agent.description, + }; + + if (agent.tools) frontmatter.tools = agent.tools; + if (agent.model) frontmatter.model = agent.model; + if (agent.effort) frontmatter.effort = agent.effort; + if (agent.maxTurns) frontmatter.maxTurns = agent.maxTurns; + + return `${generateYamlFrontmatter(frontmatter)}\n${body.trim()}\n`; +} + +function buildAgentFile(config, agent, body) { + if (config.agentFormat === 'codex-toml') { + return { + filename: `${agent.codexName || agent.name.replace(/-/g, '_')}.toml`, + content: buildCodexAgent(agent, body), + }; + } + + if (config.agentFormat === 'claude-md') { + return { + filename: `${agent.claudeName || agent.name}.md`, + content: buildClaudeAgent(agent, body), + }; + } + + return null; +} + /** * Create a transformer function for a given provider config. * @@ -46,7 +146,17 @@ const FIELD_SPECS = { * @returns {Function} transform(skills, distDir, options?) */ export function createTransformer(config) { - const { provider, configDir, displayName, frontmatterFields = [], bodyTransform, placeholderProvider } = config; + const { + provider, + configDir, + displayName, + frontmatterFields = [], + bodyTransform, + placeholderProvider, + providerTags = [provider], + writeOpenAIMetadata = false, + includeVersion = true, + } = config; const placeholderKey = placeholderProvider || provider; const activeFields = frontmatterFields @@ -54,8 +164,8 @@ export function createTransformer(config) { .filter(Boolean); return function transform(skills, distDir, options = {}) { - const { prefix = '', outputSuffix = '', skillsVersion = '' } = options; - const providerDir = path.join(distDir, `${provider}${outputSuffix}`); + const { skillsVersion = '' } = options; + const providerDir = path.join(distDir, provider); const skillsDir = path.join(providerDir, `${configDir}/skills`); cleanDir(providerDir); @@ -64,13 +174,14 @@ export function createTransformer(config) { const allSkillNames = skills.map((s) => s.name); const commandNames = skills .filter((s) => s.userInvocable) - .map((s) => `${prefix}${s.name}`); + .map((s) => s.name); let refCount = 0; let scriptCount = 0; + let agentCount = 0; for (const skill of skills) { - const skillName = `${prefix}${skill.name}`; + const skillName = skill.name; const skillDir = path.join(skillsDir, skillName); // Build frontmatter @@ -78,7 +189,7 @@ export function createTransformer(config) { name: skillName, description: skill.description, }; - if (skillsVersion) frontmatterObj.version = skillsVersion; + if (skillsVersion && includeVersion) frontmatterObj.version = skillsVersion; for (const spec of activeFields) { if (spec.condition && !spec.condition(skill)) continue; @@ -86,27 +197,51 @@ export function createTransformer(config) { if (val) frontmatterObj[spec.yamlKey] = val; } + // Replace {{command_hint}} in argument-hint with command names from metadata, + // grouped by category with middle dots between groups for natural line-breaking. + if (frontmatterObj['argument-hint']?.includes('{{command_hint}}')) { + const metaScript = skill.scripts?.find(s => s.name === 'command-metadata.json'); + if (metaScript) { + const commands = Object.keys(JSON.parse(metaScript.content)); + // Derive groups from SKILL_CATEGORIES, excluding the parent skill name + const grouped = CATEGORY_ORDER + .map(cat => commands.filter(c => SKILL_CATEGORIES[c] === cat).join('|')) + .filter(Boolean) + .join(' · '); + frontmatterObj['argument-hint'] = frontmatterObj['argument-hint'].replace( + '{{command_hint}}', + grouped + ); + } + } + const frontmatter = generateYamlFrontmatter(frontmatterObj); // Build body - const cmdPrefix = (PROVIDER_PLACEHOLDERS[placeholderKey] || {}).command_prefix || '/'; - let skillBody = replacePlaceholders(skill.body, placeholderKey, commandNames, allSkillNames); + let skillBody = compileProviderBlocks(skill.body, providerTags); + skillBody = replacePlaceholders(skillBody, placeholderKey, commandNames, allSkillNames); // Replace {{scripts_path}} with provider-aware path to skill's scripts directory const scriptsPath = `${configDir}/skills/${skillName}/scripts`; skillBody = skillBody.replace(/\{\{scripts_path\}\}/g, scriptsPath); - if (prefix) skillBody = prefixSkillReferences(skillBody, prefix, allSkillNames, cmdPrefix); if (bodyTransform) skillBody = bodyTransform(skillBody, skill); const content = `${frontmatter}\n\n${skillBody}`; writeFile(path.join(skillDir, 'SKILL.md'), content); + if (writeOpenAIMetadata) { + const openaiMetadata = buildOpenAIMetadata(skill); + writeFile(path.join(skillDir, 'agents', 'openai.yaml'), generateYamlDocument(openaiMetadata)); + } + // Copy reference files if (skill.references && skill.references.length > 0) { const refDir = path.join(skillDir, 'reference'); ensureDir(refDir); for (const ref of skill.references) { - const refContent = replacePlaceholders(ref.content, placeholderKey, [], allSkillNames); + let refContent = compileProviderBlocks(ref.content, providerTags); + refContent = replacePlaceholders(refContent, placeholderKey, [], allSkillNames); + refContent = refContent.replace(/\{\{scripts_path\}\}/g, scriptsPath); writeFile(path.join(refDir, `${ref.name}.md`), refContent); refCount++; } @@ -123,10 +258,28 @@ export function createTransformer(config) { } } - const userInvocableCount = skills.filter((s) => s.userInvocable).length; + if (config.agentFormat) { + const agentsDir = path.join(providerDir, `${configDir}/agents`); + for (const skill of skills) { + for (const agent of skill.agents || []) { + // Agents can declare `providers: ` to limit which harnesses + // they emit to. Default (no field) ships everywhere with agentFormat. + if (agent.providers && !agent.providers.includes(provider)) continue; + let body = compileProviderBlocks(agent.body, providerTags); + body = replacePlaceholders(body, placeholderKey, [], allSkillNames); + const agentFile = buildAgentFile(config, agent, body); + if (!agentFile) continue; + ensureDir(agentsDir); + writeFile(path.join(agentsDir, agentFile.filename), agentFile.content); + agentCount++; + } + } + } + + const skillWord = skills.length === 1 ? 'skill' : 'skills'; const refInfo = refCount > 0 ? ` (${refCount} reference files)` : ''; const scriptInfo = scriptCount > 0 ? ` (${scriptCount} script files)` : ''; - const prefixInfo = prefix ? ` [${prefix}prefixed]` : ''; - console.log(`✓ ${displayName}${prefixInfo}: ${skills.length} skills (${userInvocableCount} user-invocable)${refInfo}${scriptInfo}`); + const agentInfo = agentCount > 0 ? ` (${agentCount} agent files)` : ''; + console.log(`✓ ${displayName}: ${skills.length} ${skillWord}${refInfo}${scriptInfo}${agentInfo}`); }; } diff --git a/scripts/lib/transformers/index.js b/scripts/lib/transformers/index.js index 2d7ab7a16c6f37e35f5881df4c90651586e29cb9..57f35ba6f5da5898ff55532641f5ce115de932e0 100644 --- a/scripts/lib/transformers/index.js +++ b/scripts/lib/transformers/index.js @@ -1,14 +1,19 @@ import { createTransformer } from './factory.js'; import { PROVIDERS } from './providers.js'; +// Named exports exist primarily as stable spy targets for the test suite +// (build.test.js uses spyOn(transformers, 'transformCursor') etc.). build.js +// itself uses createTransformer + PROVIDERS directly, not these. export const transformCursor = createTransformer(PROVIDERS.cursor); export const transformClaudeCode = createTransformer(PROVIDERS['claude-code']); export const transformGemini = createTransformer(PROVIDERS.gemini); export const transformCodex = createTransformer(PROVIDERS.codex); export const transformAgents = createTransformer(PROVIDERS.agents); +export const transformGitHub = createTransformer(PROVIDERS.github); export const transformKiro = createTransformer(PROVIDERS.kiro); export const transformOpenCode = createTransformer(PROVIDERS.opencode); export const transformPi = createTransformer(PROVIDERS.pi); +export const transformQoder = createTransformer(PROVIDERS.qoder); export const transformRovoDev = createTransformer(PROVIDERS['rovo-dev']); export { createTransformer, PROVIDERS }; diff --git a/scripts/lib/transformers/providers.js b/scripts/lib/transformers/providers.js index 6cc863061bd49af7c915e1cfd1be52164161eaf4..8ae9657f72c23d6a5d377c2ebdec86e5ff4a89d1 100644 --- a/scripts/lib/transformers/providers.js +++ b/scripts/lib/transformers/providers.js @@ -5,60 +5,92 @@ * - provider: key into PROVIDER_PLACEHOLDERS (e.g. 'claude-code') * - configDir: dot-directory name (e.g. '.claude') * - displayName: human-readable name for log output (e.g. 'Claude Code') + * - providerTags: markdown block tags kept for this target (e.g. ...) * - frontmatterFields: which optional fields to emit beyond name + description * - bodyTransform: optional function (body, skill) => transformed body */ export const PROVIDERS = { cursor: { provider: 'cursor', + providerTags: ['cursor'], configDir: '.cursor', displayName: 'Cursor', frontmatterFields: ['license', 'compatibility', 'metadata'], }, 'claude-code': { provider: 'claude-code', + providerTags: ['claude-code', 'claude'], configDir: '.claude', displayName: 'Claude Code', frontmatterFields: ['user-invocable', 'argument-hint', 'license', 'compatibility', 'metadata', 'allowed-tools'], + agentFormat: 'claude-md', }, gemini: { provider: 'gemini', + providerTags: ['gemini'], configDir: '.gemini', displayName: 'Gemini', frontmatterFields: [], }, codex: { provider: 'codex', + providerTags: ['codex'], configDir: '.codex', displayName: 'Codex', - frontmatterFields: ['argument-hint', 'license'], + frontmatterFields: [], + includeVersion: false, + writeOpenAIMetadata: true, + agentFormat: 'codex-toml', }, agents: { provider: 'agents', + providerTags: ['agents', 'codex'], configDir: '.agents', - displayName: 'Agents', + displayName: 'Codex Repo Skills', + placeholderProvider: 'codex', + frontmatterFields: [], + includeVersion: false, + writeOpenAIMetadata: true, + }, + github: { + provider: 'github', + providerTags: ['github'], + configDir: '.github', + displayName: 'GitHub Copilot', + placeholderProvider: 'agents', frontmatterFields: ['user-invocable', 'argument-hint', 'license', 'compatibility', 'metadata'], }, kiro: { provider: 'kiro', + providerTags: ['kiro'], configDir: '.kiro', displayName: 'Kiro', frontmatterFields: ['license', 'compatibility', 'metadata'], }, opencode: { provider: 'opencode', + providerTags: ['opencode'], configDir: '.opencode', displayName: 'OpenCode', frontmatterFields: ['user-invocable', 'argument-hint', 'license', 'compatibility', 'metadata', 'allowed-tools'], }, pi: { provider: 'pi', + providerTags: ['pi'], configDir: '.pi', displayName: 'Pi', frontmatterFields: ['license', 'compatibility', 'metadata', 'allowed-tools'], }, + qoder: { + provider: 'qoder', + providerTags: ['qoder'], + configDir: '.qoder', + displayName: 'Qoder', + frontmatterFields: ['user-invocable', 'argument-hint', 'license', 'compatibility', 'metadata', 'allowed-tools'], + }, 'trae-cn': { provider: 'trae-cn', + providerTags: ['trae-cn', 'trae'], configDir: '.trae-cn', displayName: 'Trae China', placeholderProvider: 'trae', @@ -66,12 +98,14 @@ export const PROVIDERS = { }, trae: { provider: 'trae', + providerTags: ['trae'], configDir: '.trae', displayName: 'Trae', frontmatterFields: ['user-invocable', 'argument-hint', 'license', 'compatibility', 'metadata'], }, 'rovo-dev': { provider: 'rovo-dev', + providerTags: ['rovo-dev'], configDir: '.rovodev', displayName: 'Rovo Dev', frontmatterFields: ['user-invocable', 'argument-hint', 'license', 'compatibility', 'metadata', 'allowed-tools'], diff --git a/scripts/lib/transformers/shared.js b/scripts/lib/transformers/shared.js deleted file mode 100644 index 6cea4052162ac26c68e0ba9bcc428bb53af79ed6..0000000000000000000000000000000000000000 --- a/scripts/lib/transformers/shared.js +++ /dev/null @@ -1,81 +0,0 @@ -import path from 'path'; -import { cleanDir, ensureDir, writeFile, generateYamlFrontmatter, replacePlaceholders, prefixSkillReferences } from '../utils.js'; - -/** - * Shared transformer logic for all providers. - * - * @param {Object} config - Provider-specific configuration - * @param {string} config.provider - Provider key for placeholders (e.g., 'claude-code') - * @param {string} config.displayName - Display name for logging (e.g., 'Claude Code') - * @param {string} config.configDir - Dot-directory name (e.g., '.claude') - * @param {Function} config.buildFrontmatter - (skill, skillName) => frontmatter object - * @param {Function} [config.transformBody] - Optional (body, skill) => transformed body - * @param {Array} skills - All skills - * @param {string} distDir - Distribution output directory - * @param {Object} options - Optional settings (prefix, outputSuffix) - */ -export function transformProvider(config, skills, distDir, options = {}) { - const { provider, displayName, configDir, buildFrontmatter, transformBody } = config; - const { prefix = '', outputSuffix = '' } = options; - const providerDir = path.join(distDir, `${provider}${outputSuffix}`); - const skillsDir = path.join(providerDir, `${configDir}/skills`); - - cleanDir(providerDir); - ensureDir(skillsDir); - - const allSkillNames = skills.map(s => s.name); - const commandNames = skills.filter(s => s.userInvokable).map(s => `${prefix}${s.name}`); - let refCount = 0; - let scriptCount = 0; - - for (const skill of skills) { - const skillName = `${prefix}${skill.name}`; - const skillDir = path.join(skillsDir, skillName); - - const frontmatterObj = buildFrontmatter(skill, skillName); - const frontmatter = generateYamlFrontmatter(frontmatterObj); - - let skillBody = replacePlaceholders(skill.body, provider, commandNames); - - // Replace {{scripts_path}} with provider-aware path to skill's scripts directory - const scriptsPath = provider === 'claude-code' - ? '${CLAUDE_PLUGIN_ROOT}/scripts' - : `${configDir}/skills/${skillName}/scripts`; - skillBody = skillBody.replace(/\{\{scripts_path\}\}/g, scriptsPath); - - if (prefix) skillBody = prefixSkillReferences(skillBody, prefix, allSkillNames); - if (transformBody) skillBody = transformBody(skillBody, skill); - - const content = `${frontmatter}\n\n${skillBody}`; - writeFile(path.join(skillDir, 'SKILL.md'), content); - - // Copy reference files if they exist - if (skill.references && skill.references.length > 0) { - const refDir = path.join(skillDir, 'reference'); - ensureDir(refDir); - for (const ref of skill.references) { - writeFile( - path.join(refDir, `${ref.name}.md`), - replacePlaceholders(ref.content, provider) - ); - refCount++; - } - } - - // Copy script files if they exist - if (skill.scripts && skill.scripts.length > 0) { - const scriptsOutDir = path.join(skillDir, 'scripts'); - ensureDir(scriptsOutDir); - for (const script of skill.scripts) { - writeFile(path.join(scriptsOutDir, script.name), script.content); - scriptCount++; - } - } - } - - const userInvokableCount = skills.filter(s => s.userInvokable).length; - const refInfo = refCount > 0 ? ` (${refCount} reference files)` : ''; - const scriptInfo = scriptCount > 0 ? ` (${scriptCount} script files)` : ''; - const prefixInfo = prefix ? ` [${prefix}prefixed]` : ''; - console.log(`✓ ${displayName}${prefixInfo}: ${skills.length} skills (${userInvokableCount} user-invokable)${refInfo}${scriptInfo}`); -} diff --git a/scripts/lib/utils.js b/scripts/lib/utils.js index 3ea386c32cdfc8ce9ee8231b8095714b64510fc5..50e323a1c1ea7496edffc5c2a7628757b9c7fe28 100644 --- a/scripts/lib/utils.js +++ b/scripts/lib/utils.js @@ -1,12 +1,78 @@ import fs from 'fs'; import path from 'path'; +// Per-project artifacts live inside `scripts/` of an installed skill but +// belong to the consuming project, not the distributable skill. The build +// excludes them from dist, and the harness-sync step preserves them across +// the rm+recopy so local state isn't destroyed on every rebuild. +// - config.json: legacy live-mode inject target list for existing projects. +// New installs write project config at .impeccable/live/config.json instead. +export const PER_PROJECT_SCRIPT_ARTIFACTS = new Set(['config.json']); + +const DETECTOR_BUNDLE_DIR = 'cli/engine'; + +// Walk the harness-dir skill tree and return any per-project script +// artifacts found, ready for restoration after a full sync rm+recopy. +// Returns [{ relPath, content: Buffer }], where relPath is relative to +// the passed-in rootDir (typically `/skills`). +export function stashPerProjectArtifacts(rootDir) { + if (!fs.existsSync(rootDir)) return []; + const out = []; + const walk = (dir) => { + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + const p = path.join(dir, entry.name); + if (entry.isDirectory()) { walk(p); continue; } + // Only preserve files inside a skill's scripts/ directory. + if (path.basename(path.dirname(p)) !== 'scripts') continue; + if (PER_PROJECT_SCRIPT_ARTIFACTS.has(entry.name)) { + out.push({ relPath: path.relative(rootDir, p), content: fs.readFileSync(p) }); + } + } + }; + walk(rootDir); + return out; +} + +export function restorePerProjectArtifacts(rootDir, stashed) { + for (const { relPath, content } of stashed) { + const target = path.join(rootDir, relPath); + fs.mkdirSync(path.dirname(target), { recursive: true }); + fs.writeFileSync(target, content); + } +} + +function readDetectorBundleScripts(rootDir) { + const detectorDir = path.join(rootDir, DETECTOR_BUNDLE_DIR); + if (!fs.existsSync(detectorDir)) return []; + + const scripts = []; + const walk = (dir) => { + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + const entryPath = path.join(dir, entry.name); + if (entry.isDirectory()) { + walk(entryPath); + continue; + } + if (!entry.isFile()) continue; + const relPath = path.relative(detectorDir, entryPath).split(path.sep).join('/'); + scripts.push({ + name: `detector/${relPath}`, + content: fs.readFileSync(entryPath, 'utf-8'), + filePath: entryPath, + generated: true, + }); + } + }; + walk(detectorDir); + return scripts; +} + /** * Parse frontmatter from markdown content * Returns { frontmatter: object, body: string } */ export function parseFrontmatter(content) { - const frontmatterRegex = /^---\n([\s\S]*?)\n---\n([\s\S]*)$/; + const frontmatterRegex = /^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/; const match = content.match(frontmatterRegex); if (!match) { @@ -17,7 +83,7 @@ export function parseFrontmatter(content) { const frontmatter = {}; // Simple YAML parser (handles basic key-value and arrays) - const lines = frontmatterText.split('\n'); + const lines = frontmatterText.split(/\r?\n/); let currentKey = null; let currentArray = null; @@ -62,13 +128,19 @@ export function parseFrontmatter(content) { if (colonIndex > 0) { const key = trimmed.slice(0, colonIndex).trim(); const value = trimmed.slice(colonIndex + 1).trim(); + const isQuoted = /^(".*"|'.*')$/.test(value); + const unquotedValue = isQuoted ? value.slice(1, -1) : value; + const shouldCoerceBoolean = + key === 'user-invocable' || key === 'user-invokable' || !isQuoted; if (value) { - // Strip YAML quotes - const unquoted = (value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'")) - ? value.slice(1, -1) - : value; - frontmatter[key] = unquoted === 'true' ? true : unquoted === 'false' ? false : unquoted; + frontmatter[key] = shouldCoerceBoolean + ? unquotedValue === 'true' + ? true + : unquotedValue === 'false' + ? false + : unquotedValue + : unquotedValue; currentKey = key; currentArray = null; } else { @@ -109,80 +181,107 @@ export function readFilesRecursive(dir, fileList = []) { } /** - * Read and parse all source files (unified skills architecture) - * All source lives in source/skills/{name}/SKILL.md - * Returns { skills } where each skill has userInvocable flag + * Read and parse the impeccable skill source. + * After v3.0 the repo holds exactly one user-invocable skill, flat at skill/. + * Returns { skills: [oneEntry] } so downstream array-shaped consumers stay happy. */ export function readSourceFiles(rootDir) { - const skillsDir = path.join(rootDir, 'source/skills'); - + const skillDir = path.join(rootDir, 'skill'); const skills = []; - if (fs.existsSync(skillsDir)) { - const entries = fs.readdirSync(skillsDir, { withFileTypes: true }); + const skillMdPath = path.join(skillDir, 'SKILL.md'); + if (!fs.existsSync(skillMdPath)) { + return { skills }; + } - for (const entry of entries) { - const entryPath = path.join(skillsDir, entry.name); + const content = fs.readFileSync(skillMdPath, 'utf-8'); + const { frontmatter, body } = parseFrontmatter(content); + + const references = []; + const referenceDir = path.join(skillDir, 'reference'); + if (fs.existsSync(referenceDir)) { + const refFiles = fs.readdirSync(referenceDir).filter(f => f.endsWith('.md')); + for (const refFile of refFiles) { + const refPath = path.join(referenceDir, refFile); + references.push({ + name: path.basename(refFile, '.md'), + content: fs.readFileSync(refPath, 'utf-8'), + filePath: refPath + }); + } + } - if (entry.isDirectory()) { - // Directory-based skill with potential references - const skillMdPath = path.join(entryPath, 'SKILL.md'); - if (fs.existsSync(skillMdPath)) { - const content = fs.readFileSync(skillMdPath, 'utf-8'); - const { frontmatter, body } = parseFrontmatter(content); - - // Read reference files if they exist - const references = []; - const referenceDir = path.join(entryPath, 'reference'); - if (fs.existsSync(referenceDir)) { - const refFiles = fs.readdirSync(referenceDir).filter(f => f.endsWith('.md')); - for (const refFile of refFiles) { - const refPath = path.join(referenceDir, refFile); - const refContent = fs.readFileSync(refPath, 'utf-8'); - references.push({ - name: path.basename(refFile, '.md'), - content: refContent, - filePath: refPath - }); - } - } - - // Read script files if they exist - const scripts = []; - const scriptsDir = path.join(entryPath, 'scripts'); - if (fs.existsSync(scriptsDir)) { - const scriptFiles = fs.readdirSync(scriptsDir).filter(f => fs.statSync(path.join(scriptsDir, f)).isFile()); - for (const scriptFile of scriptFiles) { - const scriptPath = path.join(scriptsDir, scriptFile); - const scriptContent = fs.readFileSync(scriptPath, 'utf-8'); - scripts.push({ - name: scriptFile, - content: scriptContent, - filePath: scriptPath - }); - } - } - - skills.push({ - name: frontmatter.name || entry.name, - description: frontmatter.description || '', - license: frontmatter.license || '', - compatibility: frontmatter.compatibility || '', - metadata: frontmatter.metadata || null, - allowedTools: frontmatter['allowed-tools'] || '', - userInvocable: frontmatter['user-invocable'] === true || frontmatter['user-invocable'] === 'true', - argumentHint: frontmatter['argument-hint'] || '', - context: frontmatter.context || null, - body, - filePath: skillMdPath, - references, - scripts - }); - } + // PER_PROJECT_SCRIPT_ARTIFACTS (defined at module top) are excluded from + // the distributable skill so the build never bundles one project's state + // into another's. + const scripts = []; + const scriptsDir = path.join(skillDir, 'scripts'); + if (fs.existsSync(scriptsDir)) { + const scriptFiles = fs.readdirSync(scriptsDir).filter(f => { + if (PER_PROJECT_SCRIPT_ARTIFACTS.has(f)) return false; + return fs.statSync(path.join(scriptsDir, f)).isFile(); + }); + for (const scriptFile of scriptFiles) { + const scriptPath = path.join(scriptsDir, scriptFile); + scripts.push({ + name: scriptFile, + content: fs.readFileSync(scriptPath, 'utf-8'), + filePath: scriptPath + }); + } + } + scripts.push(...readDetectorBundleScripts(rootDir)); + + const agents = []; + const agentsDir = path.join(skillDir, 'agents'); + if (fs.existsSync(agentsDir)) { + const agentFiles = fs.readdirSync(agentsDir).filter(f => f.endsWith('.md')); + for (const agentFile of agentFiles) { + const agentPath = path.join(agentsDir, agentFile); + const agentContent = fs.readFileSync(agentPath, 'utf-8'); + const { frontmatter: agentFrontmatter, body: agentBody } = parseFrontmatter(agentContent); + const name = agentFrontmatter.name || path.basename(agentFile, '.md'); + const providersRaw = agentFrontmatter.providers; + let providers = null; + if (Array.isArray(providersRaw)) { + providers = providersRaw.map(p => String(p).trim()).filter(Boolean); + } else if (typeof providersRaw === 'string' && providersRaw.trim()) { + providers = providersRaw.split(',').map(p => p.trim()).filter(Boolean); } + agents.push({ + name, + codexName: agentFrontmatter['codex-name'] || name.replace(/-/g, '_'), + claudeName: agentFrontmatter['claude-name'] || name, + description: agentFrontmatter.description || '', + tools: agentFrontmatter.tools || '', + model: agentFrontmatter.model || '', + effort: agentFrontmatter.effort || '', + maxTurns: agentFrontmatter['max-turns'] ? Number(agentFrontmatter['max-turns']) : '', + nicknameCandidates: agentFrontmatter['nickname-candidates'] || [], + providers, + body: agentBody, + filePath: agentPath, + }); } } + skills.push({ + name: frontmatter.name || 'impeccable', + description: frontmatter.description || '', + license: frontmatter.license || '', + compatibility: frontmatter.compatibility || '', + metadata: frontmatter.metadata || null, + allowedTools: frontmatter['allowed-tools'] || '', + userInvocable: frontmatter['user-invocable'] === true || frontmatter['user-invocable'] === 'true', + argumentHint: frontmatter['argument-hint'] || '', + context: frontmatter.context || null, + body, + filePath: skillMdPath, + references, + scripts, + agents + }); + return { skills }; } @@ -214,16 +313,114 @@ export function writeFile(filePath, content) { } /** - * Extract patterns from frontend-design SKILL.md - * Parses DO/DON'T lines grouped by section headings. - * Recognizes both formats: + * Extract DO/DON'T patterns from a skill markdown file, grouped by section + * (h3 `### ` headings). Recognizes both formats: * - Markdown bullet form: `**DO**: …` / `**DON'T**: …` - * - XML-block prose form: `DO …` / `DO NOT …` (used inside - * , , , ) + * - Prose form: `DO …` / `DO NOT …` + * + * Defaults to the main impeccable SKILL.md but accepts any relative path so + * rules in `cli/engine/detect-antipatterns.mjs` can anchor to register-specific + * reference files (e.g. `reference/editorial.md`) via an optional `skillFile` + * field. Callers that don't pass `relativePath` get the legacy behavior. + * * Returns { patterns: [...], antipatterns: [...] } */ -export function readPatterns(rootDir) { - const skillPath = path.join(rootDir, 'source/skills/impeccable/SKILL.md'); +// Curated short-list for the homepage Antidote section. Intentionally +// hand-written (not auto-extracted) so the copy stays tight and +// editorial. The long-form catalog lives on /slop — this is the teaser. +const CURATED_CATEGORIES = [ + { + name: 'Typography', + do: [ + 'Pair a distinctive display face with a restrained body face; vary across projects.', + 'Use a ≥1.25 scale ratio between hierarchy steps. Flat scales read as bland.', + 'Cap body line length at 65–75ch. Wider is fatiguing.', + ], + dont: [ + 'Inter, Roboto, Plex, Fraunces, or any other reflex default. Look further.', + 'Monospace as lazy shorthand for "technical."', + 'Long passages in uppercase. Reserve all-caps for short labels.', + ], + }, + { + name: 'Color & Contrast', + do: [ + 'Use OKLCH. Reduce chroma near lightness extremes.', + 'Tint neutrals toward the brand hue. Chroma 0.005–0.01 is enough.', + 'Pick a color strategy before picking colors (Restrained, Committed, Full, Drenched).', + ], + dont: [ + 'Pure #000 or #fff. Always tint.', + 'Dark mode + purple-to-cyan gradients. The AI tell.', + 'Gradient text via background-clip. Use weight or size for emphasis.', + ], + }, + { + name: 'Layout & Space', + do: [ + 'Vary spacing for rhythm. Tight groupings, generous separations.', + 'Use the simplest tool: Flexbox for 1D, Grid for 2D, plain flow often enough.', + 'Let whitespace carry hierarchy before reaching for color or scale.', + ], + dont: [ + 'Wrap everything in cards. Nested cards are always wrong.', + 'Identical card grids of icon + heading + text, repeated endlessly.', + 'The hero-metric template: big number, small label, supporting stats, gradient accent.', + ], + }, + { + name: 'Visual Details', + do: [ + 'Commit to an aesthetic direction and execute it with precision.', + 'Use ornament only where it earns its place.', + ], + dont: [ + 'Side-stripe borders (border-left/-right > 1px). The dashboard tell.', + 'Glassmorphism everywhere. Rare and purposeful or nothing.', + 'Rounded rectangles with generic drop shadows. "Could be any AI output."', + ], + }, + { + name: 'Motion', + do: [ + 'Use transform and opacity. Animate the composited properties only.', + 'Ease out with exponential curves (quart / quint / expo).', + 'Respect prefers-reduced-motion on every transition.', + ], + dont: [ + 'Animate layout (width, height, padding, margin).', + 'Bounce or elastic easing. Feels dated and tacky.', + 'Decorative motion for its own sake. Motion should signal state.', + ], + }, + { + name: 'Interaction', + do: [ + 'Use optimistic UI: update immediately, sync later.', + 'Design empty states that teach the interface, not just say "nothing here."', + 'Progressive disclosure: start simple, reveal sophistication on demand.', + ], + dont: [ + 'Make every button primary. Hierarchy matters.', + 'Default to a modal. Exhaust inline alternatives first.', + 'Repeat information the user can already see.', + ], + }, +]; + +export function readPatterns(_rootDir, _relativePath) { + // Hand-curated list — see CURATED_CATEGORIES above. The homepage + // Antidote teaser uses this; the full catalog lives on /slop. + return { + patterns: CURATED_CATEGORIES.map((c) => ({ name: c.name, items: c.do })), + antipatterns: CURATED_CATEGORIES.map((c) => ({ name: c.name, items: c.dont })), + }; +} + +// Previous SKILL.md parser retained below but disabled; kept as a +// reference for how prefix-style extraction used to work. +function _legacyReadPatterns(rootDir, relativePath = 'skill/SKILL.md') { + const skillPath = path.join(rootDir, relativePath); if (!fs.existsSync(skillPath)) { return { patterns: [], antipatterns: [] }; @@ -336,7 +533,7 @@ export const PROVIDER_PLACEHOLDERS = { 'codex': { model: 'GPT', config_file: 'AGENTS.md', - ask_instruction: 'ask the user directly to clarify what you cannot infer.', + ask_instruction: "STOP and use Codex's structured user-input/question tool when available; if unavailable, ask directly in chat to clarify what you cannot infer.", command_prefix: '$' }, 'agents': { @@ -363,6 +560,12 @@ export const PROVIDER_PLACEHOLDERS = { ask_instruction: 'ask the user directly to clarify what you cannot infer.', command_prefix: '/' }, + 'qoder': { + model: 'the model', + config_file: 'AGENTS.md', + ask_instruction: 'ask the user directly to clarify what you cannot infer.', + command_prefix: '/' + }, 'trae': { model: 'the model', config_file: 'RULES.md', @@ -377,62 +580,89 @@ export const PROVIDER_PLACEHOLDERS = { } }; +export const PROVIDER_BLOCK_TAGS = new Set([ + 'agents', + 'claude', + 'claude-code', + 'codex', + 'cursor', + 'gemini', + 'github', + 'kiro', + 'opencode', + 'pi', + 'qoder', + 'rovo-dev', + 'trae', + 'trae-cn', +]); + /** - * Replace all {{placeholder}} tokens with provider-specific values - */ -/** - * Prefix skill cross-references in body text. - * Replaces patterns like `/skillname` and `the skillname skill` with prefixed versions. + * Compile harness-conditional markdown blocks. + * + * Known provider blocks must be written as standalone tags: + * + * + * Codex-only instructions. + * * - * @param {string} content - The skill body text - * @param {string} prefix - The prefix to add (e.g., 'i-') - * @param {string[]} skillNames - Array of all skill names - * @param {string} commandPrefix - The command invocation prefix (e.g., '/' or '$') + * Matching blocks keep their body and drop the tags. Non-matching blocks are + * removed. Unknown tags are preserved so ordinary markdown/HTML is untouched. */ -export function prefixSkillReferences(content, prefix, skillNames, commandPrefix = '/') { - if (!prefix || !skillNames || skillNames.length === 0) return content; - - let result = content; - // Sort by length descending to avoid partial matches (e.g. 'teach-impeccable' before 'teach') - const sorted = [...skillNames].sort((a, b) => b.length - a.length); - - for (const name of sorted) { - const prefixed = `${prefix}${name}`; - - // Replace command invocations (e.g., `/skillname` or `$skillname`) with prefixed versions - const escapedPrefix = escapeRegex(commandPrefix); - result = result.replace( - new RegExp(`${escapedPrefix}(?=${escapeRegex(name)}(?:[^a-zA-Z0-9_-]|$))`, 'g'), - `${commandPrefix}${prefix}` - ); - - // Replace `the skillname skill` references - result = result.replace( - new RegExp(`(the) ${escapeRegex(name)} skill`, 'gi'), - (_, article) => `${article} ${prefixed} skill` - ); - } - - return result; +export function compileProviderBlocks(content, activeTags = []) { + const activeTagSet = new Set(activeTags); + const providerBlockPattern = /(^|\r?\n)[ \t]*<([a-z][a-z0-9-]*)>[ \t]*\r?\n([\s\S]*?)\r?\n[ \t]*<\/\2>[ \t]*(?=\r?\n|$)/g; + let didCompileBlock = false; + + const compiled = content.replace(providerBlockPattern, (match, prefix, tag, body) => { + if (!PROVIDER_BLOCK_TAGS.has(tag)) return match; + didCompileBlock = true; + return activeTagSet.has(tag) ? `${prefix}${body}` : prefix; + }); + + return didCompileBlock ? compiled.replace(/(?:\r?\n){3,}/g, '\n\n') : compiled; } +/** + * Replace all {{placeholder}} tokens with provider-specific values + */ function escapeRegex(str) { return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); } const EXCLUDED_FROM_SUGGESTIONS = new Set([ - 'impeccable', 'i-impeccable', // foundational skill, not a steering command - 'teach-impeccable', 'i-teach-impeccable', // deprecated shim - 'frontend-design', 'i-frontend-design', // deprecated shim + 'impeccable', // foundational skill, not a steering command + 'teach-impeccable', // deprecated shim + 'frontend-design', // deprecated shim ]); +// Sub-commands of /impeccable that should appear in {{available_commands}}. +// These are the commands that audit/critique/etc. reference when suggesting next steps. +const IMPECCABLE_SUB_COMMANDS = [ + 'adapt', 'animate', 'audit', 'bolder', 'clarify', 'colorize', + 'critique', 'delight', 'distill', 'document', 'harden', 'layout', + 'onboard', 'optimize', 'overdrive', 'polish', 'quieter', 'shape', 'typeset', +]; + export function replacePlaceholders(content, provider, commandNames = [], allSkillNames = []) { const placeholders = PROVIDER_PLACEHOLDERS[provider] || PROVIDER_PLACEHOLDERS['cursor']; const cmdPrefix = placeholders.command_prefix || '/'; - const commandList = commandNames - .filter(n => !EXCLUDED_FROM_SUGGESTIONS.has(n)) - .map(n => `${cmdPrefix}${n}`) - .join(', '); + + // Build the available_commands list. + // After the v3.0 consolidation, commands are sub-commands of /impeccable. + // If there's only one user-invocable skill (impeccable), generate sub-command references. + // Otherwise fall back to listing skill names (backwards compat for forks). + const nonExcluded = commandNames.filter(n => !EXCLUDED_FROM_SUGGESTIONS.has(n)); + let commandList; + if (nonExcluded.length === 0) { + // Single-skill architecture: list sub-commands as /impeccable + commandList = IMPECCABLE_SUB_COMMANDS + .map(n => `${cmdPrefix}impeccable ${n}`) + .join(', '); + } else { + // Multi-skill architecture (backwards compat) + commandList = nonExcluded.map(n => `${cmdPrefix}${n}`).join(', '); + } let result = content .replace(/\{\{model\}\}/g, placeholders.model) @@ -456,6 +686,66 @@ export function replacePlaceholders(content, provider, commandNames = [], allSki return result; } +/** + * Decide whether a YAML scalar string value must be quoted to survive parsing. + * + * Plain (unquoted) YAML scalars cannot contain `: ` or ` #`, cannot start with + * a YAML indicator character, cannot look like a boolean/null/number, and + * cannot carry leading/trailing whitespace. parseFrontmatter strips surrounding + * quotes on input, so we must re-detect the need to quote on output — otherwise + * descriptions like "Handles: critique/review..." round-trip into invalid YAML. + */ +function yamlNeedsQuoting(value) { + if (typeof value !== 'string') return false; + if (value === '') return true; + // Leading or trailing whitespace + if (/^\s|\s$/.test(value)) return true; + // Starts with a YAML flow/indicator character + if (/^[\[\]{},&*!|>'"%@`#]/.test(value)) return true; + // Starts with `?`, `:`, or `-` followed by space or end of string + if (/^[?:-](\s|$)/.test(value)) return true; + // Contains `: ` (ends plain scalar) or ` #` (starts comment), or ends with `:` + if (/: |\s#|:$/.test(value)) return true; + // Reserved keywords that YAML 1.1 parsers coerce to boolean/null + if (/^(true|false|null|yes|no|on|off|~)$/i.test(value)) return true; + // Looks like a number + if (/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/.test(value)) return true; + return false; +} + +function formatYamlScalar(value) { + if (typeof value !== 'string') return String(value); + if (yamlNeedsQuoting(value)) { + return `"${value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`; + } + return value; +} + +function appendYamlObject(lines, data, indent = 0) { + const space = ' '.repeat(indent); + + for (const [key, value] of Object.entries(data)) { + if (Array.isArray(value)) { + lines.push(`${space}${key}:`); + for (const item of value) { + if (item && typeof item === 'object' && !Array.isArray(item)) { + lines.push(`${space} -`); + appendYamlObject(lines, item, indent + 4); + } else { + lines.push(`${space} - ${formatYamlScalar(item)}`); + } + } + } else if (value && typeof value === 'object') { + lines.push(`${space}${key}:`); + appendYamlObject(lines, value, indent + 2); + } else if (typeof value === 'boolean') { + lines.push(`${space}${key}: ${value}`); + } else { + lines.push(`${space}${key}: ${formatYamlScalar(value)}`); + } + } +} + /** * Generate YAML frontmatter string */ @@ -467,21 +757,29 @@ export function generateYamlFrontmatter(data) { lines.push(`${key}:`); for (const item of value) { if (typeof item === 'object') { - lines.push(` - name: ${item.name}`); - if (item.description) lines.push(` description: ${item.description}`); + lines.push(` - name: ${formatYamlScalar(item.name)}`); + if (item.description) lines.push(` description: ${formatYamlScalar(item.description)}`); if (item.required !== undefined) lines.push(` required: ${item.required}`); } else { - lines.push(` - ${item}`); + lines.push(` - ${formatYamlScalar(item)}`); } } } else if (typeof value === 'boolean') { lines.push(`${key}: ${value}`); } else { - const needsQuoting = typeof value === 'string' && /^[\[{]/.test(value); - lines.push(`${key}: ${needsQuoting ? `"${value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"` : value}`); + lines.push(`${key}: ${formatYamlScalar(value)}`); } } lines.push('---'); return lines.join('\n'); } + +/** + * Generate a plain YAML document string. + */ +export function generateYamlDocument(data) { + const lines = []; + appendYamlObject(lines, data); + return lines.join('\n'); +} diff --git a/scripts/lib/zip.js b/scripts/lib/zip.js index 35a8342723b014ed82e736d71dff3adbbc9e7aec..6f563112f2027b02b9a18308c708c68b63fc10dd 100644 --- a/scripts/lib/zip.js +++ b/scripts/lib/zip.js @@ -58,5 +58,4 @@ export async function createAllZips(distDir) { console.log('\n📦 Creating ZIP bundles...'); await createProviderZip(path.join(distDir, 'universal'), distDir, 'universal'); - await createProviderZip(path.join(distDir, 'universal-prefixed'), distDir, 'universal-prefixed'); } diff --git a/scripts/release.mjs b/scripts/release.mjs new file mode 100755 index 0000000000000000000000000000000000000000..4855404598834ad453cc11edad2b66de5864e0df --- /dev/null +++ b/scripts/release.mjs @@ -0,0 +1,281 @@ +#!/usr/bin/env node +// Tags and publishes a GitHub release for one of three independently versioned +// components: skill, cli, extension. +// +// Usage: node scripts/release.mjs [--dry-run] +// +// Refuses on a dirty tree, an unpushed HEAD, or a missing changelog entry. +// For the skill component, also reruns `bun run build` and refuses if the +// regenerated harness directories drift from what is committed. + +import { readFileSync, writeFileSync, unlinkSync, existsSync } from 'node:fs'; +import { execSync } from 'node:child_process'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); + +const COMPONENTS = { + skill: { + manifest: '.claude-plugin/plugin.json', + sibling: '.claude-plugin/marketplace.json', + siblingVersion: (m) => m.plugins?.[0]?.version, + tagPrefix: 'skill-v', + label: 'Skill', + changelogLabel: 'v', + buildCmd: 'bun run build', + artifacts: ['dist/universal.zip'], + postReleaseHint: null, + tweetHeader: (v) => `Impeccable v${v} is out.`, + tweetCta: 'Install / update: npx skills add pbakaus/impeccable', + }, + cli: { + manifest: 'package.json', + tagPrefix: 'cli-v', + label: 'CLI', + changelogLabel: 'CLI v', + buildCmd: null, + artifacts: [], + postReleaseHint: 'Run `npm publish` next to push the package to the npm registry.', + tweetHeader: (v) => `Impeccable CLI v${v} is out.`, + tweetCta: 'npm i -g impeccable', + }, + extension: { + manifest: 'extension/manifest.json', + tagPrefix: 'ext-v', + label: 'Extension', + changelogLabel: 'Extension v', + buildCmd: 'bun run build:extension', + artifacts: ['dist/extension.zip'], + postReleaseHint: 'Upload `dist/extension.zip` to the Chrome Web Store dashboard to publish.', + tweetHeader: (v) => `Impeccable Chrome extension v${v} is out.`, + tweetCta: null, + }, +}; + +const REPO_URL = 'https://github.com/pbakaus/impeccable'; +const TWEET_LIMIT = 280; + +const args = process.argv.slice(2); +const dryRun = args.includes('--dry-run'); +const component = args.find((a) => !a.startsWith('--')); + +if (!component || !COMPONENTS[component]) { + console.error('usage: release.mjs [--dry-run]'); + process.exit(1); +} +const cfg = COMPONENTS[component]; + +function fail(msg) { + console.error(`✗ ${msg}`); + process.exit(1); +} +function ok(msg) { + console.log(`✓ ${msg}`); +} +function step(msg) { + console.log(`\n→ ${msg}`); +} +function run(cmd) { + return execSync(cmd, { cwd: repoRoot, encoding: 'utf8' }).trim(); +} +function runMutating(cmd) { + if (dryRun) { + console.log(` [dry-run] ${cmd}`); + return; + } + execSync(cmd, { cwd: repoRoot, stdio: 'inherit' }); +} + +step(`Reading version from ${cfg.manifest}`); +const manifest = JSON.parse(readFileSync(path.join(repoRoot, cfg.manifest), 'utf8')); +const version = manifest.version; +if (!version) fail(`No version field in ${cfg.manifest}`); +ok(`${cfg.label} ${version}`); + +if (cfg.sibling) { + const sibling = JSON.parse(readFileSync(path.join(repoRoot, cfg.sibling), 'utf8')); + const siblingVersion = cfg.siblingVersion(sibling); + if (siblingVersion !== version) { + fail(`${cfg.manifest} (${version}) and ${cfg.sibling} (${siblingVersion}) disagree. Bump both.`); + } + ok(`${cfg.sibling} agrees`); +} + +const tag = `${cfg.tagPrefix}${version}`; + +step('Checking working tree is clean'); +const status = run('git status --porcelain'); +if (status) fail(`Working tree is dirty. Commit or stash first:\n${status}`); +ok('clean'); + +if (cfg.buildCmd) { + step(`Rebuilding outputs (${cfg.buildCmd})`); + if (dryRun) { + console.log(` [dry-run] ${cfg.buildCmd}`); + } else { + execSync(cfg.buildCmd, { cwd: repoRoot, stdio: 'inherit' }); + const postBuild = run('git status --porcelain'); + if (postBuild) { + fail(`Build produced uncommitted changes. Run \`${cfg.buildCmd}\`, commit the result, then re-run.\n${postBuild}`); + } + ok('build outputs match source'); + } +} + +step('Checking HEAD is pushed to origin'); +const branch = run('git rev-parse --abbrev-ref HEAD'); +const head = run('git rev-parse HEAD'); +let remoteHead; +try { + remoteHead = run(`git rev-parse origin/${branch}`); +} catch { + fail(`No tracking branch origin/${branch}. Push first.`); +} +if (head !== remoteHead) fail(`HEAD is ahead of origin/${branch}. Push your commits first.`); +ok(`origin/${branch} matches HEAD`); + +step(`Verifying tag ${tag} does not already exist`); +let localTagExists = false; +try { + run(`git rev-parse -q --verify "refs/tags/${tag}"`); + localTagExists = true; +} catch {} +if (localTagExists) fail(`Tag ${tag} already exists locally.`); +const remoteTags = run('git ls-remote --tags origin'); +if (remoteTags.split('\n').some((line) => line.endsWith(`refs/tags/${tag}`))) { + fail(`Tag ${tag} already exists on origin.`); +} +ok('tag is free'); + +step(`Extracting changelog entry for "${cfg.changelogLabel}${version}"`); +const changelogSource = path.join(repoRoot, 'site/pages/index.astro'); +const indexHtml = readFileSync(changelogSource, 'utf8'); +const expectedHeader = `${cfg.changelogLabel}${version}`; +const headerIdx = indexHtml.indexOf(expectedHeader); +if (headerIdx === -1) { + fail(`No changelog entry found for "${cfg.changelogLabel}${version}" in site/pages/index.astro. Add one before releasing.`); +} +const entryStart = indexHtml.lastIndexOf('
      ', headerIdx); +if (entryStart === -1 || ulEnd === -1) fail('Changelog entry markup is malformed.'); +const entryEnd = indexHtml.indexOf('
      ', ulEnd) + ''.length; +const entryHtml = indexHtml.slice(entryStart, entryEnd); + +const notes = htmlToMarkdown(entryHtml); +ok('extracted'); + +step('Verifying release artifacts exist'); +for (const artifact of cfg.artifacts) { + const abs = path.join(repoRoot, artifact); + if (!existsSync(abs)) fail(`Missing artifact: ${artifact}`); + ok(artifact); +} + +console.log('\n--- Release notes preview ---'); +console.log(notes); +console.log('--- end preview ---\n'); + +step(`Creating annotated tag ${tag}`); +const tagMessageFile = path.join(repoRoot, '.release-tag-msg.tmp'); +const releaseNotesFile = path.join(repoRoot, '.release-notes.tmp.md'); +if (!dryRun) { + writeFileSync(tagMessageFile, `${cfg.label} ${version}\n\n${notes}\n`); + writeFileSync(releaseNotesFile, notes); +} +try { + runMutating(`git tag -a ${tag} -F "${tagMessageFile}"`); + runMutating(`git push origin ${tag}`); + + step(`Creating GitHub release ${tag}`); + const artifactArgs = cfg.artifacts.map((a) => `"${a}"`).join(' '); + const title = `${cfg.label} ${version}`; + runMutating( + `gh release create ${tag} --title "${title}" --notes-file "${releaseNotesFile}"${artifactArgs ? ' ' + artifactArgs : ''}` + ); + +} finally { + if (!dryRun) { + try { unlinkSync(tagMessageFile); } catch {} + try { unlinkSync(releaseNotesFile); } catch {} + } +} + +console.log(`\n✓ ${cfg.label} ${version} released as ${tag}`); +if (cfg.postReleaseHint) { + console.log(`\n→ Next step: ${cfg.postReleaseHint}`); +} + +const tweet = renderTweet(cfg, version, entryHtml, tag); +console.log(`\n--- Tweet (${tweet.length}/${TWEET_LIMIT} chars) for @impeccable_ai ---`); +console.log(tweet); +console.log('--- end tweet ---'); + +// Pull the bold lead text from each changelog bullet. Each
    • reads +// "Headline. Body...", so the strong text alone is a +// tweet-grade summary. Returns a list ordered by appearance. +function extractHighlights(entryHtml) { + const highlights = []; + const liRe = /
    • ([\s\S]*?)<\/li>/g; + let match; + while ((match = liRe.exec(entryHtml))) { + const strong = match[1].match(/([\s\S]*?)<\/strong>/); + if (!strong) continue; + const text = strong[1] + .replace(/<[^>]+>/g, '') + .replace(/×/g, '×') + .replace(/&/g, '&') + .replace(/</g, '<') + .replace(/>/g, '>') + .replace(/"/g, '"') + .replace(/'/g, "'") + .replace(/\s+/g, ' ') + .replace(/[.!?]+\s*$/, '') + .trim(); + if (text) highlights.push(text); + } + return highlights; +} + +function renderTweet(cfg, version, entryHtml, tag) { + const releaseUrl = `${REPO_URL}/releases/tag/${tag}`; + const header = cfg.tweetHeader(version); + const highlights = extractHighlights(entryHtml); + const tail = [cfg.tweetCta, releaseUrl].filter(Boolean).join('\n'); + + // Greedy: include as many highlights as fit. Always include the URL. + let bullets = ''; + const bulletPrefix = '• '; + for (const h of highlights) { + const candidate = bullets + bulletPrefix + h + '\n'; + const draft = [header, '', candidate.trimEnd(), '', tail].join('\n'); + if (draft.length > TWEET_LIMIT) break; + bullets = candidate; + } + + // Fallback if even the first highlight overflows: drop bullets entirely. + if (!bullets) { + return [header, '', tail].join('\n'); + } + return [header, '', bullets.trimEnd(), '', tail].join('\n'); +} + +function htmlToMarkdown(html) { + let md = html; + md = md.replace(/
      /, ''); + md = md.replace(/
    • ([\s\S]*?)<\/li>/g, (_, inner) => `- ${inner.trim()}\n`); + md = md.replace(/([\s\S]*?)<\/strong>/g, '**$1**'); + md = md.replace(/([\s\S]*?)<\/code>/g, '`$1`'); + md = md.replace(/]*>([\s\S]*?)<\/a>/g, '[$2]($1)'); + md = md.replace(/<\/?(ul|div|span)[^>]*>/g, ''); + md = md.replace(/×/g, '×'); + md = md.replace(/&/g, '&'); + md = md.replace(/</g, '<'); + md = md.replace(/>/g, '>'); + md = md.replace(/"/g, '"'); + md = md.replace(/'/g, "'"); + md = md.replace(/^[ \t]+/gm, ''); + md = md.replace(/[ \t]+\n/g, '\n'); + md = md.replace(/\n{3,}/g, '\n\n'); + return md.trim(); +} diff --git a/scripts/screenshot-antipatterns.js b/scripts/screenshot-antipatterns.js index c333ca9ba682cc353ffc1a4f71a5c96ca89890fc..9e1b07673a22960b31cbb84db7b0996e646a6f79 100644 --- a/scripts/screenshot-antipatterns.js +++ b/scripts/screenshot-antipatterns.js @@ -15,8 +15,8 @@ import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const ROOT_DIR = path.resolve(__dirname, '..'); -const EXAMPLES_DIR = path.join(ROOT_DIR, 'public', 'antipattern-examples'); -const OUTPUT_DIR = path.join(ROOT_DIR, 'public', 'antipattern-images'); +const EXAMPLES_DIR = path.join(ROOT_DIR, 'site', 'public', 'antipattern-examples'); +const OUTPUT_DIR = path.join(ROOT_DIR, 'site', 'public', 'antipattern-images'); async function screenshotAntipatterns() { // Ensure output directory exists diff --git a/server/index.js b/server/index.js deleted file mode 100644 index c9acdcdbb69be1d08cdc669d3779ceeb939e33d5..0000000000000000000000000000000000000000 --- a/server/index.js +++ /dev/null @@ -1,210 +0,0 @@ -import { serve, file } from "bun"; -import path from "node:path"; -import { fileURLToPath } from "node:url"; -import homepage from "../public/index.html"; -import cheatsheet from "../public/cheatsheet.html"; -import gallery from "../public/gallery.html"; -import privacy from "../public/privacy.html"; -import { - getSkills, - getCommands, - getCommandSource, - getPatterns, - handleFileDownload, - handleBundleDownload -} from "./lib/api-handlers.js"; -import { generateSubPages } from "../scripts/build-sub-pages.js"; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = path.dirname(__filename); -const ROOT_DIR = path.resolve(__dirname, ".."); - -// Pre-generate sub-pages so dev + prod share the same output shape. -console.log("📝 Generating sub-pages for dev server..."); -const { files: subPageFiles } = await generateSubPages(ROOT_DIR); -console.log(`✓ Generated ${subPageFiles.length} sub-page(s)`); - -// Helper: serve a generated HTML file by absolute path, 404 if missing. -async function serveGenerated(pagePath) { - const f = file(pagePath); - if (!(await f.exists())) return new Response("Not Found", { status: 404 }); - return new Response(f, { - headers: { - "Content-Type": "text/html;charset=utf-8", - "X-Content-Type-Options": "nosniff", - "X-Frame-Options": "DENY", - }, - }); -} - -const server = serve({ - port: process.env.PORT || 3000, - - routes: { - "/": homepage, - "/cheatsheet": cheatsheet, - "/gallery": gallery, - "/privacy": privacy, - - // Generated sub-pages — served directly from the pre-generated files - "/skills": () => serveGenerated(path.join(ROOT_DIR, "public/skills/index.html")), - "/skills/:id": (req) => { - const id = req.params.id.replace(/[^a-z0-9-]/gi, ""); - return serveGenerated(path.join(ROOT_DIR, `public/skills/${id}.html`)); - }, - "/anti-patterns": () => serveGenerated(path.join(ROOT_DIR, "public/anti-patterns/index.html")), - "/visual-mode": () => serveGenerated(path.join(ROOT_DIR, "public/visual-mode/index.html")), - "/tutorials": () => serveGenerated(path.join(ROOT_DIR, "public/tutorials/index.html")), - "/tutorials/:slug": (req) => { - const slug = req.params.slug.replace(/[^a-z0-9-]/gi, ""); - return serveGenerated(path.join(ROOT_DIR, `public/tutorials/${slug}.html`)); - }, - - // Static assets - all public subdirectories - "/assets/*": async (req) => { - const url = new URL(req.url); - if (url.pathname.includes('..')) return new Response("Bad Request", { status: 400 }); - const filePath = `./public${url.pathname}`; - const assetFile = file(filePath); - if (await assetFile.exists()) { - return new Response(assetFile, { - headers: { "X-Content-Type-Options": "nosniff", "X-Frame-Options": "DENY" } - }); - } - return new Response("Not Found", { status: 404 }); - }, - "/css/*": async (req) => { - const url = new URL(req.url); - if (url.pathname.includes('..')) return new Response("Bad Request", { status: 400 }); - const filePath = `./public${url.pathname}`; - const assetFile = file(filePath); - if (await assetFile.exists()) { - return new Response(assetFile, { - headers: { "Content-Type": "text/css", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "DENY" } - }); - } - return new Response("Not Found", { status: 404 }); - }, - "/js/*": async (req) => { - const url = new URL(req.url); - if (url.pathname.includes('..')) return new Response("Bad Request", { status: 400 }); - // Check public/js/ first, then fall back to built artifacts - const headers = { "Content-Type": "application/javascript", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "DENY" }; - const publicFile = file(`./public${url.pathname}`); - if (await publicFile.exists()) return new Response(publicFile, { headers }); - // Browser detector served from impeccable package - if (url.pathname === '/js/detect-antipatterns-browser.js') { - const pkgFile = file('./src/detect-antipatterns-browser.js'); - if (await pkgFile.exists()) return new Response(pkgFile, { headers }); - } - return new Response("Not Found", { status: 404 }); - }, - // Test fixtures (for browser visual testing) - "/fixtures/*": async (req) => { - const url = new URL(req.url); - if (url.pathname.includes('..')) return new Response("Bad Request", { status: 400 }); - const filePath = `./tests${url.pathname}`; - const assetFile = file(filePath); - if (await assetFile.exists()) { - const ext = url.pathname.split('.').pop(); - const types = { html: 'text/html', css: 'text/css', js: 'application/javascript' }; - return new Response(assetFile, { - headers: { "Content-Type": types[ext] || "application/octet-stream", "X-Content-Type-Options": "nosniff" } - }); - } - return new Response("Not Found", { status: 404 }); - }, - "/antipattern-images/*": async (req) => { - const url = new URL(req.url); - if (url.pathname.includes('..')) return new Response("Bad Request", { status: 400 }); - const filePath = `./public${url.pathname}`; - const assetFile = file(filePath); - if (await assetFile.exists()) { - return new Response(assetFile, { - headers: { "X-Content-Type-Options": "nosniff" } - }); - } - return new Response("Not Found", { status: 404 }); - }, - "/antipattern-examples/*": async (req) => { - const url = new URL(req.url); - if (url.pathname.includes('..')) return new Response("Bad Request", { status: 400 }); - const filePath = `./public${url.pathname}`; - const assetFile = file(filePath); - if (await assetFile.exists()) { - return new Response(assetFile, { - headers: { "Content-Type": "text/html", "X-Content-Type-Options": "nosniff", "X-Frame-Options": "SAMEORIGIN" } - }); - } - return new Response("Not Found", { status: 404 }); - }, - - // API: Get all skills - "/api/skills": { - async GET() { - const skills = await getSkills(); - return Response.json(skills); - }, - }, - - // API: Get all commands - "/api/commands": { - async GET() { - const commands = await getCommands(); - return Response.json(commands); - }, - }, - - // API: Get patterns and antipatterns - "/api/patterns": { - async GET() { - const patterns = await getPatterns(); - return Response.json(patterns); - }, - }, - - // API: Get command source content - "/api/command-source/:id": async (req) => { - const { id } = req.params; - const result = await getCommandSource(id); - if (result && result.error) { - return Response.json({ error: result.error }, { status: result.status }); - } - if (!result) { - return Response.json({ error: "Command not found" }, { status: 404 }); - } - return Response.json({ content: result }); - }, - - // API: Download individual file - "/api/download/:type/:provider/:id": async (req) => { - const { type, provider, id } = req.params; - return handleFileDownload(type, provider, id); - }, - - // API: Download provider bundle ZIP - "/api/download/bundle/:provider": async (req) => { - const { provider } = req.params; - return handleBundleDownload(provider); - }, - }, - - // Serve root-level static files (og-image.png, favicon, robots.txt, etc.) - fetch(req) { - const url = new URL(req.url); - if (url.pathname.includes('..')) { - return new Response("Bad Request", { status: 400 }); - } - const filePath = `./public${url.pathname}`; - const staticFile = file(filePath); - if (staticFile.size > 0) { - return new Response(staticFile); - } - return new Response("Not Found", { status: 404 }); - }, - - development: process.env.NODE_ENV !== "production", -}); - -console.log(`🎨 impeccable.style running at ${server.url}`); - diff --git a/server/lib/api-handlers.js b/server/lib/api-handlers.js deleted file mode 100644 index c27ab428d6da330c5c941f32982e77f3a51e5fa3..0000000000000000000000000000000000000000 --- a/server/lib/api-handlers.js +++ /dev/null @@ -1,165 +0,0 @@ -import { readdir, readFile } from "fs/promises"; -import { basename, join, dirname } from "path"; -import { existsSync } from "fs"; -import { fileURLToPath } from "url"; -import { readPatterns, parseFrontmatter } from "../../scripts/lib/utils.js"; -import { FILE_DOWNLOAD_PROVIDER_CONFIG_DIRS } from "../../lib/download-providers.js"; -import { - isAllowedBundleProvider, - isAllowedFileProvider, - isAllowedType, - isValidId, - sanitizeFilename -} from "./validation.js"; - -// Get project root directory (works in both Node.js and Bun, including Vercel) -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); -const PROJECT_ROOT = join(__dirname, "..", ".."); - -// Helper to read file content (works in both Node.js and Bun) -async function readFileContent(filePath) { - return readFile(filePath, "utf-8"); -} - -// Read all skills from source/skills/ subdirectories -export async function getSkills() { - const skillsDir = join(PROJECT_ROOT, "source", "skills"); - const entries = await readdir(skillsDir, { withFileTypes: true }); - const skills = []; - - for (const entry of entries) { - if (!entry.isDirectory()) continue; - const skillMdPath = join(skillsDir, entry.name, "SKILL.md"); - if (!existsSync(skillMdPath)) continue; - - const content = await readFileContent(skillMdPath); - const { frontmatter } = parseFrontmatter(content); - - skills.push({ - id: entry.name, - name: frontmatter.name || entry.name, - description: frontmatter.description || "No description available", - userInvocable: frontmatter['user-invocable'] === true || frontmatter['user-invocable'] === 'true', - }); - } - - return skills; -} - -// Read commands (user-invocable skills) -export async function getCommands() { - const allSkills = await getSkills(); - return allSkills.filter(s => s.userInvocable); -} - -// Get command/skill source content -export async function getCommandSource(id) { - if (!isValidId(id)) { - return { error: "Invalid command ID", status: 400 }; - } - - const skillPath = join(PROJECT_ROOT, "source", "skills", id, "SKILL.md"); - - try { - if (!existsSync(skillPath)) { - return null; - } - const content = await readFileContent(skillPath); - return content; - } catch (error) { - console.error("Error reading skill source:", error); - return null; - } -} - -// Get the appropriate file path for a provider -export function getFilePath(type, provider, id) { - const distDir = join(PROJECT_ROOT, "dist"); - const configDir = FILE_DOWNLOAD_PROVIDER_CONFIG_DIRS[provider]; - if (!configDir) return null; - - // Everything is a skill now - if (type === "skill" || type === "command") { - return join(distDir, provider, configDir, "skills", id, "SKILL.md"); - } - - return null; -} - -// Handle individual file download -export async function handleFileDownload(type, provider, id) { - if (!isAllowedType(type)) { - return new Response("Invalid type", { status: 400 }); - } - - if (!isAllowedFileProvider(provider)) { - return new Response("Invalid provider", { status: 400 }); - } - - if (!isValidId(id)) { - return new Response("Invalid file ID", { status: 400 }); - } - - const filePath = getFilePath(type, provider, id); - - if (!filePath) { - return new Response("Invalid provider", { status: 400 }); - } - - try { - if (!existsSync(filePath)) { - return new Response("File not found", { status: 404 }); - } - - const content = await readFile(filePath); - const fileName = sanitizeFilename(basename(filePath)); - return new Response(content, { - headers: { - "Content-Type": "application/octet-stream", - "Content-Disposition": `attachment; filename="${fileName}"`, - }, - }); - } catch (error) { - console.error("Error downloading file:", error); - return new Response("Error downloading file", { status: 500 }); - } -} - -// Extract patterns from SKILL.md using the shared utility -export async function getPatterns() { - try { - return readPatterns(PROJECT_ROOT); - } catch (error) { - console.error("Error reading patterns:", error); - return { patterns: [], antipatterns: [] }; - } -} - -// Handle bundle download -export async function handleBundleDownload(provider) { - if (!isAllowedBundleProvider(provider)) { - return new Response("Invalid provider", { status: 400 }); - } - - const distDir = join(PROJECT_ROOT, "dist"); - const zipPath = join(distDir, `${provider}.zip`); - - try { - if (!existsSync(zipPath)) { - return new Response("Bundle not found", { status: 404 }); - } - - const content = await readFile(zipPath); - const safeProvider = sanitizeFilename(provider); - return new Response(content, { - headers: { - "Content-Type": "application/zip", - "Content-Disposition": `attachment; filename="impeccable-style-${safeProvider}.zip"`, - }, - }); - } catch (error) { - console.error("Error downloading bundle:", error); - return new Response("Error downloading bundle", { status: 500 }); - } -} diff --git a/server/lib/validation.js b/server/lib/validation.js deleted file mode 100644 index b2a1f92853cfa97b669bbce666622f34007e047b..0000000000000000000000000000000000000000 --- a/server/lib/validation.js +++ /dev/null @@ -1,40 +0,0 @@ -// Shared validation helpers for input sanitization - -import { - BUNDLE_DOWNLOAD_PROVIDERS, - DOWNLOAD_PROVIDERS, - FILE_DOWNLOAD_PROVIDERS, -} from '../../lib/download-providers.js'; - -// Only allow alphanumeric, hyphens, and underscores in IDs -export const VALID_ID = /^[a-zA-Z0-9_-]+$/; - -export const ALLOWED_PROVIDERS = DOWNLOAD_PROVIDERS; -export const ALLOWED_FILE_PROVIDERS = FILE_DOWNLOAD_PROVIDERS; -export const ALLOWED_BUNDLE_PROVIDERS = BUNDLE_DOWNLOAD_PROVIDERS; -export const ALLOWED_TYPES = ['skill', 'command']; - -export function isValidId(id) { - return typeof id === 'string' && VALID_ID.test(id); -} - -export function isAllowedProvider(provider) { - return ALLOWED_PROVIDERS.includes(provider); -} - -export function isAllowedFileProvider(provider) { - return ALLOWED_FILE_PROVIDERS.includes(provider); -} - -export function isAllowedBundleProvider(provider) { - return ALLOWED_BUNDLE_PROVIDERS.includes(provider); -} - -export function isAllowedType(type) { - return ALLOWED_TYPES.includes(type); -} - -// Sanitize a filename for use in Content-Disposition headers -export function sanitizeFilename(filename) { - return filename.replace(/[^a-zA-Z0-9._-]/g, ''); -} diff --git a/site/components/Footer.astro b/site/components/Footer.astro new file mode 100644 index 0000000000000000000000000000000000000000..1d2309478198f14eb343632939f7c356af63056c --- /dev/null +++ b/site/components/Footer.astro @@ -0,0 +1,29 @@ +--- +--- + + diff --git a/content/site/partials/header.html b/site/components/Header.astro similarity index 69% rename from content/site/partials/header.html rename to site/components/Header.astro index f52c00a8dc9d2b3d1830e7269db6532fde9cd49a..41a7f9f7c98fa8ec190cbe3d4a54eb7cabdadc1c 100644 --- a/content/site/partials/header.html +++ b/site/components/Header.astro @@ -1,4 +1,10 @@ - +--- +interface Props { + activeNav?: 'home' | 'designing' | 'docs' | 'slop' | 'live'; +} +const { activeNav } = Astro.props; +--- +