Claude Code and Computer Use
Notes on Claude Code and Computer Use from Anthropic's course on Claude. Covers workflow patterns.
Claude code is a CLI based coding assistant. Computer use is a set of tools that allow Claude to interact with a desktop environment. These both serve as the foundations for agents and allow for:
- Tool integration and usage
- Multi-step task execution
- Environmental interaction
- Autonomous problem-solving
You can use Claude Code for a number of phases in product development, not just writing code:
Typical Workflow
TDD Workflow
We can also use Claude code with a test driven development workflow:
- Feed context into Claude - Same as before, show Claude relevant files
- Ask Claude to think of test cases - Have Claude brainstorm what tests would validate your new feature
- Ask Claude to implement those tests - Select the most relevant tests and have Claude write them
- Ask Claude to write code that passes the tests - Claude will iterate on the implementation until all tests pass
MCP Extensions
You can use custom MCP based tools, or existing ones to enhance how Claude code works:
Automating Development with MCP and Claude Code
An example of automating the development process:
- A Sentry server to fetch production error details
- A Jira server to read ticket requirements
- A Slack server to notify your team when work is complete
- Custom servers for your internal tools and APIs
You can adapt this process by:
- Adjusting the error detection frequency
- Customizing which types of errors to prioritize
- Adding specific debugging instructions for your application
- Integrating with different logging systems
- Setting up notifications for critical issues
Parallelizing with Claude Code
You can run multiple instances to allow parallel execution of a task if the task is decomposable and seperable:
One challenge is file conflicts - this is solved by giving each instance it's own workspace to make isolated changes which are then merged back into main using a typical feature branch workflow:
You can also automate this step using a prompt:
You can also implement this prompt as a custom command:
To create custom commands:
Add a .md file to .claude/commands
Put your prompt inside the file
Use $ARGUMENTS as a placeholder for dynamic values
Run with /project:filename argument
For example, /project:create_worktree feature_b
would create a worktree named "feature_b".
Typical Parallel Workflow
- Create multiple worktrees for different features
- Launch Claude Code in each workspace
- Assign different tasks to each instance
- Let them work in parallel
- Commit changes when each task completes
- Merge all branches back to main
You can then also use a prompt to handle the merging and handle any conflicts:
Computer Use
Useful for things like:
- Automated QA testing of web applications
- Data entry and form filling
- Website navigation and information gathering
- UI testing and validation
- Repetitive desktop tasks
Runs in it's own isolated docker container, you interact with Claude via chat and watch the container.
Uses the same kind of flow as a regular tool where you register schemas and the LLM sends a response back to you telling you how to use the tool.
The container can run anything that supports:
- key - Press keyboard keys
- mouse_move - Move the cursor
- left_click - Click at specific coordinates
- screenshot - Take a screenshot
- scroll - Scroll the screen