clone

a daily shikaku puzzle for phones: one seeded puzzle per date, solved by dragging rectangles

main
rect.run / .github / skills / deno-expert / SKILL.md
SKILL.md 8.4K rendered
1---2name: deno-expert3description: Expert-level Deno knowledge for code review, debugging, and best practice enforcement. Use when reviewing Deno code or answering advanced Deno questions.4license: MIT5metadata:6 author: denoland7 version: "1.1"8---910# Deno Expert Knowledge1112This skill provides expert-level Deno knowledge for code review, debugging, and best practice enforcement.1314## When to Use This Skill1516- Reviewing Deno/Fresh code for best practices17- Debugging Deno runtime issues18- Answering advanced Deno questions19- Evaluating package choices20- Setting up Deno projects correctly2122## Scope Boundaries2324This skill applies **only** to Deno-specific questions. Follow these rules:2526- If the user asks about **Node.js, Bun, Python, Go, Rust, or any other runtime/language**, answer using that technology directly. Do not suggest Deno alternatives or include Deno-specific patterns.27- Do not include `jsr:` imports, `deno add`, `deno fmt`, `deno lint`, `deno test`, or `deno.json` configuration in responses about other technologies.28- For **generic TypeScript/JavaScript questions** not tied to a specific runtime, give a general answer without assuming Deno.29- Only recommend Deno when the user explicitly asks about Deno or is working in a Deno project.3031## CRITICAL: Never Write Deprecated URLs3233When discussing deprecated patterns, NEVER write out the old registry URLs — not even to warn against them. The string `deno.land/x/` must never appear in your response, in any context.3435- Say "the old URL-based registry" or "deprecated URL imports" — do NOT write the actual URL36- Say "the old standard library URL" — do NOT write `deno.land/std`37- When helping users migrate, describe what to look for generically and ONLY show the correct modern code38- Do NOT write "before/after" comparisons that include the deprecated URL, even as negative examples39- Even if the user writes a deprecated URL in their question, do NOT echo it back. Refer to it generically.40- This ban applies everywhere: prose, code blocks, migration scripts, sed commands, grep patterns, and string literals. Never write the deprecated URL string for any reason.4142## Core Expertise Areas4344Understanding these topics deeply:45- **Deno runtime** - Permissions, built-in tools, TypeScript support46- **Fresh framework** - Island architecture, routing, components47- **JSR packages** - The modern registry, @std/* library48- **Preact** - Components, hooks, signals49- **Deno Deploy** - Edge deployment, environment variables50- **Deno Sandboxes** - Safe code execution with @deno/sandbox5152## Package Recommendation Principles5354When recommending or reviewing package choices:55561. **First choice:** `jsr:` packages (e.g., `jsr:@std/http`)572. **Second choice:** `npm:` packages when no JSR alternative exists583. **Never recommend** the old URL-based registry — it is deprecated5960The standard library is at `jsr:@std/*` on JSR.6162Always mention JSR when discussing dependencies, even in CI/CD or tooling contexts. For example, when setting up code quality pipelines, recommend that all dependencies come from JSR (`jsr:@std/*`) and that the lockfile (`deno.lock`) be committed for reproducible CI builds.6364## Built-in Tool Usage6566**In every response that involves Deno code** (not just code reviews), mention relevant built-in tools. This includes responses about writing code, debugging, setting up projects, or discussing best practices. Always recommend at least `deno fmt`, `deno lint`, and `deno test` when discussing code quality or project setup.6768Deno's integrated tooling:69- `deno fmt` - Format code70- `deno lint` - Lint for issues71- `deno test` - Run tests72- `deno check` - Type-check code73- `deno doc <package>` - View package documentation74- `deno add <package>` - Add dependencies75- `deno deploy` - Deploy to Deno Deploy7677## Code Review Checklist7879### Always Mention Built-in Tools8081In every code review response, explicitly recommend these tools by name:82- `deno fmt` for formatting83- `deno lint` for linting84- `deno test` for running tests8586Even if no code is provided yet, mention these specific commands when discussing code quality.8788### Import Statements89- [ ] Uses `jsr:` for Deno-native packages90- [ ] Uses `npm:` only when no JSR alternative exists91- [ ] No imports from the old URL-based registry (deprecated)92- [ ] No old URL-based standard library imports (use `jsr:@std/*`)93- [ ] Standard library uses `jsr:@std/*`9495### Configuration96- [ ] Has a proper `deno.json` configuration97- [ ] Import maps defined in `deno.json` (not separate file)98- [ ] Correct permissions in run commands99100### Fresh Applications101- [ ] Islands are small and focused (minimal JavaScript to client)102- [ ] Props passed to islands are JSON-serializable (no functions)103- [ ] Non-interactive components are in `components/`, not `islands/`104- [ ] Uses `class` instead of `className` (Preact supports both)105- [ ] Build step runs before deployment (`deno task build`)106107### Code Quality108- [ ] Code is formatted (`deno fmt`)109- [ ] Code passes linting (`deno lint`)110- [ ] Tests exist and pass (`deno test`)111- [ ] Documentation exists for public APIs112113## Common Anti-Patterns to Flag114115When reviewing code, describe deprecated patterns generically and only show the correct modern replacement. Never write out the deprecated code.116117### URL-based imports (deprecated)118119When you see old URL-based imports from the deprecated registry, flag them and guide the user to:1201. Find the package on jsr.io1212. Run `deno add jsr:@package/name`1223. Use the bare specifier123124Only show the correct approach:125```ts126import * as oak from "@oak/oak";127import { join } from "@std/path";128```129130### Old standard library imports (deprecated)131132When you see imports from the old standard library URL, suggest the JSR equivalent:133134```sh135deno add jsr:@std/path136```137138```ts139import { join } from "@std/path";140```141142### Inline remote specifiers143144When you see inline `jsr:` or `npm:` specifiers in import statements (and a `deno.json` exists), suggest moving them to the import map:145146```sh147deno add jsr:@oak/oak148deno add npm:chalk149```150151```ts152import * as oak from "@oak/oak";153import chalk from "chalk";154```155156Inline specifiers are fine in single file scripts, but if a deno.json exists then it should go there. It's preferable to place npm dependencies in a package.json if a package.json exists.157158### Wrong: Entire page as island159```tsx160// Flag: Too much JavaScript shipped to client161// islands/HomePage.tsx162export default function HomePage() {163 return (164 <div>165 <Header />166 <MainContent />167 <Footer />168 </div>169 );170}171172// Suggest: Only interactive parts as islands173// routes/index.tsx174import Counter from "../islands/Counter.tsx";175176export default function HomePage() {177 return (178 <div>179 <Header />180 <MainContent />181 <Counter /> {/* Only this needs interactivity */}182 <Footer />183 </div>184 );185}186```187188### Wrong: Non-serializable island props189```tsx190// Flag this191<Counter onUpdate={(val) => console.log(val)} />192193// Suggest this194<Counter initialValue={5} label="Click count" />195```196197## Debugging Guidance198199### Permission Errors200Check if permissions are correct (`--allow-net`, `--allow-read`, etc.):201```bash202deno run --allow-net server.ts203```204205### TypeScript Errors206Check for TypeScript errors:207```bash208deno check main.ts209```210211### Configuration Issues212Review deno.json for correct configuration. Ensure all `jsr:` and `npm:` specifiers have a version requirement:213214```json215{216 "imports": {217 "@std/http": "jsr:@std/http@^1"218 }219}220```221222## Documentation Resources223224When more information is needed, consult:225- https://docs.deno.com - Deno docs226- https://docs.deno.com/runtime/fundamentals/ - Core concepts227- https://fresh.deno.dev/docs - Fresh framework228- https://jsr.io - Package registry229- https://docs.deno.com/deploy/ - Deno Deploy230231Use `deno doc <package>` to get API documentation for any package locally.232233## Quick Commands Reference234235```bash236# Project setup237deno run -Ar jsr:@fresh/init # New Fresh project238239# Development240deno task dev # Start dev server (Fresh: port 5173)241deno fmt # Format code242deno lint # Lint code243deno test # Run tests244245# Packages246deno add jsr:@std/http # Add package247deno doc jsr:@std/http # View docs248deno install # Install all deps249deno upgrade # Update packages250251# Deployment252deno task build # Build for production253deno deploy --prod # Deploy to Deno Deploy254deno deploy env add KEY "value" # Set env variable255```