feat(skills): sdlc 产线默认 task/team-communication 技能 + skill_loader 支持 capability/tools
- 产线技能放正确位置 pipelines/sdlc_general/common/(原 all/ 误放全局,已删) - skill_loader 支持 frontmatter capability/tools 字段,to_prompt_block 注入配套能力+工具名 - task/team-communication frontmatter 声明 capability+tools
This commit is contained in:
parent
5f754a8f61
commit
189d75f12c
@ -64,6 +64,8 @@ class Skill:
|
|||||||
scope_id: str = "" # org_id / pipeline_id / pipeline_id:role / project_id / user_id
|
scope_id: str = "" # org_id / pipeline_id / pipeline_id:role / project_id / user_id
|
||||||
trigger_keywords: List[str] = field(default_factory=list)
|
trigger_keywords: List[str] = field(default_factory=list)
|
||||||
version: str = "1.0.0"
|
version: str = "1.0.0"
|
||||||
|
capability: str = "" # 配套能力名(如 task_capability / communication)
|
||||||
|
tools: List[str] = field(default_factory=list) # 配套工具名列表
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_file(cls, filepath: str, scope: str = "global",
|
def from_file(cls, filepath: str, scope: str = "global",
|
||||||
@ -73,6 +75,8 @@ class Skill:
|
|||||||
description = ""
|
description = ""
|
||||||
trigger_keywords = []
|
trigger_keywords = []
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
|
capability = ""
|
||||||
|
tools = []
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(filepath, "r", encoding="utf-8") as f:
|
with open(filepath, "r", encoding="utf-8") as f:
|
||||||
@ -87,6 +91,8 @@ class Skill:
|
|||||||
trigger_keywords = fm.get("trigger_keywords", trigger_keywords)
|
trigger_keywords = fm.get("trigger_keywords", trigger_keywords)
|
||||||
version = fm.get("version", version)
|
version = fm.get("version", version)
|
||||||
scope = fm.get("scope", scope)
|
scope = fm.get("scope", scope)
|
||||||
|
capability = fm.get("capability", "") or ""
|
||||||
|
tools = fm.get("tools", []) or []
|
||||||
|
|
||||||
if not description:
|
if not description:
|
||||||
for line in content.split("\n"):
|
for line in content.split("\n"):
|
||||||
@ -99,6 +105,7 @@ class Skill:
|
|||||||
name=name, path=filepath, description=description,
|
name=name, path=filepath, description=description,
|
||||||
content=content, scope=scope, scope_id=scope_id,
|
content=content, scope=scope, scope_id=scope_id,
|
||||||
trigger_keywords=trigger_keywords, version=version,
|
trigger_keywords=trigger_keywords, version=version,
|
||||||
|
capability=capability, tools=tools,
|
||||||
)
|
)
|
||||||
|
|
||||||
def to_prompt_block(self) -> str:
|
def to_prompt_block(self) -> str:
|
||||||
@ -109,10 +116,19 @@ class Skill:
|
|||||||
end = body.find("---", 3)
|
end = body.find("---", 3)
|
||||||
if end != -1:
|
if end != -1:
|
||||||
body = body[end + 3:].strip()
|
body = body[end + 3:].strip()
|
||||||
|
# 配套能力/工具声明(frontmatter 里 capability/tools,剥离后这里显式注入,让 LLM 知道工具在哪)
|
||||||
|
cap_line = ""
|
||||||
|
if self.capability or self.tools:
|
||||||
|
parts = []
|
||||||
|
if self.capability:
|
||||||
|
parts.append(f"配套能力: {self.capability}")
|
||||||
|
if self.tools:
|
||||||
|
parts.append(f"配套工具: {', '.join(self.tools)}")
|
||||||
|
cap_line = " | ".join(parts) + "\n"
|
||||||
return f"""## [{scope_tag}] {self.name}
|
return f"""## [{scope_tag}] {self.name}
|
||||||
{self.description}
|
{self.description}
|
||||||
|
|
||||||
{body}
|
{cap_line}{body}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
---
|
---
|
||||||
name: task
|
name: task
|
||||||
description: 任务状态机规范——定义任务状态、合法流转、角色→操作权限、门禁、人拍板点。agent 处理任务时据此操作,LLM 读本 skill 判断流转合法性。产线默认 SDLC 状态机,项目可同名覆盖。触发:认领/提交/审核/退回/完成/重试任务。
|
description: SDLC 产线默认任务状态机规范——定义任务状态、合法流转、角色→操作权限、门禁、人拍板点。agent 处理任务时据此操作,LLM 读本 skill 判断流转合法性。项目可同名 skill 覆盖。触发:认领/提交/审核/退回/完成/重试任务。
|
||||||
|
capability: task_capability
|
||||||
|
tools: [claim_task, submit_task, approve_task, reject_task, complete_task, mark_failed, retry_task, suspend_task, revive_task, set_task_state]
|
||||||
---
|
---
|
||||||
|
|
||||||
# 任务状态机规范
|
# 任务状态机规范(SDLC 产线默认)
|
||||||
|
|
||||||
本 skill 是**规范**(任务状态 + 流转规则 + 角色权限)。任务操作由系统固化的 **task 能力**(工具)执行,
|
本 skill 是**规范**(任务状态 + 流转规则 + 角色权限)。任务操作由系统固化的 **task 能力**(工具)执行,
|
||||||
本 skill 描述这些工具该怎么用、什么时候能用。
|
本 skill 描述这些工具该怎么用、什么时候能用。
|
||||||
@ -75,5 +77,5 @@ problem_type 用 approval/confirm)。人答复后由 agent 再执行状态迁
|
|||||||
|
|
||||||
## 八、分层覆盖
|
## 八、分层覆盖
|
||||||
|
|
||||||
本 skill 是产线默认(SDLC 状态机);项目可放**同名 task skill** 覆盖:简化/扩展状态机、改角色权限。
|
本 skill 是 **SDLC 产线默认**状态机;项目可用**同名 task skill** 覆盖:简化/扩展状态机、改角色权限。
|
||||||
加载顺序:项目级 → 产线级 → 全局兜底。
|
加载优先级(低→高):global → org → pipeline(common) → role → project → user。
|
||||||
@ -1,9 +1,11 @@
|
|||||||
---
|
---
|
||||||
name: team-communication
|
name: team-communication
|
||||||
description: 团队沟通规范(问题冒泡)——定义团队角色、问题类型、冒泡路径,agent 有问题时据此处理(提问题/找自己要处理的/回答/转交)。角色用规范名:agent 角色 agent.{role},人角色 {orgtype}.{role}。产线默认规范,项目可同名覆盖。触发:agent 发现问题、角色缺信息、PM 退回、故障上报、客户提问、待处理问题>0。
|
description: SDLC 产线默认团队沟通规范(问题冒泡)——定义团队角色、问题类型、冒泡路径,agent 有问题时据此处理(提问题/找自己要处理的/回答/转交)。角色用规范名:agent 角色 agent.{role},人角色 {orgtype}.{role}。项目可同名覆盖。触发:agent 发现问题、角色缺信息、PM 退回、故障上报、客户提问、待处理问题>0。
|
||||||
|
capability: communication
|
||||||
|
tools: [raise_problem, resolve_problem, escalate_problem, list_problems_for]
|
||||||
---
|
---
|
||||||
|
|
||||||
# 团队沟通(问题冒泡)规范
|
# 团队沟通(问题冒泡)规范(SDLC 产线默认)
|
||||||
|
|
||||||
本 skill 是**规范**(团队结构 + 问题类型 + 冒泡路径)。问题操作的工具由系统固化,
|
本 skill 是**规范**(团队结构 + 问题类型 + 冒泡路径)。问题操作的工具由系统固化,
|
||||||
agent 读本 skill 理解规范后,用工具执行。
|
agent 读本 skill 理解规范后,用工具执行。
|
||||||
@ -58,8 +60,8 @@ cockpit 侧包装:`list_questions`(查待我处理)、`answer_question`(
|
|||||||
|
|
||||||
## 六、分层与覆盖
|
## 六、分层与覆盖
|
||||||
|
|
||||||
- 本 skill 是**产线级默认规范**;项目可用**同名 team-communication skill** 覆盖。
|
本 skill 是 **SDLC 产线默认**规范;项目可用**同名 team-communication skill** 覆盖。
|
||||||
- 加载顺序:项目级 → 产线级 → 全局兜底。
|
加载优先级(低→高):global → org → pipeline(common) → role → project → user。
|
||||||
|
|
||||||
## 七、状态与归属
|
## 七、状态与归属
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user