agentleFS
dbos-incdbos-inc/agent-skills/skills/dbos-java/SKILL.md

dbos-java

Skill19 starsChanged 10 months agoMITView on GitHub

DBOS Java SDK for building reliable, fault-tolerant applications with durable workflows. Use this skill when writing Java or Kotlin code with DBOS, creating workflows and steps, using queues, integrating DBOS with Spring Boot, using DBOSClient from external applications, or building JVM applications that need to be resilient to failures.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Add the DBOS dependency (Java 17+, Gradle 8+ recommended):

    line 46
  2. Very specific:

    When creating a new application, set withAppVersion("0.1.0").

    line 102
  3. Very specific:

    All workflow classes MUST be registered before launch().

    line 135
  4. Very specific:

    Do NOT start, enqueue, or retrieve workflows from within a step, and do NOT call send, recv, setEvent, or getEvent from a step

    line 136
  5. Distinctive:

    Do NOT mutate state outside the workflow's own scope from workflows or steps

    line 139
  6. Very specific:

    Use dbos.sleep, not Thread.sleep, inside workflows

    line 141
  7. Distinctive:

    Read individual rule files for detailed explanations and examples:

    line 145

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

DBOS Java Best Practices

Guide for building reliable, fault-tolerant Java applications with DBOS durable workflows.

When to Apply

Reference these guidelines when:

  • Adding DBOS to existing Java or Kotlin code
  • Creating workflows and steps
  • Using queues for concurrency control
  • Implementing workflow communication (events, messages, streams)
  • Configuring and launching DBOS applications, including with Spring Boot
  • Using DBOSClient from external applications
  • Testing DBOS applications

Rule Categories by Priority

PriorityCategoryImpactPrefix
1LifecycleCRITICALlifecycle-
2WorkflowCRITICALworkflow-
3StepHIGHstep-
4QueueHIGHqueue-
5CommunicationMEDIUMcomm-
6PatternMEDIUMpattern-
7TestingLOW-MEDIUMtest-
8ClientMEDIUMclient-
9AdvancedLOWadvanced-

Critical Rules

Installation

Add the DBOS dependency (Java 17+, Gradle 8+ recommended):

dependencies {
    implementation("dev.dbos:transact:1.2.0")
    implementation("org.slf4j:slf4j-simple:2.0.17") // to see DBOS log messages
}

DBOS requires a PostgreSQL-compatible database. Connection settings are typically supplied through DBOS_SYSTEM_JDBC_URL, PGUSER, and PGPASSWORD.

DBOS Configuration and Launch

A DBOS application MUST create a DBOS instance, register its workflow classes, then launch:

import dev.dbos.transact.DBOS;
import dev.dbos.transact.config.DBOSConfig;
import dev.dbos.transact.workflow.Workflow;

interface Example {
  String workflow(String input);
}

class ExampleImpl implements Example {
  private final DBOS dbos;

  ExampleImpl(DBOS dbos) {
    this.dbos = dbos;
  }

  @Override
  @Workflow
  public String workflow(String input) {
    return dbos.runStep(() -> fetchData(input), "fetchData");
  }

  private String fetchData(String input) { /* external call */ return input; }
}

public class App {
  public static void main(String[] args) {
    DBOSConfig config = DBOSConfig.defaultsFromEnv("my-app")
        .withAppVersion("0.1.0");
    DBOS dbos = new DBOS(config);

    Example proxy = dbos.registerProxy(Example.class, new ExampleImpl(dbos));

    dbos.launch();

    proxy.workflow("input"); // durable: called through the proxy
  }
}

When creating a new application, set withAppVersion("0.1.0"). If omitted, DBOS derives an opaque hash from the workflow code, SDK version, and application name. When editing an existing application, leave its configured version alone — changing it is a deployment decision (see references/advanced-versioning.md). Version names are unique across a shared system database, so applications sharing one need distinct version strings (for example "billing-0.1.0"; see references/advanced-shared-database.md).

The name passed to DBOSConfig.defaults(appName) / defaultsFromEnv(appName) identifies the application and owns everything it creates. Multiple applications (in any language) can share one system database, isolated by application name (1.1+, see references/advanced-shared-database.md).

Workflow and Step Structure

Workflows are ordinary methods annotated @Workflow on a class registered with registerProxy. Any operation that is complex, non-deterministic, or calls an external service must run as a step, either through dbos.runStep or as a @Step-annotated method invoked through the proxy:

@Workflow
public String myWorkflow(String url) throws Exception {
  // Inline lambda step — use for one-off work
  String body = dbos.runStep(() -> httpGet(url), "httpGet");
  // Reusable step declared with @Step — MUST be invoked through the proxy (self)
  return self.parse(body);
}

@Step(maxAttempts = 3)
public String parse(String body) { /* ... */ }

Key Constraints

  • Workflows and @Step methods are ONLY durable when invoked through the proxy returned by registerProxy (or, with Spring Boot, through an injected self-reference). Calls via this bypass DBOS.
  • All workflow classes MUST be registered before launch(); database-backed queues are registered after launch()
  • Do NOT start, enqueue, or retrieve workflows from within a step, and do NOT call send, recv, setEvent, or getEvent from a step
  • Workflows MUST be deterministic — random numbers, current time, I/O, and threading go in steps
  • Do NOT mutate state outside the workflow's own scope from workflows or steps
  • Workflow arguments and step/workflow return values MUST be JSON-serializable by Jackson
  • Use dbos.sleep, not Thread.sleep, inside workflows

How to Use

Read individual rule files for detailed explanations and examples:

references/lifecycle-config.md
references/workflow-registration.md
references/queue-concurrency.md

References

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.