From glean-pack
Provides typed TypeScript client for Glean API with batch indexing, pagination, search, and error handling. Useful for production Glean integrations.
How this skill is triggered — by the user, by Claude, or both
Slash command
/glean-pack:glean-sdk-patternsThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
```typescript
class GleanClient {
private indexUrl: string;
private searchUrl: string;
constructor(private domain: string, private indexToken: string, private clientToken: string) {
this.indexUrl = `https://${domain}/api/index/v1`;
this.searchUrl = `https://${domain}/api/client/v1`;
}
async indexDocuments(datasource: string, docs: GleanDocument[]) {
const res = await fetch(`${this.indexUrl}/indexdocuments`, {
method: 'POST',
headers: { 'Authorization': `Bearer ${this.indexToken}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ datasource, documents: docs }),
});
if (!res.ok) throw new Error(`Glean index error ${res.status}: ${await res.text()}`);
return res.json();
}
async search(query: string, options: { pageSize?: number; datasource?: string } = {}) {
const res = await fetch(`${this.searchUrl}/search`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${this.clientToken}`,
'X-Glean-Auth-Type': 'BEARER',
'Content-Type': 'application/json',
},
body: JSON.stringify({
query,
pageSize: options.pageSize ?? 20,
requestOptions: options.datasource ? { datasourceFilter: options.datasource } : undefined,
}),
});
if (!res.ok) throw new Error(`Glean search error ${res.status}: ${await res.text()}`);
return res.json();
}
async bulkIndex(datasource: string, docs: GleanDocument[], batchSize = 100) {
const uploadId = `bulk-${Date.now()}`;
for (let i = 0; i < docs.length; i += batchSize) {
const batch = docs.slice(i, i + batchSize);
await fetch(`${this.indexUrl}/bulkindexdocuments`, {
method: 'POST',
headers: { 'Authorization': `Bearer ${this.indexToken}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
datasource, uploadId,
isFirstPage: i === 0,
isLastPage: i + batchSize >= docs.length,
documents: batch,
}),
});
}
}
}
interface GleanDocument {
id: string;
title: string;
url: string;
body: { mimeType: string; textContent: string };
author?: { email: string };
updatedAt?: string;
permissions?: { allowAnonymousAccess?: boolean; allowedUsers?: Array<{ email: string }> };
}
npx claudepluginhub jeremylongshore/claude-code-plugins-plus-skills --plugin glean-packIndexes documents into Glean custom datasources via Indexing API and searches using Client API. For building connectors, testing search quality, or learning patterns.
Searches and fetches Glean developer docs via MCP tools for APIs, SDKs (Python/JS), MCP config, authentication, indexing, and integrations.
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.