Skip to content

Commit 6ee252a

Browse files
committed
README.md- Add note on postinstall script to copy Claude folder
1 parent a49c147 commit 6ee252a

3 files changed

Lines changed: 59 additions & 0 deletions

File tree

.claude/skills/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Each skill is a single markdown file named `<area>-<task>.md`.
2626
├── storybook-add-font.md — add a new font to Storybook
2727
├── testing-add-unit-test.md — create a Vitest unit test with snapshots
2828
├── testing-add-playwright.md — create a Playwright visual regression test
29+
├── setup-postinstall.md — automate nuxt prepare + Claude skills copy via postinstall so neither is forgotten after npm install
2930
├── theming-override-default.md — replace the entire default theme with a custom colour scale (full palette swap)
3031
├── theming-partial-override.md — override a specific token category (forms, buttons, colours) without a full theme replacement
3132
├── colour-scheme-disable.md — disable light/dark scheme support in a consumer app
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Automate nuxt prepare and Claude Skills with postinstall
2+
3+
## Overview
4+
5+
Prevent two common "forgot to run after install" problems in a consuming app:
6+
7+
1. `nuxt prepare` — generates Nuxt type declarations. Skipping it causes TypeScript errors after install or package updates.
8+
2. `npm run setup:claude` — copies the latest `srcdev-nuxt-components` skills into `.claude/skills/srcdev-nuxt-components/`. Skipping it leaves Claude working from stale skill docs after a package update.
9+
10+
A `postinstall` script runs both automatically after every `npm install`.
11+
12+
## Steps
13+
14+
### 1. Add the scripts to package.json
15+
16+
```json
17+
"scripts": {
18+
"setup:claude": "cp -r node_modules/srcdev-nuxt-components/.claude/skills .claude/skills/srcdev-nuxt-components",
19+
"postinstall": "nuxt prepare && npm run setup:claude"
20+
}
21+
```
22+
23+
### 2. Check whether your app needs an env flag for nuxt prepare
24+
25+
Some apps set an env var to switch `nuxt.config.ts` behaviour when running outside the full dev server (e.g. `NUXT_STANDALONE=true`). Check your own `nuxt.config.ts` — if it gates any config behind such a variable, add it to the `postinstall` command:
26+
27+
```json
28+
"postinstall": "NUXT_STANDALONE=true nuxt prepare && npm run setup:claude"
29+
```
30+
31+
If your `nuxt.config.ts` has no such conditional, plain `nuxt prepare` is sufficient.
32+
33+
### 3. Run once manually to bootstrap
34+
35+
```bash
36+
npm run setup:claude
37+
```
38+
39+
From this point on, `npm install` and `npm ci` trigger both steps automatically.
40+
41+
## Notes
42+
43+
- Skills land in `.claude/skills/srcdev-nuxt-components/` — safe to re-run without overwriting your own project's skills.
44+
- `postinstall` also fires on `npm ci`, so CI environments get the skills too if they have a `.claude/` directory in the project.
45+
- If you do not want `postinstall` running in CI, guard it: `"postinstall": "[ \"$CI\" = \"true\" ] || (nuxt prepare && npm run setup:claude)"`.

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,19 @@ npm run setup:claude
4141

4242
Skills are copied into `.claude/skills/srcdev-nuxt-components/` so they never conflict with or overwrite skills your own project defines. Re-running the script after a package update is safe.
4343

44+
### Automate with postinstall (recommended)
45+
46+
To ensure skills are always up to date and `nuxt prepare` is never forgotten, combine both into a `postinstall` script. npm runs this automatically after every `npm install`:
47+
48+
```json
49+
"scripts": {
50+
"setup:claude": "cp -r node_modules/srcdev-nuxt-components/.claude/skills .claude/skills/srcdev-nuxt-components",
51+
"postinstall": "nuxt prepare && npm run setup:claude"
52+
}
53+
```
54+
55+
> If your app uses a standalone env flag for `nuxt prepare` (e.g. `NUXT_STANDALONE=true`), include it in the `postinstall` command. This is project-specific — check your own `nuxt.config.ts` to confirm whether it is needed.
56+
4457
---
4558

4659
## Consumer App Configuration

0 commit comments

Comments
 (0)