glean-sdk-patterns

Featured

Apply production-ready Glean API patterns with typed clients, batch indexing, pagination, and error handling. Trigger: "glean SDK patterns", "glean best practices", "glean API client".

AI & Automation 2,266 stars 315 forks Updated today MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Glean SDK Patterns ## Overview Production-ready patterns for the Glean enterprise search platform. Glean uses POST-based REST endpoints for both search and indexing. Search queries go to the Client API while document ingestion uses the Indexing API. A structured client centralizes token management, enforces batch pagination for bulk indexing, and provides typed responses for search results. ## Singleton Client ```typescript let _client: GleanClient | null = null; export function getClient(): GleanClient { if (!_client) { const domain = process.env.GLEAN_DOMAIN, key = process.env.GLEAN_API_KEY; if (!domain || !key) throw new Error('GLEAN_DOMAIN and GLEAN_API_KEY must be set'); _client = new GleanClient(domain, key); } return _client; } class GleanClient { private base: string; private h: Record<string, string>; constructor(domain: string, key: string) { this.base = `https://${domain}/api`; this.h = { 'Authorization': `Bearer ${key}`, 'Content-Type': 'application/json' }; } async search(query: string, opts: { pageSize?: number; datasource?: string } = {}) { const r = await fetch(`${this.base}/client/v1/search`, { method: 'POST', headers: { ...this.h, 'X-Glean-Auth-Type': 'BEARER' }, body: JSON.stringify({ query, pageSize: opts.pageSize ?? 20, requestOptions: opts.datasource ? { datasourceFilter: opts.datasource } : undefined }) }); if (!r.ok) throw new GleanError(r.status, await r.text()); return r.json() as Prom...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
7 months ago
Last Updated
today
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Featured

glean-hello-world

Index documents into Glean and search them back using the Indexing and Client APIs. Use when starting a new Glean custom connector, testing search quality, or learning the index/search pattern. Trigger: "glean hello world", "glean example", "glean index document", "glean search".

2,266 Updated today
jeremylongshore
AI & Automation Featured

glean-performance-tuning

Optimize Glean search relevance and indexing throughput with batch sizing, datasource configuration, and content quality improvements. Trigger: "glean performance", "glean search quality", "glean indexing speed".

2,266 Updated today
jeremylongshore
AI & Automation Featured

algolia-sdk-patterns

Apply production-ready algoliasearch v5 patterns: singleton client, typed search, error handling, and batch operations. Use when implementing Algolia integrations, refactoring SDK usage, or establishing team coding standards. Trigger: "algolia SDK patterns", "algolia best practices", "algolia code patterns", "idiomatic algolia".

2,266 Updated today
jeremylongshore
AI & Automation Featured

glean-core-workflow-a

Execute Glean primary workflow: search, chat, and AI-powered answers across enterprise data. Use when building search integrations, implementing Glean chat, or creating AI assistants. Trigger: "glean search API", "glean chat", "glean AI answers", "enterprise search".

2,266 Updated today
jeremylongshore
AI & Automation Featured

glean-security-basics

Token security: Indexing tokens have write access -- never expose in frontend. Trigger: "glean security basics", "security-basics".

2,266 Updated today
jeremylongshore