.crustagent/skills/npm-build/SKILL.md
npm/Vite local build pipeline for ClawChives©™. Covers dev server setup, production build, output verification, environment variable behavior, and known failure modes.
npx skillsauth add acidgreenservers/clawchives clawchives-npm-build©™Install this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
# Start both Vite dev server (4545) and API server (4242) concurrently
npm start
# Vite dev server only — API will be unreachable, use npm start instead
npm run dev
# API server only (port 4242)
npm run start:api
# Full TypeScript check + Vite production bundle → dist/
npm run build
# Run unit tests (Vitest)
npm test
Dev: http://localhost:4545 (Vite HMR)
API (dev): http://localhost:4242 (Express, separate process)
Docker: http://localhost:4545 (Vite bundle + Express, single container on same port)
tailwind.config.js exists in project rootpostcss.config.js exists in project rootnpx tsc --noEmitfetch() calls directly in components (all API calls go through RestAdapter)localhost:4242 in src/ (use getApiBaseUrl() from src/config/apiConfig.ts)import.meta.env.VITE_API_URL is used as exact literal (not type-cast — see Critical note below)After npm run build, verify dist/ is correct before using in Docker:
wc -c dist/assets/*.css
# Expected: 50000+ bytes
# FAIL if: ~1400 bytes — PostCSS did not run, @tailwind directives are raw text
head -c 200 dist/assets/*.css
# Expected: minified CSS rules starting with :root{... or *, ::before...
# FAIL if: @tailwind base;@tailwind components;@tailwind utilities;
grep -c "localhost:4242" dist/assets/*.js
# Expected: 0
# FAIL if: any number > 0 (Vite env replacement did not fire)
ls dist/assets/
# Expected: index-[hash].css index-[hash].js (and optionally main-logo.png)
ClawChives©™ uses a priority-based URL resolution via src/config/apiConfig.ts:
Priority 1 (highest): VITE_API_URL env var set at build time
Priority 2: Production build → "" (relative paths, same-origin)
Priority 3 (default): Dev fallback → http://localhost:4242
npm start)VITE_API_URL not set → import.meta.env.PROD = false → http://localhost:4242
Frontend (4545) calls API (4242) via absolute URL
npm run build)import.meta.env.PROD = true → API_BASE = ""
All /api/* calls are relative → works on any host/port (Docker, LAN, reverse proxy)
VITE_API_URL=https://bookmarks.yourdomain.com npm run build
# Bakes the custom URL into the bundle at build time
The VITE_API_URL env var MUST appear as the exact literal string in source code.
Vite's build-time string replacement only fires when it sees the exact token.
// ✅ CORRECT — Vite sees the exact string and replaces it
// @ts-ignore: Vite replaces import.meta.env.VITE_API_URL at build-time
const API_BASE = import.meta.env.PROD ? "" : (import.meta.env.VITE_API_URL || "http://localhost:4242");
// ❌ WRONG — TypeScript casting hides the string from Vite's scanner
const API_BASE = (import.meta as unknown as { env: Record<string, string> }).env.VITE_API_URL;
// Result: Vite never sees it → always serves localhost:4242 in production
This applies in ALL files that use VITE_API_URL:
src/services/database/rest/RestAdapter.tssrc/components/auth/LoginForm.tsxsrc/components/auth/SetupWizard.tsxsrc/App.tsxThe // @ts-ignore is intentional and must not be removed.
@tailwind Directives in OutputSymptom: npm run build completes but CSS file is ~1400 bytes of literal @tailwind text
Root Cause: postcss.config.js or tailwind.config.js missing from project root
Fix: Ensure both files exist:
postcss.config.js → plugins: { tailwindcss: {}, autoprefixer: {} }
tailwind.config.js → content: ["./index.html", "./src/**/*.{ts,tsx}"]
Symptom: npm run build exits with TS error on *.test.ts files
Root Cause: vitest types not installed or tsconfig includes test files
Fix: Ensure vitest is in devDependencies
Add to tsconfig.json: "exclude": ["**/*.test.ts", "**/*.spec.ts"]
Symptom: Production Docker container tries to connect to localhost:4242
Evidence: grep "localhost:4242" dist/assets/*.js returns matches
Root Cause: Type-cast used instead of exact import.meta.env.VITE_API_URL literal
Fix: See Critical section above — restore exact literal with // @ts-ignore
Symptom: File changes in src/ don't hot-reload in browser
Fix: Ensure vite.config.ts has server.host: true for LAN access
Confirm npm start is running (not npm run dev — that's Vite only, no API)
Symptom: All /api/* calls return 404 or connection refused on port 4242
Root Cause: Running npm run dev (Vite only) instead of npm start (both servers)
Fix: Always use npm start for local development
"The npm build is where the lobster grows its shell. If PostCSS doesn't run, the shell is gossamer — beautiful in source, invisible in production. Always verify the molt before deploying to the reef."
development
# Feature Development Assistant ## Mission Statement You are an expert full-stack developer who builds complete features from concept to implementation using Desktop Commander's file management capabilities. Your role is to analyze existing codebases, design feature architecture, implement all necessary code, and integrate seamlessly with existing systems. ## Important: Multi-Chat Workflow **Feature development requires multiple chat sessions to avoid context limits and manage implementation c
development
The canonical ClawChives©™ agent integration skill. Full API reference for autonomous agents (Lobsters©™) to authenticate, manage bookmarks, folders, and integrate with the ClawChive bookmarking system.
development
# Truthpack Updater Skill ## When to Use Activate this skill whenever: - A new route is added to `server/routes/` - A new environment variable is introduced - The project structure or a feature cluster is modified - Security protocols or auth rules are updated ## Instructions 1. **Audit Phase**: Perform a full-codebase scan (`grep` or `list_dir`) to identify changes since the last truthpack sync. 2. **Atomic Updates**: Update the corresponding JSON file in `.crustagent/vibecheck/truthpack/`:
development
# Truthpack Lookup Skill ## When to Use Activate this skill BEFORE generating any code that: - Creates or modifies API routes - References environment variables - Touches authentication/authorization - Modifies API request/response shapes ## Instructions 1. Read `.crustagent/vibecheck/truthpack/routes.json` for verified API routes 2. Read `.crustagent/vibecheck/truthpack/env.json` for verified environment variables 3. Read `.crustagent/vibecheck/truthpack/auth.json` for verified auth rules 4.