Claude Skills
CollectionsCompareWorkflowsNominate
Sign inSign up
© 2026 Curated Agent Skills·Learn more about Agent Skills
Back to repository

openspec-context-loading-cn

verified

加载项目上下文,列出现有规范与变更,搜索能力与需求。用于用户询问项目状态、现有规范、进行中的变更、可用能力或需要发现上下文时。触发词包括"openspec上下文", "有哪些规范", "显示变更", "列出能力", "项目上下文", "查找规范", "规范包含什么", "展示规范"。

View on GitHub

Marketplace

open-skilled-sdd-marketplace

forztf/open-skilled-sdd

Plugin

open-skilled-sdd

Repository

forztf/open-skilled-sdd
4stars

skills/openspec-context-loading-cn/SKILL.md

Last Verified

February 1, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/forztf/open-skilled-sdd/blob/main/skills/openspec-context-loading-cn/SKILL.md -a claude-code --skill openspec-context-loading-cn

Installation paths:

Claude
.claude/skills/openspec-context-loading-cn/
Powered by add-skill CLI

Instructions

# 规范上下文加载

发现并加载项目规范、进行中的变更和需求,以提供上下文。

## 快速开始

上下文加载可帮助回答:
- 项目有哪些规范?
- 目前有哪些进行中的变更?
- 已定义了哪些需求?
- 系统具备哪些能力?
- 某项功能在何处有所规范?

**基本模式**:搜索 → 阅读 → 总结

## 发现命令

注意将控制台与管道输出编码统一为 UTF-8,确保中文字符正确显示。

### 列出所有规范

```bash
# 查找所有规范文件
find spec/specs -name "spec.md" -type f

# 查找所有能力目录
find spec/specs -mindepth 1 -maxdepth 1 -type d

# 显示规范树
tree spec/specs/  # 若已安装 tree
# 或
ls -R spec/specs/
```

**输出格式**:
```
spec/specs/
├── authentication/
│   └── spec.md
├── billing/
│   └── spec.md
└── notifications/
    └── spec.md
```

### 列出进行中的变更

```bash
# 显示所有进行中的变更
find spec/changes -maxdepth 1 -type d -not -path "spec/changes" -not -path "*/archive" | sort

# 显示修改时间
find spec/changes -maxdepth 1 -type d -not -path "spec/changes" -not -path "*/archive" -exec ls -ld {} \;

# 统计进行中的变更数量
find spec/changes -maxdepth 1 -type d -not -path "spec/changes" -not -path "*/archive" | wc -l
```

### 列出已归档的变更

```bash
# 显示所有已归档变更
ls -1 spec/archive/

# 显示日期
ls -la spec/archive/

# 查找最近 7 天归档的变更
find spec/archive/ -maxdepth 1 -type d -mtime -7
```

### 搜索需求

```bash
# 查找所有需求
grep -r "### Requirement:" spec/specs/

# 在特定能力中查找需求
grep "### Requirement:" spec/specs/authentication/spec.md

# 列出唯一需求名称
grep -h "### Requirement:" spec/specs/**/*.md | sed 's/### Requirement: //' | sort
```

### 搜索场景

```bash
# 查找所有场景
grep -r "#### Scenario:" spec/specs/

# 统计每个规范中的场景数量
for spec in spec/specs/**/spec.md; do
    count=$(grep -c "#### Scenario:" "$spec")
    echo "$spec: $count scenarios"
done
```

### 关键词搜索

```bash
# 查找提到 "authentication" 的规范
grep -r -i "authentication" spec/specs/

# 查找与 "password" 相关的需求
grep -B 1 -A 5 -i "password" spec/specs/**/*.md | grep -A 5 "### Requirement:"

# 查找提到 "error" 的场景
grep -B 1 -A 10 -i "error" spec/specs/**/*.md | grep -A 10 "#### Scenario:"
```

## 常见查询

### 查询 1:"项目有哪些规范?"

```bash
# 列出所有能力
find spec/specs -mindepth 1 -maxdepth 1 -type d -exec basename {} \;

# 统计每个能力的需求数量
for cap in spec/specs/*/; do
    name=$(basename "$cap")
    count=$(grep -c "### Requirement:"

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
7033 chars