SKILL.md
Role: R2MO Domain Expert
🚨 Critical Rules
- Execution Mode: You act as a direct processor. Do not generate script code. Perform the analysis and file modifications directly.
- Path Resolution Logic:
- Identify: Read pom.xml in the current root -> Extract <artifactId> -> Set as {PROJECTID}. - Locate: Enter directory ./{PROJECTID}-ui/.r2mo/domain/.
- Enhancement Logic:
- Read: Scan all .proto files in the target directory. - Translate: Identify the main model name, translate its business meaning into Chinese, and append it as a comment. - Infer: Apply "Expert Experience" rules to field names. - Rewrite: Append semantic constraints as comments to the file content in-place.
- Language Requirement: All appended comments and constraints MUST be in Simplified Chinese.
📂 Architecture
- Input: Project
pom.xmland Protobuf definitions. - Logic: Semantic Inference Engine (Expert Knowledge Base).
- Output: Enhanced
.protofiles with Chinese business constraints.
💻 Executor Template(Native)
[INSTRUCTION SET FOR AI AGENT]
STEP 1: CONTEXTUALIZATION
- Find Project ID:
- Scan the current directory for pom.xml. - Extract the text content of the <artifactId> tag. - Example: If <artifactId>shop</artifactId>, then ID is shop.
- Target Directory:
- Construct path: {ID}-ui/.r2mo/domain/. - If directory exists, proceed. If not, stop and report error.
STEP 2: SEMANTIC ANALYSIS (The Expert Rules)
Part A: Model Name Translation Identify the main message name in each file. Translate the English model name into appropriate business Chinese and append it to the message definition line.
- Example:
message MerchantAccount {->message MerchantAccount { // [模型: 商户账户] - Example:
message OrderItem {->message OrderItem { // [模型: 订单明细]
Part B: Field Constraint Inference Read every field definition. Analyze the Field Name. If it matches a pattern below, append the specific Chinese Comment:
| Field Name Pattern | Constraint Comment to Append (Chinese) |
|---|---|
email |
// [格式: 邮箱] |
phone, mobile |
// [格式: 手机号] |
password, secret |
// [安全: 加密存储] |
price, amount, cost |
// [精度: 2位小数] |
rate, ratio |
// [精度: 4位小数] |
status, type, state |
// [枚举/常量] (Check for Enum definitions) |
createdat, time |
// [格式: ISO8601] |
is_..., active, enable |
// [布尔: 0/1] |
id, key |
// [必填, 雪花/UUID] |
name, title |
// [长度: 64] |
desc, content, remark |
// [长度: 500/大字段] |
| (Repeated Field) | // [关系: 0..n] |
STEP 3: EXECUTION (Rewrite)
- Modify: Update the file content by adding the comments identified in Step 2.
- Constraint: Do NOT change the syntax, package, option, field types, or field names. Only add comments at the end of lines.
- Save: Overwrite the files with the enhanced content.
- Report: List the files that were successfully enhanced.