From c1c7282b76461e295ecf9750616c3fd87bca0867 Mon Sep 17 00:00:00 2001 From: Joan Leon Date: Mon, 19 Oct 2026 13:20:50 +0200 Subject: [PATCH] fix(skills): run the skills in the conversation of the agent, not in a forked context A skill with context: fork runs in a subagent that does not get the conversation, so it does not know the URL the user gave or the page the agent opened. In the MCP evals (npm run eval:mcp, devtools-skill) the forked skill failed every time it was invoked, answering "no page to measure" or "the task gave no URL", and the agent went on by itself with more turns and tokens. The generator no longer writes context: fork in the category skills or the webperf router, and a test fails if a generated SKILL.md carries it. --- .claude/skills/webperf-core-web-vitals/SKILL.md | 1 - .claude/skills/webperf-interaction/SKILL.md | 1 - .claude/skills/webperf-loading/SKILL.md | 1 - .claude/skills/webperf-media/SKILL.md | 1 - .claude/skills/webperf-resources/SKILL.md | 1 - .claude/skills/webperf/SKILL.md | 1 - scripts/generate-skills.js | 2 -- scripts/skill-guidance.test.js | 10 ++++++++++ skills/webperf-core-web-vitals/SKILL.md | 1 - skills/webperf-interaction/SKILL.md | 1 - skills/webperf-loading/SKILL.md | 1 - skills/webperf-media/SKILL.md | 1 - skills/webperf-resources/SKILL.md | 1 - skills/webperf/SKILL.md | 1 - 14 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.claude/skills/webperf-core-web-vitals/SKILL.md b/.claude/skills/webperf-core-web-vitals/SKILL.md index 434f9cad..709d9e40 100644 --- a/.claude/skills/webperf-core-web-vitals/SKILL.md +++ b/.claude/skills/webperf-core-web-vitals/SKILL.md @@ -1,7 +1,6 @@ --- name: webperf-core-web-vitals description: Intelligent Core Web Vitals analysis with automated workflows and decision trees. Measures LCP, CLS, INP with guided debugging that automatically determines follow-up analysis based on results. Includes workflows for LCP deep dive (5 phases), CLS investigation (loading vs interaction), INP debugging (latency breakdown + attribution), and cross-skill integration with loading, interaction, and media skills. Use when the user asks about Core Web Vitals, LCP optimization, layout shifts, or interaction responsiveness. Compatible with Chrome DevTools MCP. -context: fork license: MIT metadata: author: Joan Leon | @nucliweb diff --git a/.claude/skills/webperf-interaction/SKILL.md b/.claude/skills/webperf-interaction/SKILL.md index ea6c2292..9e7ba539 100644 --- a/.claude/skills/webperf-interaction/SKILL.md +++ b/.claude/skills/webperf-interaction/SKILL.md @@ -1,7 +1,6 @@ --- name: webperf-interaction description: Intelligent interaction performance analysis with automated workflows for INP debugging, scroll jank investigation, and main thread blocking. Includes decision trees that automatically run script attribution when long frames detected, break down input latency phases, and correlate layout shifts with interactions. Features workflows for complete interaction audit, third-party script impact analysis, and animation performance debugging. Cross-skill integration with Core Web Vitals (INP/CLS correlation) and Loading (script execution analysis). Use when the user asks about slow interactions, janky scrolling, unresponsive pages, or INP optimization. Compatible with Chrome DevTools MCP. -context: fork license: MIT metadata: author: Joan Leon | @nucliweb diff --git a/.claude/skills/webperf-loading/SKILL.md b/.claude/skills/webperf-loading/SKILL.md index ac277889..1fea4de1 100644 --- a/.claude/skills/webperf-loading/SKILL.md +++ b/.claude/skills/webperf-loading/SKILL.md @@ -1,7 +1,6 @@ --- name: webperf-loading description: Intelligent loading performance analysis with automated workflows for TTFB investigation (DNS/connection/server breakdown), render-blocking detection, script performance deep dive (first vs third-party attribution), font optimization, and resource hints validation. Includes decision trees that automatically analyze TTFB sub-parts when slow, detect script loading anti-patterns (async/defer/preload conflicts), identify render-blocking resources, and validate resource hints usage. Features workflows for complete loading audit (6 phases), backend performance investigation, and priority optimization. Cross-skill integration with Core Web Vitals (LCP resource loading), Interaction (script execution blocking), and Media (lazy loading strategy). Use when the user asks about TTFB, FCP, render-blocking, slow loading, font performance, script optimization, or resource hints. Compatible with Chrome DevTools MCP. -context: fork license: MIT metadata: author: Joan Leon | @nucliweb diff --git a/.claude/skills/webperf-media/SKILL.md b/.claude/skills/webperf-media/SKILL.md index 997f6b2e..033076b4 100644 --- a/.claude/skills/webperf-media/SKILL.md +++ b/.claude/skills/webperf-media/SKILL.md @@ -1,7 +1,6 @@ --- name: webperf-media description: Intelligent media optimization with automated workflows for images, videos, and SVGs. Includes decision trees that detect LCP images (triggers format/lazy-loading/priority analysis), identify layout shift risks (missing dimensions), and flag lazy loading issues (above-fold lazy or below-fold eager). Features workflows for complete media audit, LCP image investigation, video performance (poster optimization), and SVG embedded bitmap detection. Cross-skill integration with Core Web Vitals (LCP/CLS impact) and Loading (priority hints, resource preloading). Provides performance budgets and format recommendations based on content type. Use when the user asks about image optimization, LCP is an image/video, layout shifts from media, or media loading strategy. Compatible with Chrome DevTools MCP. -context: fork license: MIT metadata: author: Joan Leon | @nucliweb diff --git a/.claude/skills/webperf-resources/SKILL.md b/.claude/skills/webperf-resources/SKILL.md index 7a2ac2d3..27cc913f 100644 --- a/.claude/skills/webperf-resources/SKILL.md +++ b/.claude/skills/webperf-resources/SKILL.md @@ -1,7 +1,6 @@ --- name: webperf-resources description: Intelligent network quality analysis with adaptive loading strategies. Detects connection type (2g/3g/4g), bandwidth, RTT, and save-data mode, then automatically triggers appropriate optimization workflows. Includes decision trees that recommend image compression for slow connections, critical CSS inlining for high RTT, and save-data optimizations (disable autoplay, reduce quality). Features connection-aware performance budgets (500KB for 2g, 1.5MB for 3g, 3MB for 4g+) and adaptive loading implementation guides. Cross-skill integration with Loading (TTFB impact), Media (responsive images), and Core Web Vitals (connection impact on LCP/INP). Use when the user asks about slow connections, mobile optimization, save-data support, or adaptive loading strategies. Compatible with Chrome DevTools MCP. -context: fork license: MIT metadata: author: Joan Leon | @nucliweb diff --git a/.claude/skills/webperf/SKILL.md b/.claude/skills/webperf/SKILL.md index e4693936..23ef4f41 100644 --- a/.claude/skills/webperf/SKILL.md +++ b/.claude/skills/webperf/SKILL.md @@ -1,7 +1,6 @@ --- name: webperf description: Web performance measurement and debugging toolkit. Use when the user asks about web performance, wants to audit a page, or says "analyze performance", "debug lcp", "check ttfb", "measure core web vitals", "audit images", or similar. -context: fork license: MIT metadata: author: Joan Leon | @nucliweb diff --git a/scripts/generate-skills.js b/scripts/generate-skills.js index 34338f32..1ded152e 100755 --- a/scripts/generate-skills.js +++ b/scripts/generate-skills.js @@ -446,7 +446,6 @@ async function generateCategorySkill(category, catConfig) { '---', `name: ${catConfig.skill}`, `description: ${catConfig.description}`, - 'context: fork', `license: ${SKILL_METADATA.license}`, 'metadata:', ...Object.entries(SKILL_METADATA.metadata).map(([k, v]) => ` ${k}: ${v}`), @@ -532,7 +531,6 @@ function generateMetaSkill() { '---', 'name: webperf', `description: ${metaDesc}`, - 'context: fork', `license: ${SKILL_METADATA.license}`, 'metadata:', ...Object.entries(SKILL_METADATA.metadata).map(([k, v]) => ` ${k}: ${v}`), diff --git a/scripts/skill-guidance.test.js b/scripts/skill-guidance.test.js index d05412a0..32718081 100644 --- a/scripts/skill-guidance.test.js +++ b/scripts/skill-guidance.test.js @@ -75,3 +75,13 @@ test('finds the generated guidance of every target', () => { assert.equal(categoryGuides.length, 5 * GENERATED_DIRS.length) assert.equal(routers.length, GENERATED_DIRS.length) }) + +// A skill in a forked context runs in a subagent that does not get the conversation: it does not know +// the URL the user gave or the page the agent opened, and answered "no page to measure" in the MCP evals +// (npm run eval:mcp). The skills run in the conversation of the agent instead. +for (const file of files.filter((f) => f.endsWith('SKILL.md'))) { + test(`${rel(file)} runs in the conversation of the agent, not in a forked context`, () => { + const frontmatter = read(file).split('\n---')[0] + assert.doesNotMatch(frontmatter, /^context:\s*fork/m) + }) +} diff --git a/skills/webperf-core-web-vitals/SKILL.md b/skills/webperf-core-web-vitals/SKILL.md index 434f9cad..709d9e40 100644 --- a/skills/webperf-core-web-vitals/SKILL.md +++ b/skills/webperf-core-web-vitals/SKILL.md @@ -1,7 +1,6 @@ --- name: webperf-core-web-vitals description: Intelligent Core Web Vitals analysis with automated workflows and decision trees. Measures LCP, CLS, INP with guided debugging that automatically determines follow-up analysis based on results. Includes workflows for LCP deep dive (5 phases), CLS investigation (loading vs interaction), INP debugging (latency breakdown + attribution), and cross-skill integration with loading, interaction, and media skills. Use when the user asks about Core Web Vitals, LCP optimization, layout shifts, or interaction responsiveness. Compatible with Chrome DevTools MCP. -context: fork license: MIT metadata: author: Joan Leon | @nucliweb diff --git a/skills/webperf-interaction/SKILL.md b/skills/webperf-interaction/SKILL.md index ea6c2292..9e7ba539 100644 --- a/skills/webperf-interaction/SKILL.md +++ b/skills/webperf-interaction/SKILL.md @@ -1,7 +1,6 @@ --- name: webperf-interaction description: Intelligent interaction performance analysis with automated workflows for INP debugging, scroll jank investigation, and main thread blocking. Includes decision trees that automatically run script attribution when long frames detected, break down input latency phases, and correlate layout shifts with interactions. Features workflows for complete interaction audit, third-party script impact analysis, and animation performance debugging. Cross-skill integration with Core Web Vitals (INP/CLS correlation) and Loading (script execution analysis). Use when the user asks about slow interactions, janky scrolling, unresponsive pages, or INP optimization. Compatible with Chrome DevTools MCP. -context: fork license: MIT metadata: author: Joan Leon | @nucliweb diff --git a/skills/webperf-loading/SKILL.md b/skills/webperf-loading/SKILL.md index ac277889..1fea4de1 100644 --- a/skills/webperf-loading/SKILL.md +++ b/skills/webperf-loading/SKILL.md @@ -1,7 +1,6 @@ --- name: webperf-loading description: Intelligent loading performance analysis with automated workflows for TTFB investigation (DNS/connection/server breakdown), render-blocking detection, script performance deep dive (first vs third-party attribution), font optimization, and resource hints validation. Includes decision trees that automatically analyze TTFB sub-parts when slow, detect script loading anti-patterns (async/defer/preload conflicts), identify render-blocking resources, and validate resource hints usage. Features workflows for complete loading audit (6 phases), backend performance investigation, and priority optimization. Cross-skill integration with Core Web Vitals (LCP resource loading), Interaction (script execution blocking), and Media (lazy loading strategy). Use when the user asks about TTFB, FCP, render-blocking, slow loading, font performance, script optimization, or resource hints. Compatible with Chrome DevTools MCP. -context: fork license: MIT metadata: author: Joan Leon | @nucliweb diff --git a/skills/webperf-media/SKILL.md b/skills/webperf-media/SKILL.md index 997f6b2e..033076b4 100644 --- a/skills/webperf-media/SKILL.md +++ b/skills/webperf-media/SKILL.md @@ -1,7 +1,6 @@ --- name: webperf-media description: Intelligent media optimization with automated workflows for images, videos, and SVGs. Includes decision trees that detect LCP images (triggers format/lazy-loading/priority analysis), identify layout shift risks (missing dimensions), and flag lazy loading issues (above-fold lazy or below-fold eager). Features workflows for complete media audit, LCP image investigation, video performance (poster optimization), and SVG embedded bitmap detection. Cross-skill integration with Core Web Vitals (LCP/CLS impact) and Loading (priority hints, resource preloading). Provides performance budgets and format recommendations based on content type. Use when the user asks about image optimization, LCP is an image/video, layout shifts from media, or media loading strategy. Compatible with Chrome DevTools MCP. -context: fork license: MIT metadata: author: Joan Leon | @nucliweb diff --git a/skills/webperf-resources/SKILL.md b/skills/webperf-resources/SKILL.md index 7a2ac2d3..27cc913f 100644 --- a/skills/webperf-resources/SKILL.md +++ b/skills/webperf-resources/SKILL.md @@ -1,7 +1,6 @@ --- name: webperf-resources description: Intelligent network quality analysis with adaptive loading strategies. Detects connection type (2g/3g/4g), bandwidth, RTT, and save-data mode, then automatically triggers appropriate optimization workflows. Includes decision trees that recommend image compression for slow connections, critical CSS inlining for high RTT, and save-data optimizations (disable autoplay, reduce quality). Features connection-aware performance budgets (500KB for 2g, 1.5MB for 3g, 3MB for 4g+) and adaptive loading implementation guides. Cross-skill integration with Loading (TTFB impact), Media (responsive images), and Core Web Vitals (connection impact on LCP/INP). Use when the user asks about slow connections, mobile optimization, save-data support, or adaptive loading strategies. Compatible with Chrome DevTools MCP. -context: fork license: MIT metadata: author: Joan Leon | @nucliweb diff --git a/skills/webperf/SKILL.md b/skills/webperf/SKILL.md index e4693936..23ef4f41 100644 --- a/skills/webperf/SKILL.md +++ b/skills/webperf/SKILL.md @@ -1,7 +1,6 @@ --- name: webperf description: Web performance measurement and debugging toolkit. Use when the user asks about web performance, wants to audit a page, or says "analyze performance", "debug lcp", "check ttfb", "measure core web vitals", "audit images", or similar. -context: fork license: MIT metadata: author: Joan Leon | @nucliweb