dbos-typescript
它能做什么
这份指南教你如何使用 DBOS 构建更可靠、更具容错能力的 TypeScript 应用。它会帮你把代码组织成“工作流”和“步骤”,即使出现意外,也能确保一切正确运行。
适用场景
- ✓当你要把 DBOS 添加到现有的 TypeScript 项目中时。
- ✓当你要创建新的“工作流”(任务序列)和“步骤”(单个任务)时。
- ✓当你要使用队列来控制同时运行的任务数量时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/dbos-typescript/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我该如何配置 DBOS 来开始使用?”
每周 5 个新技能,1 分钟读完。
工作原理
DBOS 会把你的代码组织成“工作流”和“步骤”。即使程序崩溃,它也能确保每个步骤可靠地执行。如果某个步骤失败,DBOS 可以重试它,或者确保之前的状态得以保留。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Lifecycle | CRITICAL | lifecycle- |
| 2 | Workflow | CRITICAL | workflow- |
| 3 | Step | HIGH | step- |
| 4 | Queue | HIGH | queue- |
| 5 | Communication | MEDIUM | comm- |
| 6 | Pattern | MEDIUM | pattern- |
| 7 | Testing | LOW-MEDIUM | test- |
| 8 | Client | MEDIUM | client- |
| 9 | Advanced | LOW | advanced- |
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.startWorkflowor 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.
常见问题
什么是“工作流”和“步骤”?
“工作流”是需要按顺序执行的一系列任务,“步骤”是“工作流”中的单个任务。DBOS 会确保“步骤”可靠地执行。
为什么代码需要是“确定性”的?
这意味着相同的输入总会得到相同的输出。这一点很重要,因为 DBOS 需要借此保证可靠性,并在必要时重新执行某个步骤,同时不改变最终结果。
DBOS 如何处理故障?
DBOS 被设计成具有“容错性”。它可以记录执行进度,一旦出现问题,就尝试重新执行某个步骤,或确保系统保持一致的状态。
详情
作者的原始描述
Guide for building reliable, fault-tolerant TypeScript applications with DBOS durable workflows. Use when adding DBOS to existing TypeScript code, creating workflows and steps, or using queues for concurrency control.
热度
- GitHub 星标
- 48k
- 排名
- #4344
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。