| name | planning-wsh-improvements |
| description | Analyzes a Web Speed Hackathon project, researches each improvement topic in depth, stores research as Agent Skills, and generates executable Claude Code commands for each optimization. Use when starting WSH optimization, creating an optimization roadmap, or generating executable improvement commands. |
Planning WSH Improvements
Analyzes a Web Speed Hackathon project, identifies performance bottlenecks, researches each improvement topic in depth, stores findings as reusable Agent Skills, and generates executable Claude Code commands. Every command references the relevant skill and includes mandatory Lighthouse score check followed by quick visual verification (curl + Playwright screenshot).
Use this skill when starting a WSH competition, creating an optimization plan, or when the user asks to generate improvement commands for a WSH project.
Supporting files:
Workflow
Step 1: Analyze the Project
Before generating any plan, gather data:
- Read
package.json ā Identify dependencies, build scripts, framework
- Read build config ā
webpack.config.*, vite.config.*, tsconfig.json
- Read
docs/regulation.md or equivalent ā Understand VRT and scoring rules
- Check server code ā Look for artificial delays, N+1 queries, missing compression
- Check bundle size ā Run
npm run build if needed, inspect output
- Scan for known WSH traps ā See IMPROVEMENT-CATALOG.md
- Run Lighthouse baseline ā Measure and record scores for all scored pages before any changes
- Quick visual baseline ā Confirm key pages load correctly via curl + screenshot before any changes
Step 2: Research & Generate Skills
For each identified improvement, conduct deep research and store the knowledge as an Agent Skill.
Research Process
For each improvement topic:
- Identify knowledge gaps ā What does Claude need to know beyond general knowledge to implement this specific optimization correctly in this project?
- Research the topic using web search, documentation, and codebase analysis:
- Official documentation for relevant tools/libraries
- Known pitfalls and edge cases specific to this optimization
- Compatibility with the project's tech stack (React version, bundler, etc.)
- VRT implications ā what visual changes this optimization might cause
- Project-specific context ā how the codebase uses the relevant code
- Synthesize findings into a focused Agent Skill
Skill Generation
Create a skill directory at .claude/skills/wsh-{topic}/ for each improvement topic. Follow the template in RESEARCH-SKILL-TEMPLATE.md.
When to create a skill vs. skip:
- Create when the topic has non-obvious details, pitfalls, or project-specific nuances
- Create when the optimization requires understanding of specific APIs, configs, or patterns
- Skip when the optimization is trivially simple (e.g., deleting one line)
Skill naming: wsh-{topic} (e.g., wsh-avif-conversion, wsh-tree-shaking, wsh-preact-migration)
Skill content should include:
- Specific techniques and their trade-offs
- Code patterns and examples adapted to this project's stack
- Known pitfalls and how to avoid them
- VRT risk factors and mitigation strategies
- References to official documentation
Do NOT include in the skill:
- Generic knowledge Claude already has
- Information that will be in the command itself (specific file paths, line numbers)
- Time-sensitive information
Example: Research for Image Optimization
If the project has oversized PNG images:
- Research: AVIF vs WebP quality/size trade-offs, Sharp API for batch conversion,
<picture> element with fallbacks, how the project's image pipeline works
- Generate skill at
.claude/skills/wsh-image-optimization/SKILL.md:
- AVIF encoding parameters for best size/quality balance
- Sharp CLI commands for batch conversion
- How to update image references in the project's component structure
- VRT pitfalls: color profile shifts, transparency handling, quality thresholds
Step 3: Prioritize Improvements
Score each potential improvement:
- Impact: Estimated Lighthouse score gain (from IMPROVEMENT-CATALOG.md)
- Risk: VRT failure risk (Low / Medium / High)
- Effort: Implementation complexity (Small / Medium / Large)
Sort by: Impact (descending) ā Risk (ascending) ā Effort (ascending)
Step 4: Generate the Plan Document
Create a plan document at .claude/wsh-plan.md:
# WSH Improvement Plan
Generated: {date}
Baseline VRT: PASS / FAIL
Estimated Total Impact: +{X} pts
## Lighthouse Baseline
| Page | FCP | SI | LCP | TBT | CLS | Score |
|------|-----|-----|-----|-----|-----|-------|
| / | {ms} | {ms} | {ms} | {ms} | {val} | {score} |
| {page} | ... | ... | ... | ... | ... | ... |
Total baseline: {sum} pts
## Improvements (Priority Order)
| # | Command | Skill | Category | Est. Impact | Risk | Effort |
|---|---------|-------|----------|-------------|------|--------|
| 1 | /wsh-001-{name} | wsh-{topic} | Bundle | +{X} pts | Low | Small |
| 2 | /wsh-002-{name} | wsh-{topic} | Image | +{X} pts | Medium | Medium |
| ... | ... | ... | ... | ... | ... | ... |
## Generated Skills
| Skill | Location | Covers |
|-------|----------|--------|
| wsh-{topic} | .claude/skills/wsh-{topic}/ | {brief description} |
| ... | ... | ... |
## Execution Notes
- Run commands in order (highest impact first)
- Each command references its skill for implementation knowledge
- Flow per command: Changes ā Build ā Lighthouse ā Quick visual check ā Commit ā PR
- Assumes a dedicated improvement branch is already checked out
- If visual check fails, the command will guide you through resolution
- Each successful command produces a PR with Lighthouse results
Step 5: Generate Commands
For each improvement, create a command file at .claude/commands/wsh-{NNN}-{name}.md.
Command naming: wsh-{3-digit-number}-{short-name}
- Number indicates priority order (001 = highest priority)
- Short name describes the optimization
Every command MUST:
- Reference its skill ā Include a line telling Claude to read the relevant skill for background knowledge
- Follow the template in COMMAND-TEMPLATE.md
- Have clear scope ā Exactly ONE improvement per command
- Include concrete steps ā Specific files, line numbers, changes
- Build verification ā Must build successfully
- Lighthouse score check ā Measure score impact on affected pages
- Quick visual check ā curl for HTTP 200 + Playwright screenshot for visual spot-check (NOT full VRT/e2e)
- Commit & PR ā Commit on verification pass, push, and create a PR with Lighthouse results
Step 6: Verify and Report
After generating all skills and commands:
- List generated skills:
ls .claude/skills/wsh-*/SKILL.md
- List generated commands:
ls .claude/commands/wsh-*.md
- Present the plan summary to the user
- Instruct: "Run
/wsh-001-{name} to start the first improvement"
Important Rules
- Never skip visual verification in any generated command ā At minimum: curl HTTP 200 check + Playwright screenshot
- Always run Lighthouse before visual check ā Confirm score improvement, then confirm visual integrity
- Do NOT run full e2e/VRT suites in generated commands ā Too slow for iterative development; use curl + screenshot instead
- Always commit and create PR after verification passes ā Assumes improvement branch is already checked out
- One improvement per command ā Atomic and bisectable
- Research before generating ā Every non-trivial command should have a backing skill
- Skills contain knowledge, commands contain actions ā Keep this separation clean
- Commands must be self-contained ā Include all context needed (referencing the skill for background)
- Include rollback guidance ā If visual check fails, guide revert
- Reference specific files and line numbers ā No vague instructions
- Adapt to the project ā Read the actual codebase
- Check regulation ā Exclude rule-violating optimizations
Example Output Structure
.claude/
āāā wsh-plan.md # The plan document
āāā skills/
ā āāā wsh-production-build/
ā ā āāā SKILL.md # Research: production mode, source maps, minification
ā āāā wsh-dependency-cleanup/
ā ā āāā SKILL.md # Research: bloated deps in this project
ā ā āāā references/
ā ā āāā REPLACEMENTS.md # Detailed replacement strategies
ā āāā wsh-image-optimization/
ā ā āāā SKILL.md # Research: AVIF conversion, lazy loading
ā āāā wsh-runtime-css-removal/
ā āāā SKILL.md # Research: UnoCSS runtime ā static CSS
āāā commands/
ā āāā wsh-001-production-mode.md # Command referencing wsh-production-build
ā āāā wsh-002-remove-ffmpeg.md # Command referencing wsh-dependency-cleanup
ā āāā wsh-003-remove-iconify.md # Command referencing wsh-dependency-cleanup
ā āāā wsh-004-avif-images.md # Command referencing wsh-image-optimization
ā āāā wsh-005-static-css.md # Command referencing wsh-runtime-css-removal
Note: Multiple commands can reference the same skill (e.g., several dependency removals share one skill).