Index of every page on this site: llms.txt
All skills
ccusage avatar

/nushell

@7e789e8
by ccusageccusage/ccusage20k stars
934
Run it yourself

Guides ccusage Nushell scripts. Use when adding, editing, formatting, or validating .nu files under .github/scripts, apps/ccusage/scripts, or scripts, including their Nix shebangs and GitHub Actions callers.

Use this Skill: https://skilld.dev/gh/ccusage/ccusage/nushell

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈54 tokens for metadata: the name and description. ≈625 when used: this file.

Description uses 2.7% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈217 characters, or 2.7%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

ccusage Nushell

Script boundaries

Executable Nushell scripts need a pinned Nix shebang and def main. List only tools the script invokes. Resolve --inputs-from relative to the script's directory. Imported modules have neither a shebang nor main.

Scripts invoked directly through nu by the gate workflows, commit hook, or infra fixture suites must run with the caller's toolchain and cannot depend on packages provided only by the script's Nix shebang. Use $"#!($nu.current-exe)" for mock executables in the Linux build sandbox.

Docs

https://www.nushell.sh/book/thinking_in_nu.html

https://www.nushell.sh/book/nushell_map_functional.html

https://www.nushell.sh/book/style_guide.html

Style

Functional style is the default. Treat each of these as a defect to fix:

  • mut + for as an accumulator. Use reduce, each, where, group-by, zip, flatten, insert/update, generate. mut is legitimate only for genuinely sequential state that no filter expresses.
  • String plumbing between steps. Pass records and tables; serialize once at the boundary (to json --raw) and parse once on the way in (from json).
  • Nested if/else chains on a value's shape. Use match, including list patterns and guards.
  • Shelling out for data. Native commands over ^jq, ^sed, ^awk, ^date.
  • Bare each for effects. Say so with | ignore when the result is unused.

Also:

  • Type custom command signatures — parameter types, --flag, and the return type. They document intent and are checked at parse time.
  • run-external for commands whose flags Nushell would otherwise parse; quote short flags such as '-L', '-x', '-c', and keep arguments as lists up to the external boundary.
  • complete when you need exit code, stdout, and stderr without throwing; error make rather than a sentinel return value.
  • Timestamps are datetime and durations are duration; compare and subtract them directly instead of formatting to strings.
  • Progress to stderr for CI scripts whose stdout is a data artifact.

Validation

Validate with the pinned interpreter:

direnv exec . nu --ide-check 10 path/to/script.nu
direnv exec . nu -c 'help <command>'

nix flake check fails on any --ide-check diagnostic in a .nu file (scripts/check-nushell.nu). just fmt runs nufmt over *.nu through treefmt. For behavior changes, invoke the script through its shebang as a smoke check and run the repo check that owns the caller.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    This skill provides guidelines and coding standards for writing Nushell scripts within a repository, utilizing Nix for environment management. It contains standard development workflows and no malicious patterns.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 7e789e8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated yesterday
paths
[
  "**/*.nu"
]
globs
*.nu

README badge

README badge for ccusage/ccusage/nushell