Writing / agentic-coding · claude-code · ai-engineering · workflow
Working with AI agents like a senior team, not a search box
How I manage agentic coding in Claude Code by adapting the 4D framework—Delegation, Description, Discernment and Diligence—alongside CLAUDE.md, AGENTS.md, hooks, tools and scripts across a senior-team delivery cycle.
The least useful way for me to think about an AI coding agent is as an endlessly capable search box. That framing encourages vague delegation: describe a large outcome, accept a plausible-looking diff and discover the missing boundaries later when something breaks in staging or production.
In my own day-to-day engineering work with Claude Code, I get far better results by borrowing the operating habits of a senior engineering team. Not because an agent is a senior engineer, and not because spinning up several agents magically creates wisdom. The useful part is the structure: clear ownership, narrow scopes, reviewable handovers and explicit human approval gates.
The aim of agentic coding for me is not maximum autonomy. It is dependable progress where human responsibility remains easy to see.
High-level operating model
The 4D framework applied to code delivery
To make this operating model concrete, I adapt the 4D AI Fluency Framework (developed by Rick Dakan and Joseph Feller, and taught through Claude Academy) directly into our repository workflow:
- Delegation: Deciding what belongs to the agent and what stays human. It requires knowing the limits of the model context and breaking a large workflow into bounded, specialized tasks.
- Description: Communicating intent, target invariants, non-negotiables, file boundaries and acceptance criteria so the model never has to guess.
- Discernment: Evaluating every output with senior engineering scrutiny—falsifying assumptions, hunting for silent regressions, and refusing to confuse confident text with safe code.
- Diligence: Backing up human judgment with deterministic proof—hooks, linters, contract tests and reproducible validation scripts before any change reaches production.
When you connect these four dimensions, you stop treating an agent like an unpredictable chatbot and start treating it as an amplifier for disciplined engineering practice.
Shared context, separate responsibilities
How the technical primitives power each stage
In Claude Code, these principles translate into tangible repository primitives:
CLAUDE.md: The repository’s living memory. It documents build commands, architectural boundaries, security invariants and code style rules that Claude Code reads automatically at the start of every session.AGENTS.md: Definitions of specialized subagents, establishing bounded personas with restricted tools and specific deliverables (e.g. read-only architecture explorer vs. scoped implementer).- Hooks: Deterministic automation that runs before or after actions—running linters on file edits, auditing tool calls or blocking forbidden commands.
- Tools & MCP: Scoped tools and Model Context Protocol servers that give agents precise inspection capabilities rather than unrestrained shell execution.
- Scripts: Standalone, versioned scripts in
scripts/that run contract suites, generate assets or verify deployments reproducibly.
Here is how I manage each of the five stages in Claude Code:
1. Frame: Delegation and Description
Every change begins with a human brief. Before Claude Code touches a single file, I formulate the problem in writing.
This is Delegation and Description working together. I deliberately decide not to delegate the problem framing to the model. Instead, I describe the expected behaviour, the invariants that must remain unchanged, and the blast radius. Rather than asking “clean up our authentication middleware”, the brief states: “Migrate session verification to the new JWT validator without changing public response headers or latency budgets, keeping backwards compatibility for existing mobile clients.”
Here, CLAUDE.md provides the shared foundation. It houses our non-negotiable rules: no unvetted npm packages, strict TypeScript settings, no logging of authorization headers, and the exact commands to build and test. Because CLAUDE.md is loaded automatically by Claude Code, these baselines apply to every prompt without repetitive preamble.
2. Plan: Description and Discernment
Once the brief is clear, I delegate the planning phase before any implementation begins.
In Claude Code, I use a specialized planning pass defined in AGENTS.md. This subagent operates with read-only tools: it can search the codebase, inspect schemas and trace dependencies, but it has no write permissions.
Its job is to deliver a concise twenty-line plan answering three questions:
- Which files, models and endpoints will be modified?
- Which existing callers, background workers or migrations could be affected?
- What is the step-by-step verification plan?
This is where Discernment protects the system. A written plan is the cheapest place to catch a flawed assumption. If the agent suggests adding a heavy runtime dependency or making a breaking change to a shared database contract, I catch it before a single line of code is edited. I review the plan, adjust the constraints, and only then approve the implementation.
3. Build: Delegation and Diligence
With an approved plan, implementation becomes a focused, bounded task.
I delegate the build pass to a session scoped strictly to the planned files. The agent is explicitly told to implement the agreed diff without widening the surface area. If it notices an unrelated typo in a neighbouring module, it leaves it alone. Senior engineers know that opportunistic refactoring inside a critical change creates noisy diffs and hides regressions.
During the build stage, hooks and scripts enforce Diligence:
- Post-tool hooks can run formatting, linting or typechecking automatically whenever a file is written. If the agent makes a syntax error or breaks a type signature, the hook returns immediate, deterministic feedback in the console.
- Scripts in
scripts/provide one-command verification targets (for example,npm run checkorpytest tests/contract/). The agent runs the exact verification command documented inCLAUDE.mdand provides the test output.
This combination keeps feedback loops tight and eliminates guesswork about whether the code compiles and passes local tests.
The safe delivery path
4. Challenge: Discernment and Diligence
The most common trap in AI-assisted coding is asking the session that wrote the diff to review its own work. The same context that introduced a subtle bug will usually defend it with plausible prose.
For non-trivial work, I launch an independent Challenge pass using a reviewer subagent defined in AGENTS.md. This subagent runs in a fresh context, receiving only the original brief, the diff and read-only tools. Its role is adversarial:
- Check whether error cases, rate limits and timeouts are properly handled;
- Look for silent schema alterations or changed return shapes;
- Verify whether newly added tests actually test the business logic or merely assert the implementation;
- Search for edge cases that could fail under concurrent load.
This independent challenge is Discernment in action. The reviewer cannot edit files; it only outputs findings with exact file and line references.
Meanwhile, deterministic diligence runs in parallel: pre-commit hooks, security scanners, contract suites and integration tests. A model’s opinion that a change looks safe is helpful context, but automated tests and deterministic checks are the non-negotiable proof.
5. Decide: Discernment and Diligence
The final stage is always human.
No agent merges code to main or promotes a container image to production on its own. As the engineer accountable for the system, I inspect the evidence: the diff, the test results, the findings from the challenge pass, and the rollback instructions.
This is where senior Discernment matters most:
- Does this change solve the problem cleanly without unnecessary complexity?
- Is the residual risk acceptable?
- If this fails in production at 2 AM, will our observability signals expose it immediately, and can we revert cleanly?
Once I approve and merge, Diligence completes the loop:
- Deployment scripts promote the verified container image;
- We observe live telemetry and compare production metrics against the expected baseline;
- Any lessons, edge cases or new conventions from the change are committed back into
CLAUDE.mdso the whole team—and all future agent sessions—learn from the experience.
Real engineering, not novelty
The real leverage of agentic coding is not that it eliminates human effort. It is that it makes engineering standards enforceable, repeatable and fast.
When you use Claude Code with CLAUDE.md for shared memory, AGENTS.md for bounded delegation, hooks and scripts for deterministic guardrails, and the 4D framework for human judgment, the technology stops feeling like an unpredictable toy. It becomes a reliable, transparent extension of how a senior engineering team builds software: with care, with evidence, and with genuine pride in the craft.