protobuf
You are an expert in Protocol Buffers (protobuf), Google's language-neutral binary serialization format. You help developers define data schemas with `.proto` files, generate typed code for multiple languages, build efficient APIs with gRPC, and handle schema evolution with backward/forward compatibility — achieving 3-10x smaller payloads and 20-100x faster serialization than JSON.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o protobuf.zip https://jpskill.com/download/15300.zip && unzip -o protobuf.zip && rm protobuf.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/15300.zip -OutFile "$d\protobuf.zip"; Expand-Archive "$d\protobuf.zip" -DestinationPath $d -Force; ri "$d\protobuf.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
protobuf.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
protobufフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Claude が読む原文 SKILL.md(中身を展開)
この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。
Protocol Buffers — Efficient Binary Serialization
You are an expert in Protocol Buffers (protobuf), Google's language-neutral binary serialization format. You help developers define data schemas with .proto files, generate typed code for multiple languages, build efficient APIs with gRPC, and handle schema evolution with backward/forward compatibility — achieving 3-10x smaller payloads and 20-100x faster serialization than JSON.
Core Capabilities
Proto Schema Definition
// proto/user.proto
syntax = "proto3";
package myapp.v1;
import "google/protobuf/timestamp.proto";
import "google/protobuf/field_mask.proto";
option go_package = "github.com/myapp/proto/v1";
message User {
string id = 1;
string name = 2;
string email = 3;
Role role = 4;
Address address = 5;
repeated Post posts = 6; // Repeated = array
map<string, string> metadata = 7; // Map type
google.protobuf.Timestamp created_at = 8;
// Oneof — only one field set at a time
oneof contact {
string phone = 9;
string slack_id = 10;
}
// Optional (explicit presence tracking)
optional string bio = 11;
}
enum Role {
ROLE_UNSPECIFIED = 0;
ROLE_USER = 1;
ROLE_ADMIN = 2;
ROLE_MODERATOR = 3;
}
message Address {
string street = 1;
string city = 2;
string country = 3;
string zip = 4;
}
message Post {
string id = 1;
string title = 2;
bool published = 3;
}
// Service definition (for gRPC)
service UserService {
rpc GetUser(GetUserRequest) returns (User);
rpc ListUsers(ListUsersRequest) returns (ListUsersResponse);
rpc CreateUser(CreateUserRequest) returns (User);
rpc UpdateUser(UpdateUserRequest) returns (User);
rpc DeleteUser(DeleteUserRequest) returns (google.protobuf.Empty);
rpc StreamUsers(StreamUsersRequest) returns (stream User);
}
message GetUserRequest {
string id = 1;
}
message ListUsersRequest {
int32 page_size = 1;
string page_token = 2;
string filter = 3; // e.g., "role=ADMIN"
}
message ListUsersResponse {
repeated User users = 1;
string next_page_token = 2;
int32 total_count = 3;
}
message CreateUserRequest {
User user = 1;
}
message UpdateUserRequest {
User user = 1;
google.protobuf.FieldMask update_mask = 2; // Partial updates
}
Usage in TypeScript
// Generated from proto using protoc or buf
import { UserServiceClient } from "./generated/user_grpc_pb";
import { GetUserRequest, CreateUserRequest, User } from "./generated/user_pb";
import * as grpc from "@grpc/grpc-js";
const client = new UserServiceClient("localhost:50051", grpc.credentials.createInsecure());
// Get user
const req = new GetUserRequest();
req.setId("user-123");
client.getUser(req, (err, response) => {
if (err) throw err;
console.log(response.getName());
console.log(response.getEmail());
console.log(response.getRole());
});
// Streaming
const stream = client.streamUsers(new StreamUsersRequest());
stream.on("data", (user: User) => console.log(user.getName()));
stream.on("end", () => console.log("Stream ended"));
Schema Evolution Rules
// Adding new fields is safe (backward compatible)
message User {
string id = 1;
string name = 2;
string email = 3;
// NEW: added in v2 — old clients ignore it, new clients get default ""
string avatar_url = 12;
}
// NEVER: change field numbers
// NEVER: change field types (int32 → string)
// OK: rename fields (wire format uses numbers, not names)
// OK: add new fields with new numbers
// OK: remove fields (but reserve the number)
// OK: convert singular to repeated (compatible for scalar types)
// Reserve removed field numbers to prevent reuse
message User {
reserved 4, 7; // Don't reuse these numbers
reserved "old_field_name"; // Documentation
}
Installation
# protoc compiler
brew install protobuf
# Buf (modern protobuf toolchain — recommended)
brew install bufbuild/buf/buf
buf generate # Generate code from proto files
# Language-specific plugins
npm install @grpc/grpc-js @grpc/proto-loader # Node.js
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest # Go
pip install grpcio-tools # Python
Best Practices
- Field numbers are forever — Never change or reuse field numbers; they're the wire format identity
- Reserve removed fields — Use
reservedto prevent accidentally reusing deleted field numbers - Use Buf — Use
bufCLI instead of rawprotoc; linting, breaking change detection, BSR registry - Proto3 defaults — All fields have zero defaults; use
optionalfor explicit presence tracking - Enums start at 0 — Always include
UNSPECIFIED = 0as the first enum value; it's the default - Package versioning — Use
package myapp.v1;for API versioning; createv2package for breaking changes - FieldMask for updates — Use
google.protobuf.FieldMaskfor partial updates; clients specify which fields to change - Backward compatibility — New fields with new numbers are always safe; old clients ignore unknown fields