Skip to content

feat: add Nuxt 4 patterns skill#702

Merged
affaan-m merged 1 commit intomainfrom
community/nuxt4-patterns-skill
Mar 20, 2026
Merged

feat: add Nuxt 4 patterns skill#702
affaan-m merged 1 commit intomainfrom
community/nuxt4-patterns-skill

Conversation

@affaan-m
Copy link
Owner

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

Summary

  • add a new nuxt4-patterns skill covering hydration safety, route rules, lazy loading, and SSR-safe data fetching
  • update README and AGENTS catalog counts for the new skill

Testing

  • node tests/ci/validators.test.js
  • node tests/run-all.js (progresses through validators, hooks, and lib tests, then stalls locally in tests/scripts/claw.test.js because this machine has a real claude binary on PATH at /Users/affoon/.local/bin/claude)

Summary by cubic

Adds a new nuxt4-patterns skill to guide Nuxt 4 apps on hydration safety, route rules, lazy loading, and SSR-safe data fetching. Updates docs to reflect 115 total skills.

  • New Features
    • Added skills/nuxt4-patterns/SKILL.md with patterns for hydration safety, useFetch/useAsyncData, route rules, and lazy hydration/loading.
    • Included examples and a quick review checklist for common Nuxt 4 pitfalls.
    • Updated README.md and AGENTS.md to show 115 skills.

Written for commit f2cdcb7. Summary will update on new commits.

Summary by CodeRabbit

  • Documentation
    • Added comprehensive Nuxt 4 Patterns guide covering hydration safety, SSR-safe data fetching best practices, route rules configuration, and lazy loading/performance optimization strategies with implementation checklists.
    • Updated skills catalog count to 115.

@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

Three documentation files were updated to reflect a new addition to the skill catalog. The skill count across metadata and README references was incremented from 114 to 115. A new documentation file defining "Nuxt 4 Patterns" was added, covering SSR safety, data fetching, route rules, and lazy loading best practices.

Changes

Cohort / File(s) Summary
Documentation Metadata Updates
AGENTS.md, README.md
Incremented skill count from 114 to 115 in project metadata and feature parity table.
New Skill Documentation
skills/nuxt4-patterns/SKILL.md
Added comprehensive Nuxt 4 Patterns guide covering hydration safety, SSR-safe data fetching, route rules, lazy loading strategies, and a review checklist.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A fifteenth skill hops into the warren,
Nuxt patterns dance on the server with care,
Hydration flows safe, and routes find their share,
From the burrow of docs, our catalog's grown fair! 🌿

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add Nuxt 4 patterns skill' directly and clearly describes the main change—adding a new Nuxt 4 patterns skill to the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch community/nuxt4-patterns-skill
📝 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 #703

Repository Profile
Attribute Value
Language JavaScript
Framework Not detected
Commit Convention conventional
Test Directory separate
Detected Workflows (9)
Workflow Description
database-migration Database schema changes with migration files
feature-development Standard feature implementation workflow
add-new-skill Adds a new skill to the system, including documentation and sometimes scripts.
add-new-agent Adds a new agent to the system, with documentation and catalog registration.
add-language-rules Adds a new programming language's rule set (coding style, hooks, patterns, security, testing).
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/database-migration.md
  • .claude/commands/feature-development.md
  • .claude/commands/add-new-skill.md

ECC Tools | Everything Claude Code

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.

No issues found across 3 files

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: 1

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

Inline comments:
In `@skills/nuxt4-patterns/SKILL.md`:
- Around line 11-100: The SKILL.md file uses nonstandard headings; rename and
reorganize the content to match the repo skill template by adding three explicit
top-level sections titled "When to Use", "How It Works", and "Examples" (replace
"When to Activate" with "When to Use"; move the "Hydration Safety", "Data
Fetching", "Route Rules", and "Lazy Loading and Performance" subsections under a
single "How It Works" section; keep the code snippets and usage patterns under
"Examples" and include the Review Checklist there or under "How It Works" as
appropriate). Keep all existing content and code blocks intact, only
retitle/restructure headings in SKILL.md so the document follows the required
template.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 46a25223-411c-4893-a33f-021947ae2e68

📥 Commits

Reviewing files that changed from the base of the PR and between bea6854 and f2cdcb7.

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

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

- Hydration mismatches between server HTML and client state
- Route-level rendering decisions such as prerender, SWR, ISR, or client-only sections
- Performance work around lazy loading, lazy hydration, or payload size
- Page or component data fetching with `useFetch`, `useAsyncData`, or `$fetch`
- Nuxt routing issues tied to route params, middleware, or SSR/client differences

## Hydration Safety

- Keep the first render deterministic. Do not put `Date.now()`, `Math.random()`, browser-only APIs, or storage reads directly into SSR-rendered template state.
- Move browser-only logic behind `onMounted()`, `import.meta.client`, `ClientOnly`, or a `.client.vue` component when the server cannot produce the same markup.
- Use Nuxt's `useRoute()` composable, not the one from `vue-router`.
- Do not use `route.fullPath` to drive SSR-rendered markup. URL fragments are client-only, which can create hydration mismatches.
- Treat `ssr: false` as an escape hatch for truly browser-only areas, not a default fix for mismatches.

## Data Fetching

- Prefer `await useFetch()` for SSR-safe API reads in pages and components. It forwards server-fetched data into the Nuxt payload and avoids a second fetch on hydration.
- Use `useAsyncData()` when the fetcher is not a simple `$fetch()` call, when you need a custom key, or when you are composing multiple async sources.
- Give `useAsyncData()` a stable key for cache reuse and predictable refresh behavior.
- Keep `useAsyncData()` handlers side-effect free. They can run during SSR and hydration.
- Use `$fetch()` for user-triggered writes or client-only actions, not top-level page data that should be hydrated from SSR.
- Use `lazy: true`, `useLazyFetch()`, or `useLazyAsyncData()` for non-critical data that should not block navigation. Handle `status === 'pending'` in the UI.
- Use `server: false` only for data that is not needed for SEO or the first paint.
- Trim payload size with `pick` and prefer shallower payloads when deep reactivity is unnecessary.

```ts
const route = useRoute()

const { data: article, status, error, refresh } = await useAsyncData(
() => `article:${route.params.slug}`,
() => $fetch(`/api/articles/${route.params.slug}`),
)

const { data: comments } = await useFetch(`/api/articles/${route.params.slug}/comments`, {
lazy: true,
server: false,
})
```

## Route Rules

Prefer `routeRules` in `nuxt.config.ts` for rendering and caching strategy:

```ts
export default defineNuxtConfig({
routeRules: {
'/': { prerender: true },
'/products/**': { swr: 3600 },
'/blog/**': { isr: true },
'/admin/**': { ssr: false },
'/api/**': { cache: { maxAge: 60 * 60 } },
},
})
```

- `prerender`: static HTML at build time
- `swr`: serve cached content and revalidate in the background
- `isr`: incremental static regeneration on supported platforms
- `ssr: false`: client-rendered route
- `cache` or `redirect`: Nitro-level response behavior

Pick route rules per route group, not globally. Marketing pages, catalogs, dashboards, and APIs usually need different strategies.

## Lazy Loading and Performance

- Nuxt already code-splits pages by route. Keep route boundaries meaningful before micro-optimizing component splits.
- Use the `Lazy` prefix to dynamically import non-critical components.
- Conditionally render lazy components with `v-if` so the chunk is not loaded until the UI actually needs it.
- Use lazy hydration for below-the-fold or non-critical interactive UI.

```vue
<template>
<LazyRecommendations v-if="showRecommendations" />
<LazyProductGallery hydrate-on-visible />
</template>
```

- For custom strategies, use `defineLazyHydrationComponent()` with a visibility or idle strategy.
- Nuxt lazy hydration works on single-file components. Passing new props to a lazily hydrated component will trigger hydration immediately.
- Use `NuxtLink` for internal navigation so Nuxt can prefetch route components and generated payloads.

## Review Checklist

- First SSR render and hydrated client render produce the same markup
- Page data uses `useFetch` or `useAsyncData`, not top-level `$fetch`
- Non-critical data is lazy and has explicit loading UI
- Route rules match the page's SEO and freshness requirements
- Heavy interactive islands are lazy-loaded or lazily hydrated
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

Align required skill section headings with repo standard.

Please add explicit sections named When to Use, How It Works, and Examples (you can keep the current content and reorganize/retitle headings). Right now the document uses custom headings (When to Activate, Hydration Safety, etc.), which misses the required skill template structure.

As per coding guidelines, skills/**/*.md: 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/nuxt4-patterns/SKILL.md` around lines 11 - 100, The SKILL.md file uses
nonstandard headings; rename and reorganize the content to match the repo skill
template by adding three explicit top-level sections titled "When to Use", "How
It Works", and "Examples" (replace "When to Activate" with "When to Use"; move
the "Hydration Safety", "Data Fetching", "Route Rules", and "Lazy Loading and
Performance" subsections under a single "How It Works" section; keep the code
snippets and usage patterns under "Examples" and include the Review Checklist
there or under "How It Works" as appropriate). Keep all existing content and
code blocks intact, only retitle/restructure headings in SKILL.md so the
document follows the required template.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 20, 2026

Greptile Summary

This PR adds a new nuxt4-patterns skill covering hydration safety, SSR-safe data fetching, route rules, and lazy loading, and increments the skill count from 114 to 115 across AGENTS.md and README.md. The skill is well-structured and follows the repository's established format, but the useAsyncData code example contains a type error that would immediately surface in any project that follows it.

  • AGENTS.md / README.md: Count updates are consistent across all three occurrences in README.md and both occurrences in AGENTS.md — no issues.
  • skills/nuxt4-patterns/SKILL.md: The prose guidance is accurate and useful, but line 42 passes an arrow function () => \article:${route.params.slug}`as thekeyargument touseAsyncData. Nuxt 4 types keyasstring, not () => string`, so this is a TypeScript error that contradicts the text just above it which correctly advises a "stable key." The fix is to drop the wrapping arrow function and pass the template literal directly.

Confidence Score: 3/5

  • Safe to merge after fixing the incorrect useAsyncData key type in the example code block.
  • All changes are documentation/skill content — no executable code is shipped. However, the useAsyncData key example passes a function where Nuxt 4 requires a string, which will cause a TypeScript error in any project that copies the pattern verbatim. The skill's explicit goal is to guide correct Nuxt 4 usage, so shipping a type-incorrect example undermines that purpose and warrants a fix before merge.
  • skills/nuxt4-patterns/SKILL.md — line 42 uses an arrow function as the useAsyncData key instead of a plain string.

Important Files Changed

Filename Overview
skills/nuxt4-patterns/SKILL.md New Nuxt 4 skill covering SSR, hydration, route rules, lazy loading, and data fetching. Well-structured and aligned with repo format, but the useAsyncData code example passes a function as the key argument instead of a required string, which will produce a TypeScript error in any project following the example.
AGENTS.md Skill count updated from 114 to 115 in both the header paragraph and the project structure block — consistent and correct.
README.md Skill count updated from 114 to 115 in all three relevant locations (install confirmation line, comparison table, and any other count references) — consistent and correct.

Sequence Diagram

sequenceDiagram
    participant Browser
    participant NuxtServer
    participant API

    Note over Browser,API: SSR Data Fetching (useFetch / useAsyncData)
    Browser->>NuxtServer: Initial page request
    NuxtServer->>API: $fetch('/api/articles/:slug')
    API-->>NuxtServer: Article data
    NuxtServer->>API: $fetch('/api/articles/:slug/comments') [skipped if server:false]
    API-->>NuxtServer: Comments (optional)
    NuxtServer-->>Browser: HTML + serialised Nuxt payload

    Note over Browser,API: Hydration (no duplicate fetch)
    Browser->>Browser: Restore state from payload
    Browser->>Browser: Hydrate Vue components

    Note over Browser,API: Client-side lazy data (lazy:true / server:false)
    Browser->>API: $fetch('/api/articles/:slug/comments')
    API-->>Browser: Comments
    Browser->>Browser: Update UI (status: pending → success)
Loading

Last reviewed commit: "feat: add nuxt 4 pat..."

Comment on lines +41 to +44
const { data: article, status, error, refresh } = await useAsyncData(
() => `article:${route.params.slug}`,
() => $fetch(`/api/articles/${route.params.slug}`),
)
Copy link
Contributor

Choose a reason for hiding this comment

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

P1 useAsyncData key must be a string, not a function

The first argument to useAsyncData is typed as string in Nuxt 4 — passing an arrow function () => \article:${...}`in its place is a TypeScript type error and will not be treated as a reactive/computed key at runtime. The text immediately above this block correctly states "GiveuseAsyncData()` a stable key for cache reuse," but the example contradicts that guidance by wrapping the key in a function.

Suggested change
const { data: article, status, error, refresh } = await useAsyncData(
() => `article:${route.params.slug}`,
() => $fetch(`/api/articles/${route.params.slug}`),
)
const { data: article, status, error, refresh } = await useAsyncData(
`article:${route.params.slug}`,
() => $fetch(`/api/articles/${route.params.slug}`),
)

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: f2cdcb77b7

ℹ️ 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".

```

✨ **That's it!** You now have access to 27 agents, 114 skills, and 59 commands.
✨ **That's it!** You now have access to 27 agents, 115 skills, and 59 commands.

Choose a reason for hiding this comment

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

P2 Badge Add nuxt4-patterns to the install manifests

Users who follow the manual/selective install flow shown just above (./install.sh typescript or --with lang:typescript) still will not receive this new skill. The installer resolves those selections through the framework-language module (scripts/lib/install-manifests.js / manifests/install-components.json), and that module’s paths in manifests/install-modules.json does not include skills/nuxt4-patterns or expose a skill:nuxt4-patterns/framework:nuxt component. After this change, the README advertises 115 skills, but a common install path continues to ship only 114.

Useful? React with 👍 / 👎.

@affaan-m affaan-m merged commit b77f495 into main Mar 20, 2026
40 checks passed
@affaan-m affaan-m deleted the community/nuxt4-patterns-skill branch March 20, 2026 13:51
@yongggquannn
Copy link

Thank you @affaan-m for adding the changes in #643! Looking forward to more contribution towards this repository!

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.

2 participants