soft-delete-restore

Implement soft delete and restore using a nullable deletedAt timestamp.

Updated Oct 8, 2025
One-click install
npx skills add https://github.com/ichabodcole/project-docs-scaffold-template --skill soft-delete-restore
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: soft-delete-restore
Source: https://github.com/ichabodcole/project-docs-scaffold-template/tree/main/plugins/recipes/skills/soft-delete-restore
Command: npx skills add https://github.com/ichabodcole/project-docs-scaffold-template --skill soft-delete-restore

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Implement a soft delete pattern with restore capability using a nullable deletedAt timestamp column. Use when the user asks to "add soft delete", "implement trash and restore", "add a deletedAt pattern", "add a recycle bin", "make deletion reversible", "support undo delete", or wants to mark records as deleted without permanently removing them from the database.

Core Features & Use Cases

  • Provides a consistent, auditable deletion lifecycle by marking records as deleted via a nullable deletedAt field.
  • Supports restore and soft-deletes with optional hard-delete purge path.
  • Applicable across data models where recoverability and audit trails are important.

Quick Start

Enable soft delete on a model and perform a test restore to verify functionality.

Frequently Asked Questions about soft-delete-restore

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

FAQPage Schema
How do I implement a soft delete pattern to make data deletions reversible?

Implement soft delete by adding a nullable deletedAt timestamp column to your data model. This marks records as deleted without permanent removal, enabling a consistent, auditable deletion lifecycle with data recoverability.

What is the best way to add a recycle bin or undo delete feature to my database?

Add a recycle bin by utilizing a deletedAt timestamp pattern to mark records as deleted. This supports restore and optional hard-delete purge operations, providing safe data lifecycle control and cross-device restoration capabilities.

How does cascading delete work with a soft delete and restore service layer?

Cascading soft delete propagates the deletedAt timestamp marking across related data models. The service layer manages these cascading behaviors during softDelete and restore operations, ensuring referential integrity while preserving audit trails.

When do I need a soft delete pattern instead of permanently removing data from the database?

You need a soft delete pattern when your app requires audit trails, data recoverability, or safe data lifecycle control. It preserves records using a deletedAt field, supporting cross-device restoration and optional hardDelete purge paths.

Can I permanently purge records after using a soft delete pattern?

Yes, a soft delete implementation can include an optional hard-delete purge path. This allows you to mark records as deleted with a deletedAt timestamp first, then permanently remove them from the database later if needed.

Does implementing a deletedAt pattern provide an audit trail for data lifecycle control?

Yes, implementing a deletedAt pattern provides a consistent, auditable deletion lifecycle. By marking records with a nullable timestamp instead of erasing them, you maintain an audit trail and support safe data lifecycle control across your models.