jpskill.com
🛠️ 開発・MCP コミュニティ

data-substrate-analysis

Analyze fundamental data primitives, type systems, and state management patterns in a codebase. Use when (1) evaluating typing strategies (Pydantic vs TypedDict vs loose dicts), (2) assessing immutability and mutation patterns, (3) understanding serialization approaches, (4) documenting state shape and lifecycle, or (5) comparing data modeling approaches across frameworks.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o data-substrate-analysis.zip https://jpskill.com/download/18855.zip && unzip -o data-substrate-analysis.zip && rm data-substrate-analysis.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/18855.zip -OutFile "$d\data-substrate-analysis.zip"; Expand-Archive "$d\data-substrate-analysis.zip" -DestinationPath $d -Force; ri "$d\data-substrate-analysis.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して data-substrate-analysis.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → data-substrate-analysis フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

[スキル名] data-substrate-analysis

データ基盤分析

データと状態管理パターンの基本的な単位を分析します。

プロセス

  1. 型ファイルの特定 — types.py、schema.py、models.py、state.py を見つけます。
  2. 型付けの分類 — 厳密 (Pydantic)、構造的 (TypedDict)、緩い (dict) に分類します。
  3. ミューテーションの分析 — インプレース変更とコピーオンライトを分析します。
  4. シリアライゼーションの文書化 — json()、dict()、pickle、カスタムメソッドを文書化します。

型付け戦略の分類

検出パターン

戦略 指標 確認するファイル
Pydantic BaseModelField()validator models.py、schema.py
Dataclass @dataclassfield() types.py、models.py
TypedDict TypedDictRequired[]NotRequired[] types.py
NamedTuple NamedTupletyping.NamedTuple types.py
Loose Dict[str, Any]、プレーンな dict 全体

分析の質問

  • 境界は検証されていますか (API の入力/出力)?
  • ネストの深さは妥当ですか (3 レベル未満)?
  • オプションフィールドは明示的ですか、それとも暗黙的な None ですか?
  • バージョン移行パスはありますか (Pydantic V1 → V2)?

不変性分析

可変パターン (リスク指標)

# In-place list modification
state.messages.append(msg)
state.history.extend(new_items)

# Direct dict mutation
state['key'] = value
state.update(new_data)

# Object attribute mutation
state.status = 'complete'

不変パターン (より安全)

# Pydantic copy
new_state = state.model_copy(update={'key': value})

# Dataclass replace
new_state = replace(state, messages=[*state.messages, msg])

# Spread operator style
new_state = {**state, 'key': value}

# Frozen dataclass
@dataclass(frozen=True)
class State: ...

シリアライゼーション戦略

一般的なパターン

メソッド コードパターン トレードオフ
Pydantic JSON .model_dump_json() 型安全、自動
Pydantic Dict .model_dump() 内部使用向け
Dataclass asdict(obj) 手動、検証なし
Custom to_dict()from_dict() 完全な制御
Pickle pickle.dumps() 高速、脆弱、セキュリティリスク
JSON json.dumps(obj, default=...) エンコーダーが必要

回答すべき質問

  • シリアライゼーションは暗黙的 (自動) ですか、それとも明示的 (手動) ですか?
  • ネストされたオブジェクトはどのように処理されますか?
  • デシリアライゼーションは検証されますか?
  • 未知のフィールドはどうなりますか?

出力テンプレート

## Data Substrate Analysis: [Framework Name]

### Typing Strategy
- **Primary Approach**: [Pydantic/Dataclass/TypedDict/Loose]
- **Key Files**: [List of files]
- **Nesting Depth**: [Shallow/Medium/Deep]
- **Validation**: [At boundaries/Everywhere/None]

### Core Primitives

| Type | Location | Purpose | Mutability |
|------|----------|---------|------------|
| Message | schema.py:L15 | Chat message | Immutable |
| State | state.py:L42 | Agent state | Mutable ⚠️ |
| Result | types.py:L78 | Tool output | Immutable |

### Mutation Analysis
- **Pattern**: [In-place/Copy-on-write/Mixed]
- **Risk Areas**: [List of mutable state locations]
- **Concurrency Safe**: [Yes/No/Partial]

### Serialization
- **Method**: [Pydantic/Custom/JSON]
- **Implicit/Explicit**: [Description]
- **Round-trip Tested**: [Yes/No/Unknown]

統合

  • 前提条件: 型ファイルを特定するための codebase-mapping
  • 入力元: 型付けの決定のための comparative-matrix
  • 関連: シリアライゼーションにおけるエラー処理のための resilience-analysis
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Data Substrate Analysis

Analyzes the fundamental units of data and state management patterns.

Process

  1. Locate type files — Find types.py, schema.py, models.py, state.py
  2. Classify typing — Strict (Pydantic), structural (TypedDict), loose (dict)
  3. Analyze mutation — In-place modification vs. copy-on-write
  4. Document serialization — json(), dict(), pickle, custom methods

Typing Strategy Classification

Detection Patterns

Strategy Indicators Files to Check
Pydantic BaseModel, Field(), validator models.py, schema.py
Dataclass @dataclass, field() types.py, models.py
TypedDict TypedDict, Required[], NotRequired[] types.py
NamedTuple NamedTuple, typing.NamedTuple types.py
Loose Dict[str, Any], plain dict Throughout

Analysis Questions

  • Are boundaries validated (API ingress/egress)?
  • Is nesting depth reasonable (<3 levels)?
  • Are optional fields explicit or implicit None?
  • Version migration path (Pydantic V1 → V2)?

Immutability Analysis

Mutable Patterns (Risk Indicators)

# In-place list modification
state.messages.append(msg)
state.history.extend(new_items)

# Direct dict mutation
state['key'] = value
state.update(new_data)

# Object attribute mutation
state.status = 'complete'

Immutable Patterns (Safer)

# Pydantic copy
new_state = state.model_copy(update={'key': value})

# Dataclass replace
new_state = replace(state, messages=[*state.messages, msg])

# Spread operator style
new_state = {**state, 'key': value}

# Frozen dataclass
@dataclass(frozen=True)
class State: ...

Serialization Strategy

Common Patterns

Method Code Pattern Trade-offs
Pydantic JSON .model_dump_json() Type-safe, automatic
Pydantic Dict .model_dump() For internal use
Dataclass asdict(obj) Manual, no validation
Custom to_dict(), from_dict() Full control
Pickle pickle.dumps() Fast, fragile, security risk
JSON json.dumps(obj, default=...) Requires encoder

Questions to Answer

  • Is serialization implicit (automatic) or explicit (manual)?
  • How are nested objects handled?
  • Is deserialization validated?
  • What happens with unknown fields?

Output Template

## Data Substrate Analysis: [Framework Name]

### Typing Strategy
- **Primary Approach**: [Pydantic/Dataclass/TypedDict/Loose]
- **Key Files**: [List of files]
- **Nesting Depth**: [Shallow/Medium/Deep]
- **Validation**: [At boundaries/Everywhere/None]

### Core Primitives

| Type | Location | Purpose | Mutability |
|------|----------|---------|------------|
| Message | schema.py:L15 | Chat message | Immutable |
| State | state.py:L42 | Agent state | Mutable ⚠️ |
| Result | types.py:L78 | Tool output | Immutable |

### Mutation Analysis
- **Pattern**: [In-place/Copy-on-write/Mixed]
- **Risk Areas**: [List of mutable state locations]
- **Concurrency Safe**: [Yes/No/Partial]

### Serialization
- **Method**: [Pydantic/Custom/JSON]
- **Implicit/Explicit**: [Description]
- **Round-trip Tested**: [Yes/No/Unknown]

Integration

  • Prerequisite: codebase-mapping to identify type files
  • Feeds into: comparative-matrix for typing decisions
  • Related: resilience-analysis for error handling in serialization