Docs backend skill#2640
Open
baiyutang wants to merge 1 commit intocoze-dev:mainfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a tool-agnostic “Coze Studio backend Go + DDD” documentation skill bundle under docs/skills/coze-backend-go/ to guide backend contributions (IDL-first, layering, DAL generation, errno, etc.). Also includes a small backend change to improve ORDER BY field resolution in memory database SQL execution.
Changes:
- Add a new documentation bundle (
SKILL.md, checklist, notes, citations, and Skill 1–14 topic docs) describing backend conventions forcoze-studiov0.5.1. - Add a Mermaid flowchart generator skill doc for consistent diagram output.
- Update
executeSelectSQLto additionally mapOrderByList.Fieldfrom AlterID → physical column name.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/skills/coze-backend-go/SKILL.md | Entry point + index for the skill bundle and repo layering map. |
| docs/skills/coze-backend-go/README.md | Usage/readme for installing and triggering the skill bundle. |
| docs/skills/coze-backend-go/checklist.md | End-to-end SOP for adding a module/API (DDL → IDL → layers → errno → wiring). |
| docs/skills/coze-backend-go/notes.md | Additional repo-specific caveats (generated code, layering, error handling, etc.). |
| docs/skills/coze-backend-go/citations.md | Code pointer index (paths + line ranges) to avoid copying stale snippets. |
| docs/skills/coze-backend-go/skill-01-idl.md | IDL-first rules and hz codegen guidance. |
| docs/skills/coze-backend-go/skill-02-dal.md | DAL reverse-generation workflow via gorm/gen. |
| docs/skills/coze-backend-go/skill-03-domain.md | Domain module structure and boundaries (DDD layering). |
| docs/skills/coze-backend-go/skill-04-application.md | Application layer responsibilities and init chain conventions. |
| docs/skills/coze-backend-go/skill-05-transaction.md | Transaction template and DAL WithTX variant conventions. |
| docs/skills/coze-backend-go/skill-06-errno.md | Errno ranges, registration, layered validation, and handler mapping behavior. |
| docs/skills/coze-backend-go/skill-07-handler.md | Standard Hertz handler implementation pattern. |
| docs/skills/coze-backend-go/skill-08-middleware.md | Middleware ordering + session/space-authorization conventions. |
| docs/skills/coze-backend-go/skill-09-crossdomain.md | crossdomain package layout and registration conventions. |
| docs/skills/coze-backend-go/skill-10-dto.md | DTO placement and layering table. |
| docs/skills/coze-backend-go/skill-11-mock.md | Mock generation/testing structure guidance (mockgen + AAA). |
| docs/skills/coze-backend-go/skill-12-id.md | ID generation conventions and IDL api.js_conv note. |
| docs/skills/coze-backend-go/skill-13-flowchart-generator.md | Mermaid diagram generation skill (Mermaid 9.2.2 compatibility rules). |
| docs/skills/coze-backend-go/skill-14-eino.md | Eino usage boundaries and code distribution guidance. |
| backend/domain/memory/database/service/database_impl.go | Map OrderByList.Field from AlterID to physical column name during SELECT. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| @@ -0,0 +1,75 @@ | |||
| ## Coze Backend Go + DDD - Skill | |||
|
|
|||
| This is the Coze Studio backend engineering conventions | |||
| - SOP: `checklist.md` | ||
| - Notes: `notes.md` | ||
| - Code pointers: `citations.md` | ||
| - Detailed topics: `skill-01-*.md` … `skill-13-*.md` |
| - {table}.go DAO implementation (CRUD + WithTX variants) | ||
|
|
||
| Step 4: Register errno | ||
| - Add error-code constants in types/errno/{domain}.go (allocate within range) |
| @@ -0,0 +1,22 @@ | |||
| # Notes | |||
|
|
|||
| 1. **Generated code vs handwritten code**: files under `api/router/coze/api.go`, `api/model/`, `dal/model/*.gen.go`, and `dal/query/*.gen.go` are **generated** and must **not** be edited manually. Handler function bodies, middleware bodies, the `application/` layer, and the `domain/` layer are handwritten. | |||
Comment on lines
+20
to
+22
| api/router/coze/api.go (routes) | ||
| api/model/{gen_path}/*.go (API structs) | ||
| api/handler/coze/{service}_service.go (handler stubs) |
Comment on lines
+43
to
+51
| - application/{X}/init.go InitService + dependency injection | ||
| - application/{X}/*.go orchestrate, call Domain services | ||
|
|
||
| Step 6: Implement handler bodies | ||
| - api/handler/coze/{service}_service.go fill handler function bodies | ||
|
|
||
| Step 7: Register crossdomain (if needed) | ||
| - crossdomain/{X}/ define interface contracts | ||
| - application/application.go SetDefaultSVC(...) |
|
|
||
| ## Conventions | ||
|
|
||
| - Service names and method names use **camelCase**. |
Comment on lines
+8
to
+13
| defer func() { | ||
| if r := recover(); r != nil { | ||
| tx.Rollback(); err = fmt.Errorf("catch panic: %v\nstack=%s", r, debug.Stack()); return | ||
| } | ||
| if err != nil { tx.Rollback() } | ||
| }() |
Comment on lines
+1234
to
+1240
| physicalField := order.Field | ||
| if mapped, exists := fieldNameToPhysical[order.Field]; exists { | ||
| physicalField = mapped | ||
| } else { | ||
| // AlterID | ||
| if _, exists := fieldMap[order.Field]; exists { | ||
| physicalField = fieldMap[order.Field].PhysicalName |
5971225 to
fb430db
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
docs
Check the PR title.
This PR title match the format: (optional scope):
The description of this PR title is user-oriented and clear enough for others to understand.
Add documentation if the current PR requires user awareness at the usage level.
PR title (suggested): docs(skills): add Coze Studio backend Go DDD skill bundle (v0.5.1)
(Optional) Translate the PR title into Chinese.
(可选)docs(skills): 新增 Coze Studio 后端 Go DDD 技能文档包(v0.5.1)
(Optional) More detailed description for this PR(en: English/zh: Chinese).
en:
Add a tool-agnostic backend development skill bundle under docs/skills/coze-backend-go/.
Covers IDL-first workflow (hz), DDD layering, DAL generation (gorm/gen), errno conventions, transactions, middleware/session, crossdomain/infra patterns, ID generation, and Eino usage notes.
Includes citations.md (code pointers) and an end-to-end checklist for adding modules/APIs.
zh(optional):
(可选)在 docs/skills/coze-backend-go/ 新增一套与工具无绑定的后端开发技能文档,覆盖 IDL/DDD/DAL/errno/事务/middleware/crossdomain/infra/IDGen/Eino,并提供引用索引与 SOP。
(Optional) Which issue(s) this PR fixes:
N/A