Skip to content

feat(skills): add Nuxt 4 frontend patterns (rebased #643)#683

Closed
affaan-m wants to merge 16 commits intomainfrom
community/pr-643-nuxt-patterns
Closed

feat(skills): add Nuxt 4 frontend patterns (rebased #643)#683
affaan-m wants to merge 16 commits intomainfrom
community/pr-643-nuxt-patterns

Conversation

@affaan-m
Copy link
Owner

@affaan-m affaan-m commented Mar 20, 2026

Summary

  • Rebased community PR feat(skills): add Nuxt 4 patterns skill #643 by @yongggquannn onto latest main
  • Adds nuxt-4-frontend-patterns skill with comprehensive Nuxt 4 development patterns
  • Fixed catalog count mismatch in AGENTS.md and README.md (27 agents, 114 skills, 58 commands)
  • All 1421 tests passing

Original PR

Closes #643

Test plan

  • All 1421 tests pass after rebase
  • Catalog counts match filesystem
  • Clean rebase (no conflicts)

Summary by cubic

Adds the nuxt-4-frontend-patterns skill with production Nuxt 4 patterns for SSR safety, performance, and data fetching. Also fixes SKILL parsing and example issues, and syncs catalog counts.

  • New Features

    • SSR safety: hydration-safe state (useState, useCookie), browser-only guards, ClientOnly.
    • Performance: route rules (prerender, swr, isr, ssr: false), lazy components/hydration, NuxtLink prefetch, NuxtImg optimization.
    • Data + plugins: useFetch/useAsyncData with header forwarding and error states; plugin best practices with parallel loading; @vueuse/nuxt patterns (storage, breakpoints with ssrWidth, dark mode, intersection observer, debounced search, shortcuts).
  • Bug Fixes

    • Fix SKILL frontmatter (remove heading in name, add closing ---) so catalog parses; convert pitfalls to bullet points.
    • Repair examples and types: add missing script tags/refs, correct useFetch placement, complete useScript manual trigger, fix keyboard shortcuts runtime error and item types; update responsive guidance to prefer CSS-first.
    • Sync catalog counts in AGENTS.md and README.md (27 agents, 114 skills, 58 commands).

Written for commit 50b11a0. Summary will update on new commits.

Summary by CodeRabbit

  • Documentation
    • Added a comprehensive Nuxt 4 / Vue 3 frontend patterns guide covering SSR-safe practices, performance optimizations, data fetching, hydration strategies, third-party integration patterns, and common pitfalls.
    • Updated catalog/inventory counts to: 27 agents, 114 skills, 58 commands.

@ecc-tools
Copy link
Contributor

ecc-tools bot commented Mar 20, 2026

Analyzing 5000 commits...

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2026

📝 Walkthrough

Walkthrough

Added a new comprehensive Nuxt 4 frontend patterns skill (documentation-only) and updated project documentation counts: skills 109 → 114, commands 57 → 58.

Changes

Cohort / File(s) Summary
Inventory Count Updates
AGENTS.md, README.md
Updated documented counts: workflow skills increased 109 → 114; slash commands increased 57 → 58. Adjusted README feature parity table accordingly.
New Nuxt Skill
skills/nuxt-4-frontend-patterns/SKILL.md
Added a new SKILL.md with production-focused Nuxt 4 / Vue 3 guidance: SSR-safe hydration patterns, performance (routeRules, lazy loading/hydration, NuxtImg), data fetching (useFetch/useAsyncData), plugin/composable best practices, VueUse examples, and common pitfalls.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 I hopped through docs to add Nuxt cheer,
SSR-safe patterns now appear near,
Lazy load dreams and hydration light,
Catalog grows with a springtime bite,
Small crumbs of guidance, big delight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the main change: adding a new Nuxt 4 frontend patterns skill with a rebase reference, directly reflecting the primary deliverable.
Linked Issues check ✅ Passed All primary coding objectives from issue #643 are met: new skill added, hydration safety patterns documented, performance optimization guidance included, data-fetching best practices covered, and plugin/VueUse integration documented.
Out of Scope Changes check ✅ Passed All changes are in scope: the new skill documentation, supporting catalog count updates in AGENTS.md and README.md directly address the linked issue requirements with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch community/pr-643-nuxt-patterns
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ecc-tools
Copy link
Contributor

ecc-tools bot commented Mar 20, 2026

Analysis Complete

Generated ECC bundle from 500 commits | Confidence: 100%

View Pull Request #685

Repository Profile
Attribute Value
Language JavaScript
Framework Not detected
Commit Convention conventional
Test Directory separate
Detected Workflows (9)
Workflow Description
feature-development Standard feature implementation workflow
add-new-skill Adds a new skill to the codebase, including documentation and cross-harness copies if needed.
add-new-agent Adds a new agent to the codebase, registers it in documentation and mapping files.
add-new-language-rules Adds a new set of language rules (coding-style, hooks, patterns, security, testing) for a supported language.
sync-catalog-counts Synchronizes the documented counts of agents, skills, and commands in AGENTS.md and README.md with the actual catalog.
Generated Instincts (17)
Domain Count
git 2
code-style 3
testing 3
workflow 9

After merging, import with:

/instinct-import .claude/homunculus/instincts/inherited/everything-claude-code-instincts.yaml

Files

  • .claude/ecc-tools.json
  • .claude/skills/everything-claude-code/SKILL.md
  • .agents/skills/everything-claude-code/SKILL.md
  • .agents/skills/everything-claude-code/agents/openai.yaml
  • .claude/identity.json
  • .codex/config.toml
  • .codex/AGENTS.md
  • .codex/agents/explorer.toml
  • .codex/agents/reviewer.toml
  • .codex/agents/docs-researcher.toml
  • .claude/homunculus/instincts/inherited/everything-claude-code-instincts.yaml
  • .claude/rules/everything-claude-code-guardrails.md
  • .claude/research/everything-claude-code-research-playbook.md
  • .claude/team/everything-claude-code-team-config.json
  • .claude/enterprise/controls.md
  • .claude/commands/feature-development.md
  • .claude/commands/add-new-skill.md
  • .claude/commands/add-new-agent.md

ECC Tools | Everything Claude Code

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 20, 2026

Greptile Summary

This PR adds a new nuxt-4-frontend-patterns skill covering SSR hydration safety, hybrid rendering with route rules, lazy loading, data fetching, VueUse integration, and plugin best practices for production Nuxt 4 applications. It also syncs the catalog counts in AGENTS.md and README.md to reflect the addition (113 → 114 skills). The skill is well-structured and covers the most common Nuxt 4 pain points, but several examples reference external modules without noting the required installation step.

Key observations:

  • useRequestHeaders is called inside the useAsyncData handler rather than outside it — this deviates from the official Nuxt docs pattern and could mislead developers about composable context rules.
  • <NuxtImg> examples appear without any mention of the required @nuxt/image module, mirroring the already-noted gap for useScriptGoogleAnalytics / @nuxtjs/scripts.
  • Several issues were flagged in earlier review rounds (missing anti-pattern in the "Avoid Non-Deterministic Rendering" section, import.meta.client top-level await context, keyboard shortcut with no close path, redundant useBreakpoints import, @nuxtjs/scripts missing install note) — these remain open and should be addressed before merge.
  • Catalog count updates in AGENTS.md and README.md are accurate and consistent.

Confidence Score: 3/5

  • Safe to merge once the missing module installation notes and useRequestHeaders pattern are corrected; the changes are documentation-only and carry no runtime risk to the host project.
  • The PR is documentation-only (a new SKILL.md + count bumps), so it cannot break any runtime code. However, multiple issues remain open from prior review rounds — missing module prerequisites, a misleading useRequestHeaders usage, and an incomplete keyboard-shortcut example — meaning developers who copy the patterns verbatim could run into subtle bugs. A score of 3 reflects that the content is broadly useful and the catalog changes are correct, but the skill needs a few more fixes before it fully meets production-documentation standards.
  • skills/nuxt-4-frontend-patterns/SKILL.md requires attention for missing module installation notes and the useRequestHeaders callback pattern.

Important Files Changed

Filename Overview
skills/nuxt-4-frontend-patterns/SKILL.md New 500-line skill covering Nuxt 4 SSR safety, performance, data fetching, and VueUse integration. Several examples are missing required module installation notes (@nuxt/image for NuxtImg, @nuxtjs/scripts for useScriptGoogleAnalytics), useRequestHeaders is called inside an useAsyncData callback rather than the recommended outer-scope pattern, and the keyboard shortcut example only shows opening the palette with no close mechanism.
AGENTS.md Count updated from 113 to 114 skills — correct and matches the new skill added in this PR.
README.md Skill counts updated from 113 to 114 in three places consistently — accurate catalog sync.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Page Request] --> B{Route Rule?}
    B -->|prerender: true| C[Static HTML\nServed from CDN]
    B -->|swr: N seconds| D[SSR + Cache\nStale-While-Revalidate]
    B -->|isr: N seconds| E[SSR + Cache\nIncremental Static Regen]
    B -->|ssr: false| F[SPA / Client-Only\nNo SSR]
    B -->|No rule| G[Full SSR\nEvery Request]

    C --> H[Hydration]
    D --> H
    E --> H
    G --> H

    H --> I{Hydration Safe?}
    I -->|useState / useCookie| J[✅ Same value\nServer & Client]
    I -->|Math.random / Date.now\nin template| K[❌ Mismatch\nDifferent values]
    I -->|Browser API in setup| L[❌ Error on Server]

    J --> M[Interactive App]
    K --> N[Fix: Wrap in useState]
    L --> O[Fix: onMounted or\nimport.meta.client guard]
    N --> M
    O --> M

    F --> P[Client Render Only\nNo hydration step]
    P --> M
Loading

Last reviewed commit: "fix: update catalog ..."

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Around line 1073-1074: The README has inconsistent counts: update the later
"Cross-Tool Feature Parity" table so its "Commands" and "Skills" rows match the
earlier values shown (Commands: 58 and 31; Skills: 114 and 37) — locate the
pipe-table under the "Cross-Tool Feature Parity" heading and replace the
outdated numbers with 58/31 for Commands and 114/37 for Skills so both tables
are consistent.

In `@skills/nuxt-4-frontend-patterns/SKILL.md`:
- Around line 11-21: Rename the existing "## When to Activate" section to the
required "## When to Use" and move its bullet list under that heading; then add
a new "## How It Works" section summarizing the core concepts (SSR vs CSR,
hydration handling, fetch/state patterns, hybrid rendering and route rules, and
integration points like VueUse) and a new "## Examples" section containing at
least two short example use-cases (one showing handling of useFetch/useAsyncData
in SSR and one showing a route-level hybrid rendering or plugin script handling)
so the SKILL.md matches the repo convention; update headings exactly to "## When
to Use", "## How It Works", and "## Examples" in
skills/nuxt-4-frontend-patterns/SKILL.md and keep the existing "Project
Structure" section below.
- Around line 1-5: The new skill "nuxt-4-frontend-patterns" is not registered in
the install modules manifest, so add the skill folder name to the
framework-language paths list in manifests/install-modules.json; specifically,
update the array that lists skills (the same list referenced by
selective/module-based installs) to include "skills/nuxt-4-frontend-patterns" so
installers can discover it, ensuring the entry matches the existing path format
used by other skills.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3150a4c2-bc54-411e-b22a-ebe19b17a21c

📥 Commits

Reviewing files that changed from the base of the PR and between 07f6156 and 9e01b82.

📒 Files selected for processing (3)
  • AGENTS.md
  • README.md
  • skills/nuxt-4-frontend-patterns/SKILL.md

Comment on lines +1 to +5
---
name: nuxt-4-frontend-patterns
description: Nuxt 4 frontend patterns — hydration safety, performance optimization, route rules, lazy loading, plugin best practices, data fetching, and VueUse integration for production Vue 3/Nuxt apps.
origin: ECC
---
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Skill is added but appears unregistered in install modules.

skills/nuxt-4-frontend-patterns is not present in manifests/install-modules.json (framework-language paths list in the provided snippet), so selective/module-based installs may never include this skill.

Suggested manifest update
--- a/manifests/install-modules.json
+++ b/manifests/install-modules.json
@@
         "skills/frontend-patterns",
+        "skills/nuxt-4-frontend-patterns",
         "skills/frontend-slides",
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@skills/nuxt-4-frontend-patterns/SKILL.md` around lines 1 - 5, The new skill
"nuxt-4-frontend-patterns" is not registered in the install modules manifest, so
add the skill folder name to the framework-language paths list in
manifests/install-modules.json; specifically, update the array that lists skills
(the same list referenced by selective/module-based installs) to include
"skills/nuxt-4-frontend-patterns" so installers can discover it, ensuring the
entry matches the existing path format used by other skills.

Comment on lines +11 to +21
## When to Activate

- Building Nuxt 4 / Vue 3 applications
- Fixing hydration mismatch warnings
- Optimizing Core Web Vitals (LCP, CLS, INP)
- Configuring hybrid rendering or route rules
- Working with `useFetch`, `useAsyncData`, or `useState`
- Integrating VueUse composables in an SSR context
- Managing third-party scripts or plugins

## Project Structure
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add canonical skill sections required by repo conventions.

Please include explicit ## When to Use, ## How It Works, and ## Examples headings. Current structure is close, but the required section names/shape are not fully present, which can break consistency across skills.

As per coding guidelines, “Skills should be formatted as Markdown with clear sections for When to Use, How It Works, and Examples”.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@skills/nuxt-4-frontend-patterns/SKILL.md` around lines 11 - 21, Rename the
existing "## When to Activate" section to the required "## When to Use" and move
its bullet list under that heading; then add a new "## How It Works" section
summarizing the core concepts (SSR vs CSR, hydration handling, fetch/state
patterns, hybrid rendering and route rules, and integration points like VueUse)
and a new "## Examples" section containing at least two short example use-cases
(one showing handling of useFetch/useAsyncData in SSR and one showing a
route-level hybrid rendering or plugin script handling) so the SKILL.md matches
the repo convention; update headings exactly to "## When to Use", "## How It
Works", and "## Examples" in skills/nuxt-4-frontend-patterns/SKILL.md and keep
the existing "Project Structure" section below.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 3 files

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="skills/nuxt-4-frontend-patterns/SKILL.md">

<violation number="1" location="skills/nuxt-4-frontend-patterns/SKILL.md:365">
P2: The claim that all VueUse composables are auto-imported is incorrect; @vueuse/nuxt has documented exclusions, so this guidance can cause missing-import/runtime confusion.</violation>

<violation number="2" location="skills/nuxt-4-frontend-patterns/SKILL.md:372">
P2: The storage example is labeled SSR-safe, but it reads browser storage without `initOnMounted`, which can produce server/client state divergence during hydration.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

})
```

All VueUse composables are auto-imported — no manual imports needed.
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The claim that all VueUse composables are auto-imported is incorrect; @vueuse/nuxt has documented exclusions, so this guidance can cause missing-import/runtime confusion.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At skills/nuxt-4-frontend-patterns/SKILL.md, line 365:

<comment>The claim that all VueUse composables are auto-imported is incorrect; @vueuse/nuxt has documented exclusions, so this guidance can cause missing-import/runtime confusion.</comment>

<file context>
@@ -0,0 +1,500 @@
+})
+```
+
+All VueUse composables are auto-imported — no manual imports needed.
+
+### SSR-Safe Storage
</file context>
Suggested change
All VueUse composables are auto-imported — no manual imports needed.
Most VueUse composables are auto-imported, but conflicted names (for example `useStorage`, `useFetch`, `useCookie`, and `useHead`) should be imported explicitly from `@vueuse/core` when needed.
Fix with Cubic

Comment on lines +372 to +373
const theme = useLocalStorage('theme', 'light')
const session = useSessionStorage('session-data', { loggedIn: false })
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The storage example is labeled SSR-safe, but it reads browser storage without initOnMounted, which can produce server/client state divergence during hydration.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At skills/nuxt-4-frontend-patterns/SKILL.md, line 372:

<comment>The storage example is labeled SSR-safe, but it reads browser storage without `initOnMounted`, which can produce server/client state divergence during hydration.</comment>

<file context>
@@ -0,0 +1,500 @@
+```vue
+<script setup lang="ts">
+// Good: useLocalStorage is SSR-safe via @vueuse/nuxt
+const theme = useLocalStorage('theme', 'light')
+const session = useSessionStorage('session-data', { loggedIn: false })
+</script>
</file context>
Suggested change
const theme = useLocalStorage('theme', 'light')
const session = useSessionStorage('session-data', { loggedIn: false })
const theme = useLocalStorage('theme', 'light', { initOnMounted: true })
const session = useSessionStorage('session-data', { loggedIn: false }, { initOnMounted: true })
Fix with Cubic

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e01b8282f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +242 to +245
const { load, proxy } = useScriptGoogleAnalytics({
id: 'G-XXXXXXX',
scriptOptions: { trigger: 'manual' },
})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document the @nuxt/scripts prerequisite

useScriptGoogleAnalytics() is not part of Nuxt 4 core; it is provided by the separate @nuxt/scripts module. In a plain Nuxt app, copying this section verbatim will fail because the composable is undefined unless the reader has already run the Scripts module install and added it to modules. Please add that prerequisite here or switch this example to a core Nuxt API so the skill stays copy-paste safe.

Useful? React with 👍 / 👎.

})
```

All VueUse composables are auto-imported — no manual imports needed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Narrow the VueUse auto-import claim

This sentence is broader than what @vueuse/nuxt actually does. VueUse explicitly disables auto-imports for conflict-prone utilities like useFetch, useCookie, useHead, useStorage, and useImage; telling readers that all composables are auto-imported will lead to unresolved imports or accidental use of Nuxt's similarly named composables when they expand beyond the examples in this skill.

Useful? React with 👍 / 👎.

@affaan-m affaan-m force-pushed the community/pr-643-nuxt-patterns branch from 9e01b82 to 9f86e55 Compare March 20, 2026 08:19
@affaan-m affaan-m force-pushed the community/pr-643-nuxt-patterns branch from 9f86e55 to 50b11a0 Compare March 20, 2026 08:48
Comment on lines +307 to +312
const { data: user } = await useAsyncData('user', () => {
return $fetch('/api/user', {
headers: useRequestHeaders(['cookie']),
})
})
</script>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 useRequestHeaders called inside async callback

useRequestHeaders is a Nuxt composable and must be called synchronously in the setup scope (or in a context where the Nuxt instance is available synchronously). Calling it inside the callback passed to useAsyncData is non-standard — the official Nuxt docs consistently show it captured before the useAsyncData call. Inside the async callback, Nuxt's composable context may not be guaranteed, especially on client-side re-fetches triggered by refreshNuxtData or navigation.

Capture the headers outside the handler to match the documented pattern:

Suggested change
const { data: user } = await useAsyncData('user', () => {
return $fetch('/api/user', {
headers: useRequestHeaders(['cookie']),
})
})
</script>
const headers = useRequestHeaders(['cookie'])
const { data: user } = await useAsyncData('user', () => {
return $fetch('/api/user', {
headers,
})
})

Comment on lines +211 to +235
### Image Optimization with NuxtImg

```vue
<template>
<!-- High priority: hero/LCP image -->
<NuxtImg
src="/hero.jpg"
format="webp"
:preload="{ fetchPriority: 'high' }"
loading="eager"
width="1200"
height="600"
/>

<!-- Low priority: below the fold -->
<NuxtImg
src="/thumbnail.jpg"
format="webp"
loading="lazy"
fetchpriority="low"
width="300"
height="200"
/>
</template>
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 NuxtImg requires unlisted @nuxt/image module

<NuxtImg> is not part of Nuxt core — it is provided by the @nuxt/image module. A developer copying these examples without that module installed will get a "Unknown custom element: <NuxtImg>" warning and the images will not render correctly. This is the same class of issue as the already-noted useScriptGoogleAnalytics / @nuxtjs/scripts dependency.

Consider adding a setup note before this section:

> Requires `@nuxt/image`: `npx nuxt@latest module add image`

Copy link

@dtjldamien dtjldamien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool stuff @yongggquannn !

@affaan-m
Copy link
Owner Author

Will re-apply on fresh branch

@affaan-m affaan-m closed this Mar 20, 2026
@affaan-m affaan-m deleted the community/pr-643-nuxt-patterns branch March 20, 2026 13:51
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.

3 participants