ai-toolkit-rules
Mandatory engineering, security, testing, git, performance, quality, and response rules.…
RAG: embeddings, chunking, hybrid search (BM25+vector), reranking, CRAG, multi-hop. Triggers: RAG, embedding, pgvector, Qdrant, Pinecone, Weaviate, reranker, semantic search.
$ npx -y skills add softspark/ai-toolkit --skill rag-patterns --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/rag-patternsContext preview
The summary Claude sees to decide when to auto-load this skill.
RAG: embeddings, chunking, hybrid search (BM25+vector), reranking, CRAG, multi-hop. Triggers: RAG, embedding, pgvector, Qdrant, Pinecone, Weaviate, reranker, semantic search.
name: rag-patterns description: "RAG: embeddings, chunking, hybrid search (BM25+vector), reranking, CRAG, multi-hop. Triggers: RAG, embedding, pgvector, Qdrant, Pinecone, Weaviate, reranker, semantic search." effort: medium user-invocable: false allowed-tools: Read
Combine dense (vector) and sparse (BM25) retrieval with RRF fusion:
# RAG-MCP hybrid search
result = await hybrid_search_kb(
query="rate limiting configuration",
service="nginx",
limit=10
)Self-correcting retrieval with relevance validation:
result = await crag_search(
query="fuzzy query",
relevance_threshold=0.4,
max_retries=2
)
# Or via smart_query
result = await smart_query(query="...", use_crag=True)Generate hypothetical answers for better retrieval on conceptual queries:
result = await smart_query(
query="conceptual question about design patterns",
use_hyde=True
)Complex queries requiring multiple retrieval steps:
result = await multi_hop_search(
query="Compare nginx with varnish for Magento cache",
max_hops=3
)
# Or via smart_query
result = await smart_query(query="compare A vs B", use_multi_hop=True)---
| Aspect | Recommendation | |--------|----------------| | Chunk size | 512-1024 tokens | | Overlap | 10-20% of chunk | | Structure | Preserve headers, sections | | Metadata | Include title, path, date, category, tags | | Frontmatter | YAML with standardized fields |
---
title: "Document Title"
service: {project-name}
category: reference|howto|procedures|troubleshooting|decisions|best-practices
tags: [tag1, tag2, tag3]
last_updated: "YYYY-MM-DD"
------
| Tool | Use Case | Speed | |------|----------|-------| | `smart_query` ⭐ | Default for 90% of queries | 2-4s | | `hybrid_search_kb` | Raw vector + text search | <1s | | `get_document` | Full document content | <1s | | `crag_search` | Vague/fuzzy queries | 1-3s | | `multi_hop_search` | Complex reasoning | 20-30s |
# Default - auto-routing
smart_query("specific technical question")
# Vague query - self-correcting
crag_search("jak to skonfigurować")
# Complex comparison
multi_hop_search("nginx vs varnish performance comparison")
# Known document
get_document(path="kb/reference/architecture.md")---
| Metric | Description | Target | |--------|-------------|--------| | Faithfulness | Answer based on context | >70% | | Relevancy | Answer addresses question | >70% | | Context Precision | Found context is accurate | >60% | | Latency (p95) | Response time | <2s | | Precision@k | Relevant results in top-k | >80% |
---
# Retrieve more, rerank to top-k initial_results = await hybrid_search_kb(query, limit=20) reranked = rerank_results(initial_results, query) final_results = reranked[:5]
---
❌ **Don't**:
✅ **Do**:
---
scripts/ ├── search_core.py # Core search ├── query_enhancements.py # HyDE, query expansion ├── corrective_rag.py # CRAG ├── multi_hop.py # Multi-hop ├── unified_indexer.py # Indexing └── rag_evaluator.py # Evaluation
**Direct execution:**
# Index KB make index # Evaluate RAG python scripts/evaluate_rag.py # Detect gaps python scripts/knowledge_gaps.py --detect
**Docker execution (if containerized):**
# Index KB
docker exec {app-container} make index
# Evaluate RAG
docker exec {api-container} python3 scripts/evaluate_rag.py
# Detect gaps
docker exec {api-container} python3 scripts/knowledge_gaps.py --detectAI coding toolkit with machine-enforced safety, 116 skills, 44 agents, lifecycle hooks, persona presets, opt-in plugin packs, and benchmark tooling.
Repo: softspark/ai-toolkit
Mandatory engineering, security, testing, git, performance, quality, and response rules.…
Searches past coding sessions for observations, decisions, context. Triggers: mem-search,…
Accessibility validator: WCAG 2.1 AA, EN 301 549, EAA. Triggers: a11y, accessibility, WCAG,…
Creates new specialized agents with frontmatter, tools, delegation. Triggers: new agent,…
Analyzes code quality, complexity, patterns across codebase. Triggers: quality report,…
API design: naming, versioning, pagination, idempotency, OpenAPI, error contracts and safe…