cd /news/ai-agents/claude-code-harness-engineering · home › topics › ai-agents › article
[ARTICLE · art-179368] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

Claude Code ~Harness Engineering~

A developer documented a five-layer "harness engineering" pattern for configuring Claude Code, layering CLAUDE.md, domain Rules, Skills, subagents, and settings permissions to steer the agent's behavior. Moving deterministic work like RSS fetching and parsing into Python scripts while leaving translation and classification to the model cut token use to about one-sixth and processing time to about one-third, the developer reports. The writeup also advises explicitly listing prohibited actions and deferring Hooks in favor of static deny patterns.

recommendation

Move deterministic steps like API calls, parsing and file I/O into pinned scripts and leave only judgment to the model; one setup cut tokens to a sixth and time to a third.

more in playbook: Working with AI coding agents
by read3 min views1 publishedDec 1, 2026

#

Harness Engineering with Claude Code: A Five-Layer Design Pattern

#

Main Thesis

Good prompts alone are not enough to use Claude Code well. The author argues for harness engineering: designing the environment around the model, using Claude Code's configuration mechanisms (CLAUDE.md, Rules, Skills, Agents, Settings, Hooks) to steer its behavior deliberately. The article presents a five-layer implementation from a personal information-collection and knowledge-management repository. Hooks are not used yet.

#

Background

Origin: Mitchell Hashimoto introduced the term in February 2026. When an agent makes a mistake, you fix the environment permanently so it doesn't repeat it. #

Why it's needed: LLMs are stateless. Conversation history and project context are re-injected on every request, and anything not injected effectively doesn't exist for the model. #

Three disciplines: - Prompt engineering optimizes what you ask.

  • Context engineering optimizes what the model sees.
  • Harness engineering is broader: tools, permissions, and guardrails, with context engineering as a part of it.

#

The Five Layers

  1. CLAUDE.md (the "constitution")
  • Covers project purpose, structure, technical rules, and security rules.
  • Explicitly lists what the assistant should not do. This defines behavioral scope rather than suppressing reasoning, and reduces drift.
  • In team repos, personal preferences go in a gitignored file imported with @ . Missing import targets are ignored, so the import is safe to commit.

  1. Rules (domain-specific rulebooks)
  • Markdown files in .claude/rules/ , split by domain to keep CLAUDE.md small.
  • A globs frontmatter field enables lazy and saves context. The author reports parsing bugs with the documentedpaths field, soglobs is safer for now.

  1. Skills (reusable workflows)
  • Invoked as /command and defined in SKILL.md. The author runs 13.

Principle: separate what the LLM does from what a script does. Moving RSS fetching and parsing into Python, and leaving only translation and classification to the LLM, cut token use to about one-sixth and processing time to about one-third.

  • Running scripts with uv run and pinned versions needs no environment setup and lowers supply-chain risk.
  • A good description field lets Claude Code suggest relevant skills on its own.

  1. Agents (specialized subagents)
  • Invoked as @name and run in a separate context.
  • Main benefit is context isolation: searching hundreds of notes doesn't fill the main context, and only a summary returns.

  1. Settings (permissions and security)

settings.json allow and deny lists act as the safety mechanism.

  • Allow routine commands broadly, explicitly deny destructive operations (such as repo deletion), and keep machine-specific permissions in settings.local.json .
  • Piped commands are evaluated per subcommand and are hard to match with allow patterns. Running commands without pipes and letting the LLM parse the output is more reliable.

#

Lessons Learned

Defining "what not to do" is the most cost-effective choice. It prevents unrequested "improvements." #

Separate deterministic work from LLM judgment. API calls, parsing, and file I/O go in scripts; judgment and generation go to the LLM. #

Keep CLAUDE.md lean. Treat it as a constitution, not an encyclopedia. Domain detail goes to Rules, workflows to Skills. #

Tune permissions iteratively. Run the workflow, note the prompts that appear, and add patterns over time. #

Defer Hooks. CLAUDE.md and Rules are advisory; Hooks are deterministic. Staticdeny patterns cover most needs, and LLM-based Hooks add token cost on every tool call. Start minimal and add Hooks after observing real failures.

#

Conclusion

Layering CLAUDE.md, Rules, Skills, Agents, and Settings turns Claude Code from a "smart chatbot" into a personalized development environment that carries context across sessions and works within defined rules, which the author calls a "personal team."

── more in #ai-agents 4 stories · sorted by recency
── more on @claude code 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/claude-code-harness-…] indexed:0 read:3min 2026-12-01 · —