spectra-diff
/spectra-diff
Use this skill when the user asks to: - Compare code against its spec to find drift - Check if spec is still in sync with code - Find new behaviors not documented in spec - Identify spec items that no longer exist in code - Validate spec accuracy after code changes Useful after code changes to keep specs current, or before refactoring to understand what's changed.
- Author
- connor-git-yaml ↗
- Repository
- cc-plugin-market ↗
- Licence
- MIT
- Last repository change
- 15.09.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 15.09.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Use this skill when the user asks to: - Compare code against its spec to find drift - Check if spec is still in sync with code - Find new behaviors not documented in spec - Identify spec items that no longer exist in code - Validate spec accuracy after code changes Useful after code changes to keep specs current, or before refactoring to understand what's changed.
Original author description
Use this skill when the user asks to: - Compare code against its spec to find drift - Check if spec is still in sync with code - Find new behaviors not documented in spec - Identify spec items that no longer exist in code - Validate spec accuracy after code changes Useful after code changes to keep specs current, or before refactoring to understand what's changed.
How it works
- User Input
- Purpose
- Execution Flow
- 语言规范
- Guidelines
SKILL.md preview
---
name: spectra-diff
description: |
Use this skill when the user asks to:
- Compare code against its spec to find drift
- Check if spec is still in sync with code
- Find new behaviors not documented in spec
- Identify spec items that no longer exist in code
- Validate spec accuracy after code changes
Useful after code changes to keep specs current, or before refactoring to understand what's changed.
---
## User Input
```text
$ARGUMENTS
```
You **MUST** consider the user input before proceeding (if not empty).
## Purpose
Detect specification drift between a .spec.md and its corresponding source code. Useful after code changes to keep specs current, or before refactoring to understand what's changed.
## Execution Flow
### 1. Parse Arguments
Expected format: `<spec-file> [source-target]`
- `<spec-file>`: Path to existing .spec.md (required)
- `[source-target]`: Path to source code (optional — inferred from spec's `related_files` frontmatter)
If spec file doesn't exist, suggest running `/spectra` first.
### 2. Run Drift Detection Pipeline
Execute the drift detection using the globally installed `spectra` CLI:
```bash
spectra diff <spec-file> <source-target>
```
如果需要自定义输出目录:
```bash
spectra diff <spec-file> <source-target> --output-dir drift-logs/
```
流水线自动执行以下步骤:
1. 从 spec HTML 注释加载基线 `CodeSkeleton`
2. 对当前源代码进行 AST 分析
3. 结构差异比较(`compareSkeletons`)
4. 噪声过滤(空白/注释/import 重排序)
5. 语义差异评估(LLM,可选)
6. 组装 `DriftReport` 并写入 `drift-logs/`
### 3. Fallback: Manual Analysis
如果 CLI 流水线不可用(依赖未安装、编译错误等),手动执行:
1. 读取 spec 文件,提取接口定义章节
2. 对源代码进行 AST 分析
3. 对比 spec 中的导出符号与当前代码
4. 按严重级别分类差异:
- **HIGH**: 删除的导出(Breaking Change)
- **MEDIUM**: 签名修改、行为变更
- **LOW**: 新增导出
### 4. Output Drift Report
报告自动写入 `drift-logs/{module}-drift-{date}.md`,包含:
- YAML frontmatter(spec 路径、源码路径、版本)
- 汇总统计表(按严重级别和变更类型)
- 逐项漂移详情(ID、类别、位置、旧/新值、建议更新)
- 综合建议
### 5. Offer Update
**在任何 spec 更新前必须提示用户确认。**
Ask: "是否需要更新 spec 以匹配当前代码?这将运行 `/spectra` 并使用现有 spec 作为基线。"
Do NOT auto-update. Wait for user confirmation.
## 语言规范
**所有漂移报告的正文内容必须使用中文撰写。** 具体规则:
- **用中文**:所有描述、说明、分析、总结、表格内容、建议
- **保留英文**:代码标识符(函数名、类名、变量名)、文件路径、类型签名、代码块内容
- **表格表头**:使用中文,例如 `| 项目 | 类型 | 位置 | 描述 |`
## Guidelines
- 这是**只读分析**——未经用户同意不修改任何文件
- 关注**语义**差异,而非格式/风格变化
- 忽略空白、纯注释变更和 import 重排序
- **突出标记破坏性变更**(删除/修改的公开 API)
Versions
The database has no other skills named spectra-diff.
Identical content appears in 2 other GitHub folders. We show one copy with the highest score.
Database snapshot: 13.11.2026 · package version 65d0d0869015 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 90spec-to-code-compliance
Use when implementation must be checked against an authoritative specification, or during PR review for spec drift against checked-in specs. Not for spec updates: use spec-driven-implementation. - 100sync
Detect Spec-to-Code drift by scanning REQ, DESIGN and TASK specs for references to code that no longer exists, then report it for triage. Use when you say `detect spec drift`, `sync the specs`, or `did my refactor break a spec`, and run it after a hand-edit that moved or deleted… - 100sync
Detect Spec-to-Code drift by scanning REQ, DESIGN and TASK specs for references to code that no longer exists, then report it for triage. Use when you say `detect spec drift`, `sync the specs`, or `did my refactor break a spec`, and run it after a hand-edit that moved or deleted… - 100check
Read-only drift detector. Diffs SPEC.md against current code and reports violations grouped by severity. Writes nothing — suggests remedies via the spec or build skills but never invokes them. Triggers when the user asks to check drift, audit the spec, verify invariants, or ask… - 100spectra
Use this skill when the user asks to: - Generate a spec/specification from existing code - Document or analyze a module's architecture - Reverse engineer what a piece of code does - Create .spec.md documentation for a file, directory, or module - Understand the intent,… - 100spectra-batch
Use this skill when the user asks to: - Generate specs for an entire project or codebase - Document all modules systematically - Create a complete specification index for the project - Batch process multiple modules for spec generation This skill generates an architecture…