sphere-feature-workflow

Implement end-to-end feature changes in go-sphere scaffold projects by following sphere-layout conventions and generation workflow. Use when adding or modifying APIs, protobuf contracts, Ent schemas, bind/map registration, service logic, or cross-layer refactors that must stay protocol-first and avoid manual edits to generated files. This skill is REQUIRED for any task involving go-sphere proto files, Ent schemas, service implementations, or generation commands (make gen/proto, make gen/docs, make gen/wire).

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "sphere-feature-workflow" with this command: npx skills add go-sphere/skills/go-sphere-skills-sphere-feature-workflow

Sphere Feature Workflow

Overview

Implement merge-ready feature changes in go-sphere scaffold projects while keeping proto, schema, service, and render layers synchronized.

This skill is scaffold-specific and required for any go-sphere feature work. Prefer repository conventions over generic architecture patterns unless the user explicitly requests otherwise.

Required Reading Order

Read these references in order before making edits:

  1. references/workflow-matrix.md - Classify change type and select workflow
  2. references/source-of-truth-and-generated-boundaries.md - Understand what files to edit vs. regenerate
  3. references/change-checklist.md - Verify complete coverage before delivery

Scope

You MUST use this skill when the task involves any of the following:

TriggerExamples
Proto file changesAdding RPC methods, HTTP annotations, validation, error enums
Ent schema changesAdding fields, relations, indexes, policy changes
Service implementationImplementing generated interfaces, business logic
Generation commandsRunning make gen/proto, make gen/docs, make gen/wire
Cross-layer workAnything affecting both proto and schema layers
Bind/map registrationChanges to cmd/tools/bind/main.go#createFilesConf

Workflow Selection (Critical - Do Not Skip)

Classify the task FIRST, then run the matching workflow. See references/workflow-matrix.md for detailed preflight checks.

WorkflowStart PointUse When
Contract-firstproto/**Adding/changing service methods, HTTP annotations, errors, validation
Schema-firstinternal/pkg/database/schema/**Adding/changing entities, fields, indexes, relationships
Service-onlyinternal/service/** + internal/pkg/dao/**Behavior changes WITHOUT contract/schema changes
Cross-layerContract-first or Schema-firstBoth proto AND schema layers affected

If classification is unclear, answer these questions first:

  1. Does the request change external API behavior, route shape, validation, or error contract? → Contract-first
  2. Does the request change persisted fields, entity relations, or index/query strategy? → Schema-first
  3. Does the request only change orchestration/query/render logic? → Service-only
  4. If multiple "yes", treat as Cross-layer

Reuse-First Policy (Required)

Before implementing new capability, check existing Sphere packages first. DO NOT duplicate behavior already covered by:

CategoryAvailable Packages
Lifecycle/bootstrappingcore/boot, core/task, server/boot
HTTP transportserver/httpz, httpx
Auth/authorizationserver/auth/*, server/middleware/auth
Middlewareserver/middleware/* (cors, ratelimiter, selector, online)
Cachingcache/* (Redis, Memory, BadgerDB, etc.)
Storagestorage/* (S3, Qiniu, Local)
Logginglog/*
Message Queuemq/* (Redis, In-memory)
Searchsearch/* (Meilisearch)
Infrastructureinfra/* (Redis client, SQLite)
Utilitiesutils/*, test/*
Core helperscore/pool, core/safe

Always document your reuse decision in the final output.

Execution Workflows

Contract-first Workflow

1. Edit proto/** (service/method, HTTP annotation, validation, errors)
2. Run: make gen/proto
3. Resolve impacts in:
   - internal/service/**    (implement generated interface)
   - internal/pkg/dao/**   (query/mutation support)
   - internal/pkg/render/** non-generated files
4. If docs changed: make gen/docs
5. Run: go test ./...
6. Verify generated diffs are consumed

Schema-first Workflow

1. Edit internal/pkg/database/schema/** (field, relation, index)
2. Verify bind/map: cmd/tools/bind/main.go#createFilesConf
3. Review WithIgnoreFields for sensitive/system fields
4. Run: make gen/proto
5. Resolve impacts in service/dao/render
6. Run: go test ./...
7. Verify query paths align with index intent

Service-only Workflow

1. Edit ONLY non-generated code:
   - internal/service/**
   - internal/pkg/dao/**
   - internal/pkg/render/** (non-generated)
   - optional: internal/biz/**
2. Keep proto/schema STABLE
3. Run: go test ./...
4. Verify no API regression

Hard Rules (Non-Negotiable)

#RuleFailure Mode
1Edit source-of-truth only; NEVER patch generated filesGenerated code overwritten on next make gen
2Run make gen/proto after ANY proto/schema changeStale generated code causes compile/behavior issues
3Run make gen/docs when HTTP contract changesAPI docs out of sync
4Run make gen/wire when DI signatures changeWire errors, runtime panics
5Update createFilesConf for new entity exposureBind/map missing, runtime errors
6Use WithIgnoreFields for timestamps, soft-delete, secretsData leakage
7Keep business errors in owning service protoError pollution across services
8Block on route conflicts or unconsumed generated changesRuntime routing/behavior bugs
9NEVER edit entbind/** or entmap/** filesChanges lost on regeneration

Standard Commands

CommandPurpose
make gen/protoEnt + proto + bind/map generation (most common)
make gen/dbEnt + autoproto generation
make gen/docsOpenAPI/Swagger refresh
make gen/wireDI wiring refresh
make gen/dtsTypeScript type generation
make gen/allRun all generation commands
go test ./...Validation

Proto Organization

PackagePurpose
sphere/bindingRequest binding annotations (URI, query, header, body)
sphere/errorsError definitions and helpers
sphere/optionsCommon option patterns

Code Generation Chain: protoc-gen-goprotoc-gen-sphere-bindingprotoc-gen-sphereprotoc-gen-sphere-errorsprotoc-gen-route

HTTP Framework (httpx)

The server/httpz package uses httpx as its foundation - a unified HTTP framework abstraction that supports multiple backends:

  • ginx (Gin), fiberx (Fiber), echox (Echo), hertzx (Hertz)

Core interfaces: Handler, Middleware, Router, Engine, Context. All Sphere HTTP services use these abstractions.

Failure Conditions (Block Delivery If)

  1. Workflow type not explicitly classified
  2. Required generation commands skipped
  3. Generated diffs exist but NOT consumed by service/dao/render
  4. Generated files manually edited
  5. Bind/map or ignore-field policy missed
  6. Compatibility impact NOT reported

When a failure condition is hit, output Blocking Issues first, then a fix plan.

Final Output Contract (Required Format)

Use this exact section order when reporting completion:

## Scope
[What was changed]

## Workflow Selection
[Contract-first / Schema-first / Service-only / Cross-layer]

## Reuse Decision
[What existing packages were used, or why new code was needed]

## Source-of-Truth Files
[List of files edited]

## Generation Commands
[Commands run: make gen/proto, make gen/docs, etc.]

## Behavior/Compatibility Notes
[API changes, breaking changes, migration needs]

## Validation
[Tests run, results]

## Blocking Issues
[Only if applicable - describe issue + fix plan]

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

pure-admin-crud-generator

No summary provided by upstream source.

Repository SourceNeeds Review
General

ent-seed-sql-generator

No summary provided by upstream source.

Repository SourceNeeds Review
General

proto-api-generator

No summary provided by upstream source.

Repository SourceNeeds Review