What problem does it solve?
This Skill helps teams implement reliable CRUD flows for API-backed resources by preventing orphan records, handling cascading deletes correctly, and turning raw database/provider failures into consistent, user-actionable errors.
Core Features & Use Cases
- Cascading deletes (schema-first + manual fallback): Choose
onDelete: "cascade" for parent-child FK relationships, and use transaction-wrapped manual cascades when external API cleanup or cross-reference logic is required.
- Validation and error-code conventions: Produce descriptive validation messages and map domain outcomes to the correct tRPC codes (e.g.,
CONFLICT for duplicates, NOT_FOUND for missing resources).
- Duplicate detection and robust exception mapping: Rely on DB unique constraints with specific handling for PostgreSQL unique violations (e.g.,
23505), avoiding leaky raw DB errors.
- Orphan prevention on external sync: Persist to the database first, then roll back the DB record if the external provider sync fails.
- Replacement hygiene for external keys: When replacing provider keys, clear dependent external skill metadata to avoid stale references and resync issues.
Quick Start
Use the api-resource-lifecycle skill when you need to add or modify delete/remove operations, introduce cascading behavior, implement duplicate detection and validation, or ensure external-provider sync failures roll back cleanly.