Rewritten
- `canEditDocument(user, doc)` — reads naturally as a boolean check at the call site
- `hasEditPermission(user, doc)` — emphasizes the permission being checked
- `isEditableBy(doc, user)` — reads well if called as a method on the document
- `userCanEdit(user, doc)` — explicit about the subject performing the action
About this tool
Naming is famously one of the hard problems in programming — a function's name is the interface every future reader meets first, and a vague one causes lasting confusion. This tool takes a description of what a function does and suggests a few clear, conventional names, each with a note on when it fits. It's for the moment you've written the logic but `doStuff` is the best name you've got, and you want options that follow standard conventions and read well at the call site.
Frequently asked questions
What naming convention does it use?+
It defaults to camelCase for functions, the most common convention. Mention it if you need snake_case, PascalCase, or another style.
How many suggestions do I get?+
Usually three to five, each with a short note so you can pick the one that reads best in your context.
Can it name variables and classes too?+
It's tuned for function names, but describing a variable or class works too — just phrase the description accordingly.