Deno
Overview
Deno is a secure JavaScript/TypeScript runtime with built-in tooling including a formatter, linter, test runner, and bundler. It features a permissions model that restricts file, network, and environment access by default, native TypeScript support without transpilation, and full web standards compatibility.
Instructions
- When creating servers, use
Deno.serve() for high-performance HTTP handling with Web Standards Request/Response, and enable parallel workers with deno serve --parallel for multi-core utilization.
- When configuring security, specify permissions explicitly (
--allow-read, --allow-net, --allow-env) scoped to specific paths, hosts, or variable names. Never deploy with --allow-all.
- When managing dependencies, use JSR (
jsr:) for versioned, type-checked packages, npm: specifier for npm packages, and configure import maps in deno.json for clean paths.
- When writing tests, use
Deno.test() with @std/assert assertions, @std/testing for mocking, and deno test --coverage for coverage reports. Deno's sanitizers detect resource leaks automatically.
- When building CLI tools, use
deno compile to produce standalone executables that cross-compile for Linux, macOS, and Windows with no runtime dependency.
- When deploying to the edge, use Deno Deploy with Deno KV for key-value storage,
Deno.cron() for scheduled tasks, and queues for background processing.
- When using Deno KV, structure keys hierarchically (
["users", id, "profile"]), use atomic() for transactions, and configure TTL with expireIn for automatic expiration.
Examples
Example 1: Build a REST API with Deno KV
User request: "Create an API with Deno that stores data in Deno KV"
Actions:
- Create HTTP server with
Deno.serve() and route matching
- Open KV store with
Deno.openKv() and define key structure
- Implement CRUD operations using
kv.get(), kv.set(), and kv.atomic()
- Set explicit permissions in
deno.json task definitions
Output: A secure API with embedded key-value storage, ready for Deno Deploy.
Example 2: Compile a CLI tool for distribution
User request: "Create a Deno CLI tool that can be distributed as a single binary"
Actions:
- Build the CLI with argument parsing using
@std/cli
- Add file and network permissions scoped to required resources
- Write tests with
Deno.test() and run with deno test
- Compile to standalone binaries with
deno compile --target for each platform
Output: Cross-platform standalone executables with no runtime dependency.
Guidelines
- Always specify permissions explicitly in production; never deploy with
--allow-all.
- Use
deno.json imports map for clean import paths instead of raw URLs.
- Prefer JSR (
jsr:) over URL imports for versioned, type-checked, immutable packages.
- Use
npm: specifier for npm packages instead of CDN URLs.
- Run
deno fmt and deno lint in CI for zero-config formatting and linting.
- Use
Deno.serve() over third-party frameworks for simple APIs; it is faster and lighter.
- Compile to standalone binary with
deno compile for distribution with no runtime dependency.
1---2name: deno3description: >-4 Assists with building secure JavaScript and TypeScript applications using the Deno runtime.5 Use when creating servers, CLI tools, or scripts with Deno's built-in tooling, permission model,6 and web standards APIs. Trigger words: deno, deno deploy, deno serve, deno kv, deno permissions,7 secure runtime, jsr.8license: Apache-2.09compatibility: "Requires Deno runtime installed"10metadata:11 source: https://skillmd.com/skills/eliferjunior/deno12 author: terminal-skills13 version: "1.0.0"14 category: development15 tags: ["deno", "typescript", "runtime", "secure", "web-standards"]16---1718# Deno1920## Overview2122Deno is a secure JavaScript/TypeScript runtime with built-in tooling including a formatter, linter, test runner, and bundler. It features a permissions model that restricts file, network, and environment access by default, native TypeScript support without transpilation, and full web standards compatibility.2324## Instructions2526- When creating servers, use `Deno.serve()` for high-performance HTTP handling with Web Standards Request/Response, and enable parallel workers with `deno serve --parallel` for multi-core utilization.27- When configuring security, specify permissions explicitly (`--allow-read`, `--allow-net`, `--allow-env`) scoped to specific paths, hosts, or variable names. Never deploy with `--allow-all`.28- When managing dependencies, use JSR (`jsr:`) for versioned, type-checked packages, `npm:` specifier for npm packages, and configure import maps in `deno.json` for clean paths.29- When writing tests, use `Deno.test()` with `@std/assert` assertions, `@std/testing` for mocking, and `deno test --coverage` for coverage reports. Deno's sanitizers detect resource leaks automatically.30- When building CLI tools, use `deno compile` to produce standalone executables that cross-compile for Linux, macOS, and Windows with no runtime dependency.31- When deploying to the edge, use Deno Deploy with Deno KV for key-value storage, `Deno.cron()` for scheduled tasks, and queues for background processing.32- When using Deno KV, structure keys hierarchically (`["users", id, "profile"]`), use `atomic()` for transactions, and configure TTL with `expireIn` for automatic expiration.3334## Examples3536### Example 1: Build a REST API with Deno KV3738**User request:** "Create an API with Deno that stores data in Deno KV"3940**Actions:**411. Create HTTP server with `Deno.serve()` and route matching422. Open KV store with `Deno.openKv()` and define key structure433. Implement CRUD operations using `kv.get()`, `kv.set()`, and `kv.atomic()`444. Set explicit permissions in `deno.json` task definitions4546**Output:** A secure API with embedded key-value storage, ready for Deno Deploy.4748### Example 2: Compile a CLI tool for distribution4950**User request:** "Create a Deno CLI tool that can be distributed as a single binary"5152**Actions:**531. Build the CLI with argument parsing using `@std/cli`542. Add file and network permissions scoped to required resources553. Write tests with `Deno.test()` and run with `deno test`564. Compile to standalone binaries with `deno compile --target` for each platform5758**Output:** Cross-platform standalone executables with no runtime dependency.5960## Guidelines6162- Always specify permissions explicitly in production; never deploy with `--allow-all`.63- Use `deno.json` imports map for clean import paths instead of raw URLs.64- Prefer JSR (`jsr:`) over URL imports for versioned, type-checked, immutable packages.65- Use `npm:` specifier for npm packages instead of CDN URLs.66- Run `deno fmt` and `deno lint` in CI for zero-config formatting and linting.67- Use `Deno.serve()` over third-party frameworks for simple APIs; it is faster and lighter.68- Compile to standalone binary with `deno compile` for distribution with no runtime dependency.