mcpField
O
openspec-context-loading

openspec-context-loading

github.com/forztf開発101.1k 回インストール48 週間前に更新
リポジトリ

openspec-context-loading について

openspec-context-loading は、プロジェクトの仕様や変更内容を調べるためのスキルです。コマンドラインで要件やシナリオ、機能の記述を検索し、必要なコンテキストを整理します。

主な機能

  1. 01仕様と機能ディレクトリの発見
  2. 02進行中・アーカイブ済み変更の一覧
  3. 03要件・シナリオ・キーワードの検索
  4. 04仕様と変更内容の要約

活用シーン

  1. 01既存プロジェクト仕様の把握
  2. 02進行中の変更の確認
  3. 03パスワード関連要件の特定
  4. 04機能仕様の要約

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/forztf/open-skilled-sdd --skill openspec-context-loading

インストール後、Claude Code で/openspec-context-loadingを入力して読み込まれたか確認します。

詳細

仕様コンテキストの読み込み

プロジェクトの仕様、進行中の変更、要件を検出して読み込み、コンテキストを提供します。

クイックスタート

コンテキストを読み込むと、次の質問に答えやすくなります。

  • このプロジェクトにはどのような仕様がありますか?
  • 現在進行中の変更は何ですか?
  • どのような要件が定義されていますか?
  • システムにはどのような機能がありますか?
  • 特定の機能の仕様はどこにありますか?

基本パターン:検索 → 読み込み → 要約

検出コマンド

すべての仕様を一覧表示する
# Find all spec files
find spec/specs -name "spec.md" -type f

# Find all capability directories
find spec/specs -mindepth 1 -maxdepth 1 -type d

# Show spec tree
tree spec/specs/  # if tree is installed
# or
ls -R spec/specs/

出力形式:

spec/specs/
├── authentication/
│   └── spec.md
├── billing/
│   └── spec.md
└── notifications/
    └── spec.md
進行中の変更を一覧表示する
# Show all active changes
find spec/changes -maxdepth 1 -type d -not -path "spec/changes" -not -path "*/archive" | sort

# Show with modification dates
find spec/changes -maxdepth 1 -type d -not -path "spec/changes" -not -path "*/archive" -exec ls -ld {} \;

# Count active changes
find spec/changes -maxdepth 1 -type d -not -path "spec/changes" -not -path "*/archive" | wc -l
アーカイブ済みの変更を一覧表示する
# Show all archived changes
ls -1 spec/archive/

# Show with dates
ls -la spec/archive/

# Find recently archived (last 7 days)
find spec/archive/ -maxdepth 1 -type d -mtime -7
要件を検索する
# Find all requirements
grep -r "### Requirement:" spec/specs/

# Find requirements in specific capability
grep "### Requirement:" spec/specs/authentication/spec.md

# List unique requirement names
grep -h "### Requirement:" spec/specs/**/*.md | sed 's/### Requirement: //' | sort
シナリオを検索する
# Find all scenarios
grep -r "#### Scenario:" spec/specs/

# Count scenarios per spec
for spec in spec/specs/**/spec.md; do
    count=$(grep -c "#### Scenario:" "$spec")
    echo "$spec: $count scenarios"
done
キーワードで検索する
# Find specs mentioning "authentication"
grep -r -i "authentication" spec/specs/

# Find requirements about "password"
grep -B 1 -A 5 -i "password" spec/specs/**/*.md | grep -A 5 "### Requirement:"

# Find scenarios about "error"
grep -B 1 -A 10 -i "error" spec/specs/**/*.md | grep -A 10 "#### Scenario:"

よくある問い合わせ

問い合わせ 1:「どのような仕様がありますか?」
# List all capabilities
find spec/specs -mindepth 1 -maxdepth 1 -type d -exec basename {} \;

# Count requirements per capability
for cap in spec/specs/*/; do
    name=$(basename "$cap")
    count=$(grep -c "### Requirement:" "$cap/spec.md" 2>/dev/null || echo "0")
    echo "$name: $count requirements"
done

回答形式:

## Existing Specifications

The project has specifications for the following capabilities:

- **authentication**: 8 requirements
- **billing**: 12 requirements
- **notifications**: 5 requirements

Total: 3 capabilities, 25 requirements
問い合わせ 2:「進行中の変更は何ですか?」
# List with proposal summaries
for change in spec/changes/*/; do
    if [ "$change" != "spec/changes/archive/" ]; then
        id=$(basename "$change")
        echo "=== $id ==="
        head -n 20 "$change/proposal.md" | grep -A 3 "## Why"
    fi
done

回答形式:

## Active Changes

Currently active changes:

### add-user-auth
**Why**: Users need secure authentication...

### update-billing-api
**Why**: Payment processing requires v2 API...

Total: 2 active changes
問い合わせ 3:「認証の仕様を見せてください」
# Read full spec
cat spec/specs/authentication/spec.md

# Or show summary
echo "Requirements:"
grep "### Requirement:" spec/specs/authentication/spec.md

echo "\nScenarios:"
grep "#### Scenario:" spec/specs/authentication/spec.md

回答形式:

## Authentication Specification

(Include full content of spec.md)

Summary:
- 8 requirements
- 16 scenarios
- Last modified: [date from git log]
問い合わせ 4:「パスワードに関する仕様を探してください」
# Search for keyword
grep -r -i "password" spec/specs/ -A 5

# Show which specs mention it
grep -r -i "password" spec/specs/ -l

回答形式:

## Specs Mentioning "Password"

Found in:
- spec/specs/authentication/spec.md (3 requirements)
- spec/specs/security/spec.md (1 requirement)

Relevant requirements:
### Requirement: Password Validation
### Requirement: Password Reset
### Requirement: Password Strength
問い合わせ 5:「変更 X の内容は何ですか?」
# Show full change context
CHANGE_ID="add-user-auth"

echo "=== Proposal ==="
cat spec/changes/$CHANGE_ID/proposal.md

echo "\n=== Tasks ==="
cat spec/changes/$CHANGE_ID/tasks.md

echo "\n=== Spec Deltas ==="
find spec/changes/$CHANGE_ID/specs -name "*.md" -exec echo "File: {}" \; -exec cat {} \;

ダッシュボード表示

プロジェクトの包括的な概要を作成します。

#!/bin/bash
# Project specification dashboard

echo "===  Specification Dashboard ==="
echo ""

# Capabilities
echo "## Capabilities"
CAPS=$(find spec/specs -mindepth 1 -maxdepth 1 -type d | wc -l)
echo "Total capabilities: $CAPS"
for cap in spec/specs/*/; do
    name=$(basename "$cap")
    reqs=$(grep -c "### Requirement:" "$cap/spec.md" 2>/dev/null || echo "0")
    echo "  - $name: $reqs requirements"
done
echo ""

# Requirements
echo "## Requirements"
TOTAL_REQS=$(grep -r "### Requirement:" spec/specs/ | wc -l)
TOTAL_SCENARIOS=$(grep -r "#### Scenario:" spec/specs/ | wc -l)
echo "Total requirements: $TOTAL_REQS"
echo "Total scenarios: $TOTAL_SCENARIOS"
echo "Avg scenarios per requirement: $(echo "scale=1; $TOTAL_SCENARIOS/$TOTAL_REQS" | bc)"
echo ""

# Changes
echo "## Changes"
ACTIVE=$(find spec/changes -maxdepth 1 -type d -not -path "spec/changes" -not -path "*/archive" | wc -l)
ARCHIVED=$(ls -1 spec/archive/ | wc -l)
echo "Active changes: $ACTIVE"
echo "Archived changes: $ARCHIVED"
echo ""

# Recent activity
echo "## Recent Activity"
echo "Recently modified specs:"
find spec/specs -name "spec.md" -type f -exec ls -lt {} \; | head -5

回答形式:

# Specification Dashboard

## Capabilities
Total capabilities: 3
  - authentication: 8 requirements
  - billing: 12 requirements
  - notifications: 5 requirements

## Requirements
Total requirements: 25
Total scenarios: 52
Avg scenarios per requirement: 2.1

## Changes
Active changes: 2
Archived changes: 15

## Recent Activity
Recently modified specs:
- spec/specs/billing/spec.md (2 days ago)
- spec/specs/authentication/spec.md (1 week ago)

高度な問い合わせ

関連する要件を見つける
# Find requirements that mention another requirement
grep -r "User Login" spec/specs/ -A 10 | grep "### Requirement:"

# Find cross-references
grep -r "See Requirement:" spec/specs/
網羅性を分析する
# Find requirements without scenarios
for spec in spec/specs/**/spec.md; do
    awk '/### Requirement:/ {req=$0; getline; if ($0 !~ /#### Scenario:/) print req}' "$spec"
done

# Find scenarios without proper Given/When/Then
grep -A 5 "#### Scenario:" spec/specs/**/*.md | grep -v "GIVEN\|WHEN\|THEN"
進行中の変更とアーカイブを比較する
# Show evolution over time
echo "Archive history:"
ls -1 spec/archive/ | head -10

echo "Recent archives (last 30 days):"
find spec/archive/ -maxdepth 1 -type d -mtime -30 -exec basename {} \;

検索パターン

パターン 1:機能の把握

ユーザーの質問:「システムで何ができますか?」

# List capabilities
find spec/specs -mindepth 1 -maxdepth 1 -type d -exec basename {} \;

# Show high-level requirements
for cap in spec/specs/*/; do
    echo "=== $(basename $cap) ==="
    grep "### Requirement:" "$cap/spec.md" | head -3
done
パターン 2:機能の検索

ユーザーの質問:「パスワードリセットの仕様はありますか?」

# Search for keyword
grep -r -i "password reset" spec/specs/ -B 1 -A 10

# If found, show full requirement
grep -B 1 -A 20 "Requirement:.*Password Reset" spec/specs/**/*.md
パターン 3:変更の追跡

ユーザーの質問:「現在、何に取り組んでいますか?」

# Show active changes with status
for change in spec/changes/*/; do
    if [ "$change" != "spec/changes/archive/" ]; then
        id=$(basename "$change")
        echo "$id:"
        test -f "$change/IMPLEMENTED" && echo "  Status: Implemented" || echo "  Status: In Progress"
        echo "  Tasks: $(grep -c "^[0-9]\+\." "$change/tasks.md")"
    fi
done

ベストプラクティス

パターン 1:詳細の前にコンテキストを示す

よい流れ:

1. Show dashboard (high-level overview)
2. User asks about specific capability
3. Show that capability's requirements
4. User asks about specific requirement
5. Show full requirement with scenarios
パターン 2:grep を効率的に使う
# Combine filters for precision
grep -r "### Requirement:" spec/specs/ | grep -i "auth"

# Use context flags for readability
grep -B 2 -A 10 "#### Scenario:" spec/specs/authentication/spec.md
パターン 3:情報を集約する

ファイルの内容をそのまま出力するだけではなく、要約してください。

**Bad**: (dump entire spec file)

**Good**:
"The authentication spec has 8 requirements covering:
- User login
- Password management
- Session handling
- Multi-factor authentication

Would you like details on any specific requirement?"

避けるべきアンチパターン

避けること:

  • ユーザーからの依頼なしに仕様ファイル全体を読み込む
  • 既定で要件を一つ残らず列挙する
  • 書式を整えずに grep の生出力を表示する
  • ユーザーが機能名を知っていると決めつける

行うこと:

  • 大まかな概要から始める
  • ユーザーがどの領域を確認したいか尋ねる
  • 出力を明確に整形する
  • ナビゲーションのヒントを提供する

参考資料


トークン予算:この SKILL.md は約 460 行で、推奨上限の 500 行以内です。

コメント