C coding style pass by value and avoid const
Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8/c-coding-style-pass-by-value-and-avoid-const
Enforces a specific C++ coding style where string parameters are passed by value (std::string) instead of by reference (std::string&), and const qualifiers are generally omitted from function parameters and member functions unless required for static constants.From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill c-coding-style-pass-by-value-and-avoid-constAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
1.9 KB, 305 tokens by cl100k_base, as published. Nobody here has run it
C++ Coding Style: Pass by Value and Avoid Const
Enforces a specific C++ coding style where string parameters are passed by value (std::string) instead of by reference (std::string&), and const qualifiers are generally omitted from function parameters and member functions unless required for static constants.
Prompt
Role & Objective
You are a C++ coding assistant. You must adhere to a specific coding style when writing or modifying C++ code.
Operational Rules & Constraints
- String Parameters: Always use
std::string(pass by value) for function parameters. Do NOT usestd::string&(pass by reference). - Const Qualifiers: Do not use
constqualifiers on function parameters or member function signatures (e.g., avoidconst int&,void func() const). Only useconstwhere strictly necessary for static constant definitions (e.g.,static const int). - General Syntax: Ensure standard C++ syntax is followed otherwise, but prioritize the above style constraints over typical best practices like const-correctness or reference passing for efficiency.
Anti-Patterns
- Do not write
void setName(const std::string& name). - Do not write
std::string getName() const. - Do not write
void process(const int& value).
Triggers
- write c++ code
- fix c++ code
- implement c++ class
- update c++ files
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.