Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)48k · #4344

dbos-typescript

Skill này làm gì

Hướng dẫn này chỉ cách xây dựng ứng dụng TypeScript đáng tin cậy và chịu lỗi tốt hơn bằng DBOS. Nó giúp tổ chức mã thành “workflow” và “step” để mọi thứ chạy đúng, ngay cả khi có sự cố.

Khi nào nên dùng

  • ✓Khi thêm DBOS vào một dự án TypeScript đang có.
  • ✓Khi tạo các “workflow” (chuỗi tác vụ) và “step” (tác vụ riêng lẻ) mới.
  • ✓Khi kiểm soát số tác vụ chạy cùng lúc bằng hàng đợi.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/dbos-typescript/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/dbos-typescript/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm thế nào để cấu hình DBOS để bắt đầu?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

DBOS tổ chức mã của bạn thành “workflow” và “step”. Nó đảm bảo mỗi step được thực thi đáng tin cậy, ngay cả khi chương trình bị sập. Nếu một step thất bại, DBOS có thể thử lại hoặc đảm bảo trạng thái trước đó được giữ nguyên.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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.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.
Câu hỏi thường gặp

“Workflow” và “step” là gì?

“Workflow” là chuỗi các tác vụ cần thực hiện theo thứ tự. “Step” là các tác vụ riêng lẻ trong một “workflow”. DBOS đảm bảo các “step” được thực thi đáng tin cậy.

Vì sao mã cần có tính “xác định” (deterministic)?

Nghĩa là với cùng một đầu vào, mã sẽ luôn cho cùng một đầu ra. Điều này quan trọng để DBOS đảm bảo độ tin cậy và, khi cần, chạy lại một step mà không làm thay đổi kết quả cuối cùng.

DBOS xử lý lỗi như thế nào?

DBOS được thiết kế để chịu lỗi (fault-tolerant). Nó có thể ghi lại tiến trình và, nếu có sự cố, thử chạy lại một step hoặc đảm bảo hệ thống vẫn ở trạng thái nhất quán.

Chi tiết

Mô tả gốc của tác giả

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.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#4344
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự