/glean-pack:glean-hello-worldfrom glean-pack
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.
Ships in glean-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Index documents into Glean and search them. Two steps: set up a custom datasource with the Indexing API, then query with the Client API.
const GLEAN = `https://${process.env.GLEAN_DOMAIN}/api`;
const idxHeaders = {
'Authorization': `Bearer ${process.env.GLEAN_INDEXING_TOKEN}`,
'Content-Type': 'application/json',
};
// Create or configure a custom datasource
await fetch(`${GLEAN}/index/v1/adddatasource`, {
method: 'POST', headers: idxHeaders,
body: JSON.stringify({
name: 'my_wiki',
displayName: 'Internal Wiki',
datasourceCategory: 'PUBLISHED_CONTENT',
urlRegex: 'https://wiki.company.com/.*',
iconUrl: 'https://wiki.company.com/favicon.ico',
}),
});
// Index individual documents
await fetch(`${GLEAN}/index/v1/indexdocuments`, {
method: 'POST', headers: idxHeaders,
body: JSON.stringify({
datasource: 'my_wiki',
documents: [{
id: 'doc-001',
title: 'Getting Started Guide',
url: 'https://wiki.company.com/getting-started',
body: { mimeType: 'text/plain', textContent: 'This guide covers onboarding steps...' },
author: { email: '[email protected]' },
updatedAt: new Date().toISOString(),
permissions: { allowAnonymousAccess: true },
}],
}),
});
console.log('Document indexed.');
const searchHeaders = {
'Authorization': `Bearer ${process.env.GLEAN_CLIENT_TOKEN}`,
'X-Glean-Auth-Type': 'BEARER',
'Content-Type': 'application/json',
};
const results = await fetch(`${GLEAN}/client/v1/search`, {
method: 'POST', headers: searchHeaders,
body: JSON.stringify({
query: 'onboarding getting started',
pageSize: 10,
requestOptions: { datasourceFilter: 'my_wiki' },
}),
}).then(r => r.json());
results.results?.forEach((r: any) => {
console.log(`${r.title} (${r.url}) — score: ${r.score}`);
});
Document indexed.
Getting Started Guide (https://wiki.company.com/getting-started) — score: 0.95
| Error | Cause | Solution |
|---|---|---|
datasource not found | Datasource not created | Run adddatasource first |
| No search results | Indexing not yet complete | Wait 1-2 minutes for processing |
invalid document | Missing required fields | Include id, title, url |
Proceed to glean-local-dev-loop for development workflow setup.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
glean, enterprise-search, custom-connector, indexing-api, search-api
npx claudepluginhub flight505/skill-forge --plugin glean-pack24 skills in this plugin
/glean-ci-integrationCI/CD for Glean connectors with automated indexing tests and search quality validation.
Trigger: "glean CI", "glean GitHub Actions", "glean connector CI/CD".
/glean-common-errorsDiagnose and fix common Glean API errors including indexing failures, search issues, and permission problems.
Trigger: "glean error", "glean not indexing", "glean search empty", "debug glean".
/glean-core-workflow-aExecute 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".
/glean-core-workflow-bExecute Glean secondary workflow: bulk document indexing, custom datasource connectors,
and content lifecycle management via the Indexing API.
Trigger: "glean bulk index", "glean custom connector", "glean datasource", "glean indexing".
/glean-cost-tuningOptimize Glean costs by managing indexed content volume, datasource efficiency,
and connector resource usage.
Trigger: "glean costs", "glean optimization", "reduce glean indexing".
/glean-data-handlingPII filtering: strip emails, phone numbers, SSNs from document body before indexing.
Trigger: "glean data handling", "data-handling".
Other plugins' skills for the same job