mcpField
R
rule-writing

rule-writing

github.com/millioncoDevelopment15.1k440 installsUpdated 2w ago
Repository

About rule-writing

rule-writing is a development skill for implementing lint rules from a research contract. It guides detector design, adversarial testing, repository registration, and validation while keeping uncertain cases out of scope.

Key features

  1. 01Plans detector conditions and limitations
  2. 02Adds adversarial valid and invalid tests
  3. 03Implements supported contract behavior
  4. 04Updates generated rule registration
  5. 05Runs focused tests and package checks

Use cases

  1. 01Implement a rule from a research contract
  2. 02Add tests for edge cases and false positives
  3. 03Validate a rule before handoff

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/millionco/react-doctor --skill rule-writing

After installing, type/rule-writingin Claude Code to confirm it loaded.

Details

From the project README

Write a rule

Implement the rule-research contract. If none exists, define a compact contract before editing.

Plan the detector

State the diagnostic condition, required syntax and bindings, unsupported cases, and adversarial tests. Keep this plan short when the user already requested implementation.

Before adding a helper, search for one to reuse:

bunx @rayhanadev/truffler "<symbol-or-behavior>" \
  packages/oxlint-plugin-react-doctor/src/plugin \
  --kind function,interface,type,constant --limit 20

Read docs/HOW_TO_WRITE_A_RULE.md, nearby rules, utilities, and tests.

Implement and test

  1. Write detector pseudocode.
  2. Add adversarial valid and invalid tests.
  3. Implement only the contract's supported behavior.
  4. Reuse utilities before creating new ones.
  5. Update generated registration with repository commands.
  6. Run focused tests and package checks.
  7. Use rde-eval when real-code feedback could expose noise.
  8. Hand the finished change to rule-validate.

Account for:

  • import aliases and shadowed bindings
  • nested functions that do not execute immediately
  • transparent JavaScript and TypeScript wrappers
  • dynamic computed properties
  • imported or unresolved values
  • framework escape hatches
  • control-flow paths required by the diagnostic claim
  • regressions found by reviews or evals

Keep uncertain cases quiet. Match the message to the condition the detector proves.

Run repository checks

Use @antfu/ni commands:

nr test
nr lint
nr typecheck
nr format
nr smoke:json-report

Use focused commands while iterating. Record each command that ran.

Report the implementation

Report changed rules, tests, registration, reused or added utilities, reported behavior, intentional non-goals, and validation results. End with the rule-validate handoff.

Comments

Markdown supported