/prototyping:claude-in-htmlfrom Prototyping
Enables calling LLMs directly from HTML prototypes using the Anthropic SDK in the browser. Useful for building live AI features like chat, summarization, and classification in prototypes.
Ships in Prototyping. 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.
Прототип может вызвать модель напрямую из браузера через Anthropic SDK или fetch к своему бэку. В Claude Code пользователь сам управляет ключом.
<script type="module">
import Anthropic from "https://esm.sh/@anthropic-ai/sdk";
// Один раз — спросить и сохранить ключ.
let key = localStorage.getItem('anthropic_key');
if (!key) {
key = prompt('Anthropic API key (sk-ant-...) — сохранится локально');
if (key) localStorage.setItem('anthropic_key', key);
}
const client = new Anthropic({ apiKey: key, dangerouslyAllowBrowser: true });
window.askClaude = async function (userText) {
const r = await client.messages.create({
model: 'claude-haiku-4-5',
max_tokens: 512,
messages: [{ role: 'user', content: userText }],
});
return r.content[0].text;
};
</script>
const stream = await client.messages.stream({
model: 'claude-haiku-4-5',
max_tokens: 1024,
messages: history,
});
for await (const event of stream) {
if (event.type === 'content_block_delta') {
chatBox.append(event.delta.text);
}
}
Когда прототип симулирует продуктовую фичу — задай system, объясняющий, что это.
client.messages.create({
model: 'claude-haiku-4-5',
max_tokens: 256,
system: 'Ты — помощник в приложении доставки еды. Отвечай коротко, на русском, без эмодзи.',
messages: [...]
});
Не спрашивай через prompt() каждый раз. Сделай нормальный onboarding-экран:
Всегда имей фолбэк, если ключа нет или запрос упал:
window.askClaude = async function (userText) {
try {
if (!localStorage.getItem('anthropic_key')) return mockResponse(userText);
// ... real call
} catch (e) {
console.warn('Claude недоступен, fallback', e);
return mockResponse(userText);
}
};
function mockResponse(text) {
return `[mock] я бы ответил на: "${text.slice(0, 60)}..."`;
}
dangerouslyAllowBrowser: true означает, что ключ светится в браузере. Это только для локальных прототипов.Если у пользователя есть бэкенд, лучший паттерн — свой endpoint, который проксирует запрос с серверным ключом. Браузер дёргает /api/claude, бэк делает реальный вызов. Безопаснее, но требует разворачивания. Для большинства локальных прототипов overkill.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
12 skills in this plugin
/canvas-designОригинальный визуальный арт в PNG/PDF: постеры, обложки, композиции. Триггеры: «сделай постер», «нарисуй обложку». НЕ сравнение макетов → design-canvas./component-playgroundStorybook-подобная страница: все компоненты дизайн-системы во всех вариантах, контролы пропсов. Триггеры: «storybook страница», «all states UI»./design-canvasN вариантов дизайна бок-о-бок в одном HTML: pan/zoom, фокус. Триггеры: «сравни 3 версии», «покажи варианты». НЕ постеры/арт → canvas-design.npx claudepluginhub jhamidun/claude-code-config-pack --plugin prototypingOther plugins' skills for the same job