rule-writing
Implement React Doctor rules from a validated contract. Use when writing oxlint rules, planning syntax or control-flow detection, designing adversar…
它会碰到什么
这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。
技能内容
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
- Write detector pseudocode.
- Add adversarial valid and invalid tests.
- Implement only the contract's supported behavior.
- Reuse utilities before creating new ones.
- Update generated registration with repository commands.
- Run focused tests and package checks.
- Use
rde-evalwhen real-code feedback could expose noise. - 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.
想直接用这个技能?
本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。