Skip to content

Agent SKILLs#61

Merged
nucliweb merged 7 commits into
mainfrom
feat/agent-skills
Mar 4, 2026
Merged

Agent SKILLs#61
nucliweb merged 7 commits into
mainfrom
feat/agent-skills

Conversation

@nucliweb
Copy link
Copy Markdown
Owner

@nucliweb nucliweb commented Feb 25, 2026

Summary

Transforms the 46 JavaScript web performance snippets into actionable agent skills for AI assistants (Claude Code, Cursor, GitHub Copilot). Each skill provides a structured interface with snippet metadata, execution instructions for Chrome DevTools MCP, performance thresholds, and educational resources.

What are Agent Skills?

Agent skills enable AI coding assistants to autonomously run web performance diagnostics using Chrome DevTools. When installed, agents can:

  • Execute performance analysis snippets in the browser
  • Interpret results against standard thresholds
  • Provide actionable recommendations
  • Access organized snippet documentation optimized for LLM consumption

Changes

New: Agent Skills System

Created 6 skill packages organized by category:

Meta-skill (Router):

  • skills/webperf/ - Main entry point that routes to category-specific skills

Category Skills:

  • skills/webperf-core-web-vitals/ - 7 snippets (LCP, CLS, INP, LCP Sub-Parts, LCP Trail, LCP Image Entropy, LCP Video Candidate)
  • skills/webperf-loading/ - 27 snippets (TTFB, FCP, render-blocking resources, fonts, scripts, service workers, etc.)
  • skills/webperf-interaction/ - 8 snippets (Long Animation Frames, LongTask, scroll performance, interactions, etc.)
  • skills/webperf-media/ - 3 snippets (image audit, video audit, SVG bitmap analysis)
  • skills/webperf-resources/ - 1 snippet (network bandwidth and connection quality)

Each skill directory contains:

  • SKILL.md - Agent instructions with snippet index, thresholds, execution steps (optimized for LLMs without unnecessary external links)
  • scripts/*.js - Executable JavaScript snippets for Chrome DevTools

New: Build Scripts

scripts/generate-skills.js

  • Generates SKILL.md files from snippet metadata extracted from MDX pages
  • Extracts descriptions, thresholds, and titles automatically
  • Copies snippets to both skills/ (for repo) and .claude/skills/ (for local use)
  • Run with: npm run generate-skills

scripts/install-skills.js

  • Installs skills locally for Claude Code in current project
  • Copies skills to .claude/skills/ and configures .claude/settings.json
  • Run with: npm run install-skills

scripts/install-global.js

  • Installs skills globally in ~/.claude/skills/ for use across all projects
  • Run with: npm run install-global

New: Documentation

SKILLS.md
Comprehensive guide covering:

  • What agent skills are and how they work
  • Installation instructions (local vs global)
  • Usage examples with Claude Code
  • Skill structure and organization
  • Chrome DevTools MCP integration requirements
  • Contributing guidelines

README.md updates

  • Added "Agent Skills" section with quick start guide
  • Links to SKILLS.md documentation
  • Installation commands

New: Claude Code Configuration

.claude/settings.json
Pre-configured with all 6 webperf skills for immediate use in this project.

.claude/skills/
Local copy of all skills for project-specific usage.

Skill Structure

Each SKILL.md follows this format:

---
name: webperf-[category]
description: Brief description with trigger keywords for AI assistants
---

# WebPerf: [Category]

Brief description of the category.

## Available Snippets

| Snippet | Description | File |
|---------|-------------|------|
| ... | ... | scripts/....js |

## Execution with Chrome DevTools MCP

1. mcp__chrome-devtools__navigate_page  → navigate to target URL
2. mcp__chrome-devtools__evaluate_script → run snippet code (read from scripts/ file)
3. mcp__chrome-devtools__get_console_message → capture console output
4. Interpret results using thresholds below, provide recommendations

---

## [Snippet Name]

Description extracted from MDX page.

**Script:** `scripts/[name].js`

**Thresholds:** (when applicable)

| Rating | Metric | Meaning |
|--------|--------|---------|
| 🟢 Good | ... | ... |
| 🟡 Needs Improvement | ... | ... |
| 🔴 Poor | ... | ... |

Note: Skills are optimized for LLM consumption. External "Further Reading" links have been removed to keep focus on actionable execution instructions and thresholds.

Requirements

For full functionality, users need:

  • Chrome DevTools MCP server installed and configured
  • Browser page open in Chrome DevTools integration
  • Claude Code or compatible AI assistant

Skills work in two modes:

  1. With MCP: Full automation - agent can execute snippets and analyze results
  2. Without MCP: Agent provides snippet code for manual execution in DevTools console

Commits

Commit 1: Initial agent skills system

  • Generated 6 SKILL.md files with snippet metadata
  • Created build script (generate-skills.js) to automate generation
  • Copied all 48 snippets to skills/*/scripts/ directories

Commit 2: Enhanced installation and documentation

  • Added install-skills.js and install-global.js for easy setup
  • Created comprehensive SKILLS.md documentation
  • Updated README with agent skills section
  • Configured .claude/settings.json with all skills
  • Improved SKILL.md descriptions and compatibility notes
  • Removed external "Further Reading" links to optimize for LLM consumption (keep skills focused on execution, not documentation browsing)

Test Plan

  • Generate skills with npm run generate-skills
  • Verify all 6 SKILL.md files are created with correct content
  • Confirm snippets are copied to both skills/*/scripts/ and .claude/skills/*/scripts/
  • Test local installation with npm run install-skills
  • Verify .claude/settings.json contains all skills
  • Test that skills appear in Claude Code skill list
  • Validate skill execution with Chrome DevTools MCP server
  • Confirm snippet code executes correctly in browser console
  • Test global installation with npm run install-global

Impact

This change enables AI assistants to become autonomous web performance auditors, capable of:

  • Running diagnostics without manual intervention
  • Providing data-driven performance recommendations based on industry-standard thresholds
  • Teaching web performance best practices through contextual guidance
  • Streamlining the performance optimization workflow

The skills leverage existing snippets (no changes to core functionality) while making them accessible to the growing ecosystem of AI-powered development tools. By removing external reference links and focusing on execution instructions, the skills are optimized for LLM consumption and action rather than documentation browsing.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
webperf-snippets Ready Ready Preview, Comment Mar 4, 2026 9:47am
webperf-snippets-u6am Ready Ready Preview, Comment Mar 4, 2026 9:47am

nucliweb added 7 commits March 4, 2026 10:42
Converts the 46 JS snippets into actionable SKILL.md files for AI agents
(Claude Code, Cursor, Copilot). Each skill contains a snippet index, execution
instructions for Chrome DevTools MCP, thresholds, and links to further reading.
Snippet code stays in scripts/ to be read on demand, keeping SKILL.md concise.

Skills generated:
- skills/webperf/               meta-skill router (46 snippets, 5 categories)
- skills/webperf-core-web-vitals/  7 snippets: LCP, CLS, INP...
- skills/webperf-loading/       27 snippets: TTFB, FCP, fonts, scripts...
- skills/webperf-interaction/    8 snippets: LoAF, LongTask, scroll...
- skills/webperf-media/          3 snippets: images, video, SVG
- skills/webperf-resources/      1 snippet:  network bandwidth

Run: npm run generate-skills
- Add install-skills.js script for local Claude Code installation
- Add install-global.js script for global skills setup
- Update generate-skills.js to copy snippets to .claude/skills/
- Update all SKILL.md files with improved descriptions and compatibility notes
- Add SKILLS.md documentation for agent skills usage
- Configure .claude/settings.json with all webperf skills
- Update README with agent skills section
Detects client-side redirects that impact Core Web Vitals, particularly LCP.
Helps identify unnecessary JavaScript-based redirects that should be replaced
with server-side 301/302 redirects for better performance.

Features:
- Detects same-origin document navigations (potential client-side redirects)
- Filters out third-party iframes (analytics, ads, GTM)
- Calculates performance impact and overhead
- Provides contextual recommendations with Nginx config examples
- Auto-detects language-based redirect patterns
- Distinguishes between problematic redirects and acceptable SPA routing

Based on analysis identifying client-side redirects as critical LCP optimization
opportunity (potential 81% improvement when replaced with server-side redirects).
Regenerates webperf skills to include the new Client-Side Redirect Detection
snippet in the webperf-loading skill category.

Changes:
- webperf-loading: 27 → 28 snippets
- Total snippets: 46 → 47
- Added Client-Side-Redirect-Detection.js to skill scripts

The snippet is now available for use via MCP/agent skills to detect
client-side redirects impacting Core Web Vitals.
Implements a persistent system for defining workflows and decision trees
that guide AI agents through autonomous performance analysis.

ARCHITECTURE:
- Workflows stored in snippets/{Category}/WORKFLOWS.md (source of truth)
- generate-skills.js reads and injects workflows into generated SKILL.md
- Workflows persist across regenerations (not lost on rebuild)

LOADING SKILL ENHANCEMENTS:
- 8 Common Workflows covering major use cases:
  * Complete loading performance audit (6-snippet sequence)
  * Server/backend performance investigation
  * Font loading optimization
  * Script performance deep dive
  * Resource hints & priority optimization
  * CSS optimization workflow
  * Image loading audit
  * SSR/framework performance analysis

- 16 Decision Trees with conditional logic:
  * If TTFB > 600ms → run TTFB-Sub-Parts.js
  * If FCP > 1.8s → run render-blocking + critical CSS analysis
  * If many third-party scripts → run timing + execution analysis
  * And 13 more threshold-based triggers

BENEFITS:
- Agents can autonomously execute multi-snippet audits
- Progressive diagnosis based on measurement results
- Context-aware snippet selection
- Reduces need for user to know specific snippet names

DOCUMENTATION:
- snippets/README.md: explains workflow system architecture
- README.md: highlights intelligent features in skills section
- SKILLS.md: documents workflow capabilities and development process

Files changed:
- scripts/generate-skills.js: workflow injection logic
- snippets/Loading/WORKFLOWS.md: source workflows (NEW)
- snippets/README.md: architecture documentation (NEW)
- skills/webperf-loading/SKILL.md: generated with workflows
- .claude/skills/webperf-loading/SKILL.md: installed with workflows
- README.md: updated skills section with workflow examples
- SKILLS.md: added workflow documentation and examples
Updated all skill descriptions to highlight intelligent automation features:

- Core Web Vitals: Automated workflows with decision trees for LCP deep dive
  (5 phases), CLS investigation (loading vs interaction), and INP debugging
  (latency breakdown + attribution)

- Loading: Automated TTFB breakdown (DNS/connection/server), script loading
  anti-pattern detection (async/defer/preload conflicts), render-blocking
  identification, and resource hints validation

- Interaction: Automated script attribution when long frames detected, input
  latency phase breakdown, and layout shift correlation with interactions

- Media: Decision trees that detect LCP images and trigger format/lazy-loading
  analysis, identify layout shift risks, and flag lazy loading issues

- Resources: Connection-aware performance budgets and adaptive loading
  strategies based on network type (2g/3g/4g), RTT, and save-data mode

Enhanced generate-skills.js to automatically copy generated skills to
.claude/skills/ directory, eliminating manual rsync step.
@nucliweb nucliweb force-pushed the feat/agent-skills branch from 6d80039 to 926744c Compare March 4, 2026 09:44
@nucliweb nucliweb merged commit c68cd8b into main Mar 4, 2026
3 checks passed
@nucliweb nucliweb deleted the feat/agent-skills branch March 4, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant