New to Claude Skills? Learn how to install them →

sickn33 on GitHub

DBOS Go Best Practices

Free

Build reliable Go applications with DBOS workflows.

Get this skill

Free · Opens the source repo

What DBOS Go Best Practices does

The DBOS Go Best Practices skill provides a comprehensive guide for developers looking to implement durable workflows in Go applications using the DBOS framework. This skill is particularly useful for those integrating DBOS into existing Go codebases, creating new workflows and steps, or managing concurrency through queues. It emphasizes best practices for building fault-tolerant applications, helping to ensure that workflows are executed reliably and efficiently.

The skill includes detailed instructions on setting up and configuring DBOS applications, including the necessary context creation and workflow registration. It outlines critical rules that developers must follow, such as ensuring workflows are deterministic and managing concurrency properly. For example, workflows should not be started or enqueued within steps, and global variables should remain unmodified to maintain consistency across executions.

Additionally, the skill offers a structured approach to understanding the various components of DBOS, categorized by priority. This allows developers to focus on the most critical aspects of lifecycle management, workflow execution, and queue handling. Each category includes specific guidelines and examples to facilitate implementation, making it easier for both novice and experienced Go developers to adopt DBOS best practices.

By referencing the provided rule files and examples, users can effectively navigate the complexities of DBOS and ensure their applications are robust and maintainable. This skill is an essential resource for anyone looking to leverage DBOS in their Go projects, providing clarity and direction in a structured manner.

When to use it

Use this skill when adding DBOS to existing Go applications, creating workflows, or managing concurrency with queues.

When not to use it

This skill is not suitable for tasks outside the scope of DBOS workflows or for applications that require extensive environment-specific validation.

What you can build with it

Integrating DBOS into an Existing Application

Reference the guidelines to smoothly integrate DBOS into your current Go application, ensuring best practices are followed.

Creating New Workflows

Use the skill to guide the creation of new workflows and steps, leveraging DBOS for efficient task management.

Managing Concurrency with Queues

Implement concurrency control in your Go applications by following the queue management best practices outlined in the skill.

How to install DBOS Go Best Practices

View source

1. Install with the skills CLI

npx skills add sickn33/agentic-awesome-skills/dbos-golang --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 Go Best Practices

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

When to Use

Reference these guidelines when:

  • Adding DBOS to existing Go code
  • Creating workflows and steps
  • Using queues for concurrency control
  • Implementing workflow communication (events, messages, streams)
  • Configuring and launching DBOS applications
  • Using the DBOS Client from external applications
  • Testing DBOS applications

Rule Categories by Priority

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

Critical Rules

Installation

Install the DBOS Go module:

go get github.com/dbos-inc/dbos-transact-golang/dbos@latest

DBOS Configuration and Launch

A DBOS application MUST create a context, register workflows, and launch before running any workflows:

package main

import (
	"context"
	"log"
	"os"
	"time"

	"github.com/dbos-inc/dbos-transact-golang/dbos"
)

func main() {
	ctx, err := dbos.NewDBOSContext(context.Background(), dbos.Config{
		AppName:     "my-app",
		DatabaseURL: os.Getenv("DBOS_SYSTEM_DATABASE_URL"),
	})
	if err != nil {
		log.Fatal(err)
	}
	defer dbos.Shutdown(ctx, 30*time.Second)

	dbos.RegisterWorkflow(ctx, myWorkflow)

	if err := dbos.Launch(ctx); err != nil {
		log.Fatal(err)
	}
}

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.RunAsStep:

func fetchData(ctx context.Context) (string, error) {
	resp, err := http.Get("https://api.example.com/data")
	if err != nil {
		return "", err
	}
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	return string(body), nil
}

func myWorkflow(ctx dbos.DBOSContext, input string) (string, error) {
	result, err := dbos.RunAsStep(ctx, fetchData, dbos.WithStepName("fetchData"))
	if err != nil {
		return "", err
	}
	return result, nil
}

Key Constraints

  • Do NOT start or enqueue workflows from within steps
  • Do NOT use uncontrolled goroutines to start workflows - use dbos.RunWorkflow with queues or dbos.Go/dbos.Select for concurrent steps
  • Workflows MUST be deterministic - non-deterministic operations go in steps
  • Do NOT modify global variables from workflows or steps
  • All workflows and queues MUST be registered before calling Launch()

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 Go Best Practices

Similar skills