AI-native Go REST template for solo developers who want coding agents that can work inside real Go constraints.
Generic AI-native repos are good at teaching agents how to spec, plan, and delegate. They are usually much weaker at teaching them how to operate inside idiomatic Go boundaries, preserve invariants, work with context, respect generated artifacts, reason about chi and sqlc, and ship code that survives review. go-service-template-rest is built around that exact gap.
This repository is for people who code with Codex, Claude Code, Cursor, Gemini CLI, and other LLM-assisted workflows, but do not want a generic process layer floating above the language. The workflow is agent-native. The instructions, skills, review surfaces, and validation loop are Go-native.
- Orchestrator-first: frame, delegate, synthesize, plan, implement, verify.
- Go-native guidance: the repository does not stop at language-agnostic workflow advice.
- Project-scoped agents: Codex agents live in
.codex/agents/, Claude Code agents live in.claude/agents/. - Portable skills: reusable workflow expertise lives in
.agents/skillsand is mirrored to compatibility/runtime directories. - Artifact-driven for non-trivial work: master
workflow-plan.mdplusworkflow-plans/<phase>.mdseparate cross-phase control from phase-local orchestration, whilespec.md,design/, andtasks.mdkeep decisions, technical design, and executable task state distinct. Pre-code phases produce that bundle; implementation and validation consume it and do not create new workflow/process artifacts. - First production feature path: before adding business code, use the first production feature checklist to place app types and ports, HTTP mapping, Postgres adapters, bootstrap wiring, telemetry, and tests.
- Production stack underneath: OpenAPI-first HTTP, PostgreSQL,
sqlc, observability, tests, and CI gates are already wired.
Most AI-native coding today is solo. Most generic AI-native repos intentionally stay technology-independent. Most Go templates still stop at folder layout, Docker files, and a Makefile. That combination leaves a real hole:
- the workflow knows how to spec and delegate, but not how to reason in Go;
- the stack knows how to compile, but not how to guide an agent through non-trivial changes;
- the repo has commands, but no explicit ownership model for research, planning, implementation, review, and validation.
This template is built from the opposite assumption: if you want agents to be useful in a Go backend, the workflow and the language need to be wired together on purpose.
That is why this repository is opinionated in four places:
- The workflow is explicit.
Non-trivial work starts with optional idea refinement, then framing, workflow planning, research, synthesis, pre-spec challenge, specification with an autonomous clarification gate, technical design, task breakdown, coding from
tasks.md, review, and validation. The loop is visible, not implied, one session normally owns one phase before coding, and session wrappers such asworkflow-planning-session,research-session,specification-session,technical-design-session,planning-session, andvalidation-closeout-sessionkeep those handoffs explicit. - The specialists are real. Subagents have narrow ownership areas like API, domain, data, reliability, performance, and security. They are not generic “helper” personas.
- The skills are Go-native. The skill library does not stop at abstract design advice. It covers Go architecture, routing, DB/cache contracts, invariants, reliability, security, review, debugging, testing, and verification.
- The backend substrate is real.
OpenAPI,
chi, PostgreSQL,sqlc, observability, tests, and CI gates are already in the template, so the workflow lands on an actual service baseline.
If you want a Go backend template that feels natural inside Codex or Claude Code and still respects how Go services are actually built, this repository is designed for that use case.
The fix is not a single block of text. It shapes the whole repository:
- Artifacts with clear jobs:
specs/<feature-id>/workflow-plan.mdkeeps master control,specs/<feature-id>/workflow-plans/<phase>.mdholds phase-local orchestration,specs/<feature-id>/spec.mdkeeps final decisions,specs/<feature-id>/design/carries task-local technical design for non-trivial work,specs/<feature-id>/tasks.mdowns the executable checkbox ledger, and the phase/session wrappers keep those handoffs explicit across sessions. - Go-aware subagents: the agent portfolio is organized around real backend concerns instead of generic brainstorming personas.
- Go-native skills: the skill library gives the orchestrator and subagents concrete playbooks for Go design, implementation, review, and verification.
- Verification as a first-class rule: “done” is tied to fresh command evidence, not to confident prose from an LLM.
- A serious service template underneath: once the workflow moves into implementation, the repo already has OpenAPI-first HTTP, PostgreSQL,
sqlc, telemetry, and CI guardrails.
This repository treats delivery as an explicit loop, not as a single long chat and not as process theater:
intake -> idea refine? -> workflow planning -> research -> synthesis -> pre-spec challenge -> specification + clarification challenge -> technical design -> planning -> coding from tasks.md -> review -> validation
intake: frame the change, scope it, and record assumptions.idea refine: when the request is still a raw concept, useidea-refineto make the user, problem, success criteria, MVP, and not-doing boundary explicit before engineering framing.workflow planning: choose the execution shape, decide whether work stays local or fans out, set the current phase in masterworkflow-plan.md, write the phase-local orchestration inworkflow-plans/<phase>.md, and state whether laterdesign/,tasks.md,test-plan.md, orrollout.mdartifacts will be required. Early checkpoints often useworkflow-plans/workflow-planning.mdorworkflow-plans/research.md; later ones use files likeworkflow-plans/specification.md,workflow-plans/technical-design.md, orworkflow-plans/planning.md. Do not optimize for a small lane count; optimize for coverage.research: keep simple work local or fan out only to read-only subagents, with enough lanes to cover the materially affected domains. When in doubt on a complex task, prefer more lanes over fewer.synthesis: compare specialist output and produce candidate decisions.pre-spec challenge: pressure-test candidate decisions before they harden intospec.md, and loop back to research if needed.specification: stabilize final decisions, constraints, and open questions inspec.md; for non-trivial work, run the autonomousspec-clarification-challengegate through a read-only challenger before approval.technical design: for non-trivial work, turn approved decisions into a task-localdesign/bundle. Loaddocs/repo-architecture.mdfirst when stable repository boundaries or runtime flows matter.planning: useplanning-and-task-breakdownor equivalent discipline to turn approvedspec.md + design/into small, verifiable execution slices intasks.md; any later review or validation phase workflow files are created here before code starts only when named multi-session routing needs them, and the planning exit records implementation readiness asPASS,CONCERNS,FAIL, orWAIVED.implementation: change the service in the main flow, not inside research agents. New code/test files are fine when approvedtasks.mdrequires them; new workflow/process artifacts are not. Existingtasks.mdcheckbox/progress state may be updated; missing requiredtasks.mdor implementation readiness ofFAILroutes back to planning or the named earlier phase instead of being invented mid-code.review: run targeted review agents only where the risk justifies them.validation: do not claim "done" without fresh command evidence, and do not create new planning/process artifacts during closeout. Existingtasks.mdmay be progress-updated only when it already belongs to the task.
For non-trivial work, one session = one phase by default before coding: master workflow-plan.md tracks the current phase, artifact status, next session, blockers, and links to phase workflow plans; the current workflow-plans/<phase>.md carries phase-local orchestration. Finish that phase, update both workflow-control files plus the owning phase artifacts, and stop before the next phase. Start the next phase in a new session unless an upfront direct path or lightweight local waiver was recorded. If later review or validation phase files are needed, create them before implementation begins and let post-code sessions update them rather than inventing them mid-execution.
When a task benefits from explicit session boundaries, use the phase/session wrappers that match the current checkpoint:
workflow-planning-session: own the pre-research routing pass only.research-session: own evidence gathering and optional preservedresearch/*.mdonly.specification-session: ownspec.mdapproval, the clarification gate, andworkflow-plans/specification.mdonly.technical-design-session: own the task-localdesign/bundle andworkflow-plans/technical-design.mdonly.planning-session: owntasks.md, optionaltest-plan.mdorrollout.md, any later review or validation phase workflow files already required, andworkflow-plans/planning.mdonly.validation-closeout-session: own fresh proof,spec.mdcloseout updates, and existing validation-phase routing only.
Think of the workflow-control artifacts as complementary, not competing:
workflow-plan.md: master cross-phase routing, artifact status, blockers, and next-session handoff.workflow-plans/<phase>.md: one phase only, with local orchestration, completion marker, stop rule, and next action.tasks.md: executable task ledger with markdown checkboxes, stable IDs such asT001, phase labels, optional[P]only for safe parallel work, dependency markers when needed, concrete file/package surfaces, and proof expectations.- Implementation readiness: a planning-phase gate.
PASSallows implementation,CONCERNSrequires named accepted risks and proof obligations,FAILroutes earlier, andWAIVEDstays limited to explicit tiny/direct-path/prototype scope.
Use workflow-status when you only need a compact read-only status or next-action check from existing artifacts. It reports state; it does not repair artifacts, approve readiness, or replace the workflow-control files.
pre-spec challenge is a risk-driven checkpoint inside the synthesis boundary, not a separate approval authority.
spec-clarification-challenge is a required non-trivial approval gate inside specification: a read-only challenger surfaces high-impact questions for the orchestrator to answer from evidence, route to targeted research, accept as risk, defer with rationale, or mark requires_user_decision without inventing an answer.
For tiny or direct-path fixes, several of these stages can collapse into one short local pass instead of turning into mandatory ceremony.
Write-capable delegate agents are out of policy for this workflow; if a tool surface cannot reliably stay read-only, keep that track in the main flow instead of delegating it.
The full contract lives in AGENTS.md and the supporting workflow doc lives in docs/spec-first-workflow.md.
This repository distinguishes between two different things:
- Subagents are read-only specialists you fan out to for focused research or review.
- Skills are portable workflow playbooks loaded on demand by the orchestrator or a subagent.
The repository ships with project-scoped, read-only subagents for focused reasoning and review.
Codex agent instructions live in .codex/agents/*.toml and are loaded through .codex/config.toml; this registry layer uses Codex-supported agents.<name>.config_file entries while keeping each agent as a standalone custom-agent file. Claude Code mirrors live in .claude/agents/ and are generated from the Codex source with make agents-sync; verify them with make agents-check.
Shared subagent invariants live in docs/subagent-contract.md, and reusable lane prompts start from docs/subagent-brief-template.md.
Click an agent name to open its Codex instruction file.
| Agent | Owns | Use when | Returns |
|---|---|---|---|
architecture-agent |
boundaries, ownership, interaction style, failure-domain shape | a feature or refactor may change module or service shape | boundary call, interaction recommendation, handoffs |
api-agent |
client-visible contract behavior and targeted transport semantics | endpoints, statuses, errors, idempotency, async acknowledgment, or chi HTTP semantics change | contract recommendation, compatibility notes |
concurrency-agent |
goroutine, channel, cancellation, and shutdown correctness | a diff touches worker pools, goroutines, shared state, or race-prone code | concurrency findings, validation gaps |
challenger-agent |
workflow-plan adequacy, pre-spec challenge, spec clarification challenge, hidden assumptions, corner cases, and planning-risk pressure tests | workflow control, candidate decisions, or non-trivial spec.md approval need an independent challenger |
discriminating questions, blocker calls, next actions |
data-agent |
source of truth, schema evolution, transaction and cache rules | schema, query, migration, or cache behavior changes | data contract, rollout implications |
delivery-agent |
CI/CD gates, rollout policy, runtime hardening, release trust | release controls, deployment policy, or platform constraints change | delivery policy, gating recommendations |
design-integrator-agent |
cross-domain reconciliation and simplification | multiple specialist outputs conflict or the design feels over-layered | integrated path, contradictions, reopen conditions |
distributed-agent |
cross-service consistency, outbox/inbox, replay, reconciliation | the workflow crosses service boundaries or depends on eventual consistency | flow model, recovery stance |
domain-agent |
business invariants, state transitions, acceptance semantics | behavior changes touch lifecycle, rules, duplicates, or forbidden paths | invariant set, corner cases, handoffs |
observability-agent |
logs, metrics, traces, SLOs, alerts, telemetry cost | signal contracts, operator response, or telemetry privacy/cardinality rules change | signal contract, observability risks, handoffs |
performance-agent |
performance budgets, bottleneck hypotheses, proof strategy | the change is hot-path sensitive or justified mainly by speed | performance stance, proof obligations |
qa-agent |
test obligations, proving levels, validation readiness | a non-trivial behavior change needs a real regression plan | scenario matrix, validation strategy |
quality-agent |
idiomatic Go review and simplification | the diff feels noisy, over-abstracted, or hard to maintain | maintainability findings, cleanup guidance |
reliability-agent |
timeouts, retries, overload, startup, shutdown, degradation | failure behavior, degraded mode, or lifecycle semantics change | reliability contract, residual risks |
security-agent |
trust boundaries, auth, tenant isolation, abuse resistance | changed paths handle untrusted input or cross security boundaries | threat/control map, verification expectations |
All of these agents stay advisory and read-only. Write-capable delegates are not part of this subagent model. Final decisions always stay with the orchestrator in the main flow.
Agent files own scope, mode routing, and handoff. If a lane uses a skill, the skill owns the procedure and exact output shape; the agent fallback return shape applies only when the chosen skill does not define one.
delivery-agent, distributed-agent, and observability-agent now have dedicated review skills (go-devops-review, go-distributed-review, and go-observability-review) for targeted review of their owned surfaces; routine application-code diff review still belongs to the matching code-domain reviewer.
Codex
Codex loads the project agent registry from .codex/config.toml. In practice, you ask the orchestrator to fan out by agent name:
Use `architecture-agent` and `api-agent` to evaluate the new async export flow.
Synthesize the result into `specs/export-flow/spec.md`.
Do not start coding until the `tasks.md` handoff and implementation readiness are explicit.
Claude Code
Claude Code project agents live in .claude/agents. You can select them directly with --agent:
claude -p --agent architecture-agent -- "Review boundary ownership for adding async webhook retries in this repository."
claude -p --agent qa-agent -- "List the minimum regression obligations for changing the order status flow."- New endpoint or contract change:
api-agent+domain-agent+qa-agent - Pre-spec pressure-test on ambiguous work:
challenger-agent+ the specialist whose decision still feels under-evidenced - Spec approval clarification:
challenger-agentwith exactly one skill,spec-clarification-challenge - Storage, cache, or migration change:
data-agent+reliability-agent - Cross-service or async workflow:
architecture-agent+distributed-agent+security-agent - Pre-merge cleanup on a larger diff:
quality-agent+ the domain reviewer that matches the risk
.agents/skills is the canonical repository skill set. These skills are procedural building blocks, not autonomous owners of the workflow.
Click a skill name to open its canonical instruction file.
The catalog has two layers:
- phase/session wrappers that keep one session bounded to one checkpoint and update
workflow-plan.mdplus the matchingworkflow-plans/<phase>.md - deeper skills that do framing, design, planning, implementation, review, or validation work inside those boundaries when needed
| Skill | What it does | Load when |
|---|---|---|
workflow-planning-session |
owns the workflow-planning checkpoint only and writes or repairs workflow-plan.md plus workflow-plans/workflow-planning.md |
non-trivial or agent-backed work needs explicit routing, research mode, lane planning, and artifact expectations before research starts |
research-session |
owns the research checkpoint only and keeps evidence gathering, optional research/*.md, and routing updates separate from spec writing |
the task already has framing and workflow routing, but one bounded research session is needed before specification |
specification-session |
owns the specification checkpoint only, runs or reconciles the non-trivial clarification gate, and updates spec.md, workflow-plan.md, and workflow-plans/specification.md without drifting into design or planning |
research or bounded local analysis is strong enough that the next honest step is finalizing the decision record |
technical-design-session |
owns the technical-design checkpoint only and turns approved spec.md into a planning-ready design/ bundle plus workflow-plans/technical-design.md |
non-trivial work needs task-local technical design before task breakdown |
planning-session |
owns the planning checkpoint only and produces tasks.md, optional test-plan.md or rollout.md, and any later review or validation phase workflow files already required, while updating workflow-plans/planning.md |
approved spec.md + design/ are ready to turn into ordered, coder-facing execution work |
validation-closeout-session |
owns final validation and closeout only, refreshes spec.md Validation and Outcome, and updates existing validation-phase routing honestly |
implementation is finished and you need fresh proof before saying a phase or task is complete |
| Skill | What it does | Load when |
|---|---|---|
idea-refine |
turns a raw idea into one concrete direction with explicit user problem, assumptions, MVP boundary, and not-doing list | the request is still product- or solution-ambiguous and is not ready for engineering framing yet |
spec-first-brainstorming |
turns a refined idea or rough change request into an engineering-ready problem frame with scope, constraints, assumptions, and design-readiness | the task is close to spec work but still needs crisp framing before challenge or deeper design |
pre-spec-challenge |
pressure-tests candidate decisions with discriminating questions before planning | research is done but hidden assumptions or edge cases could still change the spec |
spec-clarification-challenge |
surfaces non-obvious spec-approval questions for orchestrator reconciliation before non-trivial spec.md is marked approved |
candidate decisions exist inside specification and the orchestrator needs a read-only clarification gate before approval |
spec-document-designer |
designs and normalizes repository-native spec.md decision records with the right section depth, decision placement, and handoff into design and planning |
framing or research is already in place and the orchestrator needs a clean decision record instead of a PRD, research dump, or task list |
planning-and-task-breakdown |
turns approved spec.md + design/ into a tasks.md checkbox ledger with checkpoints, acceptance criteria, and verification steps |
the decisions and task-local technical design are stable and implementation needs executable tasks instead of ad hoc execution |
go-coder |
implements approved Go changes without semantic drift or new workflow-artifact sprawl | the tasks.md handoff is explicit, readiness allows code work, and code work is next |
go-qa-tester |
writes deterministic Go tests from approved test obligations as implementation work, not new planning | test code itself needs to be added or upgraded |
go-systematic-debugging |
drives root-cause-first debugging with reproducible evidence | a bug, flaky test, build failure, or incident needs diagnosis |
go-verification-before-completion |
maps completion claims to fresh command evidence without inventing missing process artifacts | you are about to say “fixed”, “ready”, or “done” |
workflow-status |
reports the current task path, phase, blockers, allowed writes, next action, stop rule, and implementation-start status from existing artifacts only | you need a compact read-only workflow status or next-action check without creating a new source of truth |
| Skill | What it does | Load when |
|---|---|---|
agent-prompt-composer |
turns messy, incomplete, repetitive, or multilingual task input into a strong English prompt for coding agents working in this repository | rough user notes need intent reconstruction, repo-aware context selection, and a downstream-agent-ready prompt instead of plain translation or copy editing |
| Skill | Focus | Load when |
|---|---|---|
go-architect-spec |
service boundaries, ownership, sync vs async interaction style | system shape or module ownership may change |
go-design-spec |
integrated technical-design-bundle assembly and reconciliation across domains | approved decisions exist, but the task-local design/ bundle still feels contradictory, layered, or not yet stable enough for task breakdown |
go-devops-spec |
CI/CD policy, rollout controls, runtime hardening, release trust | delivery or release behavior is part of the change |
go-observability-engineer-spec |
logs, metrics, traces, correlation, telemetry cost | observability behavior needs an explicit contract |
go-performance-spec |
latency, throughput, contention, benchmark strategy | performance budgets or hot paths drive the design |
go-reliability-spec |
timeouts, retries, degradation, lifecycle behavior | failure handling or operational resilience changes |
go-security-spec |
trust boundaries, auth, tenant isolation, abuse resistance | the change touches security-critical surfaces |
go-qa-tester-spec |
test levels, scenario coverage, proof strategy | you need an explicit verification plan before coding |
| Skill | Focus | Load when |
|---|---|---|
api-contract-designer-spec |
resources, methods, statuses, errors, idempotency, async contracts | client-visible API behavior is changing |
go-chi-spec |
chi router topology, middleware ordering, fallback and CORS semantics | routing shape or HTTP middleware policy changes |
go-data-architect-spec |
source of truth, schema ownership, migration and rollback shape | schema or persistence model changes |
go-db-cache-spec |
query discipline, transaction rules, cache strategy and staleness | runtime DB or cache behavior needs an explicit contract |
go-domain-invariant-spec |
business invariants, state transitions, acceptance rules | lifecycle or core domain behavior changes |
go-distributed-architect-spec |
saga shape, outbox/inbox, replay safety, reconciliation | a flow crosses service boundaries or depends on eventual consistency |
| Skill | Focus | Load when |
|---|---|---|
go-design-review |
architecture alignment, boundary integrity, accidental complexity | a diff may hide broader design drift |
go-chi-review |
router ownership, middleware order, HTTP fallback semantics | chi routing or transport behavior changed |
go-db-cache-review |
SQL safety, transaction scope, cache correctness, fallback risk | DB or cache code changed |
go-devops-review |
CI/CD gates, release policy, runtime hardening, deployment trust | delivery or platform policy changed |
go-distributed-review |
async workflow, outbox/inbox, replay, recovery | cross-service or durable async behavior changed |
go-domain-invariant-review |
business-invariant preservation and side-effect safety | behavior changes carry semantic risk |
go-idiomatic-review |
idiomatic Go, error handling, context flow, naming | you want merge-risk review on Go code quality |
go-language-simplifier-review |
lower cognitive complexity and cleaner control flow | the code works but feels noisy or over-abstracted |
go-observability-review |
logs, metrics, traces, SLOs, alerts, telemetry privacy and cardinality | observability behavior changed |
go-concurrency-review |
goroutines, channels, cancellation, shutdown safety | concurrent behavior changed or races are suspected |
go-performance-review |
hot-path regression, allocation and contention risk | performance is a review concern |
go-qa-review |
coverage quality, assertion strength, determinism | review depends on test quality and proof strength |
go-reliability-review |
retries, backpressure, startup, shutdown, degraded mode | failure-path behavior changed |
go-security-review |
authz, isolation, injection/SSRF, secret handling | changed paths accept untrusted input or cross trust boundaries |
These repository-native skill locations keep the workflow portable:
.agents/skills.claude/skills.cursor/skills.gemini/skills.github/skills.opencode/skills
The source of truth stays in .agents/skills, so you do not have to hand-maintain separate skill instructions per tool.
Refresh the runtime mirrors with bash ./scripts/dev/sync-skills.sh or make skills-sync, and verify them with bash ./scripts/dev/sync-skills.sh --check or make skills-check.
Agent mirrors follow the same hygiene: .codex/agents is canonical for project subagents, .claude/agents is generated, make agents-sync refreshes it, and make agents-check is a CI-backed drift check.
The repository is designed so the main agent acts like an orchestrator, not like a single monolithic coder.
- The orchestrator owns framing, scope, synthesis, planning, implementation, reconciliation, and validation.
- Subagents own narrow research or review tracks only.
- Skills are tools, not the workflow itself.
spec.mdis the canonical decisions artifact.workflow-plan.mdis the master control artifact for the whole task.workflow-plans/<phase>.mdis the phase workflow artifact for one phase only.design/is the task-local technical design bundle for non-trivial work.tasks.mdis the executable task ledger and final pre-code handoff, not a second spec or second design bundle.- Implementation readiness is the planning exit gate, not a phase. It is recorded in
workflow-plan.md, with the result and stop or handoff rule inworkflow-plans/planning.md. research/*.mdis optional supporting evidence, not a competing source of truth.
For non-trivial implementation work, the artifact shape is intentionally simple:
specs/<feature-id>/
workflow-plan.md
workflow-plans/
spec.md
design/
tasks.md
research/
If you want the short version: frame first, keep cross-phase control in workflow-plan.md, keep current-phase orchestration in workflow-plans/<phase>.md, use the session wrappers when a checkpoint needs a dedicated session, keep approved decisions in spec.md, write task-local technical design in design/, track executable work in tasks.md, and move into coding from that ledger. For tiny fixes, keep it lighter and skip the extra artifacts when the change is obviously local and the waiver is explicit.
make bootstrap
make template-init # run this when you create a new repo from the template
make check
make runBefore adding production feature code, start with the placement guide in Project Structure & Module Organization. It gives the short path for app-only behavior, strict-server endpoints, Postgres-backed features, workers, bootstrap wiring, and test placement.
Recommended flow:
- Create a new empty GitHub repository under your account or organization. It may be
privateorpublic, but do not initialize it withREADME,.gitignore, orLICENSE. - Clone this template into the directory you want to use for the new service.
- Rename the template remote to
upstreamand pointoriginto your repository. - Run template initialization before the first push.
git clone https://github.com/Dankosik/go-service-template-rest.git my-service
cd my-service
git remote rename origin upstream
git remote add origin git@github.com:<your-user>/<your-repo>.git
# or: git remote add origin https://github.com/<your-user>/<your-repo>.git
git remote -v
make bootstrap
make template-init
make check
git add .
git commit -m "chore: initialize service from template"
git push -u origin mainWhat this does:
originbecomes your repository, so normalgit pushgoes to your project.upstreamkeeps a reference to the original template repository in case you want to compare or pull template updates later.make template-initrewires the Go module path,CODEOWNERS, and skill mirrors for the new repository.git push -u origin mainpublishes the firstmainbranch to your repository and makes future plaingit push/git pullwork againstorigin/main.
If git push says Everything up-to-date but your GitHub repository is still empty, your local branch is probably still tracking the template branch instead of your own repository. Check:
git remote -v
git branch -vvExpected state:
originpoints to your repository.upstreampoints togo-service-template-rest.maintracksorigin/main, notupstream/main.
If needed, publish the branch explicitly:
git push -u origin mainIf SSH push fails with Permission denied (publickey), either configure your GitHub SSH key or switch origin to HTTPS:
git remote set-url origin https://github.com/<your-user>/<your-repo>.git
git push -u origin mainIf you use GitHub's Use this template button instead of the manual clone flow, clone your generated repository normally and still run:
make bootstrap
make template-initFor production-style GitHub setup after the first push:
gh auth login
make gh-protect BRANCH=mainTypical next steps:
- Copy
env/.env.exampleto.envifmake bootstrapdid not already do it. - Run
make template-initafter cloning into a new service repository to rewire module path,CODEOWNERS, and skill mirrors. - Use
make check-fullbefore larger changes or before opening a PR.
- Open the repository in Codex or Claude Code.
- Read AGENTS.md. Claude-facing compatibility is mirrored in CLAUDE.md.
- For non-trivial or agent-backed work, open docs/spec-first-workflow.md before workflow planning or subagent fan-out.
- If the task reaches technical design, load docs/repo-architecture.md before writing task-local
design/. - For feature code, use the placement guide in Project Structure & Module Organization before choosing packages or tests.
- Start with an artifact-driven, phase-bounded prompt, not with direct code generation.
Example kickoff prompt:
Use `workflow-planning-session` if this is non-trivial enough to need dedicated workflow control.
Use `idea-refine` only if the request is still too raw.
Frame a change to add tenant-aware export jobs.
Fan out to `architecture-agent`, `data-agent`, and `qa-agent` only if needed.
Run `challenger-agent` before `specification-session` if material assumptions remain.
During `specification-session`, run `challenger-agent` with `spec-clarification-challenge` before approving non-trivial `spec.md`.
Load `docs/repo-architecture.md` before `technical-design-session` if repository boundaries matter.
Write master control to `specs/tenant-export-jobs/workflow-plan.md`.
Start the current checkpoint in `specs/tenant-export-jobs/workflow-plans/workflow-planning.md`, then advance one session-bounded phase at a time through `research.md`, `specification.md`, `technical-design.md`, `planning.md`, and any needed review or validation phase files.
Write decisions to `specs/tenant-export-jobs/spec.md`, task-local technical design to `specs/tenant-export-jobs/design/`, and the executable task ledger to `specs/tenant-export-jobs/tasks.md` before coding.
Start feature work with the placement guide in Project Structure & Module Organization; it covers the short path for HTTP endpoints, Postgres-backed features, and workers without duplicating the workflow rules here.
cmd/service- service entrypoint and bootstrap lifecycle orchestrationinternal/app- use-case layerinternal/domain- domain contracts and typesinternal/infra- HTTP, Postgres, telemetry, and other infrastructure adaptersapi/openapi/service.yaml- REST API source of truthinternal/api- generated OpenAPI artifactsenv/migrations- SQL migrations for the local PostgreSQL environmentinternal/infra/postgres/sqlcgen- generatedsqlcartifactsspecs/- spec-first decision records and implementation history.agents/skills- canonical skill definitions
More detail: docs/project-structure-and-module-organization.md, plus the stable architecture baseline in docs/repo-architecture.md
Workflow comes first, but this is still a serious Go backend template.
- Go
1.26 chifor HTTP routingkin-openapiandoapi-codegenfor contract-first API work- PostgreSQL
17,pgx/v5, andsqlcfor SQL-first data access koanffor configuration- Prometheus and OpenTelemetry for observability
testcontainers-go,go.uber.org/mock, andgoleakfor testing- Docker multi-stage builds and distroless runtime images
- GitHub Actions for CI, nightly checks, and CD
For the full dependency graph, see go.mod and go.sum.
Local entry points:
make check- quick local checksmake docker-check- quick checks through pinned Docker toolingBASE_REF=origin/main HEAD_REF=HEAD make check-full- full local pre-push baseline with docs-drift comparisonmake ci-local- native CI-style flowBASE_REF=origin/main HEAD_REF=HEAD make docker-ci- closest Docker-based CI parity flow with pinned tooling imagesmake openapi-check- OpenAPI generation, drift, runtime contract, lint, and schema validation checksBASE_OPENAPI=<base> make openapi-breaking- OpenAPI breaking-change compatibility checkmake sqlc-check- generated SQL artifact drift checksmake migration-validate/make docker-migration-validate- migration rehearsal for changed migrationsmake test-integration- integration testsmake gh-protect BRANCH=main- branch protection setup helper
Migration rehearsal targets may skip when no MIGRATION_DSN is provided and Docker is unavailable; skip output is not migration proof.
For the full local-vs-GitHub parity matrix and CD caveats, see Build, Test, and Development Commands.
Repository and CI guardrails include:
- formatting and module integrity checks
golangci-lint- unit tests, race tests, and coverage thresholds
- OpenAPI generation drift, validation, lint, and breaking-change checks
sqlcgeneration drift checks- docs, agent mirror, and skills mirror drift checks
govulncheck,gosec, andgitleaks- container image scanning with Trivy
- GHCR publishing, CycloneDX SBOM generation, and Cosign signing in release flows
See .github/workflows/ and Makefile for the exact pipeline steps.