Authorization: roles and resources first
Give the permission matrix and privilege-escalation test cases
Prompt
Copy it whole, then replace the brackets with your own contentHandle this coding task: Auth: define roles and resources first. Code/error: [paste] Environment: [language/version/framework] Requirements: Permission matrix and privilege-escalation test cases. Give your diagnosis first, then the changes, then how to verify.
Replace the text in [ ] with your own situation; ask long tasks in stages.
How to get better results
Read this before you fill it inUse before building access control: list roles, resources and actions clearly.
Give the conclusion and impact scope first, then only the changed snippets (no full files), and finally one check that proves it works. Flag risky spots separately.
The system has three roles: super admin, operations, customer service; it needs to control three order actions: view, reprice, refund.
Asking for code without listing roles leaves gaps in the permission matrix Not separating "can't see" from "can't edit" Forgetting privilege-escalation tests
If problems remain after the fix, paste the new error and the changed snippet back; keep debugging on the original approach, don't switch approaches and rewrite.
More like this: Writing code prompts · All prompts