🛠️ RAG Architect
RAG Architectは、Retrieval-Augmented Generation(検索拡張生成)の技術を活用し、質問応答や文章生成において、より正確で関連性の高い情報を引き出し、ビジネス上の課題解決や意思決定を強力に支援するSkill。
📜 元の英語説明(参考)
RAG Architect - POWERFUL
🇯🇵 日本人クリエイター向け解説
RAG Architectは、Retrieval-Augmented Generation(検索拡張生成)の技術を活用し、質問応答や文章生成において、より正確で関連性の高い情報を引き出し、ビジネス上の課題解決や意思決定を強力に支援するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o rag-architect.zip https://jpskill.com/download/5286.zip && unzip -o rag-architect.zip && rm rag-architect.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/5286.zip -OutFile "$d\rag-architect.zip"; Expand-Archive "$d\rag-architect.zip" -DestinationPath $d -Force; ri "$d\rag-architect.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
rag-architect.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
rag-architectフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-17
- 取得日時
- 2026-05-18
- 同梱ファイル
- 4
💬 こう話しかけるだけ — サンプルプロンプト
- › RAG Architect を使って、最小構成のサンプルコードを示して
- › RAG Architect の主な使い方と注意点を教えて
- › RAG Architect を既存プロジェクトに組み込む方法を教えて
これをClaude Code に貼るだけで、このSkillが自動発動します。
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
RAG Architect - 強力
概要
RAG (Retrieval-Augmented Generation) Architect スキルは、プロダクションレベルの RAG パイプラインを設計、実装、最適化するための包括的なツールと知識を提供します。このスキルは、ドキュメントのチャンク分割戦略から評価フレームワークまで、RAG エコシステム全体をカバーし、スケーラブルで効率的かつ正確な検索システムを構築することを可能にします。
主要な能力
1. ドキュメント処理とチャンク分割戦略
固定サイズチャンク分割
- 文字ベースのチャンク分割: 文字数による単純な分割 (例: 512、1024、2048 文字)
- トークンベースのチャンク分割: モデルの制限を考慮したトークン数による分割
- オーバーラップ戦略: コンテキストの連続性を維持するための 10-20% のオーバーラップ
- 長所: 予測可能なチャンクサイズ、実装が簡単、一貫した処理時間
- 短所: 意味単位が壊れる可能性、コンテキスト境界が無視される
- 最適な用途: 均一なドキュメント、一貫したチャンクサイズが重要な場合
文ベースのチャンク分割
- 文境界検出: NLTK、spaCy、または正規表現パターンを使用
- 文のグループ化: サイズしきい値に達するまで文を結合
- 段落の保持: 可能な限り段落途中での分割を回避
- 長所: 自然言語の境界を保持、読みやすさが向上
- 短所: 可変のチャンクサイズ、非常に短い/長いチャンクになる可能性
- 最適な用途: 物語文、記事、書籍
段落ベースのチャンク分割
- 段落検出: 二重改行、HTML タグ、Markdown フォーマット
- 階層的分割: ドキュメント構造 (セクション、サブセクション) を尊重
- サイズ調整: 小さな段落を結合、大きな段落を分割
- 長所: 論理的なドキュメント構造を保持、トピックの一貫性を維持
- 短所: 非常に可変なサイズ、非常に大きなチャンクを作成する可能性
- 最適な用途: 構造化されたドキュメント、技術文書
意味ベースのチャンク分割
- トピックモデリング: TF-IDF、埋め込み類似性によるトピック検出
- 見出しを考慮した分割: ドキュメント階層 (H1、H2、H3) を尊重
- コンテンツベースの境界: 意味的類似性によるトピックシフトの検出
- 長所: 意味的一貫性を維持、ドキュメント構造を尊重
- 短所: 実装が複雑、計算コストが高い
- 最適な用途: 長文コンテンツ、技術マニュアル、研究論文
再帰的チャンク分割
- 階層的アプローチ: まず大きなチャンクを試し、必要に応じて再帰的に分割
- 多段階分割: 異なるレベルで異なる戦略
- サイズ最適化: サイズ制限を尊重しつつ、チャンク数を最小化
- 長所: 最適なチャンク利用、可能な限りコンテキストを保持
- 短所: ロジックが複雑、潜在的なパフォーマンスオーバーヘッド
- 最適な用途: 混合コンテンツタイプ、チャンク数最適化が重要な場合
ドキュメント認識チャンク分割
- ファイルタイプ検出: PDF ページ、Word セクション、HTML 要素
- メタデータ保持: ヘッダー、フッター、ページ番号、セクション
- テーブルと画像の処理: 非テキスト要素の特殊処理
- 長所: ドキュメント構造とメタデータを保持
- 短所: フォーマット固有の実装が必要
- 最適な用途: 複数フォーマットのドキュメントコレクション、メタデータが重要な場合
2. 埋め込みモデルの選択
次元に関する考慮事項
- 128-256 次元: 高速検索、低メモリ使用量、単純なドメインに適しています
- 512-768 次元: バランスの取れたパフォーマンス、ほとんどのアプリケーションに適しています
- 1024-1536 次元: 高品質、複雑なドメインに適していますが、コストが高くなります
- 2048+ 次元: 最高品質、特殊なユースケース、かなりのリソースが必要
速度と品質のトレードオフ
- 高速モデル: sentence-transformers/all-MiniLM-L6-v2 (384 次元、約 14k トークン/秒)
- バランスの取れたモデル: sentence-transformers/all-mpnet-base-v2 (768 次元、約 2.8k トークン/秒)
- 高品質モデル: text-embedding-ada-002 (1536 次元、OpenAI API)
- 専門モデル: ドメイン固有にファインチューニングされたモデル
モデルカテゴリ
- 汎用: all-MiniLM、all-mpnet、Universal Sentence Encoder
- コード埋め込み: CodeBERT、GraphCodeBERT、CodeT5
- 科学テキスト: SciBERT、BioBERT、ClinicalBERT
- 多言語: LaBSE、multilingual-e5、paraphrase-multilingual
3. ベクトルデータベースの選択
Pinecone
- マネージドサービス: フルホスト型、自動スケーリング
- 機能: メタデータフィルタリング、ハイブリッド検索、リアルタイム更新
- 料金: 100万ベクトル (1536 次元) で月額 70 ドル、従量課金制のスケーリング
- 最適な用途: プロダクションアプリケーション、マネージドサービスが好ましい場合
- 短所: ベンダーロックイン、コストが急速に増加する可能性
Weaviate
- オープンソース: セルフホスト型またはクラウドオプションが利用可能
- 機能: GraphQL API、マルチモーダル検索、自動ベクトル化
- スケーリング: 水平スケーリング、HNSW インデックス作成
- 最適な用途: 複雑なデータタイプ、GraphQL API が好ましい場合
- 短所: 学習曲線、インフラ管理が必要
Qdrant
- Rust ベース: 高性能、低メモリフットプリント
- 機能: ペイロードフィルタリング、クラスタリング、分散デプロイメント
- API: REST および gRPC インターフェース
- 最適な用途: 高性能要件、リソース制約のある環境
- 短所: コミュニティが小さい、統合が少ない
Chroma
- 組み込みデータベース: SQLite ベース、簡単なローカル開発
- 機能: コレクション、メタデータフィルタリング、永続性
- スケーリング: 制限あり、プロトタイピングや小規模デプロイメントに適しています
- 最適な用途: 開発、テスト、小規模アプリケーション
- 短所: プロダクション規模には適していません
pgvector (PostgreSQL)
- SQL 統合: 既存の PostgreSQL インフラストラクチャを活用
- 機能: ACID 準拠、リレーショナルデータとの結合、成熟したエコシステム
- パフォーマンス: ivfflat および HNSW インデックス作成、並列クエリ処理
- 最適な用途: 既に PostgreSQL を使用している場合、ACID 準拠が必要な場合
- 短所: PostgreSQL の専門知識が必要、専用 DB よりも専門性が低い
4. 検索戦略
密な検索
- 意味
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
RAG Architect - POWERFUL
Overview
The RAG (Retrieval-Augmented Generation) Architect skill provides comprehensive tools and knowledge for designing, implementing, and optimizing production-grade RAG pipelines. This skill covers the entire RAG ecosystem from document chunking strategies to evaluation frameworks, enabling you to build scalable, efficient, and accurate retrieval systems.
Core Competencies
1. Document Processing & Chunking Strategies
Fixed-Size Chunking
- Character-based chunking: Simple splitting by character count (e.g., 512, 1024, 2048 chars)
- Token-based chunking: Splitting by token count to respect model limits
- Overlap strategies: 10-20% overlap to maintain context continuity
- Pros: Predictable chunk sizes, simple implementation, consistent processing time
- Cons: May break semantic units, context boundaries ignored
- Best for: Uniform documents, when consistent chunk sizes are critical
Sentence-Based Chunking
- Sentence boundary detection: Using NLTK, spaCy, or regex patterns
- Sentence grouping: Combining sentences until size threshold is reached
- Paragraph preservation: Avoiding mid-paragraph splits when possible
- Pros: Preserves natural language boundaries, better readability
- Cons: Variable chunk sizes, potential for very short/long chunks
- Best for: Narrative text, articles, books
Paragraph-Based Chunking
- Paragraph detection: Double newlines, HTML tags, markdown formatting
- Hierarchical splitting: Respecting document structure (sections, subsections)
- Size balancing: Merging small paragraphs, splitting large ones
- Pros: Preserves logical document structure, maintains topic coherence
- Cons: Highly variable sizes, may create very large chunks
- Best for: Structured documents, technical documentation
Semantic Chunking
- Topic modeling: Using TF-IDF, embeddings similarity for topic detection
- Heading-aware splitting: Respecting document hierarchy (H1, H2, H3)
- Content-based boundaries: Detecting topic shifts using semantic similarity
- Pros: Maintains semantic coherence, respects document structure
- Cons: Complex implementation, computationally expensive
- Best for: Long-form content, technical manuals, research papers
Recursive Chunking
- Hierarchical approach: Try larger chunks first, recursively split if needed
- Multi-level splitting: Different strategies at different levels
- Size optimization: Minimize number of chunks while respecting size limits
- Pros: Optimal chunk utilization, preserves context when possible
- Cons: Complex logic, potential performance overhead
- Best for: Mixed content types, when chunk count optimization is important
Document-Aware Chunking
- File type detection: PDF pages, Word sections, HTML elements
- Metadata preservation: Headers, footers, page numbers, sections
- Table and image handling: Special processing for non-text elements
- Pros: Preserves document structure and metadata
- Cons: Format-specific implementation required
- Best for: Multi-format document collections, when metadata is important
2. Embedding Model Selection
Dimension Considerations
- 128-256 dimensions: Fast retrieval, lower memory usage, suitable for simple domains
- 512-768 dimensions: Balanced performance, good for most applications
- 1024-1536 dimensions: High quality, better for complex domains, higher cost
- 2048+ dimensions: Maximum quality, specialized use cases, significant resources
Speed vs Quality Tradeoffs
- Fast models: sentence-transformers/all-MiniLM-L6-v2 (384 dim, ~14k tokens/sec)
- Balanced models: sentence-transformers/all-mpnet-base-v2 (768 dim, ~2.8k tokens/sec)
- Quality models: text-embedding-ada-002 (1536 dim, OpenAI API)
- Specialized models: Domain-specific fine-tuned models
Model Categories
- General purpose: all-MiniLM, all-mpnet, Universal Sentence Encoder
- Code embeddings: CodeBERT, GraphCodeBERT, CodeT5
- Scientific text: SciBERT, BioBERT, ClinicalBERT
- Multilingual: LaBSE, multilingual-e5, paraphrase-multilingual
3. Vector Database Selection
Pinecone
- Managed service: Fully hosted, auto-scaling
- Features: Metadata filtering, hybrid search, real-time updates
- Pricing: $70/month for 1M vectors (1536 dim), pay-per-use scaling
- Best for: Production applications, when managed service is preferred
- Cons: Vendor lock-in, costs can scale quickly
Weaviate
- Open source: Self-hosted or cloud options available
- Features: GraphQL API, multi-modal search, automatic vectorization
- Scaling: Horizontal scaling, HNSW indexing
- Best for: Complex data types, when GraphQL API is preferred
- Cons: Learning curve, requires infrastructure management
Qdrant
- Rust-based: High performance, low memory footprint
- Features: Payload filtering, clustering, distributed deployment
- API: REST and gRPC interfaces
- Best for: High-performance requirements, resource-constrained environments
- Cons: Smaller community, fewer integrations
Chroma
- Embedded database: SQLite-based, easy local development
- Features: Collections, metadata filtering, persistence
- Scaling: Limited, suitable for prototyping and small deployments
- Best for: Development, testing, small-scale applications
- Cons: Not suitable for production scale
pgvector (PostgreSQL)
- SQL integration: Leverage existing PostgreSQL infrastructure
- Features: ACID compliance, joins with relational data, mature ecosystem
- Performance: ivfflat and HNSW indexing, parallel query processing
- Best for: When you already use PostgreSQL, need ACID compliance
- Cons: Requires PostgreSQL expertise, less specialized than purpose-built DBs
4. Retrieval Strategies
Dense Retrieval
- Semantic similarity: Using embedding cosine similarity
- Advantages: Captures semantic meaning, handles paraphrasing well
- Limitations: May miss exact keyword matches, requires good embeddings
- Implementation: Vector similarity search with k-NN or ANN algorithms
Sparse Retrieval
- Keyword-based: TF-IDF, BM25, Elasticsearch
- Advantages: Exact keyword matching, interpretable results
- Limitations: Misses semantic similarity, vulnerable to vocabulary mismatch
- Implementation: Inverted indexes, term frequency analysis
Hybrid Retrieval
- Combination approach: Dense + sparse retrieval with score fusion
- Fusion strategies: Reciprocal Rank Fusion (RRF), weighted combination
- Benefits: Combines semantic understanding with exact matching
- Complexity: Requires tuning fusion weights, more complex infrastructure
Reranking
- Two-stage approach: Initial retrieval followed by reranking
- Reranking models: Cross-encoders, specialized reranking transformers
- Benefits: Higher precision, can use more sophisticated models for final ranking
- Tradeoff: Additional latency, computational cost
5. Query Transformation Techniques
HyDE (Hypothetical Document Embeddings)
- Approach: Generate hypothetical answer, embed answer instead of query
- Benefits: Improves retrieval by matching document style rather than query style
- Implementation: Use LLM to generate hypothetical document, embed that
- Use cases: When queries and documents have different styles
Multi-Query Generation
- Approach: Generate multiple query variations, retrieve for each, merge results
- Benefits: Increases recall, handles query ambiguity
- Implementation: LLM generates 3-5 query variations, deduplicate results
- Considerations: Higher cost and latency due to multiple retrievals
Step-Back Prompting
- Approach: Generate broader, more general version of specific query
- Benefits: Retrieves more general context that helps answer specific questions
- Implementation: Transform "What is the capital of France?" to "What are European capitals?"
- Use cases: When specific questions need general context
6. Context Window Optimization
Dynamic Context Assembly
- Relevance-based ordering: Most relevant chunks first
- Diversity optimization: Avoid redundant information
- Token budget management: Fit within model context limits
- Hierarchical inclusion: Include summaries before detailed chunks
Context Compression
- Summarization: Compress less relevant chunks while preserving key information
- Key information extraction: Extract only relevant facts/entities
- Template-based compression: Use structured formats to reduce token usage
- Selective inclusion: Include only chunks above relevance threshold
7. Evaluation Frameworks
Faithfulness Metrics
- Definition: How well generated answers are grounded in retrieved context
- Measurement: Fact verification against source documents
- Implementation: NLI models to check entailment between answer and context
- Threshold: >90% for production systems
Relevance Metrics
- Context relevance: How relevant retrieved chunks are to the query
- Answer relevance: How well the answer addresses the original question
- Measurement: Embedding similarity, human evaluation, LLM-as-judge
- Targets: Context relevance >0.8, Answer relevance >0.85
Context Precision & Recall
- Precision@K: Percentage of top-K results that are relevant
- Recall@K: Percentage of relevant documents found in top-K results
- Mean Reciprocal Rank (MRR): Average of reciprocal ranks of first relevant result
- NDCG@K: Normalized Discounted Cumulative Gain at K
End-to-End Metrics
- RAGAS: Comprehensive RAG evaluation framework
- Correctness: Factual accuracy of generated answers
- Completeness: Coverage of all relevant aspects
- Consistency: Consistency across multiple runs with same query
8. Production Patterns
Caching Strategies
- Query-level caching: Cache results for identical queries
- Semantic caching: Cache for semantically similar queries
- Chunk-level caching: Cache embedding computations
- Multi-level caching: Redis for hot queries, disk for warm queries
Streaming Retrieval
- Progressive loading: Stream results as they become available
- Incremental generation: Generate answers while still retrieving
- Real-time updates: Handle document updates without full reprocessing
- Connection management: Handle client disconnections gracefully
Fallback Mechanisms
- Graceful degradation: Fallback to simpler retrieval if primary fails
- Cache fallbacks: Serve stale results when retrieval is unavailable
- Alternative sources: Multiple vector databases for redundancy
- Error handling: Comprehensive error recovery and user communication
9. Cost Optimization
Embedding Cost Management
- Batch processing: Batch documents for embedding to reduce API costs
- Caching strategies: Cache embeddings to avoid recomputation
- Model selection: Balance cost vs quality for embedding models
- Update optimization: Only re-embed changed documents
Vector Database Optimization
- Index optimization: Choose appropriate index types for use case
- Compression: Use quantization to reduce storage costs
- Tiered storage: Hot/warm/cold data strategies
- Resource scaling: Auto-scaling based on query patterns
Query Optimization
- Query routing: Route simple queries to cheaper methods
- Result caching: Avoid repeated expensive retrievals
- Batch querying: Process multiple queries together when possible
- Smart filtering: Use metadata filters to reduce search space
10. Guardrails & Safety
Content Filtering
- Toxicity detection: Filter harmful or inappropriate content
- PII detection: Identify and handle personally identifiable information
- Content validation: Ensure retrieved content meets quality standards
- Source verification: Validate document authenticity and reliability
Query Safety
- Injection prevention: Prevent malicious query injection attacks
- Rate limiting: Prevent abuse and ensure fair usage
- Query validation: Sanitize and validate user inputs
- Access controls: Ensure users can only access authorized content
Response Safety
- Hallucination detection: Identify when model generates unsupported claims
- Confidence scoring: Provide confidence levels for generated responses
- Source attribution: Always provide sources for factual claims
- Uncertainty handling: Gracefully handle cases where answer is uncertain
Implementation Best Practices
Development Workflow
- Requirements gathering: Understand use case, scale, and quality requirements
- Data analysis: Analyze document corpus characteristics
- Prototype development: Build minimal viable RAG pipeline
- Chunking optimization: Test different chunking strategies
- Retrieval tuning: Optimize retrieval parameters and thresholds
- Evaluation setup: Implement comprehensive evaluation metrics
- Production deployment: Scale-ready implementation with monitoring
Monitoring & Observability
- Query analytics: Track query patterns and performance
- Retrieval metrics: Monitor precision, recall, and latency
- Generation quality: Track faithfulness and relevance scores
- System health: Monitor database performance and availability
- Cost tracking: Monitor embedding and vector database costs
Maintenance & Updates
- Document refresh: Handle new documents and updates
- Index maintenance: Regular vector database optimization
- Model updates: Evaluate and migrate to improved models
- Performance tuning: Continuous optimization based on usage patterns
- Security updates: Regular security assessments and updates
Common Pitfalls & Solutions
Poor Chunking Strategy
- Problem: Chunks break mid-sentence or lose context
- Solution: Use boundary-aware chunking with overlap
Low Retrieval Precision
- Problem: Retrieved chunks are not relevant to query
- Solution: Improve embedding model, add reranking, tune similarity threshold
High Latency
- Problem: Slow retrieval and generation
- Solution: Optimize vector indexing, implement caching, use faster embedding models
Inconsistent Quality
- Problem: Variable answer quality across different queries
- Solution: Implement comprehensive evaluation, add quality scoring, improve fallbacks
Scalability Issues
- Problem: System doesn't scale with increased load
- Solution: Implement proper caching, database sharding, and auto-scaling
Conclusion
Building effective RAG systems requires careful consideration of each component in the pipeline. The key to success is understanding the tradeoffs between different approaches and choosing the right combination of techniques for your specific use case. Start with simple approaches and gradually add sophistication based on evaluation results and production requirements.
This skill provides the foundation for making informed decisions throughout the RAG development lifecycle, from initial design to production deployment and ongoing maintenance.
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (15,548 bytes)
- 📎 references/chunking_strategies_comparison.md (10,181 bytes)
- 📎 references/embedding_model_benchmark.md (12,170 bytes)
- 📎 references/rag_evaluation_framework.md (15,137 bytes)