Sdk Methods logo

Sdk Methods

OrganizationPopular
live-codes
sdk-methods

Use SDK methods to interact with playgrounds: run, getCode, setConfig, getConfig, watch, runTests, format, getShareUrl, show, destroy. Load this skill when programmatically controlling embedded playgrounds, reacting to code changes, or retrieving compiled output.

Overview

Publisherlive-codes
Repositorylivecodes
Skill namesdk-methods
Stars
1.5K
Forks
271
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by live-codes on GitHub. Read the source before you install it.

Installation

Install the Sdk Methods AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/live-codes/livecodes/tree/develop/.agents/skills/livecodes/sdk-methods
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/live-codes/livecodes.git /tmp/livecodes
mkdir -p .claude/skills
cp -r /tmp/livecodes/.agents/skills/livecodes/sdk-methods .claude/skills/sdk-methods
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Sdk Methods in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Sdk Methods on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Sdk Methods is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

This skill builds on sdk-embedding. Read it first for foundational concepts.

LiveCodes — Use SDK Methods

The Playground object returned by createPlayground exposes methods to programmatically control the playground.

Setup

javascript
import { createPlayground } from 'livecodes';

const playground = await createPlayground('#container', {
  template: 'react',
});

// All SDK methods return Promises
await playground.run();
const code = await playground.getCode();
await playground.setConfig({
  /* new config */
});

Core Patterns

Run the playground

javascript
// Run the result page (after any needed compilation)
await playground.run();

Get current code and config

javascript
// Get code from all editors
const code = await playground.getCode();
console.log(code.markup.content); // Source markup
console.log(code.markup.language); // Language name
console.log(code.markup.compiled); // Compiled output (if applicable)
console.log(code.result); // Result page HTML

// Get configuration object
const config = await playground.getConfig();
console.log(config.title);
console.log(config.markup.language);

// Get content-only config (without user preferences)
const contentConfig = await playground.getConfig(true);

Update playground configuration

javascript
// Load new project in place (no full reload)
await playground.setConfig({
  markup: { language: 'markdown', content: '# New Content' },
});

// Get the resulting config
const newConfig = await playground.setConfig({
  script: { language: 'typescript', content: 'const x: number = 1;' },
});

Watch for changes

javascript
// Watch for code changes
const codeWatcher = playground.watch('code', ({ code, config }) => {
  console.log('Code changed:', code.script.content);
});

// Watch for code execution
const runWatcher = playground.watch('run', ({ code, config }) => {
  console.log('Playground ran. Result HTML:', code.result);
});

// Watch for console output
const consoleWatcher = playground.watch('console', ({ method, args }) => {
  console[method](...args);
});

// Watch for test results
const testsWatcher = playground.watch('tests', ({ results, error }) => {
  results.forEach((r) => console.log(r.status, r.testPath));
});

// Remove watchers when done
codeWatcher.remove();
runWatcher.remove();
consoleWatcher.remove();
testsWatcher.remove();

Run tests programmatically

javascript
const { results } = await playground.runTests();
results.forEach((result) => {
  console.log(result.status); // 'pass', 'fail', or 'skip'
  console.log(result.errors); // Array of error strings
  console.log(result.testPath); // ['describe', 'it']
});

Show specific panel

javascript
// Show editors
await playground.show('editor'); // Active editor
await playground.show('markup'); // Markup editor
await playground.show('style'); // Style editor
await playground.show('script'); // Script editor

// Show tools
await playground.show('console'); // Console panel
await playground.show('compiled'); // Compiled code viewer
await playground.show('tests'); // Tests panel

// Show result
await playground.show('result'); // Result page
await playground.show('toggle-result'); // Toggle result visibility

// With options
await playground.show('result', { full: true }); // Full screen
await playground.show('result', { zoom: 0.5 }); // 50% zoom
await playground.show('script', { line: 10, column: 5 }); // Scroll to line

Format code

javascript
// Format all editors
await playground.format();

// Format only active editor
await playground.format(false);

Get share URL

javascript
// Long URL with compressed config
const longUrl = await playground.getShareUrl();

// Short URL (requires share service)
const shortUrl = await playground.getShareUrl(true);

Execute custom commands

javascript
// Set broadcast token
await playground.exec('setBroadcastToken', 'my-token');

// Show version info
await playground.exec('showVersion');

Destroy playground

javascript
await playground.destroy();
// Playground removed from DOM, all event listeners cleaned up

Common Mistakes

HIGH Not awaiting async SDK methods

Wrong:

javascript
const playground = await createPlayground('#container', {});
const code = playground.getCode(); // Returns Promise, not code
console.log(code); // Promise { <pending> }

Correct:

javascript
const playground = await createPlayground('#container', {});
const code = await playground.getCode(); // Await the Promise
console.log(code.markup.content);

All SDK methods return Promises. Use await or .then() to get the result.

Source: docs/docs/sdk/js-ts.mdx — SDK methods section

MEDIUM watch callback receives wrong data structure

Wrong:

javascript
playground.watch('code', (data) => {
  console.log(data.content); // Undefined
});

Correct:

javascript
// 'code' event provides { code, config }
playground.watch('code', ({ code, config }) => {
  console.log(code.markup.content);
  console.log(code.style.content);
  console.log(code.script.content);
  console.log(code.result); // Result page HTML
});

// 'run' event provides { code, config }
playground.watch('run', ({ code, config }) => {
  console.log(code.result); // Result page HTML
});

// 'console' event provides { method, args }
playground.watch('console', ({ method, args }) => {
  console[method](...args);
});

// 'tests' event provides { results, error? }
playground.watch('tests', ({ results, error }) => {
  if (error) console.error(error);
  results.forEach((r) => console.log(r.status));
});

Source: docs/docs/sdk/js-ts.mdx — watch method section

LOW Using deprecated onChange instead of watch

Wrong:

javascript
// Deprecated method
const watcher = playground.onChange(({ code, config }) => {
  console.log('changed');
});

Correct:

javascript
// Use watch instead
const watcher = playground.watch('code', ({ code, config }) => {
  console.log('changed');
});
watcher.remove(); // When done watching

onChange is deprecated. Use watch('code', callback) instead.

Source: src/sdk/index.ts — onChange marked as deprecated

SDK Method Reference

MethodReturnsDescription
load()Promise<void>Load playground (for click-to-load mode)
run()Promise<void>Run the result page
format(allEditors?)Promise<void>Format code
getShareUrl(shortUrl?)Promise<string>Get shareable URL
getConfig(contentOnly?)Promise<Config>Get configuration
setConfig(config)Promise<Config>Update configuration
getCode()Promise<Code>Get code from all editors
show(panel, options?)Promise<void>Show specific panel
runTests()Promise<{results}>Run tests
watch(event, fn){remove()}Subscribe to events
exec(command, ...args)Promise<any>Execute custom command
destroy()Promise<void>Clean up and remove

Frequently asked questions

What does the Sdk Methods AI skill do?

Use SDK methods to interact with playgrounds: run, getCode, setConfig, getConfig, watch, runTests, format, getShareUrl, show, destroy. Load this skill when programmatically controlling embedded playgrounds, reacting to code changes, or retrieving compiled output.

Why use Sdk Methods on TypingMind?

Because you install it once and use it with any model. Sdk Methods is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Sdk Methods in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/live-codes/livecodes/tree/develop/.agents/skills/livecodes/sdk-methods. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Sdk Methods?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Sdk Methods?

As many as you like. As long as a model supports skills, you can use Sdk Methods with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Sdk Methods AI skill free?

Yes. It is published on GitHub by live-codes under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇