TLDR;
This video explains how to effectively use Claude for coding by following the "explore, plan, code, and commit" workflow. It emphasizes the importance of using plan mode to gather research and create a plan of action before writing any code. The video also covers how to provide Claude with the right tools and context, such as a test suite and the Claude and Chrome extension, to help it complete its goals. Finally, it provides tips on testing, reviewing, and committing code with Claude's assistance.
- Follow the "explore, plan, code, and commit" workflow.
- Use plan mode to gather research and create a plan of action before writing any code.
- Provide Claude with the right tools and context, such as a test suite and the Claude and Chrome extension.
- Test, review, and commit code with Claude's assistance.
Explore, Plan, Code, and Commit Workflow [0:03]
The most effective way to use Claude for coding is to follow the workflow: explore, plan, code, and commit. Many users directly ask Claude to write code, which often leads to more corrections later. The explore phase helps Claude gather relevant context about the project. The plan phase involves creating a detailed plan of action that Claude can use to determine if it is successful. The code phase is the iterative process of collaboration between the user and Claude to achieve the final outcomes of the plan. Finally, the commit phase involves reviewing and pushing the code to start working on the next feature.
Plan Mode for Research and Planning [0:21]
Plan mode is the fastest way to handle the explore and plan phases. In plan mode, Claude can read files to gather research but cannot edit them. To enter plan mode, use shift and tab until you see the plan mode option. For example, you can ask Claude to add WebP conversion to an image upload pipeline, figure out where it should happen, identify necessary dependencies, and determine the best approach. Claude will then read relevant files, conduct web searches, and provide a plan of action. Review the plan to ensure it meets your criteria and revise it as needed. Correcting the plan at this stage is more efficient because no code has been written yet. You can also use explore without being in plan mode by simply asking Claude to explore your codebase.
Approving and Guiding the Plan [1:11]
Once the plan looks good, you can approve it to allow Claude to proceed. Claude can automatically accept file edits or ask for approval each time. Claude will attempt to troubleshoot the codebase before finalizing the plan, but sometimes course correction is necessary. The benefit of using plan mode is that you have the context of how Claude arrived at its results, which helps guide its next decision. To ensure Claude is confident in its results, be explicit about what you consider correct when writing your plan.
Adding Tools and Context for Better Results [1:49]
Adding tools that help Claude complete its goals reduces back-and-forth communication. For web UI development, use the Claude and Chrome extension so Claude can control a tab and test the UI before finishing. Include a test suite in your project that Claude can continuously validate. Claude can also write tests for you. Ensure the tests are a reliable source of truth for your team to avoid false positives. If Claude repeatedly encounters the same issues, ask it to save the solution to a Claude MD file.
Testing, Reviewing, and Committing Code [2:25]
After testing and confirming that you are satisfied with the results, it is time to push your code. Before committing, use a sub-agent code reviewer to examine your code. Then, have Claude generate a commit message in your preferred style. Repeat this process for each feature.