scaffold-delete-operation

Scaffold soft-delete workflows with ResourceDeleted events and read-model projections.

15|Updated Dec 25, 2025
One-click install
npx skills add https://github.com/aalmada/BookStore --skill scaffold-delete-operation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: scaffold-delete-operation
Source: https://github.com/aalmada/BookStore/tree/main/.claude/skills/scaffold-delete-operation
Command: npx skills add https://github.com/aalmada/BookStore --skill scaffold-delete-operation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a scaffold to implement soft-delete functionality for API resources, enabling tombstoned records instead of hard deletions, which preserves audit history and enables recovery.

Core Features & Use Cases

  • Scaffold Domain Event: create a {Resource}Deleted event in src/BookStore.ApiService/Events/
  • Scaffold Command: create a Delete{Resource} command in src/BookStore.ApiService/Commands/{Resource}/
  • Implement Endpoint: update Endpoints to support delete, using [Aggregate] attribute and proper state loading
  • Update Read Models: ensure projections handle the {Resource}Deleted event (e.g., mark Deleted = true)

Quick Start

Use this scaffold to create the event, command, endpoint, and read-model updates as described in the guide.

Frequently Asked Questions about scaffold-delete-operation

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

FAQPage Schema
How do I implement soft-delete in a backend API using event sourcing?

Soft-delete in an event-sourced backend API is implemented by creating a tombstoning event, a corresponding delete command, and updating read-model projections to mark the resource as deleted rather than removing it. This preserves audit history and enables recovery.

What is the best way to scaffold a tombstone event for API resources?

The best way to scaffold a tombstone event for API resources is to generate a dedicated domain event class, such as a ResourceDeleted event, and wire it to a command handler that updates the aggregate state and read-model projections.

Do I need read-model projections to handle soft-delete operations?

Yes, read-model projections are necessary for soft-delete operations to reflect the deletion state. Projections must handle the deletion event and update the read model, such as setting a Deleted flag to true, ensuring queries recognize tombstoned records.

Can I add a delete endpoint that uses an aggregate-backed handler?

Yes, you can add a delete endpoint that uses an aggregate-backed handler by updating the API endpoints to support the delete operation with proper state loading, ensuring the aggregate processes the delete command and applies the deletion event.

Why use soft-delete instead of hard delete for domain-driven API endpoints?

Soft-delete is preferred over hard delete in domain-driven API endpoints because it preserves audit history and enables data recovery. By tombstoning records through event-sourced patterns, you maintain a complete sequence of domain events.

What does soft-delete scaffolding generate for my API resources?

Soft-delete scaffolding generates a domain event, a delete command, an endpoint update with an aggregate-backed handler, and corresponding read-model updates. This enforces a complete event-sourced workflow for tombstoning resources like Book or Author.