How to use AI Review of MicroPython Code with Claude: Step-by-Step Guide for Beginners #19056
leezisheng
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
link:https://f1829ryac0m.feishu.cn/wiki/QXmSwHygFikcNJkR5rcc1NZrnTg

1. Preparatory Work: Installation of Claude Code
.msiformat), double-click to run the installation, and keep clicking "Next" throughout the installation process, ensuring that you check the box for 「Add to PATH」 (automatically adds environment variables, no need for manual configuration).Claude Code 0.2.10indicates successful installation2. Open Claude
Claude:3. Install the MicroPython Code Reviewer Skill
4. Usage Instructions
4.1 Review the current change
claudeand press Enter to enter Claude Code. Meanwhile, enter the following command (copy and paste directly) to trigger code review:the G:\GraftSense-Drivers-MicroPythondirectory, then executegit diff HEADThe function of git diff HEAD: View all uncommitted code changes in the current working directory/staging area relative to the latest commit HEAD, that is, the code you have modified but have not yetcommitted)Claude Coderuns in a Bash terminal environment (such asGit Bash,WSL), rather than the native WindowsCMD/PowerShell, as the path formats of the two systems are completely incompatible:WindowsusesG:\xxx(drive letter + backslash), but Bash only recognizesUnixstyle/g/xxx(G drive corresponds to/g/), and the backslash\is an escape character inBash, which will directly result in parsing failure.GraftSense-Drivers-MicroPython#(ending with#), but the path generated byAImissed this#, so the directory cannot be found even if the format is correct.Tabkey as prompted at the bottom of the interface to enter the command editing mode; modify the path to theBashformat that exactly matches the actual folder name:sensors/dps310_driver/code/main.py, which is a pure format/style adjustment, has no impact on functionality, complies withPEP 8coding standards, and there are no issues that need to be fixed.TARGET_DPS310_ADDRS.claude/settings.local.jsontool configuration file (no code review issues) and the modification of thesensors/dps310_driver/code/main.pyfile, where inmain.py, theTARGET_DPS310_ADDRSconstant (with a value of[0x76, 0x77]) was accidentally deleted and replaced with 3 consecutive blank lines.NameErrorat runtime;MicroPythonandPEP 8(at most 2 blank lines should be retained between top-level code sections). At the same time, it is recommended to restore this constant and confirm its usage in the downstream code before deletion.4.2 Review a specified local Commit
motor_drivers/opto_mos_driver/code/main.py, which is a pure whitespace adjustment and has no functional impact onMicroPythonmemory management,ESP32/RP2040platform portability, or driver performance. The code style complies withPEP 8specifications, has no issues, and is a risk-free format cleanup operation, most likely triggered by the delimiter matching fix incode_checker.py.4.3 Review all changes under the specified folder/directory
drivers/gt911/,modules/) to avoid the redundancy of full project review.22f328d) for thesensors/directoryMicroPythondriver code review results show that this commit only modified theBH1750_driver/package.jsonfile: simplified the package name frombh1750_drivertobh1750, and upgraded the version number from1.0.0to1.0.1; Review and confirm that the package name complies with the naming convention (short, lowercase, no underscores) of theMicroPythonpackage registry, that version upgrades follow semantic versioning rules, that it is a pure metadata update without modifying the driver code, and that it has no impact on memory management, portability, or performance. It is a clean and compliant optimization with no issues.4.4 Usage Notes: Unable to review multiple files
5. How to Review Others' Code in the Fork+PR Development Model
a94e883of PR 96, and Claude recognizes that this is a "1MB large commit, modifying 182 files":Claudeselects typical sensor drivers for in-depth local reading:CDS1081lacksdeinit(), which will continuously leak UART resources on ESP32 / RP2040 and must be manually added.Version History
Beta Was this translation helpful? Give feedback.
All reactions