event-modeler
Skill1 starsChanged 30 days agoMITView on GitHub
Design deterministic, type-safe event-sourced slices following Event Modeling paradigms (Commands, Events, Projections) with a hard 500 LOC per file ceiling. Use when defining domain commands, events, handlers, or projections, writing Given-When-Then contracts, or modeling state-change versus state-view slices.
In this repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- codacy-analysis-cliSkill
- codacy-cloud-cliSkill
- codacy-code-reviewSkill
- configure-codacy-cloudSkill
- configure-codacySkill
- crates-io-name-checkSkill
- fail-closed-proxySkill
- harnessSkill
- htn-plannerSkill
- issue-to-prSkill
- move-only-decompositionSkill
- nested-build-isolationSkill
- npm-github-publishSkill
- pr-triageSkill
- setup-coverageSkill
- skill-creatorSkill
- skill-distillerSkill
- spike-runnerSkill
- tokio-performanceSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 81
All domain events must implement serde::Serialize/serde::Deserialize for libSQL persistence.
- Distinctive: line 88
Keep event payloads flat and serde-compatible — nested types complicate libSQL persistence and versioning.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Event Modeler Skill
Purpose
Design deterministic, type-safe event-sourced slices following Event Modeling paradigms (Commands, Events, Projections) with a hard constraint of 500 LOC per file.
Apply this skill only when the change introduces or modifies durable domain
state transitions and projections. Stateless, mechanical, or prose changes do
not need an event schema; model the behavior directly. Completing a modeled
slice does not itself require updating this skill — review the outcome for
reusable learning, and distill only when evidence justifies it (see
.agents/skills/skill-distiller).
Schema Guidelines
1. State-Change Slice (Write Side)
// In src/domain/<slice_name>/commands.rs
#[derive(Debug, Clone, PartialEq)]
pub struct CreateUserCommand {
pub user_id: String,
pub email: String,
}
// In src/domain/<slice_name>/events.rs
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(deny_unknown_fields)]
pub enum UserEvent {
UserCreated { user_id: String, email: String, created_at: i64 },
}2. State-View Slice (Read Side)
// In src/domain/<slice_name>/projections.rs
pub struct UserSummaryView {
pub total_users: usize,
pub last_registered_user: Option<String>,
}
impl UserSummaryView {
pub fn apply(&mut self, event: &UserEvent) {
match event {
UserEvent::UserCreated { user_id, .. } => {
self.total_users += 1;
self.last_registered_user = Some(user_id.clone());
}
}
}
}Typed Errors
Define typed error enums with thiserror before writing handlers:
// In src/domain/<slice_name>/errors.rs
#[derive(Debug, thiserror::Error)]
pub enum UserError {
#[error("user {user_id} already exists")]
AlreadyExists { user_id: String },
#[error("invalid email: {0}")]
InvalidEmail(String),
}Quality Checklist
- Command handlers must be pure functions or stateless orchestrators.
- All domain events must implement
serde::Serialize/serde::Deserializefor libSQL persistence; add#[serde(deny_unknown_fields)]to reject stale or unexpected payloads. - Errors:
thiserrorenums in libraries;anyhowonly in binaries. Nounwrap()in library code. #![forbid(unsafe_code)]at crate roots.- Maximum file size: 500 LOC. Split files across
commands.rs,events.rs,handlers.rs, andprojections.rsif needed.
Gotchas
- Events are immutable facts: never mutate an emitted event after the fact; correct via a new event.
- Keep event payloads flat and serde-compatible — nested types complicate libSQL persistence and versioning.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

