transaction-consistency-designer
Skill18 starsChanged 9 months agoMITView on GitHub
Design safe transaction boundaries, rollback behavior, idempotency, locking, and consistency strategies for Kotlin + Spring business workflows. Use when a feature writes to the database, spans multiple repositories, publishes messages, calls external systems, suffers from partial commits or duplicate processing, or needs precise `@Transactional`, propagation, or isolation guidance.
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- JetBrains/skillsedited, first seen Apr 28, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- JetBrains/skills★ 36096% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository24 other files it gives its agents.
- ci-cd-containerization-advisorSkill
- configuration-properties-profiles-kotlin-safeSkill
- dependency-conflict-resolverSkill
- domain-decomposition-api-design-advisorSkill
- error-model-validation-architectSkill
- gradle-kotlin-dsl-doctorSkill
- integration-resilience-engineerSkill
- jackson-kotlin-serialization-specialistSkill
- java-kotlin-migration-assistantSkill
- jpa-spring-data-kotlin-mapperSkill
- kotlin-idiomatic-refactorer-spring-awareSkill
- kotlin-spring-proxy-compatibilitySkill
- observability-integratorSkill
- performance-concurrency-advisorSkill
- production-incident-responderSkill
- project-context-ingestionSkill
- schema-migration-plannerSkill
- spring-context-di-reasoningSkill
- spring-kotlin-code-reviewSkill
- spring-mvc-webflux-api-builderSkill
- spring-security-configurator-auditorSkill
- stacktrace-log-triageSkill
- test-suite-builderSkill
- upgrade-breaking-change-navigatorSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. About 0 are common, 14 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈14
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Place transaction boundaries where business invariants are actually enforced, not where annotations are easiest to type.
- Distinctive: line 33
Keep one database transaction focused on one consistency boundary.
- Distinctive: line 34
Avoid holding a database transaction open across external network calls.
- Distinctive: line 35
Prefer idempotency keys plus unique constraints for duplicate-request safety.
- Distinctive: line 36
Prefer the outbox pattern or post-commit publication for messages that must reflect committed state.
- Very specific: line 44
Verify whether @Transactional is on a proxied public entry point.
- Distinctive: line 45
Verify whether self-invocation bypasses the transaction boundary.
- Distinctive: line 46
Verify rollback rules. By default, unchecked exceptions roll back, checked exceptions may not.
- Very specific: line 47
Verify whether readOnly = true is used only where appropriate.
- Very specific: line 48
Verify whether REQUIRES_NEW is truly required or is masking a design issue.
- Very specific: line 49
Treat NESTED as database- and platform-dependent, not a universal escape hatch.
- Distinctive: line 68
If the workflow crosses service boundaries, distinguish local transaction design from saga or orchestration design.
- Distinctive: line 73
Start from the invariant, not from the annotation.
- Distinctive: line 74
Prefer database-enforced invariants for uniqueness and impossible states, then use application logic to make violations rare and …
- Distinctive: line 75
If a workflow mixes command and query steps, decide whether read-your-write guarantees are required immediately or whether eventual …
- Very specific: line 76
If the team wants REQUIRES_NEW, ask whether they are isolating audit logging, masking rollback behavior, or compensating for a larger …
- Very specific: line 91
Do not put @Transactional on every service method by default.
- Distinctive: line 92
Do not recommend distributed 2PC or XA unless the project already uses it and truly requires it.
- Distinctive: line 93
Do not ignore the cost of holding database connections during external calls.
- Distinctive: line 94
Do not treat duplicate prevention as an application-only concern when the database can enforce it.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
Transaction Consistency Designer
Source mapping: Tier 1 critical skill derived from Kotlin_Spring_Developer_Pipeline.md (SK-09).
Mission
Place transaction boundaries where business invariants are actually enforced, not where annotations are easiest to type. Prevent data loss, duplicate side effects, and hidden consistency bugs.
Gather These Inputs
- The business workflow step by step.
- The repositories and tables touched by each step.
- Current
@Transactionalannotations, propagation, isolation, and exception handling. - Any external HTTP, message broker, scheduler, or file I/O inside the workflow.
- Idempotency, retry, and concurrency requirements.
Model The Workflow Explicitly
- Break the use case into state-changing steps and side effects.
- Mark which steps must be atomic together and which can be asynchronous.
- Mark where external systems are called.
- Mark where retries may happen.
- Mark the business invariant that must not be violated.
Decision Rules
- Keep one database transaction focused on one consistency boundary.
- Avoid holding a database transaction open across external network calls.
- Prefer idempotency keys plus unique constraints for duplicate-request safety.
- Prefer the outbox pattern or post-commit publication for messages that must reflect committed state.
- Choose locking strategy based on contention and correctness needs:
- optimistic locking for low-contention update races
- unique constraints for duplicate prevention
- pessimistic locking only when contention and correctness justify it
Spring-Specific Checks
- Verify whether
@Transactionalis on a proxied public entry point. - Verify whether self-invocation bypasses the transaction boundary.
- Verify rollback rules. By default, unchecked exceptions roll back, checked exceptions may not.
- Verify whether
readOnly = trueis used only where appropriate. - Verify whether
REQUIRES_NEWis truly required or is masking a design issue. - Treat
NESTEDas database- and platform-dependent, not a universal escape hatch.
Anti-Patterns To Flag
@Transactionalon controllers by default.- One transaction that does database writes and then performs slow HTTP calls.
- Catching exceptions inside the transaction and converting them to success-like flows.
- Publishing irreversible side effects before commit.
- Assuming retries are safe without idempotency.
- Using a bigger propagation setting to hide unclear boundaries.
Advanced Consistency Nuances
- Distinguish duplicate prevention from concurrency control. A unique constraint solves one class of race, not lost updates or write skew.
- Remember that many integrity failures surface on flush or commit, not at the line that changed the entity. Design tests and exception handling accordingly.
UnexpectedRollbackExceptionoften means an inner operation marked the transaction rollback-only even though the outer layer tried to return success.- Isolation levels are database-specific in effect. The same setting on Postgres, MySQL, and SQL Server may protect different anomalies.
- Deadlock and serialization-failure retries belong at a carefully chosen outer boundary. Retrying a half-executed workflow with external side effects is dangerous.
@TransactionalEventListenerandTransactionSynchronizationare phase-sensitive. Choose before-commit, after-commit, or after-rollback behavior deliberately.- If the workflow crosses service boundaries, distinguish local transaction design from saga or orchestration design. Do not pretend one local transaction can guarantee distributed consistency.
- In reactive or coroutine transaction flows, verify which transaction manager and context propagation model is actually in use. Imperative assumptions often fail there.
Expert Heuristics
- Start from the invariant, not from the annotation. Ask what must never be observably false to users or downstream systems.
- Prefer database-enforced invariants for uniqueness and impossible states, then use application logic to make violations rare and understandable.
- If a workflow mixes command and query steps, decide whether read-your-write guarantees are required immediately or whether eventual consistency is acceptable.
- If the team wants
REQUIRES_NEW, ask whether they are isolating audit logging, masking rollback behavior, or compensating for a larger design problem.
Output Contract
Return these sections:
Consistency goal: the business invariant being protected.Recommended boundary: where the main transaction starts and ends.Propagation and isolation: only the settings that matter and why.Idempotency and concurrency: duplicate handling, locking, and retry safety.External side effects: what must happen outside the transaction or through outbox-style patterns.Verification: tests or scenarios that prove rollback, duplicate handling, and conflict behavior.
Guardrails
- Do not put
@Transactionalon every service method by default. - Do not recommend distributed 2PC or XA unless the project already uses it and truly requires it.
- Do not ignore the cost of holding database connections during external calls.
- Do not treat duplicate prevention as an application-only concern when the database can enforce it.
Quality Bar
A good run of this skill turns a vague workflow into explicit consistency boundaries and testable invariants.
A bad run decorates methods with @Transactional without modeling failure paths, retries, and side effects.
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.

