基于 SOC 职业分类
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/SWMFsoftware/FLEKS --skill code-cleanup命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
Create new compiled .cpp/.h files or selectable FLEKS user source templates following project conventions
Compile FLEKS standalone or as an SWMF component, build the converter, and regenerate compile_commands.json
Build documentation from code comments and LaTeX sources
| name | Code Cleanup |
| description | Find unused variables, check formatting, apply fixes following FLEKS coding standards |
This skill performs code cleanup tasks following FLEKS coding standards.
From docs/Coding_standards.md:
shared_ptr or unique_ptr, avoid raw newPascalCase (e.g., GridUtility.cpp)PascalCase (e.g., FluidInterface)camelCase (e.g., nCellPerPatch)snake_case (e.g., apply_float_boundary)using namespace amrex allowed only in .cpp filesnullptr, not NULLconst when possibleThe project uses .clang-format with Mozilla-based style (2-space indent,
80-column limit).
clang-format -i src/FileName.cpp
Use the project's formatting script, which handles both C++ and Fortran in one pass:
python3 tools/format_all.py
This is also required before submitting a PR (see CONTRIBUTING.md).
find src include -name "*.cpp" -o -name "*.h" | xargs clang-format -i
clang-format --dry-run -Werror src/FileName.cpp
For .f90/.F90 files in srcInterface/, use findent configured
to match Emacs' f90-mode indentation:
findent < srcInterface/PC_wrapper.f90 > /tmp/formatted.f90
diff srcInterface/PC_wrapper.f90 /tmp/formatted.f90
The default C++ flags already include -Wall -Wextra -Wno-unused-parameter.
Build and review compiler warnings:
make LIB -j8 2>&1 | grep -i 'warning.*unused'
Or use clang-tidy on a specific file:
clang-tidy src/FileName.cpp -p compile_commands.json
new Usagegrep -rn '\bnew\b' src/ include/ --include="*.cpp" --include="*.h"
NULL Usage (should be nullptr)grep -rn '\bNULL\b' src/ include/ --include="*.cpp" --include="*.h"
using namespace in Headersgrep -rn 'using namespace' include/ --include="*.h"
Look for:
snake_casecamelCasePascalCase# Preview changes
grep -rn '\bNULL\b' src/ include/ --include="*.cpp" --include="*.h"
# Apply fix (carefully review first!)
find src include \( -name "*.cpp" -o -name "*.h" \) -exec sed -i '' 's/\bNULL\b/nullptr/g' {} +
find src include \( -name "*.cpp" -o -name "*.h" \) -exec sed -i '' 's/[[:space:]]*$//' {} +
for f in src/*.cpp include/*.h; do
[ -n "$(tail -c1 "$f")" ] && echo >> "$f"
done
When reviewing cleanup changes:
make LIB -j8)const used where applicablesrcInterface/ are also properly indentedFor cleanup commits, use conventional commit format:
refactor: remove unused variables in Pic.cpp
- Removed unused `tempVar` variable
- Fixed NULL → nullptr
- Applied clang-format