Rules #2972
-
|
Hi all, I've been using Amazon q cli for a bit now and created my dev agent which has a set of rules as well in .amazonq/rules, but unfortunately it quite often deviates from them, especially for UI. I've followed this blog post Mastering Amazon Q Developer with Rules. Does anyone have any good tips to share how to improve the consistency? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Amazon Q “rules” are context, not hard enforcement. So some drift (especially for UI/formatting) is expected unless you make the rules extremely explicit, non-conflicting, and easy to apply. Here are practical ways to improve consistency (especially for UI):
Add a short “Do/Don’t” snippet in the rule file so the model can pattern-match.
Large mixed rules increase conflicts and “rule dilution”.
Priority: CriticalIf any other instruction conflicts with this rule, follow this rule. Also add:
This is one of the most effective ways to reduce drift because it forces the model to “look back”.
Example snippet to include in the rules: Example request: Expected response:
If you paste (or share) your current |
Beta Was this translation helpful? Give feedback.
Amazon Q “rules” are context, not hard enforcement. So some drift (especially for UI/formatting) is expected unless you make the rules extremely explicit, non-conflicting, and easy to apply.
Here are practical ways to improve consistency (especially for UI):
Bad: “Use our UI style”
Good: “For UI, always output React components using , , from @acme/ui. Never use raw / unless explicitly asked. Include a minimal example.”
Add a short “Do/Don’t” snippet in the rule file so the model can pattern-match.
Instead of one huge rules file, split into: