Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

local-delegate

A Claude Code skill that offloads large, mechanical code generation to a local LM Studio server, saving cloud tokens and wall-clock time when the would-be direct output is genuinely large.

The skill defines when delegation actually pays off, picks an appropriate local model, formats a self-contained task description, calls the local OpenAI-compatible endpoint via PowerShell, verifies the result, and falls back to writing the code directly if the local server is unavailable.

When this is useful (and when it isn't)

Use for large, mechanical, repetitive outputs:

  • Long fixture files (mock users, sample carts, seed data)
  • Comprehensive enums (HTTP status codes, ISO currencies, country codes)
  • Bulk type/model definitions (TypeScript types for entire APIs, Pydantic models from OpenAPI specs, many dataclasses)
  • Batches of parametrized test cases
  • CRUD scaffolds across many entities
  • Anything ≥80 lines of structurally repetitive content

Do NOT use for short snippets, one-liners, single regexes, small helpers, refactoring, debugging, architecture decisions, security-sensitive code (auth/crypto/payments), or anything iterative — write those directly.

The cost model is explained in detail in SKILL.md. The short version: each delegation costs ~6-10k cloud tokens of orchestration overhead, so it only pays off when the direct generation would have been larger than that.

Prerequisites

This skill assumes a fairly specific local setup. Without these, the skill is useless.

  • Windows with PowerShell available (the skill's call examples are PowerShell). Adaptable to macOS/Linux with bash + curl, but you'd need to rewrite the snippets.
  • LM Studio running with its server enabled on http://127.0.0.1:1234 (the default).
  • At least one of these models loaded (in order of preference for code):
    • qwen/qwen3-coder-next (default — code-tuned)
    • qwen/qwen3.6-35b-a3b (larger general)
    • google/gemma-4-e4b (tiny, fast)
  • Claude Code (or any host that loads ~/.claude/skills/).

Install

Pick one:

Option A — drop the SKILL.md in place

mkdir $HOME\.claude\skills\local-delegate
curl https://raw.githubusercontent.com/LaboratoriodeIA/local-delegate/main/SKILL.md `
  -o $HOME\.claude\skills\local-delegate\SKILL.md

Restart Claude Code (or start a new session). The skill is now available.

Option B — clone

git clone https://github.com/LaboratoriodeIA/local-delegate.git $HOME\.claude\skills\local-delegate

Option C — install the packaged bundle

The repo also ships local-delegate.skill, a zip bundle produced by Anthropic's skill-creator. Extract it into ~/.claude/skills/local-delegate/ so that SKILL.md lands at ~/.claude/skills/local-delegate/SKILL.md.

Repository layout

.
├── README.md                       # this file
├── SKILL.md                        # the skill itself — what Claude reads
├── local-delegate.skill            # packaged bundle (zip)
├── evals/
│   └── evals.json                  # test prompts used during development
└── benchmark/
    └── iteration-1/                # benchmark workspace
        ├── benchmark.json          # quantitative results
        ├── benchmark.md            # human-readable summary
        ├── review.html             # standalone HTML viewer for outputs
        ├── eval-1-csv-to-json-converter/
        ├── eval-2-snake-to-camel-regex/
        └── eval-3-pytest-scaffold-for-class/

Benchmark findings

This skill was developed iteratively using Anthropic's skill-creator workflow. The benchmark in benchmark/iteration-1/ ran 3 representative tasks both with the skill (delegating to the local model) and without (Claude writing the code directly). Highlights:

Metric With skill Without skill Delta
Pass rate 100% 100%
Wall-clock 340s avg 25s avg +315s
Cloud tokens 42,411 avg 35,359 avg +7,052

Both versions produced correct code. For tasks this size, delegation lost on both time and cloud tokens. That finding drove the skill's narrow targeting: it now refuses to delegate anything under ~80 lines and explicitly tells Claude that the orchestration overhead only pays off for genuinely large outputs.

Caveats:

  • Only one of the three test cases actually exercised the delegation path end-to-end. The other two hit a subagent tool-permission wall and used the skill's documented Step 5 fallback (write the code yourself when the endpoint is unreachable) — that fallback itself worked correctly, but the comparison numbers reflect skill+fallback overhead, not full delegation cost.
  • The 912s outlier in eval-1 included a 120s cold-load timeout on the first request to the model. Subsequent calls in the same session are much faster. The skill now includes a Step 2 "warm up the server" step to avoid paying this tax on the first real delegation.

Open benchmark/iteration-1/review.html in a browser to see the actual outputs side by side.

License

MIT — see LICENSE.

About

Claude Code skill that delegates large, mechanical code generation to a local LM Studio model

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages