Agent skill

Transactional Patterns

by rrezartprebreza in rrezartprebreza/spring-boot-skills

A skill your agent uses when defining or debugging Spring Boot 4 database transaction boundaries, rollback, propagation, optimistic-lock retries, or commit-bound events.

MITAuto-check passedBackend & APIs

Install Transactional Patterns

skills CLI
$ npx skills add rrezartprebreza/spring-boot-skills --skill transactional-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install rrezartprebreza/spring-boot-skills transactional-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/rrezartprebreza/spring-boot-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/spring-boot-4/transactional-patterns .claude/skills/transactional-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
transactional-patterns
GitHub stars
301
Token cost
~2.8k tokens
SKILL.md length
839 words
Files
5
Skills in repo
51
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when defining or debugging Spring Boot 4 database transaction boundaries, rollback, propagation, optimistic-lock retries, or commit-bound events.

  • Works in 4 steps: Commit the pending order, saga state and… → Dispatch the command outside that… → Persist each confirmed outcome and the… → …
  • Debugging Spring Boot 4 database transaction boundaries
  • SKILL.md covers Establish the boundary, Propagation, Self-Invocation Pitfall and Handling Exceptions, plus 7 more sections
  • Runs Java scripts from its folder

What it does

Transactional Patterns is an agent skill from rrezartprebreza/spring-boot-skills. Use when defining or debugging Spring Boot 4 database transaction boundaries, rollback, propagation, optimistic-lock retries, or commit-bound events. For duplicate HTTP commands use idempotency-patterns; for reactive transactions use webflux-reactive-patterns.

Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 7 other files (for example `agents/openai.yaml`).

It sits in Backend & APIs, covering Backend development. It works with Spring Boot and Java. The repository describes itself as: Production-grade Claude Code and Codex skills for Spring Boot developers. The licence is MIT.

When your agent uses it

  • Debugging Spring Boot 4 database transaction boundaries
  • Optimistic-lock retries
  • Commit-bound events

Example prompts

  • “/transactional-patterns”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Commit the pending order, saga state and outgoing command in one local transaction.
  2. Dispatch the command outside that transaction, using a stable provider idempotency key.
  3. Persist each confirmed outcome and the next command atomically in another local transaction.
  4. On rejection, persist failure state and a compensation command. Retry compensation

What it can do on your machine

Read from SKILL.md and the folder at commit f0c06a0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Java), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • docs.spring.io
    • jakarta.ee

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Transactional Patterns loads about 2.8k tokens when it runs. Until then it costs about 71 tokens; SKILL.md has 839 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~71
When it runs · the whole SKILL.md, loaded when a task matches
~2.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from rrezartprebreza/spring-boot-skills at commit f0c06a0, republished under its MIT licence (© rrezartprebreza). 839 words, ~2,813 tokens.

Download SKILL.mdSave it as .claude/skills/transactional-patterns/SKILL.md (or your agent's skills folder). This skill also uses 4 other files; get the full folder from GitHub.
name
transactional-patterns
description
Use when defining or debugging Spring Boot 4 database transaction boundaries, rollback, propagation, optimistic-lock retries, or commit-bound events. For duplicate HTTP commands use idempotency-patterns; for reactive transactions use webflux-reactive-patterns.

Transactional Patterns

Establish the boundary

  • Inspect the project's Boot/Framework version, transaction manager, persistence technology, rollback configuration and caller before changing propagation.
  • Place multi-step business transactions at the application/service boundary. Preserve Spring Data repository transactions; repository annotations are not inherently wrong.
  • Default propagation is REQUIRED — joins existing transaction or creates one
  • Use readOnly = true for appropriate read units of work. It is an optimization hint, not write prevention, authorization or automatic routing to a read replica.
  • Keep existing architecture and transaction-manager choices. A local database transaction does not make writes to another database or an HTTP provider atomic.

The snippets below are illustrative; domain classes and imports come from the application. Adapt the service template and compare the good and bad examples when editing a service.

java
@Service
@RequiredArgsConstructor
@Transactional(readOnly = true) // default for all methods in this service
public class OrderService {

    @Transactional // overrides readOnly for writes
    public Order createOrder(CreateOrderRequest request) {
        inventoryService.reserve(request.items()); // participates in same TX
        return orderRepository.save(Order.from(request));
    }

    public Optional<Order> findById(UUID id) {
        return orderRepository.findById(id); // readOnly = true inherited
    }
}

Propagation

PropagationBehavior
REQUIRED (default)Join existing TX or create new
REQUIRES_NEWAlways create new TX, suspend existing
SUPPORTSJoin if exists, proceed without TX if not
NOT_SUPPORTEDAlways run without TX
MANDATORYMust have existing TX, throw if not
NEVERMust NOT have TX, throw if one exists

Participating REQUIRED calls use the outer transaction's isolation, timeout and read-only settings. Catching an inner failure does not clear its rollback-only marker; outer commit may still throw UnexpectedRollbackException.

REQUIRES_NEW needs another connection while the outer transaction retains its resources. Account for pool capacity and lock contention. Reserve independent commits for records that must survive a failed operation (for example, an attempted action), not a success audit row that claims a rolled-back order was created. Do not reference an uncommitted parent row from an independent audit transaction.

java
// REQUIRES_NEW — for audit logging that must survive rollback
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void logAuditEvent(AuditEvent event) {
    auditRepository.save(event); // commits independently of parent TX
}

// Illustrative: record an attempt for an existing order; failures are unchecked.
@Transactional
public void processOrder(Order order) {
    auditService.logAuditEvent(new AuditEvent("ORDER_START", order.getId()));
    try {
        // ... process, may throw
    } catch (RuntimeException e) {
        auditService.logAuditEvent(new AuditEvent("ORDER_FAILED", order.getId()));
        throw e; // parent TX rolls back, audit TX already committed
    }
}

Self-Invocation Pitfall

java
// ❌ BROKEN — self-invocation bypasses Spring proxy, @Transactional ignored
@Service
public class OrderService {
    @Transactional
    public void processAll(List<UUID> ids) {
        ids.forEach(id -> this.processSingle(id)); // bypasses proxy!
    }

    @Transactional(propagation = Propagation.REQUIRES_NEW)
    public void processSingle(UUID id) { ... } // never creates new TX
}

// ✅ FIX — extract the independently transactional operation to another bean
@Service
@RequiredArgsConstructor
public class OrderService {
    private final OrderProcessor orderProcessor; // separate bean

    @Transactional
    public void processAll(List<UUID> ids) {
        ids.forEach(id -> orderProcessor.processSingle(id)); // goes through proxy
    }
}

Handling Exceptions

java
// Default: RuntimeException and Error roll back; checked exceptions do not.
// Check project-wide rollback configuration before adding per-method rules.

@Transactional(rollbackFor = InsufficientInventoryException.class) // checked exception
public Order createOrder(CreateOrderRequest request) throws InsufficientInventoryException {
    ...
}

Never use noRollbackFor to recover from OptimisticLockException: the persistence provider marks the transaction rollback-only. Roll it back and retry the whole unit of work in a fresh transaction, with a bounded policy and a fresh entity read.

Optimistic Locking

java
@Entity
public class Order {
    @Version
    private Long version; // Hibernate handles conflicts automatically
}

// Handles concurrent updates
@Transactional
public Order updateStatus(UUID id, OrderStatus newStatus) {
    Order order = orderRepository.findById(id).orElseThrow();
    order.updateStatus(newStatus); // conflict can surface at flush or commit
    return orderRepository.save(order);
}

Retrying Transient Failures

Retry support ships in core Spring Framework (org.springframework.resilience.annotation) — no Spring Retry dependency. Enable once with @EnableResilientMethods, then retry transient failures such as optimistic-lock conflicts:

java
@Configuration
@EnableResilientMethods
public class ResilienceConfig {}

@Service
@RequiredArgsConstructor
public class OrderStatusFacade {

    private final OrderService orderService; // separate bean — retry must wrap the TX

    @Retryable(includes = ObjectOptimisticLockingFailureException.class,
               maxRetries = 3, delay = 50, jitter = 25)
    public Order updateStatus(UUID id, OrderStatus newStatus) {
        return orderService.updateStatus(id, newStatus); // fresh @Transactional per attempt
    }
}

Put @Retryable on a method that calls the @Transactional method on another bean — each attempt needs a fresh transaction. Retrying inside the failed transaction re-runs code in a TX already marked rollback-only. For hot write paths, @ConcurrencyLimit(10) (same package) caps concurrent invocations instead of letting contention turn into retry storms.

Use the version-specific retry guidance for dependencies and annotation imports. A retrying facade must not already hold a transaction that each attempt's REQUIRED method would join.

Distributed Transactions (Saga Pattern)

A saga coordinates durable local steps; wrapping remote calls in @Transactional does not implement one.

  1. Commit the pending order, saga state and outgoing command in one local transaction.
  2. Dispatch the command outside that transaction, using a stable provider idempotency key.
  3. Persist each confirmed outcome and the next command atomically in another local transaction.
  4. On rejection, persist failure state and a compensation command. Retry compensation independently, and reconcile timeouts where the remote outcome is unknown.

Do not save failure state and then throw a rollback-triggering exception from the same transaction: that erases the state. Recovery must resume from durable state after a crash. Use the project's existing workflow mechanism; see messaging/outbox and idempotency for delivery and duplicate effects.

Show full SKILL.md (308 more words)Show less

Side Effects After Commit

For best-effort local notifications, a commit-bound listener prevents delivery on rollback. For required delivery, persist an outbox entry with the business change or use the project's durable publication mechanism. AFTER_COMMIT alone cannot recover a process crash or retry a failed delivery.

java
// Publisher — inside the TX
@Transactional
public Order place(UUID id) {
    Order order = orderRepository.findById(id).orElseThrow();
    order.place();
    eventPublisher.publishEvent(new OrderPlaced(order.getId())); // published now; listener defers handling
    return orderRepository.save(order);
}

// Listener — runs ONLY if the TX commits successfully
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
public void onOrderPlaced(OrderPlaced event) {
    emailService.sendConfirmation(event.orderId()); // best effort; no durable retry
}

AFTER_COMMIT runs after the DB commits, but resources may still be bound to the completed transaction. Delegate database writes to a separate REQUIRES_NEW bean. Listener failure cannot undo the committed business write; make delivery failures observable and recoverable. Without an active transaction the listener is skipped by default. @Async does not add durable delivery. See domain events.

Verification

Test through Spring proxies and verify committed data from a new transaction. Cover checked versus unchecked failures, inner rollback-only propagation, optimistic conflicts at commit, audit rollback, and listener behavior after commit and rollback. Use the production database engine for isolation and contention tests. A test-wide rollback can hide after-commit behavior.

Gotchas

  • Agent removes repository transaction annotations - keep the unit of work and existing Spring Data behavior.
  • Agent treats AFTER_COMMIT as durable messaging - use an outbox or persistent publication registry for required delivery.
  • Agent uses readOnly for replica routing or write protection - neither follows from the flag alone.
  • Agent commits success audit entries with REQUIRES_NEW - commit them with the business mutation.
  • Agent suppresses optimistic-lock rollback - retry in a fresh transaction.
  • Agent calls @Transactional methods on this — self-invocation bypasses proxy
  • Agent expects checked exceptions to rollback — must add rollbackFor
  • Agent uses @Transactional on private methods — Spring proxy can't intercept
  • Agent pulls in spring-retry for a new Boot 4 retry path - use core @Retryable and @EnableResilientMethods; preserve existing integrations when outside the task's scope.
  • Agent relies on unspecified retry/transaction advisor ordering - verify every attempt gets a fresh transaction; a separate retry facade makes the boundary explicit.

Official sources

© rrezartprebreza, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 4 other files in skills/spring-boot-4/transactional-patterns of rrezartprebreza/spring-boot-skills.

  • SKILL.md
  • agents/openai.yaml
  • examples/bad-transactional-service.java
  • examples/good-transactional-service.java
  • templates/TransactionalOrderService.java

Open the folder on GitHubat commit f0c06a0

Compare with similar skills

Transactional Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Transactional Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Transactional Patterns this skillrrezartprebreza/spring-boot-skills301—~2.8kAutomated safety check: PassMIT
Spring Bootpiomin/claude-ai-spring-boot1.3k—~2kAutomated safety check: PassApache-2.0
Dr Jskilljdubois/dr-jskill342—~4.6kAutomated safety check: NotesApache-2.0
WxJava Integration Guidebinarywang/WxJava33k—~123Automated safety check: PassApache-2.0
Flycms Devsunkaifei/FlyCms656—~827Automated safety check: PassMIT
Intelliconnect Service Styleruanrongman/IntelliConnect147—~2.4kAutomated safety check: PassApache-2.0

Similar skills

  • Spring Boot

    piomin/claude-ai-spring-boot

    Spring Boot 3.x development - REST APIs, JPA, Security, Testing, and Cloud-native patterns.

    1.3k GitHub stars~2k tokensUpdated 5 mo ago
    Backend & APIsAuto-check passed
  • Dr Jskill

    jdubois/dr-jskill

    Creates Java + Spring Boot projects: Web applications, full-stack apps with Vue.js or Angular or React or vanilla JS, PostgreSQL, REST APIs, and Docker.

    342 GitHub stars~4.6k tokensUpdated 10 days ago
    Backend & APIsAuto-check: notes
  • WxJava Integration Guide

    binarywang/WxJava

    Plans a WxJava setup for Java, Spring Boot or Solon projects that call WeChat services, from module and BOM choice to config and a minimal working call.

    33k GitHub stars~123 tokensUpdated today
    Backend & APIsAuto-check passed
  • Flycms Dev

    sunkaifei/FlyCms

    FlyCms 项目(backend/ Spring Boot 4.1.1 + frontend/ vue-vben-admin v5)的架构地图与开发规范总纲。凡在本仓库做任何开发——写后端接口、新增/修改模块、管理页面、数据库变更、修 bug、重构——都要先加载本 skill 再动手,即使用户只说"改一下""加个功能";前端登录/菜单/权限专项另见…

    656 GitHub stars~827 tokensUpdated yesterday
    Backend & APIsAuto-check passed
  • Intelliconnect Service Style

    ruanrongman/IntelliConnect

    Create or update IntelliConnect Spring Boot service/serviceimpl code in this repository style.

    147 GitHub stars~2.4k tokensUpdated 2 days ago
    Backend & APIsAuto-check passed
  • Java Coding Standards

    Snailclimb/AIGuide

    Java/Spring Boot 编码规范:用于编写、审查、重构和讲解 Java 代码。适用于 Java 风格、Spring Boot 架构、Controller/Service/Manager/DAO 分层、API 边界、Entity/VO/Form/DTO/BO 设计、MyBatis/MyBatis-Plus 持久化、事务、异常、日志、安全、性能、测试和 Java 代码评审等场景。默认结合…

    675 GitHub stars~1k tokensUpdated 3 mo ago
    Backend & APIsAuto-check passed

More from rrezartprebreza/spring-boot-skills

All 51 skills in this repo
  • AI Observability

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when adding Spring AI-specific model observations, token usage, latency, externally configured cost attribution, advisor telemetry, or protected prompt and completion logging.

    301 GitHub stars~1.6k tokensUpdated 18 days ago
    Auto-check passed
  • API Versioning

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when versioning Spring MVC or WebFlux APIs in Spring Boot 3 / Spring Framework 6.

    301 GitHub stars~516 tokensUpdated 18 days ago
    Auto-check passed
  • API Versioning

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when versioning Spring MVC or WebFlux APIs in Spring Boot 4 / Spring Framework 7.

    301 GitHub stars~643 tokensUpdated 18 days ago
    Auto-check passed
  • Container Native Deployment

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when packaging a Spring Boot 3 application as an OCI image or GraalVM native executable.

    301 GitHub stars~781 tokensUpdated 18 days ago
    Auto-check passed
  • Container Native Deployment

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when packaging Spring Boot 4 as an OCI image, JVM container, AOT application, or GraalVM native executable.

    301 GitHub stars~706 tokensUpdated 18 days ago
    Auto-check passed
  • Domain Driven Design

    rrezartprebreza/spring-boot-skills

    A skill your agent uses when evolving aggregate invariants, value objects or domain events in an existing DDD-style Spring Boot 3 application, or when DDD is explicitly requested.

    301 GitHub stars~2.1k tokensUpdated 18 days ago
    Auto-check passed

Works with

Categories

Questions about Transactional Patterns

What does Transactional Patterns do?

A skill your agent uses when defining or debugging Spring Boot 4 database transaction boundaries, rollback, propagation, optimistic-lock retries, or commit-bound events. Transactional Patterns is an agent skill from rrezartprebreza/spring-boot-skills. Use when defining or debugging Spring Boot 4 database transaction boundaries, rollback, propagation, optimistic-lock retries, or commit-bound events.

When should I use Transactional Patterns?

Transactional Patterns fits situations like: debugging Spring Boot 4 database transaction boundaries; optimistic-lock retries; commit-bound events.

How do I install Transactional Patterns in Claude Code?

Run `npx skills add rrezartprebreza/spring-boot-skills --skill transactional-patterns -a claude-code`. Or copy the skill folder (skills/spring-boot-4/transactional-patterns in rrezartprebreza/spring-boot-skills) into .claude/skills/transactional-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Transactional Patterns in Codex?

Run `npx skills add rrezartprebreza/spring-boot-skills --skill transactional-patterns -a codex`. Or copy the skill folder (skills/spring-boot-4/transactional-patterns in rrezartprebreza/spring-boot-skills) into .agents/skills/transactional-patterns in your project. Codex loads it when a task matches its description.

Can I use Transactional Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add rrezartprebreza/spring-boot-skills --skill transactional-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/transactional-patterns, .gemini/skills/transactional-patterns, .github/skills/transactional-patterns and .opencode/skills/transactional-patterns in your project.

What does Transactional Patterns need to run?

Going by SKILL.md and its folder, Transactional Patterns needs Java for the scripts in its folder.

Does Transactional Patterns access the network?

SKILL.md names 2 domains. As links in the text: docs.spring.io and jakarta.ee. This is read from the text; nothing was executed.

Is Transactional Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Transactional Patterns use?

Transactional Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Transactional Patterns use?

About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Transactional Patterns?

Skills that share tags, products or a category with Transactional Patterns: Spring Boot (piomin/claude-ai-spring-boot, 1.3k stars), Dr Jskill (jdubois/dr-jskill, 342 stars), WxJava Integration Guide (binarywang/WxJava, 33k stars) and Flycms Dev (sunkaifei/FlyCms, 656 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Transactional Patterns?

rrezartprebreza (a GitHub user) maintains it in rrezartprebreza/spring-boot-skills, which has 301 GitHub stars. The repository holds 51 skills in this directory. The repository was last updated on September 21, 2026.

Source: rrezartprebreza/spring-boot-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.