Claude Code: How to maximise efficiency

How to get the most out of Claude Code when building real production systems.

Claude Code: How to maximise efficiency
When your Python worked fine until you asked Claude to "just have a look".

Developer Guide · Claude Code

Claude Code is powerful out of the box — but a handful of friction points trip up most new users. Here are the most common issues and how to resolve them cleanly.


Issue 1 Context window fills up mid-task
Problem Long coding sessions accumulate context until Claude loses track of earlier files or begins to repeat itself, resulting in degraded output quality.
Fix Use /compact to summarise the current session before switching tasks. Break large projects into scoped sub-tasks with their own sessions. Reference specific files with @filename rather than relying on ambient context.
Issue 2 MCP servers not connecting
Problem MCP tools show as unavailable or throw silent errors, especially after system restarts or version updates.
Fix Open Claude Code settings and verify each MCP server entry. Confirm the server process is running independently, then reconnect from the UI. Check that environment variables (API keys, ports) are set in the shell Claude Code launches from — not just your global profile.
Issue 3 Claude edits the wrong file
Problem In large repos, Claude targets a similarly named file or an older version, producing changes that don't apply cleanly.
Fix Always open the target file in the editor before issuing a task — Claude anchors to what's visible. Use @path/to/file.ts in your prompt to be explicit. For mono-repos, run Claude Code from the relevant sub-directory.
Issue 4 Agentic loops stall or over-run
Problem Multi-step tasks either freeze waiting for confirmation or spiral into unnecessary tool calls, burning time and tokens.
Fix Set --auto-approve only for low-risk read operations. For write-heavy tasks, keep auto-approve off and use /checkpoint to review state between steps. Define a clear success condition in your initial prompt so Claude knows when to stop.
Issue 5 Slow responses on large codebases
Problem Response latency spikes when Claude Code indexes deeply nested directories, particularly with node_modules or build artefacts present.
Fix Add a .claudeignore file at the repo root (same syntax as .gitignore) to exclude build folders, dependencies, and generated files. Scope the working directory to the feature area you're actively changing.

Quick wins

📋
Use CLAUDE.md
Put project conventions, stack details, and recurring instructions in a CLAUDE.md at the repo root — loaded automatically every session.
🔀
One task per session
Separate refactor, test, and review tasks into distinct sessions. Mixed intent degrades output quality and muddies diffs.
🧪
Ask for tests first
Prompt Claude to write the test before the implementation — better-scoped code and a built-in verification step.
Pipe CLI output in
Pipe terminal errors directly: npm test 2>&1 | claude. Claude diagnoses and patches without manual copy-paste.


Claude Code: Specific prompts saving time


Build based on existing samples with great design

Read code in folder /Users/axelsunnehall/Documents/provisioning-worker/ and Build a similar Provisioning Worker MCP server in our project. This worker is called by an orchestration Claude agent to manage member access and credentials on the InAgentic platform. It has no intelligence of its own — it receives explicit structured instructions, executes them against external APIs and returns structured JSON results. It does not reason or decide.
index.js — MCP server entry point, tool registration
tools/
ghost.js — grant_ghost_access, revoke_ghost_access
apikeys.js — create_mcp_api_key, view_mcp_api_key
stubs.js — create_claude_account, create_twenty_crm_account, create_salesforce_account
lib/
logger.js — append-only JSONL logger used by all tools
retry.js — shared retry wrapper for external API calls
.env.example — environment variable template
package.json
README.md — how to run and connect to the orchestration agent

My favourite ways to work better with Claude Code

01

One domain per project

Mixing domains in the same project — www.inagentic.ai, inagentic.ai, filedone.co.uk — has cost hours of debugging. Claude makes subtle mistakes with cross-domain references: broken links in email templates, inconsistent formatting, redirect logic that misfires. One domain per project eliminates an entire class of errors.

02

Put your content in JSON

A well-structured project with JSON-driven copy means changing a button label, reordering form fields, or updating page text is flawless and takes seconds. For multi-language projects, use the industry-standard key-value approach — i18next is the go-to. Claude handles JSON edits with near-zero error rate.

03

Save mistakes to memory

When Claude Code struggles with something and you find the fix, tell it to save that lesson to memory. It won't repeat the same mistake in a future session. One correction compounds across every session that follows.

04

Use CLIs wherever possible

Stripe CLI, AWS CLI, Azure CLI, GCP CLI — wherever a command-line interface exists, use it. Claude Code excels at CLI-driven workflows. It's faster, more predictable, and far easier to debug than UI-based alternatives.

05

Make deployment a single command

Any manual step in a deployment is a liability. If manual steps are unavoidable, that's a signal to change the architecture. IAM policies, bucket configs, and environment setup can all be scripted as JSON and applied in one command. Measure how long your deploy takes and keep cutting it. Pre-configured sandboxes with permissions already in place give a significant performance boost — build them once, reuse them everywhere.