agentsclimarketplace

Local delegate

Skill LaboratoriodeIA/local-delegate

Use this skill for generating LARGE, mechanical, repetitive code or data 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 for many entities, or any output that is ≥80 lines of structurally repetitive content. Triggers on requests like "generate a fixture with N records", "list every X as an enum", "write types for the entire Y API", "create N mock entries", or anything where the volume itself is the work. Offloads to a local LM Studio model on 127.0.0.1:1234 to save cloud tokens and time. Do NOT use for short snippets (under 80 lines), one-liners, single regexes, small helpers, refactoring, debugging, architecture decisions, security-sensitive code (auth/crypto/payments), or iterative back-and-forth — write those directly.From its SKILL.md

Install
npx -y skills add LaboratoriodeIA/local-delegate

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

10.3 KB, ~2.4k tokens by cl100k_base, as published. Nobody here has run it

Local delegation via LM Studio

You have a local LM Studio server on http://127.0.0.1:1234 exposing an OpenAI-compatible API. This skill is for the narrow case where offloading a large mechanical generation actually saves cloud tokens and wall-clock time.

The cost model — read this first

Delegation is not free in cloud tokens. Each delegation costs you, in your main session:

  • Reading this SKILL.md (~2k tokens)
  • Drafting a self-contained task description (~500-1k tokens)
  • Tool call to LM Studio (small)
  • Reading the returned code and verifying it (~1-3k tokens depending on size)

That's roughly 6-10k cloud tokens of orchestration overhead per delegation.

It only pays off when the code you would have generated directly is itself large enough that delegation saves more than that. In practice this means:

  • Direct generation cost ≈ output_lines × ~10 tokens/line + reasoning overhead.
  • A 30-line snippet you'd produce in ~5 seconds = roughly 300 tokens of output. Delegation overhead (6-10k) dwarfs that. You lose badly.
  • An 80-line generation = ~800 tokens — still loses.
  • A 200-line generation = ~2000 tokens — still probably loses on tokens, but may win on latency if the local model is fast and warm.
  • A 500-line batch of structurally similar items (fixtures, parametrized cases, CRUD across 10 entities) = ~5000+ tokens of output — this is where delegation starts to actually win.

Heuristic: if you can predict you'd write the answer in under ~80 lines of straightforward code, do not delegate. Just write it.

When to delegate (a tight bar)

Delegate when all of these are true:

  1. The output is large or highly repetitive. Concretely: you expect ≥80 lines of code, OR you're generating ≥10 structurally similar items (fixtures, parametrized cases, near-identical endpoints, fixture data).
  2. The task is fully self-contained. You can specify it in one paragraph without referencing files, prior conversation, project conventions, or tools.
  3. No reasoning is required during generation. It's pattern-application, not problem-solving. A small/medium open model can plausibly get it right.
  4. Correctness is not security-critical (auth, crypto, payments, RBAC, trust-boundary validation). Those need your judgment.

Bail out and write it yourself when:

  • The task is small (most tasks). Almost always cheaper and faster.
  • It needs to match project conventions you can only learn by reading files.
  • Multi-step reasoning, debugging, or refactoring is involved.
  • The user is iterating with you turn-by-turn — orchestration overhead is worse than just writing it.

If in doubt, write it yourself. The skill is for clear-cut large mechanical generations, not a default reflex.

Step 1: Pick the model

Three useful models are loaded. Pick by task profile:

Model idSizeBest forTradeoff
google/gemma-4-e4b~4BBulk-trivial transforms across many items, simple repeated patternsFastest. Weaker on anything non-obvious.
qwen/qwen3-coder-nextcode-tunedDefault for actual code: large scaffolds, batches of functions/tests, parsersGood code quality, moderate speed.
qwen/qwen3.6-35b-a3b~35B (MoE)Trickier-but-still-mechanical: nested data transforms, edge-case-heavy regex, harder algorithmic snippetsSlowest. Use only when Qwen-Coder is likely insufficient.

Default to qwen/qwen3-coder-next for code. Drop to gemma only when the items are individually trivial and the volume is what justifies delegation. Step up to qwen3.6 only when you have a concrete reason (e.g., a previous attempt with Qwen-Coder produced wrong output).

Fallback chain: if the first model returns something wrong/empty, retry once with the next-larger model. If that also fails, abandon delegation and write the code yourself — don't burn more roundtrips.

Step 2: Warm the server (first delegation per session only)

The first request to a JIT-loaded model can take 90-120s while LM Studio loads weights. This will likely timeout at the default -TimeoutSec 120 and forces a retry, wasting wall-clock time. Before your first real delegation in a session, send a tiny warm-up request:

$warmup = @{
  model       = 'qwen/qwen3-coder-next'   # whichever model you plan to use
  messages    = @(@{ role = 'user'; content = 'ping' })
  max_tokens  = 1
  temperature = 0.0
} | ConvertTo-Json -Depth 5

Invoke-RestMethod -Uri 'http://127.0.0.1:1234/v1/chat/completions' `
  -Method Post -Body $warmup -ContentType 'application/json' -TimeoutSec 180 | Out-Null

After this completes (even if it returns a single token), the model is resident in memory and subsequent calls will be fast. Skip this step if you already warmed the same model earlier in the session.

Step 3: Write a self-contained task description

This is the single most important part. The local model has no access to your project, conversation, or tools. Your task description must include:

  1. Language and runtime (e.g., "Python 3.11", "TypeScript with strict mode").
  2. Exact input shape, with a small example if non-obvious.
  3. Exact output shape, with a small example.
  4. Constraints: dependencies allowed, style (e.g., "no external libs"), and any edge cases that matter.
  5. What "done" looks like: usually "return only the code, in one fenced block, no prose".

Example: bad vs good task description

Bad (vague, references missing context):

Write a function to clean up the user data like we discussed.

Good (self-contained, complete):

Python 3.11. Generate a pytest file with 40 parametrized test cases for a parse_iso_datetime(s: str) -> datetime function. Inputs are valid ISO 8601 strings including: dates (2024-01-15), datetimes with/without timezone (2024-01-15T10:30:00, …+02:00, …Z), fractional seconds, and edge cases (leap day, year boundary, BC dates with year 0001). For each case the test should assert the parsed datetime equals an expected datetime(...) literal. Use @pytest.mark.parametrize with (input, expected) tuples. No external libs beyond pytest and stdlib datetime. Return only the test file in one fenced code block.

Step 4: Call the endpoint

Use the PowerShell tool (you're on Windows). Use a here-string to avoid quoting hell with multi-line task descriptions:

$task = @'
<your full self-contained task description here>
'@

$body = @{
  model       = 'qwen/qwen3-coder-next'   # or another id from the table above
  messages    = @(
    @{ role = 'system'; content = 'You are a code generator. Reply with code only, inside a single fenced code block. No prose, no explanation.' },
    @{ role = 'user';   content = $task }
  )
  max_tokens  = 4000
  temperature = 0.1
} | ConvertTo-Json -Depth 5

$response = Invoke-RestMethod -Uri 'http://127.0.0.1:1234/v1/chat/completions' `
  -Method Post -Body $body -ContentType 'application/json' -TimeoutSec 180

$response.choices[0].message.content

Tuning:

  • temperature = 0.1 keeps the output deterministic. Bump to 0.4 only if you want stylistic variation (rare for mechanical code).
  • max_tokens = 4000 fits most large snippets. Raise to 8000 for very verbose outputs; if you need more than that, the task is probably too big for one delegation and should be split.
  • -TimeoutSec 180 covers cold-load delays if you skipped the warm-up.

Step 5: Extract and verify the result

The model returns a fenced block. Extract the code (strip the language and trailing fences) before showing/saving it. Then verify before using:

  • Read the snippet — does it actually solve the task you described?
  • If it's runnable in isolation (e.g., a pure function), run a quick spot-check via PowerShell or Bash on one obvious case. One quick check beats trust.
  • If it imports something exotic or references undefined names, treat that as a failure: either retry with a larger model, or write it yourself.

Never paste the model's output into the user's project unread. The local model has no awareness of your conventions, types, or filenames.

Step 6: Error handling

SymptomWhat to do
Invoke-RestMethod connection refusedLM Studio isn't running. Tell the user, don't silently fail.
404 on /v1/chat/completionsAPI endpoint disabled in LM Studio settings. Tell the user.
HTTP 400 with "model not found"Query GET /v1/models and use a returned id.
Empty choices or empty contentRetry once with the next-larger model. Then give up and write it yourself.
Timeout (>180s)Cold load wasn't completed. Either do the warm-up step and retry, or give up and write it yourself.
Permission denied on PowerShell/Bash toolYou can't reach the endpoint from this context. Write the code yourself and mention delegation wasn't available.

If the user is mid-flow and the endpoint is dead, don't block them while diagnosing the local server. Just write the code yourself and mention that delegation wasn't available.

Quick sanity check

Before deciding to delegate, you can verify the server is up:

(Invoke-RestMethod -Uri 'http://127.0.0.1:1234/v1/models' -TimeoutSec 5).data |
  Select-Object id

If that returns model ids, you're good. If it errors, skip delegation for this session.

What ships with it: 37 files

146.5 KB alongside SKILL.md, 6 of them executable

benchmark/

evals/

Keep looking

Skills are one crate of 326,851. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.