Skip to content
Skills Library
Programming · Building & coding

bun-script

/bun-script

Use when writing a TypeScript script with Bun. Covers the template, conventions, and required patterns.

Licence
MIT
Last repository change
27.10.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
2
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 2 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: assets/template-complex.ts, assets/template-simple.ts

What it does and when to use it

Use when writing a TypeScript script with Bun. Covers the template, conventions, and required patterns.

Original author description

Use when writing a TypeScript script with Bun. Covers the template, conventions, and required patterns.

How it works

  1. Template
  2. Conventions
  3. Required patterns
Original SKILL.md headings · 42 lines, 334 words
SKILL.md preview
---
name: bun-script
description: Use when writing a TypeScript script with Bun. Covers the template, conventions, and required patterns.
---

## Template

Two templates cover the two kinds of scripts. Copy the right one exactly and fill in the specific logic.

- **Simple:** Scripts intended to be run directly by a user. These typically take either no arguments or a single positional argument. Start from [`assets/template-simple.ts`](assets/template-simple.ts). It shows the one-argument form; if the script takes no arguments, delete the argument check and keep the top comment.
- **Complex:** Scripts capable of taking multiple arguments via flags. Skill scripts should _always_ be considered complex scripts. Start from [`assets/template-complex.ts`](assets/template-complex.ts). These always support `--help`.

## Conventions

- File: `<name>.ts` with kebab-case (e.g., `extract-pr-number.ts`)
- Make the file executable (`chmod +x`)
- Flag-based arguments using `--flag-name` (kebab-case). Only use positional args for very simple cases.
- Arguments are always required. Never make script arguments optional unless the user _explicitly_ asks for it.
- Variable names use camelCase (`outputDirectory`, not `output_directory`)
- Full variable names (`directory`, not `dir`)
- Call other commands with their long flags (`--session=main`, not `-s main`), so the call reads without knowing the command
- Exit `0` for success, `1` for errors
- stdout for primary output, stderr for errors/warnings/progress messages
- Let a call throw and crash instead of wrapping it in `try`/`catch`. Only add explicit handling when the failure is actually likely or needs a clearer message than the default stack trace.

## Required patterns

Always:

- `#!/usr/bin/env bun` shebang
- All error messages must start with `Error: ` and go to stderr via `console.error`
- `process.exit(1)` on error

Simple scripts:

- A top comment describing what the script does
- No `--help` flag
- If it takes an argument, print a usage message to stderr and exit `1` when the argument is missing

Complex scripts:

- Use `cleye` for argument parsing (auto-generates `--help` and separates unknown flags into `argv.unknownFlags`)
- Invalid options must print `Error: The option --<option> is invalid.`
- Validate required flags with explicit checks (cleye does not enforce required flags)
- Use `argv.showHelp()` to print help after error messages
Files in this package (3)
  • SKILL.md 2 KB
  • assets/template-complex.ts 1 KB
  • assets/template-simple.ts 1 KB

Versions

The database has no other skills named bun-script.

Database snapshot: 13.11.2026 · package version 3a0e0f76a855 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 85bun
    Bun runtime patterns. Use when running bun commands, working with package.json/bun.lock, writing TypeScript scripts under Bun, or developing Claude Code plugins.
  • 95write-script-bun
    MUST use when writing TypeScript scripts. Bun is the default and preferred TypeScript runtime — pick it for TypeScript unless the script specifically needs Deno.
  • 96testing-bun
    Use when writing or modifying tests in a Bun project
  • 100bun-file-io
    Use for Bun file I/O: Bun.file, Bun.write, streams, directories, glob patterns, metadata.
  • 90bash-script
    Use when writing or editing a Bash script (a `.sh` file or one with a Bash shebang). Covers the template, conventions, and required patterns.
  • 100bun-nextjs
    This skill should be used when the user asks about "Next.js with Bun", "Bun and Next", "running Next.js on Bun", "Next.js development with Bun", "create-next-app with Bun", or building Next.js applications using Bun as the runtime.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.