
Claude Code tested its own code roughly 5 out of 10 times without an extra instruction, in Yifan’s experience. Asking it to run tests is one way to give it feedback before it returns a solution, rather than relying on a manual check afterward. Project rules, permission settings and version control also shape how much supervision a session needs. Discover why these Claude Code workflows can make development easier to manage.
Ask Claude To Test Its Changes
TL;DR Key Takeaways :
- Tell Claude to run tests, particularly when prototyping.
- Keep repository rules concise and refresh them as the project changes.
- Use conversation controls without assuming they restore code.
- Choose permission settings carefully and stage working changes with Git.
- GitHub workflows and custom commands can support review and repeatable tasks.
Tests give Claude feedback it can act on while implementing a feature, avoiding repeated manual checks and the need to copy errors back into the conversation. That is especially useful in a large codebase or when a feature has several moving parts. Add suitable test frameworks to the project setup so that Claude has checks available to run.
For a prototype, put an instruction in the prompt or project rules telling Claude to test the feature before returning. It may write ad hoc tests or temporary scripts to check the API or UI as it works. The instruction gives Claude a clear expectation even when the project is still taking shape.
Keep Project Memory Focused
The repository-root claude.md file holds project context, coding standards and workflows that should apply on every run. Run /init inside the project directory to generate it: Claude examines the directory, README, other key files and agent rules from Cursor and GitHub Copilot. The resulting file can describe the project overview, architecture, tech stack, folder structure, key workflows and important libraries.
Keep the file to high-level pointers and rules that genuinely need to apply to every prompt. Claude can explore the codebase itself, and a rule is unnecessary if it already consistently does the right thing. Run /init again as the project evolves to identify and suggest updates instead of rewriting all the context manually.
To add a rule during a session, type # in the input box, enter the instruction and select project memory to save it to the committed rules. For example, you can ask for descriptive variable names. Claude places the rule in an appropriate part of claude.md, potentially adding a heading or putting it in more than one relevant location.
Manage Long Conversations And Recover Context
Even with the latest Claude models offering 200,000-token context windows, responses can degrade as a conversation grows. After finishing a task, use /clear to begin a fresh conversation. That is sufficient for 90% of use cases in Yifan’s experience because Claude can rediscover information in the repository and use the overview in claude.md.
When a long debugging session contains decisions or discoveries needed for the next task, use /compact and optionally specify what to focus on. Claude summarizes key decisions and code changes, then starts a new conversation from that summary rather than retaining the full message history. It also compacts automatically when the context window fills.
If a conversation takes a wrong turn, press Escape twice and select an earlier message. Unlike Windsurf and Cursor, moving back through Claude Code’s message history does not revert the codebase. Manage code changes separately with version control.
Choose Permissions For The Work
Claude Code starts in a default mode that is essentially read-only, making it useful for exploring a codebase. Shift+Tab cycles through the available modes. Plan mode also begins read-only, producing a plan for review and waiting for approval before moving into auto-edits execution.
For ordinary implementation work, auto-accept edits is a useful default. Open Claude’s local settings, set the default mode to accept edits inside the permissions block, save the settings and restart Claude Code. Most plain file edits are approved, but Bash commands still require approval, even for ls, so an early prompt can leave a task waiting when you expect it to be finished.
The dangerously skip permissions option must be enabled when starting Claude at the command line. It allows commands, including Bash commands, to run without user confirmation. It can be useful in CI or a well-configured development container, but it is generally inadvisable on a main development machine because a command could go wrong.
Claude Code Boost, built by Yifan, provides a middle ground for tool approvals. It uses Claude models to assess each tool call and a repository hook to auto-approve standard development commands while requesting extra approval for potentially dangerous ones.
Use Git To Protect And Review Changes
Version control is important when coding with an agent because Claude Code has no built-in checkpointing for reverting the codebase. After a prompting round produces a working solution, stage the current files with git add ., or select individual files if only some should be staged. Once the changes are in a working state, ask Claude to commit them.
Claude can inspect the changes, conversation context and Git history to select its own work and follow the existing commit-message format. In the demonstrated commit, it summarized the feature additions and included a generated-with-Claude-Code attribution. The auto-approval tool handled many Git commands without prompting.
Add pre-commit checks so Claude receives automated feedback before committing. One setup uses Husky to run compilation checks, linting and quick unit tests, giving Claude errors it can address before the commit goes through.
For work on GitHub, install the plugin through Claude Code and confirm the repository. Setup adds authentication tokens and workflow files for running Claude and conducting code reviews. The review workflow runs when a pull request opens; customize its prompt to concentrate on potential bugs and security concerns and ignore other issues, since the default review can be verbose.
The Claude YAML workflow also lets you mention Claude in GitHub issue or review comments. It uses those comments as context to make changes and update the branch without a local environment. In one issue, the run displayed to-do updates, work performed, key changes and follow-up steps, then supplied a link to create a pull request. With automated tests in place, Claude can iterate in the cloud and return updated code for review, leaving you to merge once checks pass.
Save Task Commands And Use Terminal Shortcuts
For a task-specific workflow that needs extra context, create a command file in the Claude commands folder rather than putting every instruction in the root rules file. Use $ARGUMENTS to pass arguments into it, or include a quoted Bash command prefixed with ! to insert its output. After creating a code-review command, restart Claude Code and select it to review the current working set.
Specialized tasks have another option in custom subagents, introduced in Claude Code version 1.0.60 and configurable through /agents. Separately, the prompt keywords think, think hard, think harder and ultra think trigger different thinking budgets. Try them progressively when Claude is stuck and use them sparingly because they can consume quota quickly. Even a Max-plan user who can use ultra think every time may find that a lower budget is enough; the keywords were rarely needed for codebase problems in Yifan’s experience.
These Claude Code tips also cover terminal input, images and returning to previous work:
- Prefix a Bash command with ! to run it and add its output to Claude’s context.
- Press Ctrl + – to undo terminal input, such as a long line deleted by accident.
- Paste an image with Ctrl + V and ask Claude about it; its vision capabilities can help debug UI errors and reason about element positions.
- Use the add command to give the current instance access to additional directories, including other repositories, where Claude can read and make changes.
- Use claude d-res to return to a specific conversation. The list shows its associated branch, although the summary uses the first message.
- Use claude d-continue to resume the most recent conversation, including a non-interactive session you want to inspect while debugging.
Non-interactive mode is useful for a quick request when you need only the final output rather than the thinking process. It is not necessarily the fastest way to run a simple command: asking Claude for the date runs slower than a traditional command.
We favor pairing automated tests with staged working changes before giving Claude broader responsibilities. Tests provide feedback during implementation, while Git gives you a way to manage the code separately from the conversation history. Auto-accept edits can reduce interruptions for routine work, but the Bash approval prompt is worth planning around if you expect a task to run unattended. For cloud work, review the returned changes and check the results before merging.
The right commands depend on the task, but the same safeguards apply across a local session and a GitHub workflow. Keep project rules focused, preserve useful decisions when moving on from a long conversation, and choose permissions with the environment in mind.
More on Claude:
- Claude Engineer: Set Up Super Cloud and a Claude Code Web GUI
- Claude Code Tips for Models, Queued Tasks and Custom Commands
- Claude Code Hooks: Text Notifications, Tests and GitHub
- SuperClaude Adds Structured Workflows to Claude Code
Media Credit: Yifan
Disclosure: Some of our articles include affiliate links. If you buy something through one of these links, Geeky Gadgets may earn an affiliate commission. Learn about our Disclosure Policy.