dykyi-roman/awesome-claude-code/create-snapshot
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
Generates Snapshot pattern for PHP 8.4. Creates aggregate snapshot infrastructure for event sourcing performance optimization with configurable strategies and version tracking. Includes unit tests.
Install
npx vskill@latest install dykyi-roman/awesome-claude-code/create-snapshotSKILL.md
Snapshot Generator
Creates Snapshot infrastructure for optimizing event sourcing aggregate rebuilds.
When to Use
| Scenario | Example | |
|---|---|---|
| Long event streams | Aggregates with 100+ events in their history | |
| Slow aggregate rebuild | Event replay taking too long for read operations | |
| Frequent reads | Aggregates loaded many times per second | |
| Large aggregates | Complex state requiring many events to reconstruct |
Component Characteristics
Snapshot
- Immutable state capture of an aggregate at a point in time
- Properties: aggregateId, aggregateType, version, state (JSON), createdAt
- Supports
fromArray()/toArray()for serialization - Version must be >= 1
SnapshotStoreInterface
save(Snapshot $snapshot): void— persist snapshot (upsert)load(string $aggregateId): ?Snapshot— retrieve latest snapshotdelete(string $aggregateId): void— remove all snapshots for aggregate
SnapshotStrategy
- Configurable event threshold (default: 100)
shouldTakeSnapshot(int $eventsSinceLastSnapshot): bool- Determines when a new snapshot should be captured
AggregateSnapshotter
- Application service coordinating snapshot operations
- Loads aggregate from snapshot + remaining events
- Takes snapshots when strategy threshold is met
Generation Process
Step 1: Generate Domain Components
Path: src/Domain/{BC}/Snapshot/
Snapshot.php— Immutable snapshot value objectSnapshotStoreInterface.php— Repository interface for snapshot persistence
Step 2: Generate Application Components
Path: src/Application/{BC}/Snapshot/
SnapshotStrategy.php— Configurable threshold strategyAggregateSnapshotter.php— Application service for snapshot operations
Step 3: Generate Infrastructure Components
Path: src/Infrastructure/{BC}/Snapshot/
DoctrineSnapshotStore.php— Doctrine DBAL implementation of SnapshotStoreInterface- Database migration SQL for snapshots table
Step 4: Generate Tests
SnapshotTest.php— Construction, serialization, validation testsSnapshotStrategyTest.php— Threshold behavior testsAggregateSnapshotterTest.php— Load and take snapshot tests
File Placement
| Component | Path | |
|---|---|---|
| Snapshot, SnapshotStoreInterface | src/Domain/{BC}/Snapshot/ | |
| SnapshotStrategy, AggregateSnapshotter | src/Application/{BC}/Snapshot/ | |
| DoctrineSnapshotStore | src/Infrastructure/{BC}/Snapshot/ | |
| Unit Tests | tests/Unit/Domain/{BC}/Snapshot/, tests/Unit/Application/{BC}/Snapshot/ |
Naming Conventions
| Component | Pattern | Example | |
|---|---|---|---|
| Value Object | Snapshot | Snapshot | |
| Store Interface | SnapshotStoreInterface | SnapshotStoreInterface | |
| Strategy | SnapshotStrategy | SnapshotStrategy | |
| Application Service | AggregateSnapshotter | AggregateSnapshotter | |
| Infrastructure Store | DoctrineSnapshotStore | DoctrineSnapshotStore | |
| Test | {ClassName}Test | SnapshotTest |
Quick Template Reference
Snapshot
SnapshotStoreInterface
SnapshotStrategy
Usage Example
Database Schema
Anti-patterns to Avoid
| Anti-pattern | Problem | Solution | |
|---|---|---|---|
| Snapshot Every Event | Storage bloat, no performance gain | Use threshold strategy (e.g., every 100 events) | |
| Mutable Snapshots | State corruption, debugging nightmares | Make Snapshot immutable (final readonly) | |
| Missing Version | Cannot determine event replay start point | Always track version in snapshot | |
| No Cleanup | Unbounded storage growth | Implement retention policy, keep only latest | |
| Tight Coupling | Snapshot tied to infrastructure | Domain interface, infrastructure implementation | |
| Skipping Validation | Invalid snapshots persisted | Validate version >= 1, non-empty state |
References
For complete PHP templates and examples, see:
references/templates.md— Snapshot, SnapshotStoreInterface, SnapshotStrategy, AggregateSnapshotter, DoctrineSnapshotStore templatesreferences/examples.md— OrderAggregate integration, event sourcing examples and tests
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/create-snapshot/SKILL.md
Popularity
- Repository stars
- 96
- Repository forks
- 25
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dykyi-roman/awesome-claude-code/create-snapshot)