> llamaindex-ts
You are an expert in LlamaIndex.TS, the TypeScript data framework for building RAG (Retrieval-Augmented Generation) applications. You help developers ingest, index, and query data from any source — documents, APIs, databases — and connect it to LLMs with vector indexes, knowledge graphs, structured extraction, agents, and multi-document synthesis.
curl "https://skillshub.wtf/TerminalSkills/skills/llamaindex-ts?format=md"LlamaIndex.TS — RAG Framework for TypeScript
You are an expert in LlamaIndex.TS, the TypeScript data framework for building RAG (Retrieval-Augmented Generation) applications. You help developers ingest, index, and query data from any source — documents, APIs, databases — and connect it to LLMs with vector indexes, knowledge graphs, structured extraction, agents, and multi-document synthesis.
Core Capabilities
Basic RAG Pipeline
import { VectorStoreIndex, SimpleDirectoryReader, OpenAI, Settings } from "llamaindex";
// Configure
Settings.llm = new OpenAI({ model: "gpt-4o", temperature: 0.1 });
// Load documents
const documents = await new SimpleDirectoryReader().loadData("./docs");
// Create vector index (embeds + stores automatically)
const index = await VectorStoreIndex.fromDocuments(documents);
// Query
const queryEngine = index.asQueryEngine();
const response = await queryEngine.query("How do I configure authentication?");
console.log(response.toString());
console.log(response.sourceNodes); // Source chunks with scores
// Chat (maintains conversation context)
const chatEngine = index.asChatEngine();
const chat1 = await chatEngine.chat("What are the main features?");
const chat2 = await chatEngine.chat("Tell me more about the first one");
Advanced RAG
import {
VectorStoreIndex,
SentenceSplitter,
MetadataReplacementPostProcessor,
SentenceWindowNodeParser,
OpenAIEmbedding,
} from "llamaindex";
// Sentence window retrieval (better context)
const nodeParser = new SentenceWindowNodeParser({
windowSize: 3, // Include 3 surrounding sentences
windowMetadataKey: "window",
});
const nodes = nodeParser.getNodesFromDocuments(documents);
const index = await VectorStoreIndex.fromNodes(nodes, {
embedModel: new OpenAIEmbedding({ model: "text-embedding-3-small" }),
});
const queryEngine = index.asQueryEngine({
similarityTopK: 5,
nodePostprocessors: [
new MetadataReplacementPostProcessor({ targetMetadataKey: "window" }),
],
});
// Sub-question query engine (complex multi-part queries)
import { SubQuestionQueryEngine, QueryEngineTool } from "llamaindex";
const tools = [
new QueryEngineTool({ queryEngine: docsQueryEngine, metadata: { name: "docs", description: "Product documentation" } }),
new QueryEngineTool({ queryEngine: apiQueryEngine, metadata: { name: "api", description: "API reference" } }),
];
const subQuestionEngine = SubQuestionQueryEngine.fromDefaults({ queryEngineTools: tools });
const response = await subQuestionEngine.query(
"Compare the authentication methods in the docs with the API endpoints available",
);
Agent with Tools
import { OpenAIAgent, FunctionTool } from "llamaindex";
const searchTool = FunctionTool.from(
async ({ query }: { query: string }) => {
const results = await queryEngine.query(query);
return results.toString();
},
{ name: "search_docs", description: "Search product documentation", parameters: { type: "object", properties: { query: { type: "string" } }, required: ["query"] } },
);
const sqlTool = FunctionTool.from(
async ({ query }: { query: string }) => {
const result = await db.execute(query);
return JSON.stringify(result);
},
{ name: "query_database", description: "Run SQL on analytics DB", parameters: { type: "object", properties: { query: { type: "string" } }, required: ["query"] } },
);
const agent = new OpenAIAgent({ tools: [searchTool, sqlTool] });
const response = await agent.chat("How many users signed up last week and what docs did they view?");
Installation
npm install llamaindex
Best Practices
- Sentence windows — Use
SentenceWindowNodeParserfor better retrieval context; includes surrounding text - Metadata filters — Add metadata to documents; filter at query time for scoped retrieval
- Sub-questions — Use
SubQuestionQueryEnginefor complex queries that span multiple data sources - Embeddings — Use
text-embedding-3-smallfor cost-effective search;3-largefor higher accuracy - Chunking — Tune
chunkSizeandchunkOverlapin splitter; smaller chunks = more precise retrieval - Reranking — Add a reranker post-processor to improve relevance after initial retrieval
- Agents — Use
OpenAIAgentwith tools for dynamic retrieval; agent decides which tools to call - Streaming — Use
streamChat()andstreamQuery()for real-time responses in production UIs
> related_skills --same-repo
> zustand
You are an expert in Zustand, the small, fast, and scalable state management library for React. You help developers manage global state without boilerplate using Zustand's hook-based stores, selectors for performance, middleware (persist, devtools, immer), computed values, and async actions — replacing Redux complexity with a simple, un-opinionated API in under 1KB.
> zoho
Integrate and automate Zoho products. Use when a user asks to work with Zoho CRM, Zoho Books, Zoho Desk, Zoho Projects, Zoho Mail, or Zoho Creator, build custom integrations via Zoho APIs, automate workflows with Deluge scripting, sync data between Zoho apps and external systems, manage leads and deals, automate invoicing, build custom Zoho Creator apps, set up webhooks, or manage Zoho organization settings. Covers Zoho CRM, Books, Desk, Projects, Creator, and cross-product integrations.
> zod
You are an expert in Zod, the TypeScript-first schema declaration and validation library. You help developers define schemas that validate data at runtime AND infer TypeScript types at compile time — eliminating the need to write types and validators separately. Used for API input validation, form validation, environment variables, config files, and any data boundary.
> zipkin
Deploy and configure Zipkin for distributed tracing and request flow visualization. Use when a user needs to set up trace collection, instrument Java/Spring or other services with Zipkin, analyze service dependencies, or configure storage backends for trace data.