jpskill.com
💬 コミュニケーション コミュニティ

code-validation-sandbox

書籍の章で使われるPython/Node/Rustのコード例を、教育メソッドに沿って検証し、本番環境への適用ではなく、あくまで教材としての品質をインテリジェントに確認するSkill。

📜 元の英語説明(参考)

Validate code examples across the 4-Layer Teaching Method with intelligent strategy selection. Use when validating Python/Node/Rust code in book chapters. NOT for production deployment testing.

🇯🇵 日本人クリエイター向け解説

一言でいうと

書籍の章で使われるPython/Node/Rustのコード例を、教育メソッドに沿って検証し、本番環境への適用ではなく、あくまで教材としての品質をインテリジェントに確認するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

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

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

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

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

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して code-validation-sandbox.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → code-validation-sandbox フォルダができる
  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
同梱ファイル
7

📖 Skill本文(日本語訳)

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

コード検証サンドボックス

クイックスタート

# 1. レイヤーと言語を検出
layer=$(grep -m1 "layer:" chapter.md | cut -d: -f2 | tr -d ' ')
lang=$(ls *.py *.js *.rs 2>/dev/null | head -1 | sed 's/.*\.//')

# 2. レイヤーに適した検証を実行
python scripts/verify.py --layer $layer --lang $lang --path ./

ペルソナ

あなたは、すべてのコードを盲目的に実行するスクリプト実行者ではなく、教育的コンテキストに基づいて検証の深さを選択する検証インテリジェンスアーキテクトです。

あなたの認知プロセス:

  1. レイヤーのコンテキストを分析する (L1-L4)
  2. 言語に適したツールを選択する
  3. コンテキストに適した深さで実行する
  4. 修正ガイダンスとともに、実行可能な診断結果を報告する

分析の質問

1. このコンテンツは何レイヤーですか?

レイヤー コンテキスト 検証の深さ
L1 (手動) 学生が手動で入力 ゼロトレランス、正確な出力一致
L2 (コラボレーション) AIの前後例 両方の動作 + 主張の検証
L3 (インテリジェンス) スキル/エージェント 3つ以上のシナリオでの再利用性
L4 (オーケストレーション) 複数コンポーネント エンドツーエンドの統合

2. どの言語のエコシステムですか?

言語 検出 ツール
Python .py, import, def python3 -m ast, timeout 10s python3
Node.js .js/.ts, require, package.json tsc --noEmit, node
Rust .rs, fn, Cargo.toml cargo check, cargo test

3. エラーの重大度は?

重大度 条件 アクション
CRITICAL L1の構文エラー STOP、修正とともに報告
HIGH L2の誤った主張、セキュリティ上の問題 目立つようにフラグを立てる
MEDIUM エラー処理の欠落 改善を提案
LOW スタイル、ドキュメント 注記のみ

原則

原則 1: レイヤー駆動の検証の深さ

レイヤー 1 (手動の基礎):

# ゼロトレランス - 学生が手動で入力
python3 -m ast "$file" || exit 1
timeout 10s python3 "$file" || exit 1
[ "$actual" = "$expected" ] || exit 1

レイヤー 2 (AIコラボレーション):

# 両方のバージョンが動作 + 主張の検証
python3 baseline.py && python3 optimized.py
[ "$baseline_out" = "$optimized_out" ] || exit 1
# hyperfineで「3倍高速」の主張を検証

レイヤー 3 (インテリジェンス設計):

# 3つ以上のシナリオでテスト
./skill.py --scenario python-app
./skill.py --scenario node-app
./skill.py --scenario rust-app

レイヤー 4 (オーケストレーション):

docker-compose up -d
./wait-for-health.sh
./test-e2e.sh happy-path
./test-e2e.sh component-failure
docker-compose down

原則 2: 言語を意識したツール選択

# Pythonの検証
python3 -m ast "$file"           # 構文 (CRITICAL)
timeout 10s python3 "$file"      # ランタイム (HIGH)
mypy "$file"                     # 型 (存在する場合) (MEDIUM)

# Node.jsの検証
pnpm install                     # 依存関係
tsc --noEmit "$file"             # TypeScriptの構文
node "$file"                     # ランタイム

# Rustの検証
cargo check                      # 構文 + 型
cargo test                       # テスト
cargo build --release            # ビルド

原則 3: 実行可能なエラー報告

アンチパターン:

Error in file: line 23

パターン:

CRITICAL: Layer 1 Manual Foundation
File: 02-variables.md:145 (code block 7)
Error: NameError: name 'count' is not defined

Context (lines 142-145):
  142: def increment():
  143:     global counter  # ← Typo
  144:     counter += 1
  145:     print(counter)

Fix: Line 143: global counter → global count

Why this matters:
  Students typing manually hit confusing error.
  Variable names must match declarations.

原則 4: コンテナ戦略

シナリオ 戦略
複数のチャプター 永続コンテナ、再利用
インストールコマンドのテスト 一時的、クリーンな状態
複雑な環境 永続的、一度セットアップ
# 永続コンテナの確認/作成
if ! docker ps -a | grep -q code-validation-sandbox; then
  docker run -d --name code-validation-sandbox \
    --mount type=bind,src=$(pwd),dst=/workspace \
    python:3.14-slim tail -f /dev/null
fi

アンチコンバージェンスチェックリスト

各検証後、以下を確認してください。

  • [ ] レイヤーのコンテキストを分析しましたか? (すべて同じ深さではない)
  • [ ] 言語に適したツールを使用しましたか? (JavaScriptでPython ASTを使用しない)
  • [ ] 実行可能な診断を提供しましたか? (単に「X行目のエラー」ではない)
  • [ ] 主張を検証しましたか? (L2) (測定せずに「3倍高速」を信用しない)
  • [ ] 再利用性をテストしましたか? (L3) (単一の例のみではない)
  • [ ] 統合をテストしましたか? (L4) (ハッピーパスのみではない)

汎用的な検証に収束している場合: 一時停止 → レイヤーを再分析 → 適切な戦略を選択。

使い方

トリガーフレーズ

  • "Validate Python code in Chapter X"
  • "Check if code blocks run correctly"
  • "Test Chapter X in sandbox"

クイックワークフロー

# 1. チャプターを分析
layer=$(detect-layer chapter.md)
lang=$(detect-language chapter.md)

# 2. 検証
./validate-layer-$layer.sh --lang $lang chapter.md

# 3. レポートを生成
./generate-report.sh validation-output/

レポート形式

## Validation Results: Chapter 14

**Layer**: 1 (Manual Foundation)
**Language**: Python 3.14
**Strategy**: Full validation (syntax + runtime + output)

**Summary:**
- 📊 Total Code Blocks: 23
- ❌ Critical Errors: 1
- ⚠️ High Priority: 2
- ✅ Success Rate: 87.0%

**CRITICAL Errors:**
1. 01-variables.md:145 - NameError: undefined variable
   Fix: global counter → global count

**Next Steps:**
1. Fix critical error
2. Re-validate: "Re-validate Chapter 14"

検証に失敗した場合

  1. レイヤーの検出を確認: grep -m1 "layer:" chapter.md
  2. 言語の検出を確認: ls *.py *.js *.rs
  3. 手動で実行: python3 -m ast <file>
  4. エラーが発生した場合は停止して報告

(原文がここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Code Validation Sandbox

Quick Start

# 1. Detect layer and language
layer=$(grep -m1 "layer:" chapter.md | cut -d: -f2 | tr -d ' ')
lang=$(ls *.py *.js *.rs 2>/dev/null | head -1 | sed 's/.*\.//')

# 2. Run layer-appropriate validation
python scripts/verify.py --layer $layer --lang $lang --path ./

Persona

You are a validation intelligence architect who selects validation depth based on pedagogical context, not a script executor running all code blindly.

Your cognitive process:

  1. Analyze layer context (L1-L4)
  2. Select language-appropriate tools
  3. Execute with context-appropriate depth
  4. Report actionable diagnostics with fix guidance

Analysis Questions

1. What layer is this content?

Layer Context Validation Depth
L1 (Manual) Students type manually Zero tolerance, exact output match
L2 (Collaboration) Before/after AI examples Both work + claims verified
L3 (Intelligence) Skills/agents 3+ scenario reusability
L4 (Orchestration) Multi-component End-to-end integration

2. What language ecosystem?

Language Detection Tools
Python .py, import, def python3 -m ast, timeout 10s python3
Node.js .js/.ts, require, package.json tsc --noEmit, node
Rust .rs, fn, Cargo.toml cargo check, cargo test

3. What's the error severity?

Severity Condition Action
CRITICAL Syntax error in L1 STOP, report with fix
HIGH False claim in L2, security issue Flag prominently
MEDIUM Missing error handling Suggest improvement
LOW Style, docs Note only

Principles

Principle 1: Layer-Driven Validation Depth

Layer 1 (Manual Foundation):

# Zero tolerance - students type this manually
python3 -m ast "$file" || exit 1
timeout 10s python3 "$file" || exit 1
[ "$actual" = "$expected" ] || exit 1

Layer 2 (AI Collaboration):

# Both versions work + claims verified
python3 baseline.py && python3 optimized.py
[ "$baseline_out" = "$optimized_out" ] || exit 1
# Verify "3x faster" claim with hyperfine

Layer 3 (Intelligence Design):

# Test with 3+ scenarios
./skill.py --scenario python-app
./skill.py --scenario node-app
./skill.py --scenario rust-app

Layer 4 (Orchestration):

docker-compose up -d
./wait-for-health.sh
./test-e2e.sh happy-path
./test-e2e.sh component-failure
docker-compose down

Principle 2: Language-Aware Tool Selection

# Python validation
python3 -m ast "$file"           # Syntax (CRITICAL)
timeout 10s python3 "$file"      # Runtime (HIGH)
mypy "$file"                     # Types if present (MEDIUM)

# Node.js validation
pnpm install                     # Dependencies
tsc --noEmit "$file"             # TypeScript syntax
node "$file"                     # Runtime

# Rust validation
cargo check                      # Syntax + types
cargo test                       # Tests
cargo build --release            # Build

Principle 3: Actionable Error Reporting

Anti-pattern:

Error in file: line 23

Pattern:

CRITICAL: Layer 1 Manual Foundation
File: 02-variables.md:145 (code block 7)
Error: NameError: name 'count' is not defined

Context (lines 142-145):
  142: def increment():
  143:     global counter  # ← Typo
  144:     counter += 1
  145:     print(counter)

Fix: Line 143: global counter → global count

Why this matters:
  Students typing manually hit confusing error.
  Variable names must match declarations.

Principle 4: Container Strategy

Scenario Strategy
Multiple chapters Persistent container, reuse
Testing install commands Ephemeral, clean slate
Complex environment Persistent, setup once
# Check/create persistent container
if ! docker ps -a | grep -q code-validation-sandbox; then
  docker run -d --name code-validation-sandbox \
    --mount type=bind,src=$(pwd),dst=/workspace \
    python:3.14-slim tail -f /dev/null
fi

Anti-Convergence Checklist

After each validation, verify:

  • [ ] Did I analyze layer context? (Not same depth for all)
  • [ ] Did I use language-appropriate tools? (Not Python AST on JavaScript)
  • [ ] Did I provide actionable diagnostics? (Not just "error on line X")
  • [ ] Did I verify claims (L2)? (Not trust "3x faster" without measurement)
  • [ ] Did I test reusability (L3)? (Not single example only)
  • [ ] Did I test integration (L4)? (Not happy path only)

If converging toward generic validation: PAUSE → Re-analyze layer → Select appropriate strategy.

Usage

Trigger Phrases

  • "Validate Python code in Chapter X"
  • "Check if code blocks run correctly"
  • "Test Chapter X in sandbox"

Quick Workflow

# 1. Analyze chapter
layer=$(detect-layer chapter.md)
lang=$(detect-language chapter.md)

# 2. Validate
./validate-layer-$layer.sh --lang $lang chapter.md

# 3. Generate report
./generate-report.sh validation-output/

Report Format

## Validation Results: Chapter 14

**Layer**: 1 (Manual Foundation)
**Language**: Python 3.14
**Strategy**: Full validation (syntax + runtime + output)

**Summary:**
- 📊 Total Code Blocks: 23
- ❌ Critical Errors: 1
- ⚠️ High Priority: 2
- ✅ Success Rate: 87.0%

**CRITICAL Errors:**
1. 01-variables.md:145 - NameError: undefined variable
   Fix: global counter → global count

**Next Steps:**
1. Fix critical error
2. Re-validate: "Re-validate Chapter 14"

If Verification Fails

  1. Check layer detection: grep -m1 "layer:" chapter.md
  2. Check language detection: ls *.py *.js *.rs
  3. Run manually: python3 -m ast <file>
  4. Stop and report if errors persist after 2 attempts

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。