xiaohongshu
xiaohongshu
kratos-proto-api
Generates protobuf API definitions for go-kratos microservices with HTTP annotations, validation rules, and OpenAPI documentation. Use when defining service contracts and APIs.
Full skill instructions
<quick_start>
Create proto file in api/{service}/v1/{entity}.proto:
syntax = "proto3";
package {service}.v1;
import "google/api/annotations.proto";
import "validate/validate.proto";
service {Entity}Service {
rpc Create{Entity}(Create{Entity}Request) returns (Create{Entity}Response) {
option (google.api.http) = {
post: "/v1/{entities}"
body: "*"
};
}
}
message Create{Entity}Request {
string name = 1 [(validate.rules).string = {min_len: 1, max_len: 255}];
}
message Create{Entity}Response {
{Entity} {entity} = 1;
}
message {Entity} {
uint64 id = 1;
string name = 2;
}
</quick_start>
<service_patterns>
service {Entity}Service {
// Create
rpc Create{Entity}(Create{Entity}Request) returns (Create{Entity}Response) {
option (google.api.http) = {
post: "/v1/{entities}"
body: "*"
};
}
// Get
rpc Get{Entity}(Get{Entity}Request) returns (Get{Entity}Response) {
option (google.api.http) = {
get: "/v1/{entities}/{id}"
};
}
// Update
rpc Update{Entity}(Update{Entity}Request) returns (Update{Entity}Response) {
option (google.api.http) = {
put: "/v1/{entities}/{id}"
body: "*"
};
}
// Delete
rpc Delete{Entity}(Delete{Entity}Request) returns (Delete{Entity}Response) {
option (google.api.http) = {
delete: "/v1/{entities}/{id}"
};
}
// List
rpc List{Entities}(List{Entities}Request) returns (List{Entities}Response) {
option (google.api.http) = {
get: "/v1/{entities}"
};
}
}
</service_patterns>
<message_patterns>
Create Request:
message Create{Entity}Request {
string name = 1 [(validate.rules).string = {min_len: 1, max_len: 255}];
uint64 project_id = 2 [(validate.rules).uint64 = {gt: 0}];
}
Update Request:
message Update{Entity}Request {
uint64 id = 1 [(validate.rules).uint64 = {gt: 0}];
string name = 2 [(validate.rules).string = {min_len: 1, max_len: 255}];
}
Get Request:
message Get{Entity}Request {
uint64 id = 1 [(validate.rules).uint64 = {gt: 0}];
}
List Request:
message List{Entities}Request {
uint64 offset = 1;
uint64 limit = 2 [(validate.rules).uint64 = {gte: 1, lte: 100}];
}
List Response with Pagination:
message List{Entities}Response {
repeated {Entity} {entities} = 1;
PaginationMeta meta = 2;
}
message PaginationMeta {
uint64 total = 1;
uint64 offset = 2;
uint64 limit = 3;
}
</message_patterns>
<validation_rules>
Strings:
string name = 1 [(validate.rules).string = {min_len: 1, max_len: 255}];
string email = 2 [(validate.rules).string = {email: true}];
string uuid = 3 [(validate.rules).string = {uuid: true}];
string status = 4 [(validate.rules).string = {in: ["active", "inactive"]}];
Numbers:
uint64 id = 1 [(validate.rules).uint64 = {gt: 0}];
uint32 count = 2 [(validate.rules).uint32 = {gte: 0, lte: 1000}];
Optional Fields: Omit validation or use ignore_empty: true
</validation_rules>
<http_annotations>
REST patterns:
/v1/{entities} - Create/v1/{entities}/{id} - Get/v1/{entities}/{id} - Update/v1/{entities}/{id} - Delete/v1/{entities} - ListPath variables:
rpc Get{Entity}(Get{Entity}Request) returns (Get{Entity}Response) {
option (google.api.http) = {
get: "/v1/{entities}/{id}" // {id} matches field in request
};
}
message Get{Entity}Request {
uint64 id = 1; // Extracted from URL path
}
Query parameters (for GET/DELETE): All request fields not in path become query params
Request body (for POST/PUT):
Use body: "*" to send entire request as JSON body
</http_annotations>
<file_structure>
api/{service}/v1/
├── {entity}.proto # Main entity definitions
├── common.proto # Shared messages (PaginationMeta, etc.)
└── errors.proto # Error definitions (optional)
Required imports:
import "google/api/annotations.proto";
import "validate/validate.proto";
import "google/protobuf/timestamp.proto"; // If using timestamps
</file_structure>
<generation_commands>
Format proto files:
make contracts-format
Lint proto files:
make contracts-lint
Generate code:
make contracts-generate
Check for breaking changes:
make contracts-breaking
</generation_commands>
<success_criteria> Proto definitions are correct when:
make contracts-generatemake contracts-breaking
</success_criteria>xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience