documented-mutations
Skill525 starsChanged 2 months agoApache-2.0View on GitHub
Migrate react-api-client useMutation hooks to useDocumentedMutation and update app callsites, tests, api-client userNotes, and audit_log keys. Use when converting mutations to documented mutations, wiring documentationState, or adding audit log actions for access control.
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Prompt the user for an audit log key and text: Do not invent either. Then add:
- Very specific: line 27
Ensure the api-client function accepts/sends userNotes if it does not already.
- Very specific: line 39
Keep api-client / useHost mocks.
- Distinctive: line 40
Do not add any new test files.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Documented Mutations
Migrate a useMutation hook to useDocumentedMutation. Copy shape from a migrated example (e.g. react-api-client/src/runs/usePlayRunMutation.ts).
Before coding
Prompt the user for an audit log key and text. Do not invent either. Then add:
- Key to
AuditLogActioninreact-api-client/src/accessControl/types.ts "key": "text"inapp/src/assets/localization/en/audit_log.jsononly (neverzh/)
Hook (react-api-client)
- Replace
useMutationwithuseDocumentedMutationfrom../accessControl. - Require
documentationState: DocumentationStateas the first arg. - Pass
actionsToDocumentas['audit_log_key']. - Mutation fn must take
{ variables, userNotes }(DocumentedMutationParameters) and forwarduserNotesto the api-client call. - Ensure the api-client function accepts/sends
userNotesif it does not already.
Callsites (app/)
- Flex / shared / ODD: pass
useDocumentationState()(or an existing docs state). - OT-2 only callsites do not need to be updated and should be passed
ACCESS_CONTROL_DISABLED_DOCUMENTATION_STATEfromapp/src/local-resources/access-control/utils.ts. - Docs modal cancel: on isDocumentedMutationError, stay on the screen that launched the mutation (confirm modal, wizard step, etc.). Reset any in-flight UI; do not toast, navigate away, or apply mutation success side effects.
Tests — update with proper mocks
- Hook tests: pass
ACCESS_CONTROL_DISABLED_DOCUMENTATION_STATEfromreact-api-client/src/accessControl/__fixtures__/documentationState. - App tests: mock
useDocumentationState(or pass the fixture) usingACCESS_CONTROL_DISABLED_DOCUMENTATION_STATEfromapp/src/local-resources/access-control/__fixtures__/documentationState. - Keep api-client /
useHostmocks; assertuserNotesis forwarded when relevant. - Do not add any new test files.
Checklist
- User supplied audit log key + English text
AuditLogAction+en/audit_log.jsonupdated- Hook uses
useDocumentedMutation+userNotes - api-client accepts
userNotes - Non-OT2 callsites get real docs state; OT2-only get disabled constant
- Docs cancel restores prior screen with no changes / no user-facing error
- Hook + app tests updated with proper mocks/fixtures
In this repository18 other files it gives its agents.
- .cursor/rules/ai-server-api-docs-curation.mdcCursor rule
- .cursor/rules/monorepo-setup.mdcCursor rule
- ai-clientSkill
- ai-serverSkill
- analyses-snapshot-testingSkill
- css-modulesSkill
- docsSkill
- e2e-testingSkill
- grill-frontend-codeSkill
- js-package-testingSkill
- locize-syncSkill
- opentrons-typescriptSkill
- protocol-authoringSkill
- protocol-designerSkill
- protocol-verificationSkill
- react-component-creationSkill
- robot-python-projectsSkill
- static-deploySkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

