用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/carrot-foundation/methodology-rules --skill create-rule-processor命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | Create Rule Processor |
| description | Scaffold a new rule processor, implement the evaluation logic, and write tests. |
Scaffold the rule using the built-in script:
pnpm create-rule <name> <scope> <description>
<name>: kebab-case rule name (e.g., vehicle-validation)<scope>: processor group (mass-id, credit-order, or mass-id-certificate)<description>: short description of what the rule validatesThis creates the standard file structure:
{rule-name}/
├── {rule-name}.processor.ts
├── {rule-name}.lambda.ts
├── {rule-name}.processor.spec.ts
├── {rule-name}.lambda.e2e.spec.ts
├── {rule-name}.test-cases.ts
├── {rule-name}.rule-subject.ts
├── index.ts
├── project.json
└── vitest.config.ts
Define the rule subject schema: In {rule-name}.rule-subject.ts, define a *RuleSubjectSchema using z.object() with the exact fields the rule needs. Export both the schema and the inferred type. Use validateRuleSubjectOrThrow as the standard validation entry point in the processor.
Implement the processor: In {rule-name}.processor.ts, implement the evaluateResult() method. The processor extends ParentDocumentRuleProcessor<RuleSubject>.
Write test cases: In {rule-name}.test-cases.ts, define shared test data using @faker-js/faker and zocker. Never use real data (no real company names, tax IDs, addresses, etc.).
Write unit tests: In {rule-name}.processor.spec.ts, test the core evaluation logic using the shared test cases.
Write e2e tests: In {rule-name}.lambda.e2e.spec.ts, test the Lambda handler end-to-end.
Apply to a methodology (if needed):
pnpm apply-methodology-rule <methodology> <rule> <scope>
Example: pnpm apply-methodology-rule carbon-organic vehicle-validation mass-id
Verify: Run pnpm lint:affected && pnpm ts:affected && pnpm test:affected to confirm everything passes.