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, ormass-id-certificate)<description>: short description of what the rule validates
This 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 ├── index.ts ├── project.json └── jest.config.tsImplement the processor: In
{rule-name}.processor.ts, implement theevaluateResult()method. The processor extendsParentDocumentRuleProcessor<RuleSubject>.Write test cases: In
{rule-name}.test-cases.ts, define shared test data using@faker-js/fakerandzocker. 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-idVerify: Run
pnpm lint:affected && pnpm ts:affected && pnpm test:affectedto confirm everything passes.
Create Rule Processor
Scaffold a new rule processor, implement the evaluation logic, and write tests.
Create Rule Processor by majiayu000 · 7ae7401
npx skillmds add majiayu000/create-rule-processor File contents
---name: create-rule-processordescription: Scaffold a new rule processor, implement the evaluation logic, and write tests.---
1. **Scaffold the rule** using the built-in script:
```bash
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 validates
This 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
├── index.ts
├── project.json
└── jest.config.ts
```
2. **Implement the processor**: In `{rule-name}.processor.ts`, implement the `evaluateResult()` method. The processor extends `ParentDocumentRuleProcessor<RuleSubject>`.
3. **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.).
4. **Write unit tests**: In `{rule-name}.processor.spec.ts`, test the core evaluation logic using the shared test cases.
5. **Write e2e tests**: In `{rule-name}.lambda.e2e.spec.ts`, test the Lambda handler end-to-end.
6. **Apply to a methodology** (if needed):
```bash
pnpm apply-methodology-rule <methodology> <rule> <scope>
```
Example: `pnpm apply-methodology-rule carbon-organic vehicle-validation mass-id`
7. **Verify**: Run `pnpm lint:affected && pnpm ts:affected && pnpm test:affected` to confirm everything passes.
majiayu000/claude-skill-registry-data/tree/main/development/create-rule-carrot-foundation-methodology-rules commit 7ae7401bcb
Frequently asked questions
Run npx skillmds add majiayu000/create-rule-processor in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Scaffold a new rule processor, implement the evaluation logic, and write tests. It is listed under Coding & Dev Tools on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Capability flags: docs only. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
majiayu000 (@majiayu000) published this skill. Their other Agent Skills are listed on their SkillMD profile.