lightrag
Skill4 starsChanged 6 months agoMITView on GitHub
Graph-based RAG system for knowledge extraction and Q&A
- Reads credentials
- Deletes or force-pushes
- Sends data out
1 other project uses a version of this.
Adopted by
Most recently taken up by
- olafgeibig/skillstheir own version, first seen May 16, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- olafgeibig/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository79 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- 21st-magicSkill
- alpacaSkill
- ask-mattSkill
- autoresearchSkill
- auto-stage-commitSkill
- browser-harnessSkill
- codebase-designSkill
- codeburnSkill
- codex-reviewSkill
- compact-memorySkill
- connect-recommendSkill
- connect-required-verification-informationSkill
- decision-mappingSkill
- delegate-taskSkill
- design-an-interfaceSkill
- design-mdSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- edit-articleSkill
- extract-designSkill
- ffmpegSkill
- find-skillsSkill
- firecrawlSkill
- generateSkill
- git-guardrails-claude-codeSkill
- grillingSkill
- grill-me-codexSkill
- grill-meSkill
- grill-with-docs-codexSkill
- grill-with-docsSkill
- gwSkill
- handoffSkill
- implementSkill
- improve-codebase-architectureSkill
- kie-aiSkill
- llmfitSkill
- loop-meSkill
- migrate-to-shoehornSkill
- notebooklmSkill
- obsidian-vaultSkill
- openspaceSkill
- playwrightSkill
- prototypeSkill
- qaSkill
- request-refactor-planSkill
- resolving-merge-conflictsSkill
- reviewSkill
- roastSkill
- scaffold-exercisesSkill
- session-handoffSkill
- setup-matt-pocock-skillsSkill
- setup-pre-commitSkill
- site-teardownSkill
- skill-discoverySkill
- skilluiSkill
- spline-3dSkill
- stripe-appsSkill
- stripe-best-practicesSkill
- stripe-directorySkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 28
Add one of these to .env:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
LightRAG — Fast Graph-Based RAG
LightRAG is a graph-based Retrieval-Augmented Generation system that extracts knowledge graphs from documents for entity-relationship-aware Q&A. Outperforms naive RAG, HyDE, and GraphRAG across multiple domains.
Use when: Building document Q&A systems, knowledge bases, semantic search with graph relationships, or multimodal RAG (PDFs, images, tables).
Source: github.com/HKUDS/LightRAG (EMNLP 2025, 13K+ stars)
Setup Workflow
1. Install Dependencies
cd tools/lightrag-plus
uv syncInstalls lightrag-hku and dependencies in isolated venv.
2. Configure LLM Provider
Add one of these to .env:
# OpenAI
OPENAI_API_KEY=sk-...
# Claude
ANTHROPIC_API_KEY=sk-ant-...
# Gemini
GEMINI_API_KEY=...
# Ollama (local)
OLLAMA_HOST=http://localhost:114343. Choose Storage Backend
Default (nano-vectordb) — no setup, good for prototyping:
rag = LightRAG(working_dir="./rag_storage")Neo4J — advanced graph queries:
# Add to .env
NEO4J_URI=bolt://localhost:7687
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=...MongoDB — unified storage:
# Add to .env
MONGODB_URI=mongodb://localhost:27017PostgreSQL — SQL-based queries:
# Add to .env
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USER=...
POSTGRES_PASSWORD=...
POSTGRES_DB=lightragUsage Patterns
Pattern 1: Core Library (Embedded)
Insert documents:
from lightrag import LightRAG, QueryParam
from lightrag.llm import openai_complete_if_cache, openai_embedding
rag = LightRAG(
working_dir="./rag_storage",
llm_model_func=openai_complete_if_cache,
embedding_func=openai_embedding
)
# Insert
with open("document.txt") as f:
rag.insert(f.read())Query:
# Modes: naive, local, global, hybrid, mix
result = rag.query(
"What is the main topic?",
param=QueryParam(mode="hybrid")
)
print(result)Pattern 2: Server Mode (Recommended for Production)
Start server:
cd tools/lightrag-plus
python -m lightrag.server --port 9621 --working-dir ./rag_storageQuery via REST API:
# Insert document
curl -X POST http://localhost:9621/insert \
-H "Content-Type: application/json" \
-d '{"text": "Your document text here"}'
# Query
curl -X POST http://localhost:9621/query \
-H "Content-Type: application/json" \
-d '{"query": "What is...?", "mode": "hybrid"}'Web UI: http://localhost:9621 — knowledge graph visualization, node queries, subgraph filtering
Query Modes
| Mode | When to Use |
naive | Baseline retrieval without graph context |
local | Local entity-based retrieval (fast) |
global | Community-based global retrieval |
hybrid | Combines local + global (best for broad queries) |
mix | Uses reranker — best performance when reranker is configured |
Default: hybrid (no reranker) or mix (with reranker)
LLM/Embedding Configuration
LLM Requirements
- Minimum: 32B params, 32KB context
- Recommended: 64KB context
- Indexing: Non-reasoning models (faster)
- Query: Stronger models than indexing for best results
Embedding Model
- Recommended:
BAAI/bge-m3,text-embedding-3-large - Critical: Same model for indexing AND querying
- Dimension lock: PostgreSQL requires dimension at table creation — changing models = drop tables and recreate
Reranker (Optional)
- Boosts performance significantly when enabled with
mode="mix" - Recommended:
BAAI/bge-reranker-v2-m3, Jina reranker API
LLM Provider Examples
OpenAI:
from lightrag.llm import openai_complete_if_cache, openai_embedding
rag = LightRAG(
working_dir="./rag_storage",
llm_model_func=openai_complete_if_cache,
embedding_func=openai_embedding
)Claude (Anthropic):
from lightrag.llm import anthropic_complete, openai_embedding # use OpenAI for embeddings
rag = LightRAG(
working_dir="./rag_storage",
llm_model_func=anthropic_complete,
embedding_func=openai_embedding
)Ollama (Local):
from lightrag.llm import ollama_model_complete, ollama_embedding
rag = LightRAG(
working_dir="./rag_storage",
llm_model_func=ollama_model_complete,
llm_model_name="llama3.2:latest",
embedding_func=ollama_embedding,
embedding_model_name="nomic-embed-text"
)Gemini:
from lightrag.llm import gemini_complete, openai_embedding
rag = LightRAG(
working_dir="./rag_storage",
llm_model_func=gemini_complete,
embedding_func=openai_embedding
)Advanced Features
- Token tracking —
rag.token_usage() - Export KG data —
rag.export_knowledge_graph() - LLM cache —
kv_store_llm_response_cache.jsonin working_dir - Delete documents —
rag.delete_document(doc_id)with auto KG regeneration - Langfuse tracing — observability integration
- RAGAS evaluation — measure retrieval quality
- Multimodal RAG — integrate with RAG-Anything for PDFs, images, tables
Full docs: docs/AdvancedFeatures.md
File Structure
tools/lightrag-plus/
pyproject.toml ← Dependencies (lightrag-hku)
README.md ← Full documentation
uv.lock ← Dependency lock file
.gitignore ← Excludes .venv, rag_storage, build artifacts
.venv/ ← Virtual environment (gitignored, recreated by `uv sync`)
rag_storage/ ← Working directory (gitignored, auto-created on first use)Commands
# Install
cd tools/lightrag-plus && uv sync
# Start server
cd tools/lightrag-plus && python -m lightrag.server --port 9621 --working-dir ./rag_storage
# Test insert/query via Python
cd tools/lightrag-plus && uv run python -c "
from lightrag import LightRAG, QueryParam
rag = LightRAG(working_dir='./rag_storage')
rag.insert('The capital of France is Paris.')
print(rag.query('What is the capital of France?', param=QueryParam(mode='naive')))
"Platform Support
- Windows: Full support (requires Python 3.10+)
- macOS: Full support
- Linux: Full support
References
- GitHub: https://github.com/HKUDS/LightRAG
- Paper: https://arxiv.org/abs/2410.05779 (EMNLP 2025)
- PyPI: https://pypi.org/project/lightrag-hku/
- Core API: docs/ProgramingWithCore.md
- Server docs: docs/LightRAG-API-Server.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

