Skip to main content

> cat ./posts/how-to-write-code-with-matt-pocock-skills.md

[terminal_mode]
cat: Software Architecture|date: 2026-11-22|rt: 14 min

How to Write Code with Matt Pocock’s Agent Skills: The Definitive Engineering Guide

Vibe coding is fun until your AI agent drifts into architectural chaos. Matt Pocock's modular skills framework turns chaotic prompting into rigorous engineering—mastering specs, glossaries, token context, and model selection.

#ai-coding#claude-code#developer-productivity#software-architecture#matt-pocock#token-economics

For the last couple of years, working with AI coding assistants like Claude Code, Cursor, or Codex has felt like riding a wild horse.

When you give an agent a great prompt, it delivers magnificent code in seconds. But when your prompt is slightly ambiguous, the agent drifts off into architectural fantasy land: introducing unrequested libraries, violating domain boundaries, and rewriting working modules without warning.

We call this vibe coding: powerful, fast, and completely unpredictable.

In his widely discussed deep-dive on agentic workflows, Matt Pocock demonstrated a radically different paradigm: Modular Agent Skills (mattpocock/skills). Instead of treating an AI agent as an ephemeral chatbot that needs endless re-explaining in every session, you equip the repository with a standardized set of markdown skills (grill-me, spec, tdd, etc.) that dictate how the agent thinks, plans, and executes.

Let’s dive deep into the advanced mechanics of this framework—including formal specifications, domain glossaries, token economics, and strategic model selection.


1. Why Specification Is Non-Negotiable (spec.md)

In unconstrained AI coding, developers often say: "I'll just let the agent figure out the implementation details."

This is an architectural trap. When an agent is handed an open-ended goal without a rigid specification, it optimizes for the easiest path to green code, completely ignoring edge cases, failure states, and security boundaries.

The Role of spec.md in Agent Workflows:

  • Contract-First Execution: Before a single line of application logic is written, the agent must generate or read a spec.md that acts as an immutable technical contract.
  • Explicit Acceptance Criteria: The spec defines exact input/output boundaries, error handling requirements, and testable invariants.
  • Zero Hallucination Guardrail: If an agent encounters an ambiguous requirement during implementation, it cannot invent a solution on the fly; it must halt and reference the spec or prompt the user for clarification.

Specs turn stochastic generation into deterministic engineering.


2. The Glossary (GLOSSARY.md) as an Anti-Hallucination Layer

One of the most insidious ways AI agents introduce technical debt is through naming drift and vocabulary hallucination.

In one file, an agent might refer to an entity as a userAccount; in another, a customerRecord; and in a third, a clientProfile. Over time, your codebase becomes a patchwork of inconsistent terminology.

Matt Pocock’s engineering skills framework emphasizes repository-level domain grounding via a GLOSSARY.md:

  • Unambiguous Vocabulary: Every domain concept (e.g., Subscription, LedgerEntry, Tenant) is formally defined in a central markdown file.
  • Agent Grounding: When an agent boots up, its system prompt or initialization skill forces it to read GLOSSARY.md.
  • Eliminating Naming Drift: Because the agent’s vocabulary is anchored to the glossary, database columns, API response keys, and TypeScript interfaces remain strictly aligned with human business logic.

3. Token Economics and Context Window Pressure

Context windows in 2026 are massive (often 100k to 2M tokens), but more context does not equal better reasoning. In fact, as an agentic session runs for hours, context pollution sets in: stale error logs, obsolete diffs, and conversational noise swamp the model's attention span.

Token volume directly influences your workflow and dictates which skills you must invoke:

  1. Context Bloat Degrades Attention: When a chat history exceeds tens of thousands of tokens of raw debugging chatter, models begin missing subtle architectural instructions nestled at the top of the prompt.
  2. Strategic Compaction (/compact or Summary Skills): Professional agent workflows require periodic context pruning. After completing a major milestone (e.g., passing Phase 1 of your execution plan), you should trigger a compaction skill that strips out intermediate tool output, preserving only the updated spec.md, current plan.md, and git diff summary.
  3. Targeted File Reading: Instead of letting an agent dump an entire repository into its context window, skills enforce precise file scoping (e.g., reading only the relevant module and its direct dependencies).

4. Strategic Model Selection for Inspection & Execution

Not all AI tasks require the same model tier. Firing up a heavyweight frontier reasoning model (such as Claude 3.5 Sonnet, o1, or DeepSeek-R1) for simple file globbing or syntax formatting is an expensive waste of tokens and latency. Conversely, relying on a lightweight model for complex architectural refactoring leads to silent failures.

Here is the model-tier selection matrix for professional agent workflows:

Workflow PhaseRecommended Model TierPurpose & Characteristics
1. Inspection & DiscoveryFast, Lightweight SLM (e.g., 7B–8B local or fast cloud API)Scanning directories, parsing ASTs, searching files, and gathering initial context cheaply and instantly.
2. Grilling & Scoping (grill-me)Balanced Reasoning ModelAsking adversarial questions, probing edge cases, and structuring user intent into a clean scope tree.
3. Specification & PlanningDeep Frontier Reasoning ModelAuthoring spec.md and plan.md. Requires top-tier logic to foresee concurrency issues, race conditions, and integration friction.
4. Autonomous TDD & ExecutionSpecialized Coding Agent ModelWriting failing tests, generating clean code matching the spec, and executing local test runner loops.

Conclusion

Matt Pocock’s modular skills framework proves that the future of AI coding isn't about finding a magic prompt—it is about building deterministic workflows for stochastic models.

By combining rigorous specifications (spec.md), domain glossaries (GLOSSARY.md), disciplined token context management, and strategic model tiering, you transform your AI coding assistant from an unpredictable chatbot into a rigorous, professional engineering partner.

Share this post