governing-mutation-semantics

Enforce PUT full replacement and RFC 7396 JSON Merge Patch for PATCH requests.

Updated Mar 6, 2026
One-click install
npx skills add https://github.com/musher-dev/bundles --skill governing-mutation-semantics
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: governing-mutation-semantics
Source: https://github.com/musher-dev/bundles/tree/main/api-route-governance/skills/governing-mutation-semantics
Command: npx skills add https://github.com/musher-dev/bundles --skill governing-mutation-semantics

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill standardizes how APIs handle updates (PUT and PATCH) and array modifications, preventing common bugs and ensuring predictable client-server interactions.

Core Features & Use Cases

  • Standardized PUT: Ensures PUT requests perform full resource replacement, resetting omitted optional fields.
  • JSON Merge Patch for PATCH: Enforces RFC 7396 for partial updates, simplifying client implementation and server logic.
  • Safe Array Mutation: Mandates dedicated sub-resource endpoints for array modifications, avoiding race conditions and complexity.
  • Use Case: Reviewing a new API endpoint to ensure its PUT and PATCH methods adhere to best practices, or auditing existing endpoints for consistency in handling array updates.

Quick Start

Use the governing-mutation-semantics skill to audit the PUT and PATCH implementation for the /users/{id} endpoint.

Frequently Asked Questions about governing-mutation-semantics

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement JSON Merge Patch for my PATCH API endpoint?

JSON Merge Patch is implemented by enforcing RFC 7396 for PATCH requests to handle partial updates. This standardizes server logic and simplifies client implementation by applying targeted modifications rather than full resource replacement.

What is the correct semantic difference between PUT and PATCH in API design?

PUT semantics dictate full resource replacement, resetting omitted optional fields to defaults, while PATCH semantics enforce partial updates. Standardizing these API mutation rules prevents common bugs and ensures predictable client-server interactions.

What is the best way to handle array mutations in an API?

The best way to handle array mutations is by mandating dedicated sub-resource endpoints for array modifications. This approach avoids race conditions and complexity, ensuring safe and predictable array updates within the API.

How do I prevent default reset issues when deserializing PATCH requests?

Prevent default reset issues during deserialization by using the exclude_unset=True rule. This ensures that only fields explicitly provided by the client are processed, preserving existing values for omitted fields during partial updates.

When should I audit my API mutation endpoints for consistency?

You should audit API mutation endpoints when reviewing new implementations or enforcing PUT vs PATCH semantics. This ensures adherence to best practices, verifying that PUT performs full replacement and PATCH handles partial updates correctly.