soft-delete-restore
Installation
SKILL.md
Soft Delete Restore Pattern
Builds on: database-patterns (soft delete) and database-patterns (optimistic locking).
The BaseRepository already has a restore() method. This skill covers the full contract: repository, service, controller, authorization, and version behavior.
1. What Restore Does
Restore sets deletedAt = null on a soft-deleted record. It does not permanently undelete anything — records remain reversible either way.
Key invariants:
- Restore operates on a deleted record (
deletedAt IS NOT NULL). TheBaseRepository.restore()currently searches withdeletedAt: null— override this for deleted-record lookup. - Restore increments
versionwhen the model uses optimistic locking. This signals to stale clients that the record has changed. - Restore is a privileged write — apply role guards at the same level as delete or stricter.