Making Lightweight Models Work in Coding Agents: From a Poor First Experience to Custom Skills

    Many developers find that fast, low-cost lightweight models feel unreliable inside coding agents: short answers, skipped logic, and tasks that drift halfway through. This article argues that the gap usually comes from mismatched workflows rather than the model itself, and shows how to study existing novel-writing skills, rebuild them as small explicit steps with external state, and evaluate them inside an agent.

    Why Lightweight Models Feel Hard to Use in Coding Agents

    Many developers have the same experience. After connecting a fast, low-cost lightweight model to a coding agent, the first reaction is often that the model is simply not good enough: answers are short, reasoning jumps, and a task drifts off course halfway through. A closer look usually shows that the problem is not the model alone. It shows up at three levels.

    1. Task size does not match model capability

    Coding agents are built for general tasks by default. Their built-in prompts, tool-calling protocols, and context-management strategies often assume strong instruction following and the ability to integrate a long context. Lightweight models are naturally weaker in those areas. Applying a heavy-model workflow unchanged produces weak results.

    2. The task lacks a domain-specific description

    Take “AI writes a novel” as an example. If you only say “write a chapter of a fantasy novel,” output quality is almost certain to be unstable. Novel writing is highly structured: worldbuilding, character arcs, plot pacing, and stylistic consistency each need explicit constraints and guidance. A generic prompt does not supply them.

    3. The skill mechanism is not used as an external capability

    Mainstream coding agents generally support a skill mechanism: a predefined set of prompt templates, workflow instructions, and examples that turn a vague task into step-by-step instructions the model can execute. Many people underestimate it. In practice, a skill attaches domain knowledge and an execution process to the model, which is exactly what compensates for weaker reasoning in a lightweight model.

    The conclusion is that a model that feels hard to use is often being used the wrong way. The better path is to analyze how strong skills are designed, then build a skill for the specific task.

    A Practical Path: Building a Novel-Generation Skill in Three Steps

    The target task below is automatic web-novel generation. The skill-building process breaks down as follows.

    Step 1: Collect existing skills and extract shared logic

    Open-source communities include a number of “AI writes a novel” skill implementations. Do not copy them immediately. Take each one apart and answer three questions:

    • Which stages does it split the task into? A typical split is: worldbuilding, character profiles, outline planning, chapter outlines, draft generation, and consistency checks.
    • How does it keep a long work consistent? Common methods include character sheets, state-tracking files, and injecting a summary of prior text before each chapter is generated.
    • What output examples does it give the model? High-quality skills almost always include few-shot examples that lock style, point of view, and pacing.

    Abstracting those shared patterns produces a knowledge base for skill design.

    Step 2: Rebuild the skill for the target model

    Lightweight models are weak at long reasoning chains and at understanding implicit instructions. The design principle for the new skill is therefore to make every step small, explicit, and checkable.

    A directory layout suited to a lightweight model looks roughly like this:

    1. novel-skill/
    2. ├── SKILL.md # Skill entry: task description and process overview
    3. ├── workflow.md # Staged execution flow and trigger conditions
    4. ├── templates/
    5. │ ├── worldview.md # Worldbuilding template
    6. │ ├── character.md # Character profile template
    7. │ ├── outline.md # Volume and chapter outline template
    8. │ └── chapter.md # Chapter outline and draft-generation template
    9. ├── examples/
    10. │ └── sample.md # Style examples (few-shot)
    11. └── state/
    12. └── progress.json # Plot progress and foreshadowing state (read and written by tools)

    Several design points matter:

    Make the process explicit. Do not let the model decide what to do next. In workflow.md, write a fixed order and the inputs and outputs of each step. For example: before generating chapter N, the model must read state/progress.json and output this chapter’s detailed outline; only after that outline is confirmed does it write the draft.

    Keep state outside the model. Long-context memory in a lightweight model is unreliable. Write foreshadowing, character relationships, and events that have already happened into structured files, and inject them on every generation. That is more stable than relying on the model to remember earlier text.

    Minimize each call. Each invocation should ask the model to do one action, such as “write a 2,000-word draft from this outline,” with clear constraints on length, point of view, and forbidden wording. The smaller the task, the closer a lightweight model’s output quality gets to that of a heavier model.

    Step 3: Load the skill into the coding agent and iterate

    Place the skill directory on the agent’s skill-loading path so a natural-language request can trigger it in a working session. Finishing the build is not the end. You need an evaluation loop:

    1. Run the full process against a fixed set of three to five test setups, and record coherence, character consistency, and style match for each chapter.
    2. For failed samples, revise template wording or add examples. Most fixes come from writing an implicit expectation as an explicit rule.
    3. Keep a change log so that fixing one place does not silently break another.

    General Lessons

    • Layer the prompts. Put global rules, such as style and taboos, in skill-level files. Inject chapter-level constraints, such as this chapter’s goal and which characters appear, on each call, so a single prompt does not grow too long.
    • Prefer structured output. Have the model emit a chapter outline as JSON before writing the draft. Intermediate artifacts can be checked and edited by a person, which raises fault tolerance.
    • Use general cloud supporting services where they help. If the text needs team collaboration or long-term archiving, general object storage, document management, and version control can turn the generation flow into an engineering process.
    • Think in cost and throughput. A lightweight model is cheap and fast per call. With a carefully split workflow, it can often deliver roughly an order-of-magnitude gain in throughput while quality remains good enough. That is the value of skill design.

    Summary

    “The model is hard to use” is usually a signal that the current task design does not match the model’s capability. By extracting the shared logic of mature skills, building an explicit small-step process for a lightweight model, and using structured state files to cover weak memory, developers can tune an ordinary model into a reliable production tool for a specific domain. The same method applies beyond novel writing to any task whose process can be made explicit, including report generation, test-case writing, and data cleaning.