mcpField
A
analyze-2-func-specs

analyze-2-func-specs

github.com/plainlang测试与质量8042 次安装今天更新
代码仓库

关于 analyze-2-func-specs

用于比较 `.plain` 文件中两项功能规格的 Skill,只输出 `COMPATIBLE` 或 `CONFLICTING`。它面向规格审查,并按行为与状态冲突清单作出判断。

主要功能

  1. 01读取两项规格及其定义
  2. 02判断规格的先后顺序
  3. 03检查五类冲突
  4. 04仅输出判定结果

适用场景

  1. 01实现前检查规格兼容性
  2. 02审查跨 required 模块的规格

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/plainlang/plain-forge --skill analyze-2-func-specs

安装后在 Claude Code 中输入/analyze-2-func-specs确认已加载。

详细介绍

原文在翻译后有更新,译文可能不是最新。

分析两个功能规范

始终使用技能 load-plain-reference 获取 ***plain 语法规则——但仅限尚未获取的情况。

输入

来自 .plain 文件(或跨 requires 模块)的两个功能规范。用户会直接提供它们,或指出它们在文件中的位置。

工作流程

  1. 阅读两个功能规范以及 ***definitions*** 部分,以理解所有引用的 :Concepts:。
  2. 确定时间顺序——哪个规范先出现?较早的规范先渲染,较晚的规范则在较早规范的上下文中渲染。
  3. 使用下方清单进行冲突分析。
  4. 只输出判定结果,不附带其他内容——只能是 COMPATIBLE 或 CONFLICTING。不提供推理、类别标签或解决建议。

冲突分析清单

逐项检查。如果任何一项的答案为“是”,这些规范很可能存在冲突。

1. 直接矛盾

两个规范是否对同一行为做出了互相排斥的断言?

Spec A: :Resource: items are returned sorted by name in ascending order.
Spec B: :Resource: items are returned sorted by creation date in descending order.

Verdict: CONFLICTING — both define the sort order for the same response,
but specify different fields and directions. A single implementation cannot
satisfy both unless scoped to different contexts.
2. 状态或数据冲突

一个规范设置的状态或值,是否与另一个规范假设的状态或值不同?

Spec A: :TaskList: is initially empty.
Spec B: :TaskList: contains a default "Welcome" :Task: on first load.

Verdict: CONFLICTING — both define the initial state of :TaskList: differently.
3. 行为覆盖

较晚的规范是否在未说明的情况下,替换了较早规范确立的行为?

Spec A: :User: credentials are validated using an API key.
Spec B: :User: credentials are validated using OAuth 2.0.

Verdict: CONFLICTING — both define the authentication mechanism but pick
different approaches. The later spec overrides the earlier one.
4. 范围歧义

两个规范是否存在足够的歧义,导致渲染器可能将它们解读为相互冲突,即使用户原本希望它们互为补充?

Spec A: All :Resource: items are returned.
Spec B: Only active :Resource: items are returned.

Verdict: CONFLICTING (ambiguous) — "all" vs "only active" appear contradictory.
Could be resolved by scoping each to different conditions (e.g., filtered vs unfiltered).
5. 共享概念,不同约束

两个规范是否对同一个 :Concept: 施加了无法同时成立的约束?

Spec A: :BatchSize: is 100 items.
Spec B: :BatchSize: is 50 items for :Resource: types with attachments.

Verdict: COMPATIBLE — Spec B adds a conditional refinement, not a contradiction.

输出格式

该技能会准确输出以下两个字符串之一,不附带任何文本、解释、类别标签或解决建议:

COMPATIBLE

或

CONFLICTING

内部分析(清单、时间顺序推理)用于得出判定结果,但不得出现在输出中。调用方决定如何处理结果——通常会根据 COMPATIBLE 继续操作,或在结果为 CONFLICTING 时调用 resolve-spec-conflict 来生成实际修复方案。

评论

支持 Markdown