| name | typescript-script-developer |
| version | 1.0.0 |
| description | Write production-ready TypeScript CLI tools, automation scripts, and batch file
processors with strict type-checking — TypeScript 5.x with strict mode tsconfig, ESM,
type-safe argument parsing via node:util parseArgs (with discriminated-union argv
types), structured stderr logging, typed Error subclasses for distinct failure modes,
exhaustiveness checks via 'never', node:fs/promises with branded types where useful,
top-level await, graceful SIGINT/SIGTERM handling, and cross-platform support (Linux,
macOS, Windows). Run scripts via tsx (default), Bun, or Deno; build for distribution
with tsc. Targets Node.js 20 LTS and above plus TypeScript 5.4+. Use this skill whenever
the user asks to create a TypeScript / TS / .ts script, typed Node CLI tool, automation,
batch processor, or data pipeline — including casual phrasings like 'write a typescript
script that ...', 'automate this in ts', 'make me a typed CLI', or 'I need a one-off TS
processor'. Also use when reviewing or hardening an existing TypeScript script.
|
| license | MIT |
| compatibility | claude-code opencode |
| allowed-tools | ["Read","Write","Edit","Grep","Glob","Bash"] |
| metadata | {"author":"MKAbuMattar","requirements":"Node.js 20 LTS or newer, TypeScript 5.4+, on Linux / macOS / Windows. Compatible with Bun 1.x and Deno 2.x via the `node:` import surface."} |
TypeScript Script Developer
Production-ready TypeScript. Strict tsconfig + ESM + parseArgs with discriminated-union argv + typed Error subclasses + exhaustiveness via never + node:fs/promises + graceful signals.
When to use
- The user asks for any
.ts script, typed Node CLI, automation, or batch processor.
- The user wants to harden, refactor, or review an existing TypeScript script.
- A task chain ends in "and put it in a TS script".
Skip this skill for: plain JavaScript scripts (use javascript-script-developer), browser-only code, framework-bound code (Next.js, Express apps), or libraries (different shape).
Required structure
Every script you write starts from this skeleton. Do not omit the entry guard, the typed catch, or the structured error class hierarchy.
#!/usr/bin/env node
import { parseArgs } from "node:util";
import { fileURLToPath } from "node:url";
import process from "node:process";
interface CliArgs {
readonly input: string;
readonly verbose: boolean;
}
abstract class ScriptError extends Error {
abstract readonly kind: string;
abstract readonly exitCode: number;
}
class UsageError {
kind = ;
exitCode = ;
}
verbose = ;
log = {
: (...: []): {
(verbose) process..();
},
: (...: []):
process..(),
: (...: []):
process..(),
} ;
(): <> {
{ values, positionals } = ({
: {
: { : , : },
: { : , : },
},
: ,
: ,
});
(values.) {
;
}
(positionals. !== )
();
: = {
: positionals[]!,
: values. ?? ,
};
verbose = args.;
process.(, process.());
(process. !== )
process.(, process.());
;
}
isEntry = process.[] === (..);
(isEntry) {
()
.( process.(code ?? ))
.( {
(err ) {
log.(err.);
process.(err.);
}
log.(, err ? err. : err);
process.();
});
}