# local codegen workflow

> Generate production code with a local LLM on the GPU you already own. Spec-driven codegen via LM Studio/Ollama/vLLM, with auto model-loading, a 13-bug review checklist, and a working genfile script — all model-agnostic.

local codegen workflow is a free AI agent skill on Agensi by Postlethwaite Labs. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Postlethwaite Labs](https://www.agensi.io/creators/postlethwaite-labs)
- Uses: 4
- Version: 1.0
- Last updated: 2026-09-04
- Security: scan passed (2026-09-04); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/local-codegen-workflow
- Tags: codegen, local-llm, lm-studio, ollama, gpu, token-savings, spec-driven

## About this skill

### The problem

Paying per-token API costs for repetitive boilerplate and large-scale code generation is expensive. Local LLMs often fail during generation due to OOM errors because they are loaded with default context windows that exceed available VRAM.

### What it does

- Automates the spec-driven generation of production code using local LLM servers.
- Manages VRAM-safe model loading via LM Studio v1 REST API to prevent OOM "terminated" errors.
- Enforces a senior-level review checklist to catch common local model fumbles like connection leaks and empty-list SQL crashes.
- Implements a 2-strike rule to prevent time-wasting loops on low-quality generations.
- Generates both the implementation module and its corresponding test suite from a single source-of-truth spec.

### Frameworks & tools

Python 3.11, httpx, LM Studio, Ollama, vLLM, Qwen2.5-Coder, DeepSeek-Coder.

### Why this beats prompting it yourself

Standard prompting often results in code blocks wrapped in conversational prose that break automation scripts. This skill includes a specialized extraction layer and a model-management handshake that ensures the model is actually loaded at a stable context length before the first token is even generated.

### Use cases

- Generating large volumes of boilerplate for new microservices without incurring API fees.
- Prototyping internal tools where data privacy prevents sending code to third-party APIs.
- Setting up a repeatable generate-review-test-commit pipeline for junior-level tasks.

### Known limitations

Not recommended for surgical edits to existing complex files. Requires a GPU with at least 8GB VRAM for 7B models or 16GB for 14B models.

## Requires

- Python

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the local codegen workflow skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does this skill help reduce costs compared to using hosted API models?

This workflow provides a VRAM-aware interface for local servers like LM Studio and Ollama, allowing you to generate production-ready code locally without per-token API fees or Out-of-Memory (OOM) crashes.

### Which local LLM servers and AI agents are compatible with this workflow?

The skill is designed for any Python-based AI agent environment and works with any local LLM server that provides an OpenAI-compatible REST API, such as LM Studio, Ollama, or vLLM.

### What specific assets are included in this purchase?

You will receive the core genfile script, the VRAM-safe model-loading handshake logic, a 13-point automated senior review checklist, and a spec-to-source-of-truth template.

### What are the minimum hardware requirements to run this skill effectively?

For 7B models like Qwen2.5-Coder, you need at least 8GB of VRAM; for 14B models or larger, 16GB+ is recommended to ensure stable generation and adequate context windows.

### Can I use this to edit existing code files, or is it only for new code generation?

This skill is optimized for "Greenfield" generation (creating new modules and tests from specs) rather than surgical edits to existing legacy files, where context complexity often exceeds local model limits.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
