[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-af0f7e38-c9cd-4e30-b292-85311f763951":3,"$f7jzhrN1QjZ_iMFVK2T6pUc_HP7KSxE7Un-ePm66uA4g":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"af0f7e38-c9cd-4e30-b292-85311f763951","dbos-golang","构建可靠、容错的Go应用程序的DBOS持久工作流指南。在将DBOS添加到现有Go代码、创建工作流和步骤或使用队列进行并发控制时使用。","cat_life_career","mod_other","sickn33,other","---\nname: dbos-golang\ndescription: \"Guide for building reliable, fault-tolerant Go applications with DBOS durable workflows. Use when adding DBOS to existing Go code, creating workflows and steps, or using queues for concurrency control.\"\nrisk: safe\nsource: \"https:\u002F\u002Fdocs.dbos.dev\u002F\"\ndate_added: \"2026-02-27\"\n---\n\n# DBOS Go Best Practices\n\nGuide for building reliable, fault-tolerant Go applications with DBOS durable workflows.\n\n## When to Use\nReference these guidelines when:\n- Adding DBOS to existing Go code\n- Creating workflows and steps\n- Using queues for concurrency control\n- Implementing workflow communication (events, messages, streams)\n- Configuring and launching DBOS applications\n- Using the DBOS Client from external applications\n- Testing DBOS applications\n\n## Rule Categories by Priority\n\n| Priority | Category | Impact | Prefix |\n|----------|----------|--------|--------|\n| 1 | Lifecycle | CRITICAL | `lifecycle-` |\n| 2 | Workflow | CRITICAL | `workflow-` |\n| 3 | Step | HIGH | `step-` |\n| 4 | Queue | HIGH | `queue-` |\n| 5 | Communication | MEDIUM | `comm-` |\n| 6 | Pattern | MEDIUM | `pattern-` |\n| 7 | Testing | LOW-MEDIUM | `test-` |\n| 8 | Client | MEDIUM | `client-` |\n| 9 | Advanced | LOW | `advanced-` |\n\n## Critical Rules\n\n### Installation\n\nInstall the DBOS Go module:\n\n```bash\ngo get github.com\u002Fdbos-inc\u002Fdbos-transact-golang\u002Fdbos@latest\n```\n\n### DBOS Configuration and Launch\n\nA DBOS application MUST create a context, register workflows, and launch before running any workflows:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"os\"\n\t\"time\"\n\n\t\"github.com\u002Fdbos-inc\u002Fdbos-transact-golang\u002Fdbos\"\n)\n\nfunc main() {\n\tctx, err := dbos.NewDBOSContext(context.Background(), dbos.Config{\n\t\tAppName:     \"my-app\",\n\t\tDatabaseURL: os.Getenv(\"DBOS_SYSTEM_DATABASE_URL\"),\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer dbos.Shutdown(ctx, 30*time.Second)\n\n\tdbos.RegisterWorkflow(ctx, myWorkflow)\n\n\tif err := dbos.Launch(ctx); err != nil {\n\t\tlog.Fatal(err)\n\t}\n}\n```\n\n### Workflow and Step Structure\n\nWorkflows are comprised of steps. Any function performing complex operations or accessing external services must be run as a step using `dbos.RunAsStep`:\n\n```go\nfunc fetchData(ctx context.Context) (string, error) {\n\tresp, err := http.Get(\"https:\u002F\u002Fapi.example.com\u002Fdata\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\tbody, _ := io.ReadAll(resp.Body)\n\treturn string(body), nil\n}\n\nfunc myWorkflow(ctx dbos.DBOSContext, input string) (string, error) {\n\tresult, err := dbos.RunAsStep(ctx, fetchData, dbos.WithStepName(\"fetchData\"))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn result, nil\n}\n```\n\n### Key Constraints\n\n- Do NOT start or enqueue workflows from within steps\n- Do NOT use uncontrolled goroutines to start workflows - use `dbos.RunWorkflow` with queues or `dbos.Go`\u002F`dbos.Select` for concurrent steps\n- Workflows MUST be deterministic - non-deterministic operations go in steps\n- Do NOT modify global variables from workflows or steps\n- All workflows and queues MUST be registered before calling `Launch()`\n\n## How to Use\n\nRead individual rule files for detailed explanations and examples:\n\n```\nreferences\u002Flifecycle-config.md\nreferences\u002Fworkflow-determinism.md\nreferences\u002Fqueue-concurrency.md\n```\n\n## References\n\n- https:\u002F\u002Fdocs.dbos.dev\u002F\n- https:\u002F\u002Fgithub.com\u002Fdbos-inc\u002Fdbos-transact-golang\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,117,396,"2026-05-16 13:14:26",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"其他","other","mdi-page-next-outline","其他类型Skill",5,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"职场发展","career","mdi-briefcase-outline","面试准备、简历优化、职业规划",4,575,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"68d1d5d1-802e-409d-8a0f-0fae96a0fe8f","1.0.0","dbos-golang.zip",30598,"uploads\u002Fskills\u002Faf0f7e38-c9cd-4e30-b292-85311f763951\u002Fdbos-golang.zip","f235d3951d9718867a0126b747f624ef029397e4f6a0cdd5da221dd450ec4499","[{\"path\":\"AGENTS.md\",\"isDirectory\":false,\"size\":2641},{\"path\":\"CLAUDE.md\",\"isDirectory\":false,\"size\":9},{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":3640},{\"path\":\"references\u002F_sections.md\",\"isDirectory\":false,\"size\":1444},{\"path\":\"references\u002Fadvanced-patching.md\",\"isDirectory\":false,\"size\":2894},{\"path\":\"references\u002Fadvanced-versioning.md\",\"isDirectory\":false,\"size\":1880},{\"path\":\"references\u002Fclient-enqueue.md\",\"isDirectory\":false,\"size\":2077},{\"path\":\"references\u002Fclient-setup.md\",\"isDirectory\":false,\"size\":1965},{\"path\":\"references\u002Fcomm-events.md\",\"isDirectory\":false,\"size\":2238},{\"path\":\"references\u002Fcomm-messages.md\",\"isDirectory\":false,\"size\":1986},{\"path\":\"references\u002Fcomm-streaming.md\",\"isDirectory\":false,\"size\":2309},{\"path\":\"references\u002Flifecycle-config.md\",\"isDirectory\":false,\"size\":2064},{\"path\":\"references\u002Fpattern-debouncing.md\",\"isDirectory\":false,\"size\":1761},{\"path\":\"references\u002Fpattern-idempotency.md\",\"isDirectory\":false,\"size\":1967},{\"path\":\"references\u002Fpattern-scheduled.md\",\"isDirectory\":false,\"size\":2047},{\"path\":\"references\u002Fpattern-sleep.md\",\"isDirectory\":false,\"size\":1467},{\"path\":\"references\u002Fqueue-basics.md\",\"isDirectory\":false,\"size\":1404},{\"path\":\"references\u002Fqueue-concurrency.md\",\"isDirectory\":false,\"size\":1460},{\"path\":\"references\u002Fqueue-deduplication.md\",\"isDirectory\":false,\"size\":1601},{\"path\":\"references\u002Fqueue-listening.md\",\"isDirectory\":false,\"size\":1332},{\"path\":\"references\u002Fqueue-partitioning.md\",\"isDirectory\":false,\"size\":1314},{\"path\":\"references\u002Fqueue-priority.md\",\"isDirectory\":false,\"size\":1221},{\"path\":\"references\u002Fqueue-rate-limiting.md\",\"isDirectory\":false,\"size\":1241},{\"path\":\"references\u002Fstep-basics.md\",\"isDirectory\":false,\"size\":2353},{\"path\":\"references\u002Fstep-concurrency.md\",\"isDirectory\":false,\"size\":2419},{\"path\":\"references\u002Fstep-retries.md\",\"isDirectory\":false,\"size\":2069},{\"path\":\"references\u002Ftest-setup.md\",\"isDirectory\":false,\"size\":2311},{\"path\":\"references\u002Fworkflow-background.md\",\"isDirectory\":false,\"size\":1598},{\"path\":\"references\u002Fworkflow-constraints.md\",\"isDirectory\":false,\"size\":2081},{\"path\":\"references\u002Fworkflow-control.md\",\"isDirectory\":false,\"size\":1692},{\"path\":\"references\u002Fworkflow-determinism.md\",\"isDirectory\":false,\"size\":1499},{\"path\":\"references\u002Fworkflow-introspection.md\",\"isDirectory\":false,\"size\":1865},{\"path\":\"references\u002Fworkflow-timeout.md\",\"isDirectory\":false,\"size\":1324}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]