Claude Official AI Programming Tutorial: Lowest Level Design and Highest Level Techniques

Deeply explore the underlying logic and advanced techniques of AI programming. The official tutorial of Claude Code will take you to appreciate the charm of AI programming.
Core content:
1. Claude Code's original model capabilities and AI programming best practices
2. Creation of CLAUDE.md files and understanding of optimized project environment
3. Deep integration of Claude Code and GitHub and AI programming workflow
The article "Claude Code: Best practices for Agentic coding" from Claude official has a bombshell opening.
Claude sticks to his usual style and never plays those empty tricks!
It clearly tells Claude Code that this AI command line tool uses the most basic, low-level, uninitiated and primitive model capabilities.
Then let’s get straight to the point: the most effective tips and tricks for AI programming.
Although it is about Claude Code, the thoughts and ideas about all AI programming are consistent. I have excerpted some of the content that I think is more useful and universal.
CLAUDE.md is a special file that Claude automatically extracts into the context when starting a conversation, similar to Cursor Rule.
Similar to the Cursor Rules principles and best practices mentioned yesterday
There is no required format for CLAUDE.md files. The official recommendation is to keep them concise and readable. For example:
# Bash commands - npm run build: Build the project - npm run typecheck: Run the typechecker # Code style - Use ES modules (import/export) syntax, not CommonJS (require) - Destructure imports when possible (eg. import { foo } from 'bar') # Workflow - Be sure to typecheck when you're done making a series of code changes - Prefer running single tests, and not the whole test suite, for performance
The above is a template of a Claude.md file, which is used to help Claude better understand the project environment, code style, and work habits, so as to provide more accurate and context-aware suggestions in the conversation.
Of course, it is not fixed and can be modified and expanded according to the actual situation of the project.
What should be filled in? Claude officials give the following directions.
The most recommended approach is to put CLAUDE.md in the root directory of the code repository and submit it to Git. This way, Claude can automatically load the context you set every time it runs, and team members can also share this configuration.
Next up is a deep integration of Claude Code with GitHub, primarily through the gh CLI .
You can say to Claude: "Please create a PR for this change and write a suitable commit message."
Claude will read the diff, generate a commit message, push the code, and create a PR via gh.
For detailed installation instructions of GH CLI, please click here: gh installation and use
Here comes the highlight, Claude’s AI programming workflow.
1. Overview of the project
Have Claude read the relevant file, image, or URL, providing a general pointer ("read the file that handles logging") or a specific file name ("read logging.py"), but explicitly telling it not to write any code yet.
In other words: you can let Claude understand the background of the problem first, such as asking it to read code, pictures or web pages; you can use vague descriptions or directly give the file name.
But the point is: you have to clearly tell Claude "don't write code now", let him just read and understand first.
This is the first step recommended by Claude Code to establish context and avoid it entering the coding stage too early. Especially when dealing with complex problems, this practice can improve Claude's accuracy and efficiency.
2. Deep thinking
This official article is mainly about Claude Code, and it is very convoluted.
In fact, to put it bluntly, it is to let you develop and evaluate various plans, analyze the pros and cons, and finally come up with a detailed implementation plan before you officially start writing pre-code. And at this step, start to establish git version control checkpoints.
3. Plan formulation
Have Claude implement his solution in code. This is also a good place to ask him to explicitly verify the sanity of his solution as he implements the various parts of it.
4. Test Driven Development
Test-driven development (TDD) becomes more powerful through proxy coding, through unit, integration, or end-to-end testing.
Unfortunately, I just happened to write this kind of article:
Marketing accounts are all teaching you to write Snake 2048, but I want to talk to you about real programming practice, practicing TDD in Cursor
This is a way of working that Anthropic officially recommends, and is suitable for changes that can be easily verified by testing (such as unit tests, integration tests, and end-to-end tests). Its process is as follows:
1. Let Claude write tests based on expected input/output, and tell Claude explicitly that you are doing test-driven development (TDD), so that Claude will not write "fake implementations" or "mock code" in advance, even if the functionality does not exist yet.
2. Run the tests and confirm failures. Tell Claude to run the tests and confirm that they fail. Instruct it explicitly not to write any implementation code at this stage. This ensures that the tests are valid and have not been "falsely passed" by the implementation code.
3. Write implementation code until the test passes Tell Claude: Write the implementation code now, but don't modify the test.
4.Claude will start iterative development: write code > run tests - fix errors > test again.
Generally, several iterations are required until all tests pass.
If you are satisfied with the test logic, you can ask Claude to commit the test code to the repository.
Claude works best when there are clear goals (such as test cases). By using test-driven development, you can make Claude output correct code more consistently. This process is particularly suitable for tasks that require "small changes but correctness must be ensured", such as fixing bugs, adding small features, and refactoring.
Optimize your workflow
Finally, the official gave some tips on using Claude Code, such as clear instructions, rational use of images, files and URLs, timely correction of directions, and use of checklists and staging areas.
Specifically, more specific instructions can help Claude understand the task more accurately; providing screenshots, file paths, or links can enhance contextual understanding.
Through these methods, users can not only complete tasks more efficiently, but also better guide Claude to become a true collaborative partner.