rs-create-file
Use it to create a new Rust source file
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- rs-create-file
- description
- Use it to create a new Rust source file
02 资源文件 1
- 脚本assets/source_header.rs212 B
03 SKILL.md 正文
Instructions to create a Rust source file in the path <source-path> with name <filename> This skill is intended to be used in Rust projects only.
Required parameters:
- <source-path> : the path relative to the src directory where the new Rust source file will be created.
- <filename> : the name of the Rust source file to create, without the .rs extension.
Steps to create a new Rust file
Locate the Rust project
This skill is intended to be used in Rust projects only. The module is created in a Rust project. If it not clear, ask the user which is the Rust project root directory and use it to locate the src directory; the one containing the files Cargo.toml and Cargo.lock.
Ask for confirmation to the user
Before adding the file, ask confirmation to the user, saying: "About to create the file src/<source-path>/<filename>.rs . 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 Rust source file, read assets/source_header.rs relative to this SKILL.md.
Read the contents of assets/source_header.rs into a variable called header.
In header substitute [username] with the username found at the step before.
In the new Rust source file, you will replace [header] with the contents of assets/source_header.rs.
Create the Rust source file
Create a file with filename src/<source-path>/<filename>.rs relative to the current Cargo project.
The Rust source file must have the following content:
[header]
use namefn::namefn;
/*
//------------------------------------------------------------------------------------------------
#[namefn]
fn my_function() {
}
*/
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-add-lib-mod-file
Use it to create a Rust source file in a library module
roll-dice
Roll dice using a random number generator. Use when asked to roll a die (6, 20, etc.), roll dice, or generate a random dice roll.