[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7F57DX85QKEY84D7CK5HZ71":3,"skill-same:01M7F57DX85QKEY84D7CK5HZ71":43},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":13,"repositoryHtmlUrl":26,"repositoryHomepageUrl":6,"ownerHtmlUrl":27,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":28,"install":29,"resources":42},"01M7F57DX85QKEY84D7CK5HZ71","shared-packages",null,"The packages every service shares under pkg\u002F — logging, errors, httputil, openapi and middleware — what each gives, and when a new one belongs there.","workflowaiorg\u002Fworkflow","workflowaiorg","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F344728430?v=4","01M7F5606QN4BXN2KJNCJPCKAZ","01M7F5607RE7Y5NNRN60FW9NJ3",0,"MIT","https:\u002F\u002Fgithub.com\u002Fworkflowaiorg\u002Fworkflow\u002Fblob\u002Fmain\u002Finternal\u002Fcomponent\u002Fbackend\u002Fbase\u002Fskills\u002Fshared-packages\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\nname: shared-packages\ndescription: \"The packages every service shares under pkg\u002F — logging, errors, httputil, openapi and middleware — what each gives, and when a new one belongs there.\"\n---\n\n# Skill: Shared packages\n\nThe root `pkg\u002F` holds what every service needs, written once. `wf add backend` wrote the ones\nbelow; they are the project's own, to change and extend.\n\n## When this skill applies\n\n- Using `pkg\u002Flogging`, `pkg\u002Ferrors`, `pkg\u002Fhttputil`, `pkg\u002Fopenapi` or `pkg\u002Fmiddleware`\n- Writing code a second service needs, which goes here rather than into a copy\n\n## `pkg\u002Flogging`\n\n| | |\n|---|---|\n| `Init()` | first line of every `main()`: JSON lines on stdout |\n| `Debug`, `Info`, `Warn`, `Error(ctx, msg, args...)` | log with the correlation ID `ctx` carries |\n| `WithCorrelationID`, `CorrelationID` | put the ID in a context, read it back |\n\n## `pkg\u002Ferrors`\n\n| | |\n|---|---|\n| `APIError{Code, Message, Cause}` | the one error that crosses layers; `Cause` is never sent to a client |\n| `New(code, message, cause)` | make one |\n| `HTTPStatus(code)`, `FromHTTPStatus(status)` | the HTTP status of a code, and the code of a status another service answered with |\n| `As`, `Is` | the standard ones, so a file needs only this errors package |\n\nAdd a code when a client must tell a new kind of failure apart, and give it its status in both\nfunctions.\n\n## `pkg\u002Fhttputil`\n\n| | |\n|---|---|\n| `Success(c, data)`, `Created(c, data)` | answer 200 or 201 with `{\"data\": …}` |\n| `RespondWithError(c, err)` | answer `{\"error\": {\"code\", \"message\"}}` with the code's status; logs the cause |\n| `BindError(err)` | the `APIError` for a request `ShouldBind*` rejected; its message names each field as the client sends it and the rule it broke, never a Go name |\n| `BindQuery(c, &q)` | binds the query into `q` by its `form` tags; a bad value is a 400 naming the parameter |\n| `ParamID(c, \"id\", \"order\")` | a positive ID from a path parameter; anything else is a 400 naming it |\n| `SplitList(raw)` | a comma-separated value as its trimmed, non-empty items |\n| `PageQuery`, `ParsePage(c, max)`, `Page.HasMore(returned, total)` | a paged list's `offset` and `limit`; no limit is a full page, one past `max` is a 400 |\n\n## `pkg\u002Fopenapi`\n\n| | |\n|---|---|\n| `Operation`, `Build(operations)` | a route's description, and the document built from them: the `api-design` skill |\n| `openapitest.Engine(t)`, `openapitest.Context(t, w)` | Gin for a handler test, checking each response against `openapi.yaml`: the `testing` skill |\n\n## `pkg\u002Fmiddleware`\n\n| | |\n|---|---|\n| `CorrelationID()` | gives each request its `X-Request-ID`, or a new one, in its context and its response |\n\nA gateway that calls another service passes the correlation ID on in the same header, so one\nrequest can be followed through every service's logs.\n\n## A new shared package\n\nCode goes here when a second service needs it, moved rather than copied, with its tests. It depends\nonly on other `pkg\u002F` packages and libraries, never on a service.\n\n## Definition of done\n\n- [ ] Nothing in a service repeats what a `pkg\u002F` package does\n- [ ] A new shared package has its own tests and imports no service\n","# Skill: Shared packages\n\nThe root `pkg\u002F` holds what every service needs, written once. `wf add backend` wrote the ones\nbelow; they are the project's own, to change and extend.\n\n## When this skill applies\n\n- Using `pkg\u002Flogging`, `pkg\u002Ferrors`, `pkg\u002Fhttputil`, `pkg\u002Fopenapi` or `pkg\u002Fmiddleware`\n- Writing code a second service needs, which goes here rather than into a copy\n\n## `pkg\u002Flogging`\n\n| | |\n|---|---|\n| `Init()` | first line of every `main()`: JSON lines on stdout |\n| `Debug`, `Info`, `Warn`, `Error(ctx, msg, args...)` | log with the correlation ID `ctx` carries |\n| `WithCorrelationID`, `CorrelationID` | put the ID in a context, read it back |\n\n## `pkg\u002Ferrors`\n\n| | |\n|---|---|\n| `APIError{Code, Message, Cause}` | the one error that crosses layers; `Cause` is never sent to a client |\n| `New(code, message, cause)` | make one |\n| `HTTPStatus(code)`, `FromHTTPStatus(status)` | the HTTP status of a code, and the code of a status another service answered with |\n| `As`, `Is` | the standard ones, so a file needs only this errors package |\n\nAdd a code when a client must tell a new kind of failure apart, and give it its status in both\nfunctions.\n\n## `pkg\u002Fhttputil`\n\n| | |\n|---|---|\n| `Success(c, data)`, `Created(c, data)` | answer 200 or 201 with `{\"data\": …}` |\n| `RespondWithError(c, err)` | answer `{\"error\": {\"code\", \"message\"}}` with the code's status; logs the cause |\n| `BindError(err)` | the `APIError` for a request `ShouldBind*` rejected; its message names each field as the client sends it and the rule it broke, never a Go name |\n| `BindQuery(c, &q)` | binds the query into `q` by its `form` tags; a bad value is a 400 naming the parameter |\n| `ParamID(c, \"id\", \"order\")` | a positive ID from a path parameter; anything else is a 400 naming it |\n| `SplitList(raw)` | a comma-separated value as its trimmed, non-empty items |\n| `PageQuery`, `ParsePage(c, max)`, `Page.HasMore(returned, total)` | a paged list's `offset` and `limit`; no limit is a full page, one past `max` is a 400 |\n\n## `pkg\u002Fopenapi`\n\n| | |\n|---|---|\n| `Operation`, `Build(operations)` | a route's description, and the document built from them: the `api-design` skill |\n| `openapitest.Engine(t)`, `openapitest.Context(t, w)` | Gin for a handler test, checking each response against `openapi.yaml`: the `testing` skill |\n\n## `pkg\u002Fmiddleware`\n\n| | |\n|---|---|\n| `CorrelationID()` | gives each request its `X-Request-ID`, or a new one, in its context and its response |\n\nA gateway that calls another service passes the correlation ID on in the same header, so one\nrequest can be followed through every service's logs.\n\n## A new shared package\n\nCode goes here when a second service needs it, moved rather than copied, with its tests. It depends\nonly on other `pkg\u002F` packages and libraries, never on a service.\n\n## Definition of done\n\n- [ ] Nothing in a service repeats what a `pkg\u002F` package does\n- [ ] A new shared package has its own tests and imports no service\n",{"name":5,"description":7},"main","68fb57dd74de5ed76dcfaff357932684f77650e6","internal\u002Fcomponent\u002Fbackend\u002Fbase\u002Fskills\u002Fshared-packages","https:\u002F\u002Fgithub.com\u002Fworkflowaiorg\u002Fworkflow","https:\u002F\u002Fgithub.com\u002Fworkflowaiorg","2026-11-13 17:41:05",{"source":8,"skillName":5,"commands":30,"prompt":40,"zipAvailable":41},[31,34,37],{"tool":32,"command":33},"npx","npx skills add workflowaiorg\u002Fworkflow --skill shared-packages",{"tool":35,"command":36},"bunx","bunx skills add workflowaiorg\u002Fworkflow --skill shared-packages",{"tool":38,"command":39},"pnpm","pnpm dlx skills add workflowaiorg\u002Fworkflow --skill shared-packages","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fworkflowaiorg\u002Fworkflow\u002Fblob\u002Fmain\u002Finternal\u002Fcomponent\u002Fbackend\u002Fbase\u002Fskills\u002Fshared-packages\u002FSKILL.md",true,[],[44,51,58,65,72,77],{"skillNo":45,"name":46,"nameZh":6,"description":47,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":48,"categories":49,"keywords":50,"publishedAt":18},"01M7F58YP2QA8F89599TDWEY0Y","notes","Where notes go.","https:\u002F\u002Fgithub.com\u002Fworkflowaiorg\u002Fworkflow\u002Fblob\u002Fmain\u002Finternal\u002Frender\u002Ftestdata\u002Fsync\u002Fwant\u002F.opencode\u002Fskills\u002Fnotes\u002FSKILL.md",[],[],{"skillNo":52,"name":53,"nameZh":6,"description":54,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":18},"01M7F58X62078DBFA7YZH0M9VP","naming","How things are named, including the sample's tables.","https:\u002F\u002Fgithub.com\u002Fworkflowaiorg\u002Fworkflow\u002Fblob\u002Fmain\u002Finternal\u002Frender\u002Ftestdata\u002Fsync\u002Fwant\u002F.opencode\u002Fskills\u002Fnaming\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":18},"01M7F58VXX28G09AJCA667GHBS","local","A skill only this project has.","https:\u002F\u002Fgithub.com\u002Fworkflowaiorg\u002Fworkflow\u002Fblob\u002Fmain\u002Finternal\u002Frender\u002Ftestdata\u002Fsync\u002Fwant\u002F.opencode\u002Fskills\u002Flocal\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":18},"01M7F58TQ8XVBD6SDV0S4T6E77","hello","Greets sample's developers.","https:\u002F\u002Fgithub.com\u002Fworkflowaiorg\u002Fworkflow\u002Fblob\u002Fmain\u002Finternal\u002Frender\u002Ftestdata\u002Fsync\u002Fwant\u002F.opencode\u002Fskills\u002Fhello\u002FSKILL.md",[],[],{"skillNo":73,"name":46,"nameZh":6,"description":47,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":18},"01M7F58R379TW8C6VY572RK11F","https:\u002F\u002Fgithub.com\u002Fworkflowaiorg\u002Fworkflow\u002Fblob\u002Fmain\u002Finternal\u002Frender\u002Ftestdata\u002Fsync\u002Fwant\u002F.github\u002Fskills\u002Fnotes\u002FSKILL.md",[],[],{"skillNo":78,"name":53,"nameZh":6,"description":54,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":18},"01M7F58PNRREJ4KPY496M2XHSY","https:\u002F\u002Fgithub.com\u002Fworkflowaiorg\u002Fworkflow\u002Fblob\u002Fmain\u002Finternal\u002Frender\u002Ftestdata\u002Fsync\u002Fwant\u002F.github\u002Fskills\u002Fnaming\u002FSKILL.md",[],[]]