feat(performance): add core-web-vitals-cls skill#5
Open
phdro88 wants to merge 1 commit into
Open
Conversation
…orkflow - Setup: Lighthouse CLI install + Chromium-based browser detection (Chrome, Edge, Brave) - Workflow: sitemap fetch → URL sampling by page type → Lighthouse per type → culprit parsing - Baseline recording with before/after delta table (Performance Score + CLS) - Sitemap script handles both flat sitemaps and sitemap index files - Common culprits: unsized images, Lazy.tsx swap, w-auto h-auto, FOUT, duplicate elements - Gotchas section from real storefront investigations Made-with: Cursor
Contributor
There was a problem hiding this comment.
2 issues found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".claude-performance/skills/core-web-vitals-cls/SKILL.md">
<violation number="1" location=".claude-performance/skills/core-web-vitals-cls/SKILL.md:76">
P2: Child sitemaps ending in `.xml.gz` are not expanded, so sitemap-index sites can produce incomplete or invalid URL samples.</violation>
<violation number="2" location=".claude-performance/skills/core-web-vitals-cls/SKILL.md:91">
P2: PLP/PDP detection is brittle because trailing slashes change `path.count("/")`, causing category URLs to be misclassified as PDP.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| home.append(u) | ||
| elif "/busca" in path or "/search" in path or "?q=" in path: | ||
| search.append(u) | ||
| elif path.count("/") == 1: |
Contributor
There was a problem hiding this comment.
P2: PLP/PDP detection is brittle because trailing slashes change path.count("/"), causing category URLs to be misclassified as PDP.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .claude-performance/skills/core-web-vitals-cls/SKILL.md, line 91:
<comment>PLP/PDP detection is brittle because trailing slashes change `path.count("/")`, causing category URLs to be misclassified as PDP.</comment>
<file context>
@@ -0,0 +1,266 @@
+ home.append(u)
+ elif "/busca" in path or "/search" in path or "?q=" in path:
+ search.append(u)
+ elif path.count("/") == 1:
+ plp.append(u)
+ elif path.count("/") >= 2:
</file context>
| locs = fetch_locs(f"{SITE}/sitemap.xml") | ||
| all_urls = [] | ||
| for loc in locs: | ||
| if "sitemap" in loc and loc.endswith(".xml"): |
Contributor
There was a problem hiding this comment.
P2: Child sitemaps ending in .xml.gz are not expanded, so sitemap-index sites can produce incomplete or invalid URL samples.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .claude-performance/skills/core-web-vitals-cls/SKILL.md, line 76:
<comment>Child sitemaps ending in `.xml.gz` are not expanded, so sitemap-index sites can produce incomplete or invalid URL samples.</comment>
<file context>
@@ -0,0 +1,266 @@
+locs = fetch_locs(f"{SITE}/sitemap.xml")
+all_urls = []
+for loc in locs:
+ if "sitemap" in loc and loc.endswith(".xml"):
+ all_urls.extend(fetch_locs(loc))
+ else:
</file context>
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Agents working on storefront performance fixes had no structured way to diagnose CLS. The typical workflow was manual — open DevTools, run Lighthouse in the browser, eyeball culprits — which doesn't translate to autonomous agent execution.
This skill makes CLS diagnosis fully runnable by an agent from the terminal, end-to-end.
What
A new skill at
.claude-performance/skills/core-web-vitals-cls/that:brew install --cask google-chrome/sitemap.xml, handles both flat sitemaps and sitemap index files, classifies URLs by page type (home, PLP, PDP, search), and selects one representative URL per type. Running Lighthouse on every URL is wasteful — pages of the same type share components, so fixing one PLP fixes all.localhostso fixes can be validated before deploying. Produces one JSON report per page type.w-auto h-autooverriding HTML dimensions, duplicate SSR elements, FOUT — with code-level fixes for each.Tested on
HomyCasa (
www.homycasa.pt) — ran the full workflow end-to-end. Sitemap fetched, 4 URLs sampled, Lighthouse ran against localhost, baseline recorded. CLS was clean across all page types (< 0.1), which correctly concluded there was no CLS problem to fix on that site.Notes
/sitemap.xmlwhich points to sub-sitemaps).SITEvariable in the sitemap script must be replaced with the actual site URL before running.Summary by cubic
Adds the
core-web-vitals-clsskill to diagnose and fix CLS from the terminal usinglighthouse. It automates URL sampling, local audits, culprit extraction, and before/after reporting to make CLS fixes reproducible..claude-performance/skills/core-web-vitals-cls/with an end-to-end CLS workflow.lighthouseand Chromium detection (CHROME_PATHsupport,brewfallback)./sitemap.xml(flat or index) and selects one per page type (home, PLP, PDP, search).lighthouseagainstlocalhost, saves JSON per type, and parses Performance Score, CLS, and top layout shift elements.Written for commit fec5af2. Summary will update on new commits.