一键导入
write-script-nushell
Nushell script writing guidelines: idioms, types, entry point, error handling. Auto-load when writing or reviewing Nushell (.nu) scripts.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Nushell script writing guidelines: idioms, types, entry point, error handling. Auto-load when writing or reviewing Nushell (.nu) scripts.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Token-efficient man page reading. Load when looking up CLI tool docs, flags, options, usage examples, config formats. Do NOT use bash to run `man` directly without loading this skill first.
Load when user asks to create, update, edit, or refactor any OpenCode (OC) artefact: skills, agents, commands, tools, plugins, or snippets — including modifying an existing one. Triggers examples: "create skill to …", "draft a command to …", "add Y to OC cmd Z", "edit the W agent", "write a plugin to …", "create a tool for …", "update crafter skill". Guides user through discovery, drafting, and iterative refinement.
Methodology for drafting technical design specs. Load when asked to write, draft, or refine a spec, design doc, architecture note, RFC, or similar document for a system, API, protocol, or subsystem.
Load ONLY when user explicitly invokes /reflect-friction or directly asks to review session friction (e.g. "review friction", "what went wrong", "where did you push back"). Do NOT auto-load speculatively.
General script writing guidelines: structure, naming, error handling, and organization. Language-agnostic. Auto-load when writing or reviewing any script. Language-specific skills (write-script-bash, write-script-bats) build on top of this.
Load whenever new files or directories are created in a git repo — via write, bash, or any other tool. Ensures `git_track_new_file` is called so new files are git-tracked for the user.
| name | write-script-nushell |
| description | Nushell script writing guidelines: idioms, types, entry point, error handling. Auto-load when writing or reviewing Nushell (.nu) scripts. |
| metadata | {"maintainers":["bew"]} |
Write Nushell scripts using native idioms: typed parameters, structured data, and proper error handling.
NOTE: Load write-script-generic skill first — it defines the shared structure, naming conventions, and error-handling rules this skill builds on.
#!/usr/bin/env nu as shebang.def main [...] { ... } with typed, documented parameters.name: string, items: list<string>, count?: int).def — nushell uses it as the command's help text.let for immutable locals, mut for mutable locals.const for compile-time constants.error make { msg: "..." } to signal errors — never echo + exit.$env.VAR? (returns null if unset, no crash).$env.FILE_PWD for the script's own directory — not a $SCRIPT_DIR workaround.$data | each { ... }) over imperative loops when natural.$in to receive piped input inside a def; declare the pipeline signature
with : inputtype -> outputtype for clarity.let over mut — reach for mut only when re-assignment is truly needed.--flag-name parameters in the def signature, not parsed manually.#!/usr/bin/env nu
# [optional: const declarations for compile-time constants]
const SOME_CONST = "value"
# Helper: short description of what this does
def helper-name [param: string]: nothing -> string {
# ...
}
# Entry point: description of the script and its arguments
def main [
required_arg: string # what this arg means
optional_arg?: int # optional, defaults to null
--flag # boolean flag
]: nothing -> nothing {
# ...
}
# Good — typed, documented
def process [
path: string # file to process
mode?: string # "fast" or "careful" (default: "fast")
--verbose # enable verbose output
]: nothing -> nothing { ... }
# Bad — untyped, undocumented
def process [path mode] { ... }
No dedicated Nushell testing skill exists yet. Ask the user how they want tests structured before writing any.
# Good
if not ($path | path exists) {
error make { msg: $"File not found: ($path)" }
}
# Bad
print $"Error: file not found"
exit 1