一键导入
go-project-proto
Protocol buffer configuration for Connect RPC + gRPC-Gateway using buf, including plugins, imports, annotations, and code generation
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Protocol buffer configuration for Connect RPC + gRPC-Gateway using buf, including plugins, imports, annotations, and code generation
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
This skill should be used when the user asks to generate or process images. Activates with phrases like generate image, create icon, make logo, design illustration, cut image, remove background. Provides image generation and processing capabilities via ComfyUI through n8n workflow service.
This skill should be used when the user asks to convert text to speech, generate audio, create TTS voice, or do voice synthesis. Activates with phrases like 语音合成, TTS, 文字转语音, 生成语音, 配音, 朗读. Provides text formatting, text splitting, TTS generation, and audio merging workflow.
Transform text content into professional Mermaid diagrams for presentations and documentation. Use when users ask to visualize concepts, create flowcharts, or make diagrams from text. Supports process flows, system architectures, comparisons, mindmaps, and more with built-in syntax error prevention.
This skill should be used when the user asks to understand new concepts or technologies. Activates with phrases like explain, teach, learn, concept, technology, how to, what is, understanding, tutorial, guide. Provides structured 5-step explanations following Problem-Based Learning principles: Scenario, Limitation, Concept, Core Mechanics, Implementation. Uses storytelling approach to create complete "problem-exploration-answer" cognitive loop with practical examples and code samples.
Automatically save chat conversations to individual markdown files with unique filenames containing timestamps. Each conversation is saved to /Users/pix/dev/code/ai/pixai/chat-history directory. Use when user wants to preserve chat history, save conversation logs, or maintain a record of discussions.
Automatically save chat conversations to individual markdown files with unique filenames containing timestamps. Each conversation is saved to /Users/pix/dev/code/ai/pixai/chat-history directory. Use when user wants to preserve chat history, save conversation logs, or maintain a record of discussions.
| name | go-project-proto |
| description | Protocol buffer configuration for Connect RPC + gRPC-Gateway using buf, including plugins, imports, annotations, and code generation |
Before creating any server code, you MUST create proto definitions!
# 1. Create proto directory
mkdir -p proto/api/v1
# 2. Create buf configuration files
touch proto/buf.yaml
touch proto/buf.gen.yaml
# 3. Create service definition
touch proto/api/v1/auth_service.proto
# 4. Generate Go code
cd proto && buf generate
Without proto files, server implementations cannot import generated types and will fail to compile!
proto/
├── buf.gen.yaml # Code generation configuration
├── buf.yaml # Lint and breaking change rules
├── buf.lock # Dependency lock file (auto-generated)
├── api/v1/ # API service definitions
│ ├── auth_service.proto
│ ├── user_service.proto
│ ├── memo_service.proto
│ └── common.proto # Shared enums
└── gen/ # Generated code (auto-generated)
├── api/v1/
│ ├── *_pb.go # Protobuf messages
│ ├── *_connect.go # Connect RPC handlers
│ ├── *_grpc.go # gRPC stubs
│ └── openapi.yaml # OpenAPI spec
version: v2
managed:
enabled: true
disable:
- file_option: go_package
module: buf.build/googleapis/googleapis
override:
- file_option: go_package_prefix
value: github.com/usememos/memos/proto/gen
plugins:
- remote: buf.build/protocolbuffers/go
out: gen
opt: paths=source_relative
- remote: buf.build/grpc/go
out: gen
opt: paths=source_relative
- remote: buf.build/connectrpc/go
out: gen
opt: paths=source_relative
- remote: buf.build/grpc-ecosystem/gateway
out: gen
opt: paths=source_relative
- remote: buf.build/community/google-gnostic-openapi
out: gen
opt: enum_type=string
- remote: buf.build/bufbuild/es
out: ../web/src/types/proto
opt: target=ts
include_imports: true
version: v2
deps:
- buf.build/googleapis/googleapis
lint:
use:
- BASIC
except:
- ENUM_VALUE_PREFIX
- FIELD_NOT_REQUIRED
- PACKAGE_DIRECTORY_MATCH
- PACKAGE_NO_IMPORT_CYCLE
- PACKAGE_VERSION_SUFFIX
disallow_comment_ignores: true
breaking:
use:
- FILE
except:
- EXTENSION_NO_DELETE
- FIELD_SAME_DEFAULT
syntax = "proto3";
package memos.api.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
option go_package = "gen/api/v1";
service MemoService {
rpc CreateMemo(CreateMemoRequest) returns (Memo) {
option (google.api.http) = {
post: "/api/v1/memos"
body: "memo"
};
option (google.api.method_signature) = "memo";
}
rpc ListMemos(ListMemosRequest) returns (ListMemosResponse) {
option (google.api.http) = {get: "/api/v1/memos"};
option (google.api.method_signature) = "";
}
rpc GetMemo(GetMemoRequest) returns (Memo) {
option (google.api.http) = {get: "/api/v1/{name=memos/*}"};
option (google.api.method_signature) = "name";
}
rpc UpdateMemo(UpdateMemoRequest) returns (Memo) {
option (google.api.http) = {
patch: "/api/v1/{memo.name=memos/*}"
body: "memo"
};
option (google.api.method_signature) = "memo,update_mask";
}
rpc DeleteMemo(DeleteMemoRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {delete: "/api/v1/{name=memos/*}"};
option (google.api.method_signature) = "name";
}
}
message Memo {
option (google.api.resource) = {
type: "memos.api.v1/Memo"
pattern: "memos/{memo}"
name_field: "name"
singular: "memo"
plural: "memos"
};
string name = 1 [(google.api.field_behavior) = IDENTIFIER];
State state = 2 [(google.api.field_behavior) = REQUIRED];
string creator = 3 [
(google.api.field_behavior) = OUTPUT_ONLY,
(google.api.resource_reference) = {type: "memos.api.v1/User"}
];
google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
string content = 7 [(google.api.field_behavior) = REQUIRED];
}
enum State {
STATE_UNSPECIFIED = 0;
NORMAL = 1;
ARCHIVED = 2;
}
message ListMemosRequest {
int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
string order_by = 4 [(google.api.field_behavior) = OPTIONAL];
string filter = 5 [(google.api.field_behavior) = OPTIONAL];
}
message ListMemosResponse {
repeated Memo memos = 1;
string next_page_token = 2;
}
| Annotation | Usage |
|---|---|
REQUIRED | Field is required |
OPTIONAL | Field is optional |
OUTPUT_ONLY | Field is server-generated |
IDENTIFIER | Field is the resource identifier |
// common.proto
syntax = "proto3";
package memos.api.v1;
option go_package = "gen/api/v1";
enum State {
STATE_UNSPECIFIED = 0;
NORMAL = 1;
ARCHIVED = 2;
}
message PageToken {
int32 limit = 1;
int32 offset = 2;
}
# Install dependencies
cd proto && buf dep update
# Generate code
cd proto && buf generate
# Lint proto files
cd proto && buf lint
# Check breaking changes
cd proto && buf breaking --against .git#main
gen/
└── api/v1/
├── auth_service.pb.go
├── auth_service.connect.go
├── auth_service_grpc.go
├── memo_service.pb.go
├── memo_service.connect.go
└── openapi.yaml
Import path:
import v1pb "github.com/usememos/memos/gen/api/v1"
*_service.protocommon.proto for enumsgoogle.api.resource for REST resourcesgoogle.api.method_signature