<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Context Engineering on Roland Huß</title><link>https://ro14nd.de/tags/context-engineering/</link><description>Recent content in Context Engineering on Roland Huß</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>© 2026 Roland Huß</copyright><lastBuildDate>Sat, 18 Apr 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://ro14nd.de/tags/context-engineering/index.xml" rel="self" type="application/rss+xml"/><item><title>Context engineering 101</title><link>https://ro14nd.de/context-engineering-101/</link><pubDate>Sat, 18 Apr 2026 00:00:00 +0000</pubDate><guid>https://ro14nd.de/context-engineering-101/</guid><description>&lt;p&gt;Everybody talks about prompt engineering. Write better prompts, get better results. That framing was useful once, but it misses the point for coding agents. The prompt is maybe five percent of what determines whether a session goes well or falls apart. The rest is context: what the agent sees when it starts working, how that context evolves over the session, and what happens when it grows too large for the model to track.&lt;/p&gt;
&lt;p&gt;Andrej Karpathy &lt;a href="https://x.com/karpathy/status/1937902205765607626" target="_blank" rel="noreferrer"&gt;named this&lt;/a&gt; &amp;ldquo;context engineering&amp;rdquo; in mid-2025, and the term stuck because it describes something real. You&amp;rsquo;re not just writing prompts. You&amp;rsquo;re engineering the entire information environment the agent operates in. That includes your project structure, your &lt;code&gt;AGENTS.md&lt;/code&gt; files, the git state, the conversation history, and everything the agent discovers as it works. Get this right and the agent feels like a capable collaborator. Get it wrong and you&amp;rsquo;ll spend more time correcting it than doing the work yourself.&lt;/p&gt;
&lt;p&gt;What follows are lessons from months of daily Claude Code use. While the examples are Claude Code-specific, the principles apply to any coding agent. Not all of them will apply directly to your setup, but I wanted to share what I&amp;rsquo;ve learned so far. Maybe some of it saves you a few wrong turns.&lt;/p&gt;

&lt;h2 class="relative group"&gt;Context fatigue is real
 &lt;div id="context-fatigue-is-real" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#context-fatigue-is-real" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;Large context windows are both a gift and a trap. Claude Code gives you a million tokens of context, and you&amp;rsquo;d think you&amp;rsquo;d never run out. In practice, model performance degrades long before you hit the limit. It&amp;rsquo;s not a cliff, more like a gradual fog. Responses get less precise, the agent starts forgetting instructions from earlier in the conversation, and it suggests approaches you already tried and rejected fifty messages ago.&lt;/p&gt;
&lt;p&gt;Give it some rest. A &lt;code&gt;/clear&lt;/code&gt; from time to time is the equivalent of a good night&amp;rsquo;s sleep. Start a fresh session when you switch to a different task, or when you notice the agent struggling with things it handled well earlier. I used to resist this because starting over felt wasteful: all that accumulated context, all those decisions, gone. But a fresh session with a clear problem statement almost always outperforms a tired session with a thousand messages of history.&lt;/p&gt;
&lt;p&gt;This matters more with larger context windows, not less. When the window was small, sessions naturally ended before quality degraded too far. With a million tokens, you can keep going well past the point where the agent is still being useful. The context window tells you how much the model can hold. It doesn&amp;rsquo;t tell you how much it can hold while still being sharp.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s a related pattern worth calling out: when you&amp;rsquo;re stuck on a problem, the worst thing you can do is keep hammering at it in the same session. The agent has already committed to an approach. It&amp;rsquo;s anchored on assumptions from earlier in the conversation that might be wrong. Open a new session, describe the problem from scratch, and don&amp;rsquo;t mention what you&amp;rsquo;ve already tried. A fresh session often finds a solution in minutes that the previous one couldn&amp;rsquo;t find in an hour, not because the model got smarter but because you removed the accumulated bias. If I&amp;rsquo;ve spent more than three back-and-forth exchanges on something without progress, I start over. The cognitive cost of re-explaining the problem is much lower than continuing down a dead end.&lt;/p&gt;

&lt;h2 class="relative group"&gt;Understand before you apply
 &lt;div id="understand-before-you-apply" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#understand-before-you-apply" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;This one bit me early. Claude suggests something that sounds sophisticated, maybe a design pattern you haven&amp;rsquo;t seen before, or an architectural decision that looks reasonable. Your instinct is to accept it and move on, which makes it especially dangerous: in a typical session you accept 80 to 90 percent of proposals unchanged, so unfamiliar patterns slip through easily.&lt;/p&gt;
&lt;p&gt;If you can&amp;rsquo;t explain why a particular approach is the right one, you can&amp;rsquo;t debug it when it breaks. And it will break, usually at the worst possible time, in a part of the codebase you haven&amp;rsquo;t touched in weeks. Claude isn&amp;rsquo;t trying to mislead you. It&amp;rsquo;s pattern-matching against its training data and producing what statistically looks correct. Sometimes that&amp;rsquo;s exactly right. Sometimes it&amp;rsquo;s a plausible-looking solution to a problem you don&amp;rsquo;t actually have.&lt;/p&gt;
&lt;p&gt;The fix is simple: before applying something you don&amp;rsquo;t fully understand, ask Claude to explain the reasoning. Not &amp;ldquo;what does this do&amp;rdquo; but &amp;ldquo;why this approach over the alternatives.&amp;rdquo; The explanations are often excellent, and they sometimes reveal that the suggestion doesn&amp;rsquo;t fit your situation at all. Five minutes of questioning can save you an afternoon of debugging code you never understood in the first place.&lt;/p&gt;

&lt;h2 class="relative group"&gt;Hardening rounds are not optional
 &lt;div id="hardening-rounds-are-not-optional" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#hardening-rounds-are-not-optional" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;The first version that works is not the version you should ship. This is true for human-written code too, but with coding agents the gap between &amp;ldquo;works&amp;rdquo; and &amp;ldquo;works reliably&amp;rdquo; is wider because the agent optimizes for getting something functional as fast as possible. That&amp;rsquo;s exactly what you asked for, and it&amp;rsquo;s exactly what will bite you later.&lt;/p&gt;
&lt;p&gt;After the initial implementation, always add explicit hardening rounds. What that means concretely: for every error you encounter, have the agent write a test. Not &amp;ldquo;make this robust&amp;rdquo; (that&amp;rsquo;s far too vague and the agent will just sprinkle some error handling around), but &amp;ldquo;this specific thing broke, write a test that catches it, then fix it.&amp;rdquo; Each bug becomes a regression test, and over time those tests accumulate into a safety net that actually reflects how the code fails in practice.&lt;/p&gt;
&lt;p&gt;Separately, add a refactoring round where you ask the agent to clean up the implementation without changing behavior. Hardening and refactoring are distinct concerns, and mixing them leads to worse results in both.&lt;/p&gt;
&lt;p&gt;For UI work especially, expect many rounds. I&amp;rsquo;ve been building &lt;a href="https://cc-deck.github.io" target="_blank" rel="noreferrer"&gt;cc-deck&lt;/a&gt; (a TUI plugin for Claude Code) for some time, and this is where the pattern shows most clearly. The initial implementation of a feature usually works for the golden path. But the agent isn&amp;rsquo;t good at keeping things consistent and concise across UI states, so the hardening catches cases where terminal sizes change, sessions disappear mid-update, or multiple events arrive in the same tick. Without those extra passes, users would hit bugs within minutes of real use.&lt;/p&gt;

&lt;h2 class="relative group"&gt;Debug systematically, not by guessing
 &lt;div id="debug-systematically-not-by-guessing" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#debug-systematically-not-by-guessing" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;For complex UI flows, whether TUI or web, there&amp;rsquo;s a technique I keep coming back to. Instead of describing a bug and hoping Claude guesses the right fix, give it actual data.&lt;/p&gt;
&lt;p&gt;The process: have Claude add debug logging for event and mode handling. Navigate to your issue in the running application. Ask Claude to take a baseline of the current logs. Then exercise the bug, trigger whatever goes wrong. Now ask Claude to analyze the new events that flowed in after the baseline.&lt;/p&gt;
&lt;p&gt;This turns debugging from &amp;ldquo;here&amp;rsquo;s a vague description of what went wrong&amp;rdquo; into &amp;ldquo;here&amp;rsquo;s the exact sequence of events that led to the unexpected state.&amp;rdquo; The agent can trace through the event log, identify where the state diverged from what was expected, and propose a fix based on actual data rather than speculation.&lt;/p&gt;
&lt;p&gt;I developed this pattern while working on cc-deck&amp;rsquo;s session state machine. The sidebar plugin tracks session activity through Init, Working, Done, Idle, and Paused states, with time-based transitions between them. When a state transition fired at the wrong time, describing the problem in English was almost useless. Showing Claude the timestamped event log and saying &amp;ldquo;the transition from Working to Done happened here, but it shouldn&amp;rsquo;t have&amp;rdquo; led to accurate fixes every time.&lt;/p&gt;

&lt;h2 class="relative group"&gt;When the output feels vague, the input was vague
 &lt;div id="when-the-output-feels-vague-the-input-was-vague" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#when-the-output-feels-vague-the-input-was-vague" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;So far, these tips have been about managing your session. But there&amp;rsquo;s also a real-time signal worth paying attention to: the quality of what the agent gives you right now.&lt;/p&gt;
&lt;p&gt;You can spot it. When Claude starts hedging, producing long explanations with multiple &amp;ldquo;alternatively&amp;rdquo; branches, or suggesting solutions that feel vague rather than specific to your codebase, it&amp;rsquo;s guessing. It doesn&amp;rsquo;t have enough context to give you a confident answer, so it&amp;rsquo;s giving you a probability distribution instead.&lt;/p&gt;
&lt;p&gt;This is your signal to provide more context, not to pick the option that sounds best. Show it the relevant code. Point it at the test that&amp;rsquo;s failing. Give it the error message, the full one, not a paraphrase.&lt;/p&gt;
&lt;p&gt;Think of context like a budget. Every piece of information in the context window has a cost, not in tokens but in attention. The more noise in the conversation, the harder it is for the model to focus on what matters. Be deliberate: point the agent at specific files, quote the relevant error, describe what you&amp;rsquo;ve already ruled out. My best sessions start with a minute of framing the problem, while the worst start with a one-line description and an expectation that the agent will figure out the rest.&lt;/p&gt;
&lt;p&gt;This also means cleaning up after yourself. If you tried an approach that didn&amp;rsquo;t work, say so explicitly. &amp;ldquo;I tried X and it failed because Y, so don&amp;rsquo;t go down that path&amp;rdquo; is more valuable than hoping the agent noticed from the conversation history. And if you&amp;rsquo;ve been going back and forth without progress, remember the context fatigue lesson: a &lt;code&gt;/clear&lt;/code&gt; or a fresh session beats piling more confusion onto an already muddled conversation.&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://ro14nd.de/cc-skill-patterns/" &gt;skill patterns post&lt;/a&gt; covers this from the plugin author&amp;rsquo;s side: how to structure skills and hooks so the agent has the right context at the right time. From the user&amp;rsquo;s side, the principle is simpler. The old programmer&amp;rsquo;s wisdom &amp;ldquo;garbage in, garbage out&amp;rdquo; applies with full force here. Sloppy context produces sloppy output, and no amount of prompt cleverness will compensate.&lt;/p&gt;

&lt;h2 class="relative group"&gt;Your project IS the context
 &lt;div id="your-project-is-the-context" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#your-project-is-the-context" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;Beyond individual sessions, there&amp;rsquo;s a layer of context engineering that pays off before you even start a conversation: your project structure itself.&lt;/p&gt;
&lt;p&gt;Everything the agent sees when it starts a session shapes how it works. Your instruction files, your directory structure, your naming conventions, your test patterns. If these are messy, the agent&amp;rsquo;s output will reflect that mess.&lt;/p&gt;
&lt;p&gt;This cuts both ways. A well-structured project with clear conventions makes the agent noticeably better. A project instruction file that explains your architecture, coding standards, and common patterns gives the agent a running start on every session. You write it once and it pays off hundreds of times. A cluttered codebase with inconsistent naming, dead code, and no documentation gives the agent bad examples to learn from, and it will faithfully reproduce those bad patterns in new code.&lt;/p&gt;
&lt;p&gt;Most coding agents support some form of project-level instructions: &lt;code&gt;CLAUDE.md&lt;/code&gt; for Claude Code, &lt;code&gt;.cursorrules&lt;/code&gt; for Cursor, &lt;code&gt;.github/copilot-instructions.md&lt;/code&gt; for Copilot. The emerging cross-tool standard is &lt;a href="https://github.com/agentsmd/agents.md" target="_blank" rel="noreferrer"&gt;&lt;code&gt;AGENTS.md&lt;/code&gt;&lt;/a&gt;, a vendor-neutral format that any agent can read. Claude Code picks it up too, so you can maintain one file instead of several.&lt;/p&gt;
&lt;p&gt;For projects where you want to go further, &lt;a href="https://en.wikipedia.org/wiki/Spec-driven_development" target="_blank" rel="noreferrer"&gt;Spec-Driven Development&lt;/a&gt; (SDD) takes this idea to its logical conclusion. SDD starts from the premise that coding agents can only produce reliable output when you structure the context properly. Formal specifications define &lt;em&gt;what&lt;/em&gt; to build, a project &amp;ldquo;constitution&amp;rdquo; captures architectural decisions and coding standards, and the agent implements from those artifacts rather than from ad-hoc conversation. SDD is applied context engineering with a defined workflow. Tools like &lt;a href="https://github.com/github/spec-kit" target="_blank" rel="noreferrer"&gt;spec-kit&lt;/a&gt; provide the scaffolding for this approach. It&amp;rsquo;s more overhead than a simple &lt;code&gt;AGENTS.md&lt;/code&gt;, but for larger projects the structure pays for itself quickly. More on SDD in a future post.&lt;/p&gt;
&lt;p&gt;Whatever format you use, treat it as living documentation. If the project evolves and the instructions don&amp;rsquo;t, the agent will drift.&lt;/p&gt;

&lt;h2 class="relative group"&gt;These aren&amp;rsquo;t permanent rules
 &lt;div id="these-arent-permanent-rules" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#these-arent-permanent-rules" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;Context engineering is a young discipline. But the core principle will last: working well with coding agents is about engineering the context, not crafting the prompt. The prompt is the last five percent. Everything else is what makes that five percent effective.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;ve found your own patterns for keeping coding agent sessions productive, I&amp;rsquo;d love to hear about them. Leave a comment below. What works for you? What did you have to learn the hard way?&lt;/p&gt;
&lt;div class="ai-attribution"&gt;
&lt;p&gt;Author: Roland Huß &lt;a href="https://aiattribution.github.io/statements/AIA-Ph-SeNc-Hin-R-?model=Claude%20Opus%204.6-v1.0" target="_blank" rel="noreferrer"&gt;AIA Ph SeNc Hin R Claude Opus 4.6 v1.0&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;</description></item><item><title>Claude Code skill patterns</title><link>https://ro14nd.de/cc-skill-patterns/</link><pubDate>Thu, 09 Apr 2026 00:00:00 +0000</pubDate><guid>https://ro14nd.de/cc-skill-patterns/</guid><description>&lt;p&gt;Claude Code skills let you extend a coding agent with custom workflows, specialist knowledge, and automation. You write a &lt;code&gt;SKILL.md&lt;/code&gt; file with instructions, and the agent follows them. At least, that&amp;rsquo;s the idea.&lt;/p&gt;
&lt;p&gt;In practice, Claude treats skill content as advice, not as instructions. A skill that says &amp;ldquo;always use spec-kit to create the specification&amp;rdquo; might get followed, or Claude might decide it already has enough context from the brainstorming phase to write the spec directly. It&amp;rsquo;s being helpful, but it&amp;rsquo;s also wrong. This post describes patterns for dealing with that challenge, from scripts that enforce consistency to hooks that block shortcuts before they happen.&lt;/p&gt;
&lt;p&gt;Stronger wording does not help. I tried &amp;ldquo;MUST&amp;rdquo;, &amp;ldquo;ALWAYS&amp;rdquo;, &amp;ldquo;CRITICAL&amp;rdquo;, bold, uppercase. None of it changes the underlying behavior: the model reads your skill, considers it, and then makes its own judgment call. Compare that to hook-injected context (system reminders), which Claude treats as ground truth. This difference in compliance is not a bug, it&amp;rsquo;s how the architecture works. Understanding it early saves you from writing increasingly aggressive skill instructions that still get ignored.&lt;/p&gt;
&lt;p&gt;The patterns in this post come from building &lt;a href="https://github.com/rhuss/cc-prose" target="_blank" rel="noreferrer"&gt;cc-prose&lt;/a&gt; (voice-consistent writing), &lt;a href="https://github.com/rhuss/cc-spex" target="_blank" rel="noreferrer"&gt;cc-spex&lt;/a&gt; (spec-driven development on top of &lt;a href="https://github.com/github/spec-kit" target="_blank" rel="noreferrer"&gt;spec-kit&lt;/a&gt;), and a few others.&lt;/p&gt;

&lt;h2 class="relative group"&gt;The shortcut race
 &lt;div id="the-shortcut-race" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#the-shortcut-race" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;This shortcutting behavior keeps coming back and deserves its own section.&lt;/p&gt;
&lt;p&gt;You fix one shortcut in your skill instructions, Claude finds another path around it, you patch that one, and it discovers a third. It&amp;rsquo;s a classic &lt;a href="https://en.wikipedia.org/wiki/The_Hare_and_the_Hedgehog" target="_blank" rel="noreferrer"&gt;Hase-und-Igel&lt;/a&gt; race, and as the skill author you will always be the hedgehog.&lt;/p&gt;
&lt;p&gt;In cc-spex, the brainstorming phase collects requirements, explores alternatives, and validates assumptions before the specification phase formalizes everything into a proper spec using spec-kit. But Claude regularly decides that the brainstorming output is &amp;ldquo;structured enough&amp;rdquo; and writes the spec directly. From the model&amp;rsquo;s perspective, this is a reasonable optimization. From the workflow&amp;rsquo;s perspective, it&amp;rsquo;s skipping the entire point.&lt;/p&gt;
&lt;p&gt;What makes this particularly frustrating is that Claude usually knows it did the wrong thing. Point out the shortcut and it will apologize, acknowledge that it should have followed the workflow, and promise to do better next time, without that actually preventing the next occurrence.&lt;/p&gt;
&lt;p&gt;A useful debugging technique is to open a fresh session, show Claude what happened, and ask: &amp;ldquo;Why did you do this, and how can we prevent it in the future?&amp;rdquo; The answers are surprisingly insightful, and many of the patterns in this post came directly from those conversations. Then I let Claude fix the skill right there in the same session, while the reasoning is still fresh. Each iteration makes the skill more reliable.&lt;/p&gt;
&lt;p&gt;Can you win this race? Not entirely. But you can make shortcuts increasingly expensive for the model by moving critical logic out of skills and into scripts and hooks, where it stops being a suggestion and becomes a constraint.&lt;/p&gt;

&lt;h2 class="relative group"&gt;Skills vs scripts
 &lt;div id="skills-vs-scripts" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#skills-vs-scripts" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;Skills can call out to scripts during execution. This is the escape hatch from the shortcut race: instead of relying on Claude to follow a multi-step procedure described in English, you delegate the deterministic parts to a script that the skill invokes at the right moment. The question then becomes: what belongs in the skill, and what belongs in the script?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Skills&lt;/strong&gt; give you flexibility, error-forgiveness, and adaptability. The LLM can handle ambiguous input, recover from unexpected situations, and apply judgment, so use them when the outcome benefits from interpretation.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Scripts&lt;/strong&gt; give you determinism, repeatability, and predictability because a Python script does the same thing every time. Use them when the outcome must be consistent across runs.&lt;/p&gt;
&lt;p&gt;One of my plugins has a workflow for processing external PDF reviews: iterate over reviewer comments, map them to source files, assess complexity, and generate fix proposals. This follows a fixed procedure with multiple stages. Early versions used skills for the whole flow, and the result was a different experience every time: sometimes it would skip comments, sometimes it would process them in the wrong order, sometimes it would invent stages that didn&amp;rsquo;t exist. A &lt;code&gt;session_manager.py&lt;/code&gt; script now handles the state management, tracks the interaction state, and stores results. The skill handles the judgment calls within each stage, like assessing whether a reviewer&amp;rsquo;s suggestion actually improves clarity. The script handles everything else.&lt;/p&gt;
&lt;p&gt;The evolution path is predictable: you start with a simple prompt-only skill (just English instructions, fragile by nature) and gradually move state management into scripts as you hit consistency problems. And you don&amp;rsquo;t write those scripts by hand, either. You tell Claude &amp;ldquo;let&amp;rsquo;s create a script to make this more predictable&amp;rdquo; and let it build the script and wire it into the skill at the right checkpoints. The rule of thumb: every state change should go through a script. Let the LLM do the thinking, and let scripts do the bookkeeping.&lt;/p&gt;

&lt;h2 class="relative group"&gt;Hooks over hopes
 &lt;div id="hooks-over-hopes" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#hooks-over-hopes" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;If skills are advisory and scripts are deterministic, hooks are the bridge. Claude Code&amp;rsquo;s hook system lets you inject context at specific points in the interaction, and that context arrives as a system reminder, which Claude treats as ground truth. Better skill instructions won&amp;rsquo;t fix the compliance gap, but hooks can enforce what instructions can&amp;rsquo;t.&lt;/p&gt;
&lt;p&gt;cc-spex uses a &lt;code&gt;PreToolUse&lt;/code&gt; hook as a guardrail layer. This hook fires before every tool call and can either allow it, deny it with an error message, or inject additional context. When the plugin runs a multi-stage ship workflow (brainstorm, specify, plan, implement, review, verify), Claude regularly tries to skip stages. A skill instruction saying &amp;ldquo;complete each stage in order&amp;rdquo; gets interpreted as a suggestion. The hook makes it a constraint: a state file on the filesystem tracks the current pipeline stage, and the hook checks it before every tool call. If Claude tries to jump from stage 2 (spec review) to stage 6 (implementation), the hook blocks the call and lists every stage it needs to complete first:&lt;/p&gt;
&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;PIPELINE DISCIPLINE: You are trying to invoke speckit-implement 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;(stage 6: implement) but the pipeline is at stage 2: review-spec. 
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;You MUST complete these stages first, in order:
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 2. review-spec (spex:review-spec)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 3. plan (speckit-plan)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 4. tasks (speckit-tasks)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; 5. review-plan (spex:review-plan)
&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;Do NOT skip stages. Do NOT shortcut.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;The same hook catches hallucinated commands (Claude inventing &lt;code&gt;/spex:specify&lt;/code&gt; which doesn&amp;rsquo;t exist) and reminds about verification before git commits. A companion &lt;code&gt;UserPromptSubmit&lt;/code&gt; hook injects plugin state as a structured system reminder on every prompt, including resolved script paths, project configuration, and session context, so that skills always have accurate state without needing to rediscover it.&lt;/p&gt;
&lt;p&gt;Instead of telling Claude what to do and hoping it complies, you build guardrails that make non-compliance impossible. The hooks don&amp;rsquo;t ask Claude to follow the process, they enforce it at the tool level before Claude&amp;rsquo;s output reaches the user.&lt;/p&gt;
&lt;div class="diagram-themed"&gt;
&lt;img class="diagram-light" src="https://ro14nd.de/images/cc-skill-patterns/enforcement-architecture-light.svg" alt="Enforcement architecture: hooks inject state and block shortcuts, skills provide advisory guidance, scripts handle deterministic state management" /&gt;
&lt;img class="diagram-dark" src="https://ro14nd.de/images/cc-skill-patterns/enforcement-architecture-dark.svg" alt="Enforcement architecture: hooks inject state and block shortcuts, skills provide advisory guidance, scripts handle deterministic state management" /&gt;
&lt;/div&gt;

&lt;h2 class="relative group"&gt;More patterns
 &lt;div id="more-patterns" class="anchor"&gt;&lt;/div&gt;
 
 &lt;span
 class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;
 &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#more-patterns" aria-label="Anchor"&gt;#&lt;/a&gt;
 &lt;/span&gt;
 
&lt;/h2&gt;
&lt;p&gt;A few more patterns that came up across my skills.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Multi-specialist over monolith.&lt;/strong&gt; Instead of one massive skill that tries to do everything, split into independent specialist skills with their own activation rules. One of my plugins uses 12 specialists for different editing concerns: style, consistency, flow, references, links, examples, and more. This keeps individual skills focused and within context budget, because one monolithic skill will lose track of its own instructions.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Prevention over correction.&lt;/strong&gt; cc-prose generates clean content upfront using voice profiles and AI pattern avoidance, rather than generating text and then running a fixer pass. It&amp;rsquo;s cheaper to prevent bad output than to detect and fix it after the fact. Not to mention that fixing AI-generated text while using AI tends to be an exercise in whack-a-mole.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Keep skills small.&lt;/strong&gt; Every line of skill content fills the context window, so if Claude &amp;ldquo;helpfully&amp;rdquo; adds optional features to your skill output, remove them. Periodic cleanup during development is important because skill code accumulates cruft faster than regular code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Configuration hierarchy.&lt;/strong&gt; Skill defaults in &lt;code&gt;knowledge-base/&lt;/code&gt; get overridden by global user config, which get overridden by project config. cc-prose uses this to layer project-specific voice profiles on top of general writing defaults. Three layers is enough.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Building on a moving platform.&lt;/strong&gt; Claude Code is transitioning from &lt;code&gt;commands/&lt;/code&gt; to user-invocable &lt;code&gt;skills/&lt;/code&gt;, but plugin skills installed from marketplaces still don&amp;rsquo;t appear in the &lt;code&gt;/&lt;/code&gt; slash command autocomplete (&lt;a href="https://github.com/anthropics/claude-code/issues/18949" target="_blank" rel="noreferrer"&gt;anthropics/claude-code#18949&lt;/a&gt;, open since January 2026). Build with &lt;code&gt;skills/&lt;/code&gt; as the primary structure but keep thin &lt;code&gt;commands/*.md&lt;/code&gt; stubs as a bridge until autocomplete catches up.&lt;/p&gt;
&lt;p&gt;The core tension between flexibility and determinism, between skills and scripts, won&amp;rsquo;t go away with better models. If anything, more capable models will just make the shortcut race more creative.&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re building Claude Code skills and have found patterns of your own, I&amp;rsquo;d like to hear about them.&lt;/p&gt;
&lt;div class="ai-attribution"&gt;
&lt;p&gt;Author: Roland Huß &lt;a href="https://aiattribution.github.io/statements/AIA-Ph-SeNc-Hin-R-?model=Claude%20Opus%204.6-v1.0" target="_blank" rel="noreferrer"&gt;AIA Ph SeNc Hin R Claude Opus 4.6 v1.0&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;</description></item></channel></rss>