You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# 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`.
"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)"`.
Copy file name to clipboardExpand all lines: README.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,6 +41,19 @@ npm run setup:claude
41
41
42
42
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.
43
43
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`:
"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.
0 commit comments