[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AYTFQSSQKA9AP5K5YS7ZW2":3,"skill-same:01M7AYTFQSSQKA9AP5K5YS7ZW2":57},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M7AYTFQSSQKA9AP5K5YS7ZW2","go-backend-service",null,"Use when building or extending a Go backend service.","oat431\u002Fhermes_config_backup","oat431","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F54722120?v=4","01M7AYD07EH8SYPMYY8CGZKS22","Oralita","01M7AYD0816QDF77E3TWCRSQC9",1,"Unlicense","https:\u002F\u002Fgithub.com\u002Foat431\u002Fhermes_config_backup\u002Fblob\u002Fmain\u002Fworkflow\u002Fproduct-owner\u002Fgo-backend-service\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: go-backend-service\ndescription: Use when building or extending a Go backend service.\n---\n\n# Go Backend Service (hexagonal, MongoDB, JWT, gRPC)\n\nCovers REST + gRPC Go services with MongoDB persistence and JWT auth, built hexagonal, tested with fakes, shipped via Docker — including the user's spec-first delivery loop and the mongo-driver v2 \u002F gRPC \u002F Windows pitfalls.\n\n## When to use\n- Building a Go service from scratch (interview challenge, Panomete business service, Deerngo-style backend)\n- Adding REST\u002FgRPC endpoints, Mongo persistence, or JWT auth to an existing Go service\n- Build\u002Ftest failures in a Go + MongoDB + gRPC stack\n\n## Delivery loop (user convention: spec first)\n1. Write the spec package first into the repo itself: `\u003Crepo>\u002F.agents\u002Fspec\u002F` with numbered subfolders mirroring `F:\\projects\\project_spec\\template\\` (01_requirement, 02_design, 03_construction, 04_testing). Keep interview specs lean — 9-10 docs, no enterprise ceremony.\n2. Resolve genuine forks with the `clarify` tool before writing docs (e.g. bonus scope). One question per fork.\n3. Implement in dependency order: scaffold → domain → application → adapters → main → tests → docker verify. Commit per phase with scoped messages.\n4. Module path: use `github.com\u002F\u003Cowner>\u002F\u003Crepo-name>`; renaming later is one `sed` pass + proto regen (user does rename to match repo — see Pitfalls).\n\n## Architecture (hexagonal)\n```\ncmd\u002Fapi\u002Fmain.go          # composition root: config → mongo → services → servers → worker → shutdown\ninternal\u002F\n  domain\u002F                # entities, validation rules, sentinel errors — STDLIB ONLY, no bson tags\n  application\u002F           # use cases + ports (interfaces). No framework imports.\n  infrastructure\u002F\n    mongodb\u002F             # adapter implements application.UserRepository\n    auth\u002F                # bcrypt hasher + HS256 JWT manager\n    httpapi\u002F             # REST adapter: router, handlers, middleware, error envelope\n    grpcapi\u002F             # gRPC adapter: server + JWT metadata interceptor (same core as REST)\n    config\u002F              # env vars, fail-fast validation at startup\n    logger\u002F              # slog JSON handler\n  worker\u002F                # background jobs (ticker loops, ctx cancellation)\ntestutil\u002F                # hand-written fakes (no mock library)\nproto\u002F + gen\u002F            # protobuf definitions + generated code (committed)\n```\nDependency rule: domain → nothing; application → domain + ports; infrastructure → application\u002Fdomain; main wires everything.\n\n## Hard-won pitfalls\n\n1. **mongo-driver v2 API broke from v1** — `bson\u002Fprimitive` is GONE: `ObjectID`, `ObjectIDFromHex`, `NilObjectID` live in `bson` directly. `mongo.Connect(opts...)` takes NO ctx. After `go get`, run `go mod tidy` or go.sum is missing transitive entries (snappy, scram, x\u002Fsync). Full map in `references\u002Fmongo-driver-v2-api.md`.\n2. **Import cycle with test doubles** — `testutil` imports `application` (for port interfaces), so application tests must be EXTERNAL: `package application_test` + qualify exported names. Internal tests (`package application`) importing testutil = `import cycle not allowed in test`.\n3. **Validation rules live in domain, not adapters** — ObjectID shape check as regex `^[0-9a-fA-F]{24}$` in domain; otherwise fake-repo tests and the Mongo adapter diverge (404 vs 400). Same for email\u002Fname rules via `domain.ValidateEmail`\u002F`ValidateName` reused by create AND update paths.\n4. **grpcurl needs reflection** — `reflection.Register(grpcSrv)` or grpcurl cannot discover the service. Reviewers use grpcurl first.\n5. **protoc on Windows without choco\u002Fscoop** — curl the win64 release zip into a gitignored `tools\u002Fprotoc\u002F`; install the Go plugins with `go install`. Use `--go_out=. --go_opt=module=\u003Cmodpath>` (NOT `paths=source_relative`, which dumps output under `gen\u002Fproto\u002F...`). Full recipe in `references\u002Fgolang-grpc-setup-windows.md`.\n6. **JWT details reviewers check** — pin alg via `jwt.WithValidMethods([]string{\"HS256\"})`; identical 401 body for wrong email AND wrong password (no user enumeration); password hash never in responses; `JWT_SECRET` ≥32 bytes enforced at startup (fail-fast).\n7. **Go 1.22+ stdlib routing** — `mux.HandleFunc(\"POST \u002Fapi\u002Fv1\u002Fusers\u002F{id}\", ...)` + `r.PathValue(\"id\")`; ServeMux auto-405s wrong methods. Zero web-framework deps reads as idiomatic.\n8. **Email uniqueness race** — lowercase-normalize at the service boundary (create + login); pre-check FindByEmail for a friendly 409 AND unique index as the race-proof backstop (`mongo.IsDuplicateKeyError` → domain error).\n9. **Terminal guard flags `docker compose up`** as a server start → run it with `background=true` + process wait; verify readiness with a separate health-poll loop. `docker stop` for shutdown tests is fine.\n10. **git-bash + make** — `make run` must load .env itself: `set -a && . .\u002F.env && set +a && go run .\u002Fcmd\u002Fapi` (single line). Long curl `&&` chains hit transient exit-23 pipe failures → run steps as separate commands.\n\n## Verification checklist (real tool output required, never prose-only)\n- `go test -race -cover .\u002F...` all green; core packages ≥80% (Mongo adapter 0% is acceptable and documented as integration-only)\n- `docker compose up --build` → healthcheck 200 on both API ports\n- `bash scripts\u002Fsmoke.sh` → full REST matrix passes\n- grpcurl: `list` (reflection), authed RPC returns data, no-token → `Unauthenticated`\n- Container logs: middleware lines (method\u002Fpath\u002Fstatus\u002Fduration_ms) + worker `total_users` ticks\n- Graceful shutdown: `docker stop` → logs end with `shutdown complete`, exit code 0\n\n## Support files\n- `references\u002Fmongo-driver-v2-api.md` — v1→v2 breaking-change map + working snippets\n- `references\u002Fgolang-grpc-setup-windows.md` — protoc install, codegen modes, reflection, bufconn test pattern\n","# Go Backend Service (hexagonal, MongoDB, JWT, gRPC)\n\nCovers REST + gRPC Go services with MongoDB persistence and JWT auth, built hexagonal, tested with fakes, shipped via Docker — including the user's spec-first delivery loop and the mongo-driver v2 \u002F gRPC \u002F Windows pitfalls.\n\n## When to use\n- Building a Go service from scratch (interview challenge, Panomete business service, Deerngo-style backend)\n- Adding REST\u002FgRPC endpoints, Mongo persistence, or JWT auth to an existing Go service\n- Build\u002Ftest failures in a Go + MongoDB + gRPC stack\n\n## Delivery loop (user convention: spec first)\n1. Write the spec package first into the repo itself: `\u003Crepo>\u002F.agents\u002Fspec\u002F` with numbered subfolders mirroring `F:\\projects\\project_spec\\template\\` (01_requirement, 02_design, 03_construction, 04_testing). Keep interview specs lean — 9-10 docs, no enterprise ceremony.\n2. Resolve genuine forks with the `clarify` tool before writing docs (e.g. bonus scope). One question per fork.\n3. Implement in dependency order: scaffold → domain → application → adapters → main → tests → docker verify. Commit per phase with scoped messages.\n4. Module path: use `github.com\u002F\u003Cowner>\u002F\u003Crepo-name>`; renaming later is one `sed` pass + proto regen (user does rename to match repo — see Pitfalls).\n\n## Architecture (hexagonal)\n```\ncmd\u002Fapi\u002Fmain.go          # composition root: config → mongo → services → servers → worker → shutdown\ninternal\u002F\n  domain\u002F                # entities, validation rules, sentinel errors — STDLIB ONLY, no bson tags\n  application\u002F           # use cases + ports (interfaces). No framework imports.\n  infrastructure\u002F\n    mongodb\u002F             # adapter implements application.UserRepository\n    auth\u002F                # bcrypt hasher + HS256 JWT manager\n    httpapi\u002F             # REST adapter: router, handlers, middleware, error envelope\n    grpcapi\u002F             # gRPC adapter: server + JWT metadata interceptor (same core as REST)\n    config\u002F              # env vars, fail-fast validation at startup\n    logger\u002F              # slog JSON handler\n  worker\u002F                # background jobs (ticker loops, ctx cancellation)\ntestutil\u002F                # hand-written fakes (no mock library)\nproto\u002F + gen\u002F            # protobuf definitions + generated code (committed)\n```\nDependency rule: domain → nothing; application → domain + ports; infrastructure → application\u002Fdomain; main wires everything.\n\n## Hard-won pitfalls\n\n1. **mongo-driver v2 API broke from v1** — `bson\u002Fprimitive` is GONE: `ObjectID`, `ObjectIDFromHex`, `NilObjectID` live in `bson` directly. `mongo.Connect(opts...)` takes NO ctx. After `go get`, run `go mod tidy` or go.sum is missing transitive entries (snappy, scram, x\u002Fsync). Full map in `references\u002Fmongo-driver-v2-api.md`.\n2. **Import cycle with test doubles** — `testutil` imports `application` (for port interfaces), so application tests must be EXTERNAL: `package application_test` + qualify exported names. Internal tests (`package application`) importing testutil = `import cycle not allowed in test`.\n3. **Validation rules live in domain, not adapters** — ObjectID shape check as regex `^[0-9a-fA-F]{24}$` in domain; otherwise fake-repo tests and the Mongo adapter diverge (404 vs 400). Same for email\u002Fname rules via `domain.ValidateEmail`\u002F`ValidateName` reused by create AND update paths.\n4. **grpcurl needs reflection** — `reflection.Register(grpcSrv)` or grpcurl cannot discover the service. Reviewers use grpcurl first.\n5. **protoc on Windows without choco\u002Fscoop** — curl the win64 release zip into a gitignored `tools\u002Fprotoc\u002F`; install the Go plugins with `go install`. Use `--go_out=. --go_opt=module=\u003Cmodpath>` (NOT `paths=source_relative`, which dumps output under `gen\u002Fproto\u002F...`). Full recipe in `references\u002Fgolang-grpc-setup-windows.md`.\n6. **JWT details reviewers check** — pin alg via `jwt.WithValidMethods([]string{\"HS256\"})`; identical 401 body for wrong email AND wrong password (no user enumeration); password hash never in responses; `JWT_SECRET` ≥32 bytes enforced at startup (fail-fast).\n7. **Go 1.22+ stdlib routing** — `mux.HandleFunc(\"POST \u002Fapi\u002Fv1\u002Fusers\u002F{id}\", ...)` + `r.PathValue(\"id\")`; ServeMux auto-405s wrong methods. Zero web-framework deps reads as idiomatic.\n8. **Email uniqueness race** — lowercase-normalize at the service boundary (create + login); pre-check FindByEmail for a friendly 409 AND unique index as the race-proof backstop (`mongo.IsDuplicateKeyError` → domain error).\n9. **Terminal guard flags `docker compose up`** as a server start → run it with `background=true` + process wait; verify readiness with a separate health-poll loop. `docker stop` for shutdown tests is fine.\n10. **git-bash + make** — `make run` must load .env itself: `set -a && . .\u002F.env && set +a && go run .\u002Fcmd\u002Fapi` (single line). Long curl `&&` chains hit transient exit-23 pipe failures → run steps as separate commands.\n\n## Verification checklist (real tool output required, never prose-only)\n- `go test -race -cover .\u002F...` all green; core packages ≥80% (Mongo adapter 0% is acceptable and documented as integration-only)\n- `docker compose up --build` → healthcheck 200 on both API ports\n- `bash scripts\u002Fsmoke.sh` → full REST matrix passes\n- grpcurl: `list` (reflection), authed RPC returns data, no-token → `Unauthenticated`\n- Container logs: middleware lines (method\u002Fpath\u002Fstatus\u002Fduration_ms) + worker `total_users` ticks\n- Graceful shutdown: `docker stop` → logs end with `shutdown complete`, exit code 0\n\n## Support files\n- `references\u002Fmongo-driver-v2-api.md` — v1→v2 breaking-change map + working snippets\n- `references\u002Fgolang-grpc-setup-windows.md` — protoc install, codegen modes, reflection, bufconn test pattern\n",{"name":5,"description":7},"main","2988869c5a7d7be2225c9ea7a54a4a56a59b0d45","workflow\u002Fproduct-owner\u002Fgo-backend-service",0,"https:\u002F\u002Fgithub.com\u002Foat431\u002Fhermes_config_backup","https:\u002F\u002Fgithub.com\u002Foat431","https:\u002F\u002Fpanomete.com\u002F","Hope and Luck is not a part of the strategy, \r\n\r\nSoftskill produces plan Hard skill produce product.","2026-11-03 00:43:08",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add oat431\u002Fhermes_config_backup --skill go-backend-service",{"tool":39,"command":40},"bunx","bunx skills add oat431\u002Fhermes_config_backup --skill go-backend-service",{"tool":42,"command":43},"pnpm","pnpm dlx skills add oat431\u002Fhermes_config_backup --skill go-backend-service","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Foat431\u002Fhermes_config_backup\u002Fblob\u002Fmain\u002Fworkflow\u002Fproduct-owner\u002Fgo-backend-service\u002FSKILL.md",true,[47,53],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"references\u002Fgolang-grpc-setup-windows.md","REFERENCE","参考文档",3890,"https:\u002F\u002Fgithub.com\u002Foat431\u002Fhermes_config_backup\u002Fblob\u002Fmain\u002Fworkflow\u002Fproduct-owner\u002Fgo-backend-service\u002Freferences\u002Fgolang-grpc-setup-windows.md",{"path":54,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":55,"sourceHtmlUrl":56},"references\u002Fmongo-driver-v2-api.md",2611,"https:\u002F\u002Fgithub.com\u002Foat431\u002Fhermes_config_backup\u002Fblob\u002Fmain\u002Fworkflow\u002Fproduct-owner\u002Fgo-backend-service\u002Freferences\u002Fmongo-driver-v2-api.md",[58,66,73,80,87,94],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":62,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M7AYZ2JY3NFKAPQSC39N5F3F","project-spec-docs","Fill\u002Fupdate project_spec docs (templates, MM handoffs).","MIT","https:\u002F\u002Fgithub.com\u002Foat431\u002Fhermes_config_backup\u002Fblob\u002Fmain\u002Fworkflow\u002Fui-ux\u002Fproject-spec-docs\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":62,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7AYYRZPE7HQX7778558X52S","penpot-mcp","Penpot MCP: connect, verify, and fix streaming via nginx.","https:\u002F\u002Fgithub.com\u002Foat431\u002Fhermes_config_backup\u002Fblob\u002Fmain\u002Fworkflow\u002Fui-ux\u002Fpenpot-mcp\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7AYYNKP61CN2281VMJDXMB5","nginx-streaming-proxy","Configure nginx for streaming endpoints (SSE, MCP, WS).","https:\u002F\u002Fgithub.com\u002Foat431\u002Fhermes_config_backup\u002Fblob\u002Fmain\u002Fworkflow\u002Fui-ux\u002Fnginx-streaming-proxy\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":62,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7AYYJP0MDV1D3WVEEZB3SGA","branding-ci","Use for brand\u002FCI identity, style guides, and brand docs.","https:\u002F\u002Fgithub.com\u002Foat431\u002Fhermes_config_backup\u002Fblob\u002Fmain\u002Fworkflow\u002Fui-ux\u002Fbranding-ci\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M7AYYGCXVT97DDTCM0ZJT6F6","yuanbao","Yuanbao (元宝) groups: @mention users, query info\u002Fmembers.","https:\u002F\u002Fgithub.com\u002Foat431\u002Fhermes_config_backup\u002Fblob\u002Fmain\u002Fworkflow\u002Fshared-skills\u002Fyuanbao\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":19},"01M7AYYC2Y65NMGMD4GQXAZMMS","slidev","Create and present web-based slidedecks for developers using Slidev with Markdown, Vue components, code highlighting, animations, and interactive features. Use when building technical presentations, conference talks, code walkthroughs, teaching materials, or developer decks.","https:\u002F\u002Fgithub.com\u002Foat431\u002Fhermes_config_backup\u002Fblob\u002Fmain\u002Fworkflow\u002Fshared-skills\u002Fslidev\u002FSKILL.md",[],[]]