基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/carrot-foundation/schemas --skill rule-package-management命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Schema version injection, $id format, and SCHEMA_VERSION environment variable
Generated JSON Schema structure — required fields, validation patterns, and $ref usage
Use when a task is complete and needs the full check, commit, and PR workflow
| name | rule-package-management |
| description | pnpm only, exact versions, Node >= 22, and minimal dependencies |
Apply this rule whenever work touches:
package.jsonpnpm-lock.yamlThis is a published npm package (@carrot-foundation/schemas). Every production dependency becomes a transitive dependency for every consumer. Minimizing the dependency footprint is a first-class concern.
pnpm is the only supported package manager. This is enforced via a preinstall script in package.json:
{
"scripts": {
"preinstall": "npx only-allow pnpm"
}
}
Running npm install or yarn install will fail with an error. Always use pnpm:
pnpm install # Install all dependencies
pnpm add -E <pkg> # Add a production dependency (exact version)
pnpm add -DE <pkg> # Add a dev dependency (exact version)
All dependencies must use exact versions. Never use version ranges (^, ~, >=). The -E flag ensures this:
{
"dependencies": {
"zod": "4.0.0",
"canonicalize": "2.0.0"
}
}
// BAD: version ranges
{
"dependencies": {
"zod": "^4.0.0",
"canonicalize": "~2.0.0"
}
}
Exact versions prevent unexpected behavior from minor/patch updates. Renovate handles dependency updates via automated PRs, where changes can be reviewed and tested.
The project requires Node.js 22 or later. This is specified in package.json engines and enforced in CI:
{
"engines": {
"node": ">=22"
}
}
Use features available in Node 22+ freely (e.g., native fetch, structured clone, import attributes).
The production dependency list must stay minimal. Currently the package has only:
zod — schema definition and validation (core functionality)canonicalize — deterministic JSON serialization (required for IPFS content hashing)Every additional production dependency:
Before adding any dependency, answer these questions:
When adding a dependency, document the reason in the PR description:
## New dependency: fast-json-stable-stringify
Added as a production dependency for deterministic JSON serialization.
Required for consistent IPFS content hash generation.
Size: 1.2KB minified + gzipped
Alternatives considered: JSON.stringify (non-deterministic key ordering)
Dev dependencies are more permissive but should still be justified. Common dev dependencies include:
Ensure dependencies are correctly classified:
# Production: ships with the package
pnpm add -E zod
# Dev: only needed for development/build
pnpm add -DE vitest typescript tsup eslint
Common misclassification:
@types/* — always dev (types are stripped at build time)Git hooks are configured via Husky and lint-staged:
These hooks run automatically. Do not skip them with --no-verify unless you have a specific, documented reason.
Always commit pnpm-lock.yaml. Never delete it to "fix" install issues — instead, run pnpm install to regenerate it properly. The lockfile ensures reproducible installs across all environments.