All skills
onmax avatar

/nuxt-modules

@22e13a9

Use when creating Nuxt modules: (1) Published npm modules (@nuxtjs/, nuxt-), (2) Local project modules (modules/ directory), (3) Runtime extensions (components, composables, plugins), (4) Server extensions (API routes, middleware), (5) Releasing/publishing modules to npm, (6) Setting up CI/CD workflows for modules. Provides defineNuxtModule patterns, Kit utilities, hooks, E2E testing, and release automation.

  • 4 files
  • 21.5 KB
  • MIT
  • Updated 8 months ago
  • GitHub

Use this Skill: https://skilld.dev/gh/onmax/claude-config/nuxt-modules

This session only. Nothing lands on disk.

referencesci-workflows.md

≈1.2k tokens on demand. Your agent reads this file only when SKILL.md points to it.

CI Workflow Templates

Copy-paste templates for GitHub Actions.

Contents


ci.yml

Runs lint, typecheck, and tests on every push/PR/tag.

name: ci

on:
  push:
    branches: [main]
    tags: ['v*']
  pull_request:
    branches: [main]

jobs:
  ci:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: pnpm

      - run: pnpm install
      - run: pnpm dev:prepare
      - run: pnpm lint
      - run: pnpm typecheck
      - run: pnpm test

pkg.yml

Publishes preview packages for every PR via pkg-pr-new.

name: pkg.new

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  pkg:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: pnpm

      - run: pnpm install
      - run: pnpm dev:prepare
      - run: pnpm prepack
      - run: pnpm dlx pkg-pr-new publish

release.yml

Triggered by tag push. Waits for CI, then publishes to npm via OIDC + creates GitHub release.

name: release

permissions:
  id-token: write
  contents: write
  actions: read

on:
  push:
    tags:
      - 'v*'

jobs:
  wait-for-ci:
    runs-on: ubuntu-latest
    steps:
      - name: Wait for CI to complete
        uses: lewagon/wait-on-check-action@v1.3.4
        with:
          ref: ${{ github.sha }}
          check-name: ci
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          wait-interval: 10

  release:
    needs: wait-for-ci
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: pnpm/action-setup@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 24
          cache: pnpm
          registry-url: 'https://registry.npmjs.org'

      - run: pnpm install
      - run: pnpm dev:prepare
      - run: pnpm prepack

      - name: GitHub Release
        run: pnpm dlx changelogithub
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

      - name: Publish to npm
        run: npm publish --provenance --access public

npm Trusted Publishing Setup (OIDC)

Preferred method - No NPM_TOKEN secret needed. Uses OIDC for secure, tokenless authentication.

See also: ts-library/ci-workflows.md for general TypeScript library CI patterns.

Requirements

  1. Node.js 24+ (npm 11.5.1+ required for OIDC - Node 22 has npm 10.x which fails)
  2. Workflow permissions: id-token: write
  3. Publish command: must include --provenance flag
  4. package.json: must have repository field for provenance verification
  5. npm 2FA setting: "Require 2FA or granular access token" (first option, allows tokens)

package.json Requirements

Each package must have a repository field or provenance verification fails:

{
  "name": "my-package",
  "repository": { "type": "git", "url": "git+https://github.com/org/repo.git" }
}

Setup Steps

  1. Open package settings: https://www.npmjs.com/package/<PACKAGE_NAME>/access
  2. Scroll to "Publishing access" section
  3. Click "Add GitHub Actions" under Trusted Publishers
  4. Fill in the form:
    • Owner: <github-org-or-username>
    • Repository: <repo-name>
    • Workflow file: release.yml
    • Environment: (leave empty)
  5. Click "Add"

Repeat for each package in your monorepo.

Troubleshooting

Error Cause Fix
"Access token expired or revoked" E404 npm version too old Use Node.js 24 (npm 11.5.1+)
ENEEDAUTH Missing registry-url Add registry-url: 'https://registry.npmjs.org' to setup-node
"repository.url is empty" E422 Missing repository field Add repository to package.json
"npm/xyz not configured as trusted publisher" Mismatch in config Check owner, repo, workflow filename match exactly

Verify Setup

The workflow uses OIDC when:

  • id-token: write permission is set
  • --provenance flag is used
  • No NODE_AUTH_TOKEN env var is set

npm automatically detects GitHub Actions and authenticates via OIDC.

Source: SKILL.md on GitHub

No third-party reports yet.

Signed by skilld at 22e13a9. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 11 hours ago.

Activeupdated 8 months ago

README badge

README badge for onmax/claude-config/nuxt-modules