用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/carrot-foundation/schemas --skill debug命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | debug |
| description | Use when schema generation fails, validation errors occur, or tests fail unexpectedly |
Diagnose and fix failures in the schemas package -- build errors, test failures, schema generation issues, and validation problems.
pnpm check to confirm the fix doesn't break anything elseCommand: pnpm type-check (runs tsc --noEmit)
Common failures:
error TS2322: Type 'string' is not assignable to type 'number'.
Isolation:
pnpm type-check 2>&1 | head -50
Common causes:
z.infer<typeof Schema> usagetsconfig.json paths)index.tsFix patterns:
z.infer<typeof MySchema> instead of manually defining typestsconfig.json includes the new file pathsCommand: pnpm lint or pnpm lint:fix
Common failures:
error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
Isolation:
pnpm lint 2>&1 | head -50
Common causes:
any type (use proper Zod inference instead)Fix patterns:
any with z.infer<typeof Schema> or specific typespnpm lint:fix for auto-fixable issuesCommand: pnpm test
Common failures:
FAIL src/mass-id/__tests__/mass-id.schema.spec.ts
✕ should parse a complete valid input
Expected: true
Received: false
Isolation:
# Run a single test file
npx vitest run src/mass-id/__tests__/mass-id.schema.spec.ts
# Run a specific test by name
npx vitest run -t "should parse a complete valid input"
Common causes:
.strictObject() rejecting unknown properties in test data.positive(), .email())Fix patterns:
safeParse error details: result.error?.issues--reporter=verbose flag for detailed outputInspecting parse errors in tests:
const result = Schema.safeParse(input);
if (!result.success) {
console.log(JSON.stringify(result.error.issues, null, 2));
}
Command: pnpm build (runs tsup)
Common failures:
DTS Build Start
Error: ...
DTS Build Failed
Isolation:
pnpm build 2>&1
Common causes:
package.jsontsc but fails tsup DTS generation)Fix patterns:
dependencies (not devDependencies)Command: pnpm generate-schemas (runs build + node scripts/generate-ipfs-schemas.js)
Common failures:
Error: Unable to generate JSON Schema for ...
Isolation:
pnpm build && node scripts/generate-ipfs-schemas.js 2>&1
Common causes:
.meta() on fields (causes empty descriptions)index.tsFix patterns:
.meta({ description: '...' }) to every fieldsrc/index.ts$ref patternsz.lazy() is used correctly for recursive schemasCommand: pnpm validate-schemas (runs node scripts/validate-schemas.js)
Common failures:
Schema validation failed: /schemas/ipfs/mass-id/v1.0.0.json
Error: strict mode: unknown keyword: "..."
Isolation:
node scripts/validate-schemas.js 2>&1
Common causes:
$id URL format is incorrect$ref pointer targets a non-existent schemaFix patterns:
$id follows the expected URL pattern$ref targets existCommand: pnpm verify-schema-versions
Common failures:
Version mismatch: expected v1.2.0, found v1.1.0
Isolation:
node scripts/verify-schema-versions.js 2>&1
Common causes:
Fix patterns:
pnpm generate-schemas && pnpm hash-schemasCommand: pnpm validate-examples
Common failures:
Example validation failed: schemas/ipfs/mass-id/examples/valid.json
Isolation:
node scripts/validate-schemas.js --data-only 2>&1
Common causes:
Fix patterns:
pnpm update-examplesAfter fixing any issue:
pnpm check to verify nothing else brokegit diff to understand what changed