Claude Cursor Skill

test-ui-worst-case

Use when the user asks to stress-test a component or screen, try the worst case, find edge cases in a list, card or table, or check it survives real data before launch. Renders it with the worst real data at phone and desktop width, measures what overflows, breaks or reads wrong,

LLM Mart · 0 points · 0 views 0 listing impressions 0 install-command copies
Download heyvhuang-copybook-skills-plugins_skills_skills_test-ui-worst-case-c2e4cc2.zip · 4 KB

Install

skills CLI npx skills add https://github.com/Heyvhuang/copybook-skills/tree/main/plugins/skills/skills/test-ui-worst-case
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install heyvhuang-copybook-skills@llmmart
Git git clone https://github.com/Heyvhuang/copybook-skills.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole heyvhuang/copybook-skills collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

Test a component with the worst real data

Demo data is written to look good. Real data has a 40-letter surname, an email with no place to break, no avatar, zero rows and a count in the millions. A component is done when it survives those.

1. Find what it takes

Read the component and where its data comes from: each field, its type, whether it can be missing, and what the person does in it (a button, a link). Note the widths the project supports; with none stated, use 390 and 1280.

2. Write the worst cases for each field

Pick only what the field can really receive:

  • text: empty, one character, 80 characters with spaces, 60 with none (averyveryverylong…@example.com), right-to-left text, emoji
  • missing: the field absent, null, an empty string
  • images: no URL, a URL that 404s, a very tall or wide image
  • numbers: 0, 1, 1,234,567, negative if it can be, a long decimal
  • lists: none, one, many (enough to scroll)
  • dates: today, years ago, missing

Write them as one or more data files in the component's own format, next to the demo data. Keep the demo data unchanged.

3. Render and measure

Load the real component with each data set at both widths, in a headless browser (Playwright). Measure, don't eyeball:

// inside page.evaluate, for each card or row element `el`
const box = el.getBoundingClientRect();
const over = [...el.querySelectorAll('*')].filter((c) => c.getBoundingClientRect().right > box.right + 1);
const pageScroll = document.documentElement.scrollWidth > innerWidth;
const broken = [...document.images].filter((i) => i.complete && i.naturalWidth === 0);
const words = document.body.innerText.match(/\b(?:undefined|null|NaN)\b|\[object Object\]/g);

Also check plurals ("1 tasks"), number formatting, an empty list that shows nothing, and a button pushed out of view. Take a screenshot of each failing case. Every failure goes on a list with its data set and width.

4. Fix the component

Fix in the component and its styles, never by trimming the data:

  • long text: min-width: 0 on flex children, then wrap (overflow-wrap: anywhere for emails and URLs) or truncate with the full value in title; keep actions on screen
  • missing image: a fallback (initials or a placeholder) on missing URL and on error
  • missing field: leave it out or show a dash, never the raw undefined
  • counts: Intl.NumberFormat and Intl.PluralRules, or the project's own helpers
  • empty list: a line that says so, and the next action if there is one

Change only what a measured failure needs; keep the component's look with the demo data.

5. Measure again

Rerun every data set at both widths, plus the demo data. All checks from step 3 must pass, and the demo must look as before. Leave the worst-case data files and the script in the repo if it has a place for tests.

Finish

Copybook's notes for the agent:

  • Report a table: data set, width, what broke, the fix, and the result after. Attach the before and after screenshots of the worst one.
  • "The demo looks fine" is the reason to run this, not a reason to stop early.
  • Say what you did not try: other languages, zoom at 200%, a screen reader.

Based on emilkowalski/skills (MIT), rewritten by Copybook.

Files (copybook-skills)
  • CHANGES.md 1016 B
    Loading…
  • example.md 2.9 KB
    Loading…
  • LICENSE 1 KB · in bundle
  • SKILL.md 3.6 KB
    ---
    name: test-ui-worst-case
    description: "Use when the user asks to stress-test a component or screen, try the worst case, find edge cases in a list, card or table, or check it survives real data before launch. Renders it with the worst real data at phone and desktop width, measures what overflows, breaks or reads wrong, fixes the component (not the data) and measures again. Not for a full design or accessibility review (review-ui-code)."
    license: MIT (see LICENSE)
    ---
    
    # Test a component with the worst real data
    
    Demo data is written to look good. Real data has a 40-letter surname, an email with no place to break, no avatar, zero rows and a count in the millions. A component is done when it survives those.
    
    ## 1. Find what it takes
    
    Read the component and where its data comes from: each field, its type, whether it can be missing, and what the person does in it (a button, a link). Note the widths the project supports; with none stated, use 390 and 1280.
    
    ## 2. Write the worst cases for each field
    
    Pick only what the field can really receive:
    
    - text: empty, one character, 80 characters with spaces, 60 with none (`averyveryverylong…@example.com`), right-to-left text, emoji
    - missing: the field absent, `null`, an empty string
    - images: no URL, a URL that 404s, a very tall or wide image
    - numbers: 0, 1, 1,234,567, negative if it can be, a long decimal
    - lists: none, one, many (enough to scroll)
    - dates: today, years ago, missing
    
    Write them as one or more data files in the component's own format, next to the demo data. Keep the demo data unchanged.
    
    ## 3. Render and measure
    
    Load the real component with each data set at both widths, in a headless browser (Playwright). Measure, don't eyeball:
    
    ```js
    // inside page.evaluate, for each card or row element `el`
    const box = el.getBoundingClientRect();
    const over = [...el.querySelectorAll('*')].filter((c) => c.getBoundingClientRect().right > box.right + 1);
    const pageScroll = document.documentElement.scrollWidth > innerWidth;
    const broken = [...document.images].filter((i) => i.complete && i.naturalWidth === 0);
    const words = document.body.innerText.match(/\b(?:undefined|null|NaN)\b|\[object Object\]/g);
    ```
    
    Also check plurals ("1 tasks"), number formatting, an empty list that shows nothing, and a button pushed out of view. Take a screenshot of each failing case. Every failure goes on a list with its data set and width.
    
    ## 4. Fix the component
    
    Fix in the component and its styles, never by trimming the data:
    
    - long text: `min-width: 0` on flex children, then wrap (`overflow-wrap: anywhere` for emails and URLs) or truncate with the full value in `title`; keep actions on screen
    - missing image: a fallback (initials or a placeholder) on missing URL and on `error`
    - missing field: leave it out or show a dash, never the raw `undefined`
    - counts: `Intl.NumberFormat` and `Intl.PluralRules`, or the project's own helpers
    - empty list: a line that says so, and the next action if there is one
    
    Change only what a measured failure needs; keep the component's look with the demo data.
    
    ## 5. Measure again
    
    Rerun every data set at both widths, plus the demo data. All checks from step 3 must pass, and the demo must look as before. Leave the worst-case data files and the script in the repo if it has a place for tests.
    
    ## Finish
    
    Copybook's notes for the agent:
    - Report a table: data set, width, what broke, the fix, and the result after. Attach the before and after screenshots of the worst one.
    - "The demo looks fine" is the reason to run this, not a reason to stop early.
    - Say what you did not try: other languages, zoom at 200%, a screen reader.
    
    Based on emilkowalski/skills (MIT), rewritten by Copybook.
    

Comments

Sign in to join the conversation.

No comments yet. Start the conversation.

Reviews (0)

No reviews yet.