build-integration
БесплатноБез исполняемых скриптовНе проверенBuild, develop, and publish GitBook integrations — apps that run inside GitBook to add custom blocks, react to events, connect external services via OAuth…
от GitbookIO★ 27 звёзд на GitHubОб этом скилле
Build a GitBook Integration
A skill for building integrations on GitBook's developer platform: apps that run inside GitBook itself. An integration can render custom blocks in the editor, show configuration UI, listen to events (content updated, Git sync completed, space viewed), authenticate against external services with OAuth, and talk to anything over HTTP.
This skill covers the integration lifecycle — scaffold, code, develop, publish. For creating or restructuring the docs site an integration might be installed into, defer to configure-site; for authoring page content, defer to write-docs.
What an integration is (mental model)
An integration is a small TypeScript app executed by GitBook's runtime — not a script injected into pages, and not code running on the user's server. Three consequences shape everything else:
- Rendering happens on GitBook's backend. Your component's
renderfunction runs server-side on every interaction and returns ContentKit markup (a JSX-like UI description). There is no client-side React tree you control, no DOM access, and UI updates flow through the action → new state → re-render loop. - You cannot inject JavaScript into a site. The
site:script:injectandsite:script:cookiesscopes you'll see in GitBook-owned integrations are internal-only. If the user's plan amounts to "add a script tag to their docs", stop and say so early — the supported paths are custom blocks, webframes, and events. - Local development is a proxy, not a server you visit.
gitbook integration devroutes the installed integration's traffic to your machine. You never open the dev server's port in a browser; you interact with the integration inside app.gitbook.com.
The project
gitbook integration new scaffolds this shape:
my-integration/
├── gitbook-manifest.yaml # identity, scopes, blocks, configuration schema
├── .gitbook-dev.yaml # local dev config (generated by `gitbook integration dev`)
├── package.json
└── src/
└── index.tsx # entry file — default-exports createIntegration()
The entry file (whatever script: in the manifest points to) default-exports createIntegration({ fetch, components, events }):
import { createIntegration, createComponent } from '@gitbook/runtime';
const helloBlock = createComponent({
componentId: 'hello-world', // must match a block id in the manifest
initialState: { message: 'Say hello!' },
action: async (element, action, context) => {
switch (action.action) {
case 'say':
return { state: { message: 'Hello world' } };
default:
return {};
}
},
render: async (element, context) => (
<block>
<button label={element.state.message} onPress={{ action: 'say' }} />
</block>
),
});
export default createIntegration({
components: [helloBlock],
events: {
space_content_updated: async (event, context) => {
// react to content changes
},
},
});
A custom block only appears in the editor's insert palette (⌘ + /) if it is declared in both places: createComponent in the code and a blocks: entry in the manifest whose id matches the componentId. Forgetting one half is the most common "my block doesn't show up" cause.
The manifest, briefly
gitbook-manifest.yaml is the integration's identity and permission grant. Required: name (globally unique across all of GitBook — pick something namespaced like acme-changelog, not test), title, description, organization (org id or subdomain), visibility, scopes, and script. Request only the scopes the code actually uses — installers see them.
The manifest also declares blocks, installer-facing configurations (account-level and site-level property schemas rendered as a settings form), and secrets (e.g. CLIENT_ID: ${{ env.CLIENT_ID }}, loaded at publish time — use dotenv-cli so gitbook integration publish sees your .env).
Full field-by-field schema, scope list, and configuration property types: references/manifest.md. Read it whenever you're editing the manifest beyond the basics.
The development loop
The loop has a non-obvious order — publish comes before local development:
- Prerequisites. Node 18+, a personal access token from https://app.gitbook.com/account/developer, and the CLI:
npm install @gitbook/cli -g, then authenticate withgitbook auth --token <token>(orgitbook authto be prompted). Use a token, notgitbook login: browser (OAuth) sign-in can't publish or unpublish integrations and doesn't work in CI, SSH, or agent sandboxes. If you already rangitbook login, rungitbook logoutfirst. The CLI also reads aGITBOOK_TOKENenvironment variable. If a token needs to be pasted into the conversation, export it to the environment and never echo it back or commit it. - Scaffold.
gitbook integration new [dir]
Установить build-integration в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл build-integration?
Build, develop, and publish GitBook integrations — apps that run inside GitBook to add custom blocks, react to events, connect external services via OAuth, and extend the editor. Use this skill whenever a task involves the GitBook integrations platform: scaffolding an integration with the GitBook CLI (`gitbook integration new`), writing or editing an integration's code (`createIntegration`, `createComponent`, ContentKit TSX), configuring `gitbook-manifest.yaml` (scopes, blocks, configurations, secrets), building custom editor blocks or link unfurlers, handling GitBook events like `space_content_updated`, setting up an integration's OAuth flow, running `gitbook integration dev`, or publishing an integration (private/unlisted/public, marketplace submission). Trigger this even if the user just says they want to 'build an app for GitBook', 'add a custom block', or 'connect <some tool> to GitBook' without saying the word 'integration'.
Как установить скилл build-integration?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл build-integration запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic