.claude/skills/promote-constitution-rule/SKILL.md
2 KB - Открыть исходный файл
name: promote-constitution-rule description: Use when a recurring decision or user correction should hold for every future change (flywheel.py candidates marks it "skill or constitution rule"). Drafts a constitution rule, runs the rule gate (no contradiction, no regression on recently archived changes), and adds it only after explicit human approval. status: active
Promote a recurring principle to the constitution
Trigger
- A
decisionorfeedbackcandidate frompython3 .flywheel/bin/flywheel.py candidatesthat is a principle (it should constrain every change), not a procedure. - The user asks to make a lesson a rule.
If the lesson is a procedure ("how to do X"), use the promote-skill skill instead.
Workflow
- Confirm the evidence:
occurrences>= the threshold (distinct changes). - Draft the rule with
.flywheel/templates/constitution-rule.md: one short principle, the rule, and why. Keep it testable: a reviewer must be able to say whether a change complies. - Contradiction check. Read
constitution.md. If the draft conflicts with or duplicates an existing rule, stop and show both to the user. - Regression check. Take the three to five most recent folders in
openspec/changes/archive/. Ask theflywheel-judgeagent, for each one, whether the accepted work would violate the draft rule (give it the rule and the change's proposal, delta specs, and design). Accepted work that would violate the rule means the rule is too broad or the old work was wrong: show the user and do not continue on your own. - Ask for approval. Show the rule, the evidence (entries and source changes), and the results of both checks. Ask an explicit yes or no question.
- On approval:
- Append the rule with its provenance comment under
## Project rulesinconstitution.md. - For each source entry:
python3 .flywheel/bin/flywheel.py set-status <entry> promoted --promoted-to constitution. python3 .flywheel/bin/flywheel.py check.
- Append the rule with its provenance comment under
- On rejection: record a
decisionentry with the reason, linked to the source entries.
Anti-patterns
- A rule that is really a procedure (belongs in a skill).
- A vague rule ("write good code") that no reviewer can check.
- Editing an existing rule silently; changes to existing rules need the same gate and approval.