New to Claude Skills? Learn how to install them →

sickn33 on GitHub

DBOS TypeScript Best Practices

Free

Build reliable TypeScript applications with DBOS workflows.

Get this skill

Free · Opens the source repo

What DBOS TypeScript Best Practices does

The DBOS TypeScript Best Practices skill provides a comprehensive guide for developers looking to implement durable workflows in TypeScript applications using DBOS. It is particularly useful for those who are integrating DBOS into existing projects or creating new workflows and steps. The skill emphasizes the importance of fault tolerance and reliability in application design, ensuring that developers can build robust systems that handle concurrency and communication effectively.

This skill covers critical aspects of DBOS, including lifecycle management, workflow structure, and the use of queues for concurrency control. It provides concrete examples and code snippets, making it easier for developers to understand and implement best practices in their applications. The structured approach to defining workflows and steps helps prevent common pitfalls, such as modifying global variables or using uncontrolled concurrency, which can lead to unpredictable behavior in applications.

By following the guidelines outlined in this skill, developers can streamline the process of configuring and launching DBOS applications. It also serves as a reference for testing DBOS applications, ensuring that all components work as intended. This skill is ideal for developers who want to leverage the full potential of DBOS in their TypeScript projects, whether they are new to DBOS or looking to refine their existing implementations.

In summary, the DBOS TypeScript Best Practices skill is a valuable resource for developers aiming to enhance the reliability and maintainability of their TypeScript applications through best practices in workflow management and concurrency control.

When to use it

Use this skill when adding DBOS to existing TypeScript code, creating workflows, or managing queues for concurrency control.

When not to use it

This skill is not suitable for tasks outside the scope of DBOS integration or for applications that do not require durable workflows.

What you can build with it

Integrating DBOS into a New Project

Use this skill to set up DBOS in a new TypeScript application, ensuring best practices are followed from the start.

Refactoring Existing Code

Leverage the guidelines to refactor existing TypeScript code to incorporate DBOS workflows for improved reliability.

Testing DBOS Applications

Utilize the testing strategies outlined in this skill to validate the functionality of your DBOS applications.

How to install DBOS TypeScript Best Practices

View source

1. Install with the skills CLI

npx skills add sickn33/agentic-awesome-skills/dbos-typescript --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by sickn33

DBOS TypeScript Best Practices

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

When to Use

Reference these guidelines when:

  • Adding DBOS to existing TypeScript code
  • Creating workflows and steps
  • Using queues for concurrency control
  • Implementing workflow communication (events, messages, streams)
  • Configuring and launching DBOS applications
  • 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

Always install the latest version of DBOS:

npm install @dbos-inc/dbos-sdk@latest

DBOS Configuration and Launch

A DBOS application MUST configure and launch DBOS before running any workflows:

import { DBOS } from "@dbos-inc/dbos-sdk";

async function main() {
  DBOS.setConfig({
    name: "my-app",
    systemDatabaseUrl: process.env.DBOS_SYSTEM_DATABASE_URL,
  });
  await DBOS.launch();
  await myWorkflow();
}

main().catch(console.log);

Workflow and Step Structure

Workflows are comprised of steps. Any function performing complex operations or accessing external services must be run as a step using DBOS.runStep:

import { DBOS } from "@dbos-inc/dbos-sdk";

async function fetchData() {
  return await fetch("https://api.example.com").then(r => r.json());
}

async function myWorkflowFn() {
  const result = await DBOS.runStep(fetchData, { name: "fetchData" });
  return result;
}
const myWorkflow = DBOS.registerWorkflow(myWorkflowFn);

Key Constraints

  • Do NOT call, start, or enqueue workflows from within steps
  • Do NOT use threads or uncontrolled concurrency to start workflows - use DBOS.startWorkflow or queues
  • Workflows MUST be deterministic - non-deterministic operations go in steps
  • Do NOT modify global variables from workflows or steps

How to Use

Read individual rule files for detailed explanations and examples:

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

References

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

Frequently asked questions about DBOS TypeScript Best Practices

Similar skills