MCPcopy Create free account
hub / github.com/53AI/53AIHub / buildSkillScanPrompt

Function buildSkillScanPrompt

api/service/skill_library_scan.go:132–189  ·  view source on GitHub ↗
(in *SkillScanInput)

Source from the content-addressed store, hash-verified

130}
131
132func buildSkillScanPrompt(in *SkillScanInput) (string, string) {
133 skillName := ""
134 skillSummary := "(无)"
135 fileSummary := "(无)"
136 if in != nil {
137 skillName = strings.TrimSpace(in.SkillName)
138 skillSummary = summarizeSkillMarkdownForScan(in.SkillMD)
139 fileSummary = summarizeSkillEntriesForScan(in.FileEntries)
140 }
141
142 systemPrompt := `# 角色
143你是技能安全审计器。
144
145# 目标
146请根据输入判断风险并输出评分,只允许返回严格 JSON。
147
148# 输出要求
149- 不要返回 Markdown
150- 不要返回解释
151- 不要返回代码块
152- 不要返回额外字段
153- 所有评分保留 1 位小数
154
155# 风险策略
156- 先判断 risk_level
157- 一旦存在明显危险脚本、命令执行、越权或破坏性行为,risk_level 必须为 high
158- 高风险时 description 必须为空
159- 低/中风险时 description 只保留核心用途,尽量短`
160
161 userPrompt := fmt.Sprintf(`# 待审计技能
162## 技能名
163%s
164
165## 技能摘要
166%s
167
168## 文件清单摘要
169%s
170
171## 输出格式
172{
173 "risk_level": "low|medium|high",
174 "score_integrity": 1-5,
175 "score_practicality": 1-5,
176 "score_safety": 1-5,
177 "score_code_quality": 1-5,
178 "score_doc_quality": 1-5,
179 "message": "简短结论",
180 "description": "低/中风险时返回适合前台展示的中文简介;高风险时必须为空"
181}
182
183## 评分说明
184- 评分范围为 1-5
185- 所有评分保留 1 位小数
186- 输出必须严格符合上面的 JSON 格式`, skillName, skillSummary, fileSummary)
187
188 return systemPrompt, userPrompt
189}

Callers 1

ScanMethod · 0.85

Calls 2

Tested by

no test coverage detected