cpp-create-file
Use it to create a new C++ file
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- cpp-create-file
- description
- Use it to create a new C++ file
02 资源文件 1
- 资产文件assets/source_header.cpp214 B
03 SKILL.md 正文
Instructions to create a C++ header or source file, in the path <source-path> with name <filename> This skill is intended to be used in C++ projects only.
Required parameters:
- <source-path> : the path where the new C++ source file will be created.
- <filename> : the name of the C++ source file to create, including either the .h or the .cpp extension
Steps to create a new C++ file
Check whether the file already exists
If the file already exists, stop and notify the user that the file will not be overwritten.
Check whether the directory <source-path> already exists
If <source-path> does not exist, create it before creating the file.
Ask for confirmation to the user
Before adding the file, ask confirmation to the user, saying: "About to create the file <source-path>/<filename> . Proceed?"
If the user denies, stop immediately.
Find environment information
Username
The username of the current user is required to populate the file header. Use the skill /utils-get-username to retrieve the username. Assign the username to the variable [username] .
Create the file header
Before creating the C++ source file, read assets/source_header.cpp relative to this SKILL.md.
Read the contents of assets/source_header.cpp into a variable called header.
In header substitute [username] with the username found at the step before.
In the new C++ source file, replace every occurrence of the string [username] in the header variable with the retrieved username.
Create the C++ source file
Create a file with filename <source-path>/<filename>
The C++ source file must contain the header
[header]
04 同仓库更多 Skills
utils-get-username
Use it to get the name of the user running the skill.
sparring-partner
When I plan a task, act like a sparring partner.
rs-create-lib
暂无简介
rs-create-lib-mod
Use with Rust, to create a new module in the project library.
rs-create-file
Use it to create a new Rust source file
rs-add-lib-mod-file
Use it to create a Rust source file in a library module