tuya/tuyaopen-dev-skills/code-check
Claude Code and agent skill by tuya/tuyaopen-dev-skills
- community
Checking that the SKILL.md file is still in the repository.
Check C/C++ code formatting, detect Chinese characters, and validate file headers using clang-format and check_format.py. Use when the user mentions code format, lint, clang-format, style check, PR check, or after editing C/C++ files. 代码格式、格式检查、代码风格、PR检查、代码规范。
Install
npx vskill@latest install tuya/tuyaopen-dev-skills/code-checkSKILL.md
TuyaOpen Code Format Check
SDK root: All$OPEN_SDK_PYTHON tools/check_format.pycommands must be run from the TuyaOpen SDK root ($OPEN_SDK_ROOT). The bundledcheck_files.pyscript resolves the SDK root automatically via$OPEN_SDK_ROOTor by walking upward for.clang-format.
Overview
tools/check_format.py validates C/C++ files (.c, .cpp, .h, .hpp, .cc, .cxx) against three rules:
- clang-format compliance — governed by
.clang-formatat the repo root (LLVM-based style with 4-space indent). - No Chinese characters — checks all content including comments and strings. Only English text is allowed in source code.
- Proper file headers — Doxygen-style with
@file,@brief, and@copyright(must include current year + "All Rights Reserved").
Paths listed in .clang-format-ignore are excluded (third-party libraries: cJSON, FlashDB, lwip, coreMQTT, etc.).
Prerequisites
clang-format must be installed. It is included in the system dependencies (sudo apt-get install clang-format). If missing, the format check will be skipped with a warning.
Usage
All commands must be run from the SDK root ($OPEN_SDK_ROOT, where .clang-format lives).
Check specific files (recommended for Agent use)
Supports glob patterns: --files "src/tal_system/**/*.c"
Check a directory recursively
Check all files in current directory (debug mode fallback)
When --debug is used without --files or --dir, it scans the current working directory recursively for all C/C++ files.
PR mode (CI / pre-merge)
Checks files modified relative to a base branch (uses git diff):
Verbose output
Add -v to any mode for detailed information:
Important Notes
--filesand--dirrequire--debugflag — they are ignored in PR mode.- The script locates the SDK root by searching upward for
.clang-format. - Exit code:
0= all checks pass,1= errors found. - Header warnings (suggestions) do not cause failure; only errors do.
Agent Workflow
When editing C/C++ files in this repo:
- Make your changes.
- Check for sensitive information before committing (see below).
- Run the bundled wrapper:
$OPEN_SDK_PYTHON .agents/skills/tuyaopen/code-check/scripts/check_files.py <changed_files>
Or directly: $OPEN_SDK_PYTHON tools/check_format.py --debug --files <changed_files>
- If format errors: run
clang-format -style=file -i <file>to auto-fix, then re-check. - If Chinese character errors: replace Chinese text with English — this applies to comments and strings too, not just identifiers.
- If header errors: ensure the file starts with a proper Doxygen header (see template below). Pay attention to the copyright year.
Sensitive Information Check
Before committing or pushing code, verify that no sensitive information is included:
- Device credentials:
UUID,AuthKey,TUYA_OPENSDK_UUID,TUYA_OPENSDK_AUTHKEY— must use placeholder values (e.g."your_uuid_here"), never real credentials. - Product IDs:
TUYA_PRODUCT_ID— use a placeholder or a development-only PID. - API keys / tokens: any hardcoded cloud API keys, access tokens, or passwords.
- Private keys / certificates: TLS private keys, certificate files, or PEM content embedded in source.
- Network credentials: Wi-Fi SSID/password, server URLs with credentials.
Agent strategy
When generating or modifying code that involves tuya_config.h or similar credential files:
- Always use placeholder values:
"your_uuid_here","your_authkey_here". - Warn the user if real credentials appear to be present (non-placeholder UUIDs/keys that look like actual hex or alphanumeric strings of expected length).
- Never log, print, or include credentials in debug output, comments, or commit messages.
File Header Template
Every .c and .h file must start with a /** comment block containing @file, @brief, @version, @date, and @copyright:
@copyright format: Copyright (c) <start_year>[-<end_year>] <holder> All Rights Reserved. — the year must include the current year (either as start or end year). This is enforced as an error by check_format.py.
What .clang-format-ignore Excludes
The following third-party paths are excluded from formatting checks:
Do not modify these third-party files for formatting. If you add new third-party code, add its path to .clang-format-ignore.
Related
- The
.clang-formatconfig at SDK root defines the full formatting rules (LLVM-based, 4-space indent, brace after control statement, etc.)
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/tuyaopen/code-check/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/tuya/tuyaopen-dev-skills/code-check)