write-js-packagelisted
Install: claude install-skill a-novel-kit/stack
# JS Package Writing Skill
Every backend service publishes a TypeScript REST client from `pkg/js/`. It is the service's public
JS surface: it mirrors the OpenAPI spec exactly and stays synchronized with the REST handlers.
**Before editing any file**, read the file first. Every service is scaffolded from
`service-template` and the layout is identical across all of them, so follow the patterns you find
rather than inventing a local variant. Read the OpenAPI spec (`openapi.yaml`) for every endpoint you
touch; the client contract must match it.
---
## Package Layout
```
pkg/js/
├── rest/ # Published npm package (@a-novel/<service-slug>-rest)
│ ├── src/
│ │ ├── index.ts # Re-exports everything — only file consumers import from
│ │ ├── api.ts # <Service>Api class (HTTP plumbing + system endpoints)
│ │ └── <domain>.ts # One file per resource domain (e.g., item.ts)
│ ├── dist/ # Build artefacts — never edit manually
│ ├── package.json
│ ├── tsconfig.json # Base TypeScript config
│ ├── tsconfig.build.json # Declaration-only build config
│ └── vite.config.ts # ES module bundle config
│
└── test/rest/ # Integration test suite (private, not published)
��── src/
│ ├── api.test.ts # Tests for <Service>Api system endpoints
│ └── <domain>.test.ts # One test file per domain (mirrors library files)
├── package.jso