Sphere Feature Workflow
Overview
Implement merge-ready feature changes in
scaffold projects while keeping
,
,
, and
layers synchronized.
This skill is scaffold-specific. Prefer repository conventions over generic architecture
patterns unless the user explicitly requests otherwise.
Required Reading Order
Read these references before making edits:
- references/workflow-matrix.md
- references/source-of-truth-and-generated-boundaries.md
- references/change-checklist.md
Scope
Use this skill when the task involves one or more of the following:
- HTTP/API contract changes in
- Ent schema updates in
internal/pkg/database/schema/**
- Bind/map registration updates in
- Service/DAO/render behavior updates that must stay generation-safe
- Cross-layer refactors that require protocol-first consistency
Workflow Selection
Classify the task first, then run the matching workflow:
- Start from
- Use when adding or changing service methods, HTTP annotations, errors, or validation
- Start from
internal/pkg/database/schema/**
- Use when adding/changing entities, fields, indexes, or relationships
- Start from and
- Use when behavior changes without contract/schema changes
- Use or as entrypoint, then complete all impacted layers
If classification is unclear, follow the preflight checks in
references/workflow-matrix.md.
Reuse-First Policy
Before implementing new framework-level capability, check existing Sphere packages first.
Do not duplicate behavior already covered by:
- Lifecycle and bootstrapping:
- HTTP transport and error flow:
- Auth and authorization: ,
- Common middleware: , ,
- Infrastructure adapters and shared runtime packages: , , , ,
When overlap exists, reuse existing packages and document the decision.
Execution Workflows
Contract-first Workflow
- Edit (service/method, HTTP annotation, validation, errors).
- Run .
- Resolve compile and behavior impacts in:
- If contract-facing docs or SDK are impacted, run and/or .
- Run tests and ensure generated diffs are consumed by manual code.
Schema-first Workflow
- Edit
internal/pkg/database/schema/**
(field policy, relation, index strategy).
- Verify bind/map registration impact in
cmd/tools/bind/main.go#createFilesConf
.
- Review for system-managed and sensitive fields.
- Run .
- Resolve compile and behavior impacts across service/dao/render.
- Run tests and verify query paths align with index intent.
Service-only Workflow
- Edit only non-generated business code:
- non-generated files
- optional shared orchestration in
- Keep contract/schema stable unless explicitly requested.
- Run targeted or full tests and confirm no API behavior regression.
Hard Rules
- Edit source-of-truth files only; never patch generated files directly.
- Run after any proto/schema change.
- Run when HTTP contract output changes.
- Run when dependency wiring signatures change.
- New entity exposure must be reviewed in
cmd/tools/bind/main.go#createFilesConf
.
- must cover system-managed and sensitive fields.
- Keep service-specific business errors in the owning service proto unless explicitly shared.
- Block delivery on route conflicts, cross-layer drift, or unconsumed generated changes.
- Never manually edit
internal/pkg/render/entbind/**
or internal/pkg/render/entmap/**
.
Standard Commands
bash
# ent + proto + bind/map generation chain
make gen/proto
# openapi/swagger generation
make gen/docs
# dependency injection generation
make gen/wire
# validation
go test ./...
Failure Conditions
Do not mark the task complete if any of the following is true:
- Workflow type is not explicitly classified.
- Required generation commands were skipped.
- Generated diffs exist but are not reflected in service/dao/render logic.
- Generated files were manually edited.
- Bind/map or ignore-field policy impact was missed for schema-affecting changes.
- Compatibility impact and residual risks were not reported.
When a failure condition is hit, output
first, then a fix plan.
Final Output Contract
Use this exact section order when reporting completion:
Behavior/Compatibility Notes
- (only when applicable)