用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/mondaycom/duckdb-claude --skill fix-tidy-errors命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
| name | fix-tidy-errors |
| description | Fix clang-tidy errors that would fail the tidy-check CI stage |
| disable-model-invocation | true |
Identify and fix all clang-tidy errors in the files changed on this branch that would fail the tidy-check CI stage.
Check whether clang-tidy is available:
which clang-tidy || echo "not found"
macOS: Homebrew LLVM is keg-only, so clang-tidy is not on PATH by default even after brew install llvm. Locate it with:
find $(brew --prefix llvm)/bin -name 'clang-tidy' 2>/dev/null
If not installed: brew install llvm. The binary will be at $(brew --prefix llvm)/bin/clang-tidy.
Store this path — you'll need it as TIDY_BINARY in subsequent steps.
Ubuntu/Debian: sudo apt-get install -y clang-tidy. It will be on PATH automatically.
Confirm we are not on main:
git rev-parse --abbrev-ref HEAD
Stop if the result is main.
The tidy build must be configured before running the diff check:
mkdir -p ./build/tidy && cd build/tidy && cmake -DCLANG_TIDY=1 -DDISABLE_UNITY=1 -DBUILD_EXTENSIONS=parquet -DBUILD_SHELL=0 ../..
This only runs cmake configuration (fast). Skip if build/tidy/compile_commands.json already exists.
Run the diff-based tidy check against main. The make variable is GIT_BASE_BRANCH (not DUCKDB_GIT_BASE_BRANCH):
Linux (clang-tidy on PATH):
GIT_BASE_BRANCH=main make tidy-check-diff 2>&1
macOS (clang-tidy is keg-only; system headers require explicit sysroot):
make tidy-check-diff cannot pass the sysroot flag, so invoke the diff script directly:
TIDY_BINARY=$(find $(brew --prefix llvm)/bin -name 'clang-tidy') && \
SDK=$(xcrun --show-sdk-path) && \
git diff origin/main . ':(exclude)tools' ':(exclude)extension' ':(exclude)test' ':(exclude)benchmark' ':(exclude)third_party' ':(exclude)src/common/adbc' ':(exclude)src/main/capi' | \
python3 scripts/clang-tidy-diff.py \
-path build/tidy \
-quiet \
-clang-tidy-binary "$TIDY_BINARY" \
-extra-arg="-isysroot${SDK}" \
-p1 2>&1
macOS note: Without
-extra-arg="-isysroot...", Homebrew LLVM clang-tidy cannot find system headers (<memory>,<sstream>, etc.) and emitsclang-diagnostic-error: file not foundfor every file. These are not real code errors — they are a local toolchain issue. Ignore them if the only errors are system headerfile not founddiagnostics; they will not occur in Linux CI.
Capture the full output. If there are no errors (or only the macOS system-header false positives described above), report success and stop.
From the tidy output, group errors by file and by check name. Each diagnostic line looks like:
src/some/file.cpp:42:10: error: [check-name] message
Common checks and how to fix them:
| Check | Fix |
|---|---|
modernize-use-nullptr | Replace NULL or 0 used as pointer with nullptr |
modernize-use-override | Add override to virtual method overrides; remove redundant virtual keyword |
google-explicit-constructor | Add explicit to single-argument constructors |
google-build-using-namespace | Remove using namespace std; (or other namespaces); qualify names instead |
google-runtime-int | Replace short/long/unsigned long etc. with sized types (int16_t, int64_t, uint64_t, etc.) |
readability-braces-around-statements | Add braces {} around the body of if/else/for/while even for single-statement bodies |
readability-container-size-empty | Replace .size() == 0 / .size() != 0 with .empty() / !.empty() |
modernize-use-bool-literals | Replace integer literals 0/1 used as booleans with false/true |
modernize-use-emplace | Replace .push_back(T(...)) with .emplace_back(...) for smart pointers listed in config |
cppcoreguidelines-pro-type-cstyle-cast | Replace C-style casts (Type)x with static_cast<Type>(x), reinterpret_cast, or duckdb_py_cast as appropriate |
cppcoreguidelines-pro-type-const-cast | Avoid ; redesign to remove the need |
DuckDB-specific conventions (from CLAUDE.md):
unique_ptr over shared_ptr; no raw new/deleteidx_t for indices/counts, [u]int(8|16|32|64)_t for sized integersD_ASSERT for programmer-error assertionsoverride or final on virtual overrides — never repeat virtualFor each file with errors:
Re-run the same tidy command from Step 4 to confirm all errors are resolved. If new errors appear (e.g. from a fix that introduced another violation), fix those too and repeat until clean.
Summarize the fixes made: which files were changed and which checks were resolved.
const_castcppcoreguidelines-rvalue-reference-param-not-moved | Call std::move() on rvalue reference parameters that are passed to functions |
cppcoreguidelines-virtual-class-destructor | Add a virtual destructor to any class with virtual methods |
cppcoreguidelines-slicing | Pass polymorphic objects by pointer or reference, not by value |
hicpp-exception-baseclass | Ensure thrown types inherit from std::exception |
misc-throw-by-value-catch-by-reference | Throw by value, catch by const reference |
performance-* | Fix as described in the diagnostic message |
bugprone-* | Fix as described in the diagnostic message |
readability-identifier-naming | Rename to match convention: CamelCase for classes/functions/enums, lower_case for variables/members/parameters, UPPER_CASE for static constants/enum values/macros, _t suffix for typedefs |
基于 SOC 职业分类