Table of Contents
Claude Code works best when the task has a clear outcome, relevant repository context, explicit constraints and observable acceptance criteria. “Aligning” with a coding agent is therefore a specification and review problem: make hidden decisions visible, let the agent inspect the code, resolve ambiguity before editing, and verify the result yourself.

Start with the outcome, not an implementation guess
Describe what must be true for the user or system when the task is complete. Then state boundaries that cannot be inferred from the issue title.
Add server-side validation to the signup flow.
Success:
- invalid email and weak passwords return the existing error format
- duplicate email remains a 409 response
- client behavior and public API fields do not change
Constraints:
- reuse the project's current validation library
- do not add a dependency
- add tests for each failure path
Before editing, inspect the current route, schema, error mapper and tests.
This is more useful than prescribing a new validator before checking what the repository already uses.
Expose the constraints that change the design
A coding agent cannot infer decisions that exist only in a meeting or in your head. Include relevant constraints such as:
- compatibility requirements and public API contracts
- performance or latency targets
- security and privacy boundaries
- supported platforms and runtime versions
- budget or third-party service limits
- migration, rollback and release requirements
- files, modules or interfaces that must not change
Do not paste every document “just in case.” Excess context can hide the important part and may expose confidential information. Link or summarize only the material that can affect the decision, and identify which source is authoritative when documents conflict.
Use Plan Mode before risky changes
Claude Code's Plan Mode is designed for changes you want to review before they touch disk. It can read relevant files and propose an approach without editing until you approve. Start the CLI with claude --permission-mode plan, or cycle to Plan Mode with Shift+Tab in an interactive session.
Ask for a plan that contains evidence and verification, not only a list of generic steps:
Inspect the authentication flow and plan this migration. For every step, name the files or symbols that justify it. Identify unresolved decisions, compatibility risks, data migration needs, rollback options and tests. Ask me only questions whose answers would materially change the plan. Do not edit files.
Anthropic's Claude Code workflow documentation describes the current Plan Mode controls and approval flow.
Do not blindly copy existing patterns
Repository context helps an agent follow local conventions, but existing code can contain duplication or obsolete architecture. Tell Claude Code when reuse is desired and when it should evaluate the pattern first.
For example, an application may have one central model client but also several older direct API calls. A vague instruction to “follow existing code” could reproduce either pattern. A better prompt is:
Find every existing model call. Identify the intended abstraction from current documentation and tests, note any legacy exceptions, and recommend whether this feature belongs in the shared client. Do not introduce another direct call unless you explain why.
The human reviewer still owns the architectural choice. Similarity to nearby code is evidence of convention, not proof of good design.
Put durable project rules in CLAUDE.md
Repeated facts such as build commands, coding standards, preferred libraries and review checks should not be retyped in every prompt. Claude Code reads a CLAUDE.md file in the project hierarchy for persistent instructions.
Keep it short and operational:
- how to build, lint and run focused tests
- the source directories and generated files
- architectural boundaries that must be preserved
- naming, formatting and dependency policies
- what evidence is required before work is considered complete
Do not turn CLAUDE.md into a full handbook. Link to longer references and move reusable procedures into skills where appropriate.
Make verification part of the request
“The code looks right” is not a completion criterion. Tell the agent which evidence to produce:
- run the smallest relevant test first, then the broader suite
- show the failing test or reproduction before fixing a bug
- run linting and type checks affected by the change
- inspect the final diff for unrelated edits
- report commands that could not run and why
- for UI work, test the interaction and error states rather than only compiling
Review test quality as carefully as application code. An agent can make a weak test pass by changing the assertion instead of fixing the behavior.
Use a two-pass review
- Requirement review: compare the result with the acceptance criteria and public behavior.
- Engineering review: inspect security, failure handling, maintainability, performance and rollback impact.
For important work, ask a fresh review pass to challenge the implementation rather than justify it. Then examine the cited files and reproduce the relevant behavior yourself.
A practical task template
Goal:
[Observable outcome]
Relevant context:
[Files, issue, design decision, or example]
Constraints:
[Compatibility, security, budget, dependencies, no-go areas]
Acceptance criteria:
[Behaviors and failure cases]
Workflow:
1. Inspect before editing.
2. Ask focused questions if a decision changes the design.
3. Propose a plan for approval.
4. Implement the smallest coherent change.
5. Run [specific tests/checks].
6. Summarize changed files, evidence, and remaining risks.
The objective is not to make Claude Code “think like you.” It is to create a traceable loop in which requirements, repository evidence, decisions and verification are visible to both the agent and the reviewer.
Reader Comments 0
Sign in with email or Google to join the discussion.