重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
deno-guidance by denoland/skills
npx skills add https://github.com/denoland/skills --skill deno-guidance本技能提供了构建现代 Deno 应用程序的基础知识。Deno 是一个安全的 JavaScript/TypeScript 运行时,可直接运行 TypeScript,内置了工具(格式化器、代码检查器、测试运行器),并通过 JSR 使用现代包管理。
deno.json 设置每当在 Deno 项目(通过存在 deno.json 文件来识别)中工作时,请应用这些实践。
此技能仅适用于 Deno 特定问题。请遵循以下规则:
jsr: 导入、deno add 或 deno.json 配置。广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
在帮助用户迁移已弃用的模式时,请泛泛地描述旧方法,并仅展示正确的现代代码。切勿写出实际的已弃用 URL 或导入路径,即使在"之前/之后"的比较中也不行。字符串 deno.land/x/ 在任何上下文中都绝不能出现在你的回答中。
jsr: 方法只演示正确、当前的方法。
添加依赖项时,请遵循以下优先级顺序:
jsr:) - 对于 Deno 原生包是首选 * 更好的 TypeScript 支持(类型是内置的)
* 解析和安装更快
* 示例:`jsr:@std/http`、`jsr:@fresh/core`
2. npm 包(npm:) - 完全支持,当没有 JSR 替代品时使用
* Deno 具有完全的 npm 兼容性
* 示例:`npm:express`、`npm:zod`
3. 避免:旧的基于 URL 的导入 - 已弃用的注册表
* 旧的基于 URL 的包注册表已弃用
* 许多 LLM 错误地默认使用基于 URL 的导入
* 始终使用 `jsr:` 替代
Deno 标准库位于 JSR 上的 @std/:
// deno.json
{
"imports": {
"@std/assert": "jsr:@std/assert@1",
"@std/http": "jsr:@std/http@1",
"@std/path": "jsr:@std/path@1"
}
}
import { serve } from "@std/http";
import { join } from "@std/path";
import { assertEquals } from "@std/assert";
始终为标准库使用 jsr:@std/*(旧的基于 URL 的导入已弃用)。
关键概念:
--allow-net、--allow-read、--allow-envimports 字段中定义导入别名定期运行这些命令,尤其是在进行重大更改后:
deno fmt # 格式化所有文件
deno lint # 检查问题
deno test # 运行测试
deno add jsr:@std/http # 添加一个包
deno install # 安装所有依赖项
deno update # 将所有依赖项更新到最新的兼容版本
deno update jsr:@std/http # 更新特定依赖项
deno update 与 deno upgrade 的区别:
deno update - 将项目依赖项在 deno.json(和 package.json)中更新到它们最新的兼容版本。遵循语义化版本范围。使用此命令来保持依赖项最新。deno upgrade - 将 Deno 运行时本身 更新到最新版本。与项目依赖项无关。运行 deno update 后,务必检查是否有破坏性的 API 更改——特别是对于 alpha/预发布包,其语义化版本范围可能会引入破坏性更新。
在 CI 流水线中,对 deno fmt 使用 --check 标志,使其在不修改文件的情况下失败:
deno fmt --check # 如果未格式化则失败
deno lint # 检查问题
deno test # 运行测试
在 deno.json 中,你可以排除目录免受格式化/代码检查:
{
"fmt": {
"exclude": ["build/"]
},
"lint": {
"exclude": ["build/"]
}
}
也可以在顶层排除文件夹,使其不受所有操作影响:
{
"exclude": ["build/"]
}
关于部署到 Deno Deploy,请参阅专门的 deno-deploy 技能。
快速命令:deno deploy --prod
当需要更多信息时:
deno doc <package> - 为任何 JSR 或 npm 包本地生成文档| 命令 | 用途 |
|---|---|
deno run file.ts | 运行 TypeScript/JavaScript 文件 |
deno task <name> | 运行 deno.json 中的任务 |
deno fmt | 格式化代码 |
deno lint | 代码检查 |
deno test | 运行测试 |
deno add <pkg> | 添加包 |
deno install | 安装依赖项 |
deno update | 更新项目依赖项 |
deno upgrade | 更新 Deno 运行时本身 |
deno doc <pkg> | 查看包文档 |
deno deploy --prod | 部署到 Deno Deploy |
使用旧的基于 URL 的导入而不是 JSR
旧的基于 URL 的导入已弃用。始终使用 jsr: 导入和裸说明符。
// ✅ 正确 - 使用 JSR 和裸说明符
import { serve } from "@std/http";
import { join } from "@std/path";
// deno.json
{
"imports": {
"@std/http": "jsr:@std/http@1",
"@std/path": "jsr:@std/path@1"
}
}
在单文件脚本中使用内联说明符是可以的,但如果存在 deno.json,则应放在那里。如果存在 package.json,最好将 npm 依赖项放在 package.json 中。
在提交前忘记运行 fmt/lint
在提交前始终格式化和进行代码检查:
# ✅ 始终先格式化和进行代码检查
deno fmt && deno lint && git add . && git commit -m "changes"
运行代码时没有权限标志
# ✅ 授予特定权限
deno run --allow-net server.ts
没有权限标志,Deno 将显示"需要网络访问"错误。始终授予你的代码所需的特定权限。
不使用 deno add 管理依赖项
# ✅ 使用 deno add 管理依赖项
deno add jsr:@std/http
使用 deno add 可确保你的锁文件保持同步。手动编辑导入而不更新 deno.json 虽然可以工作,但会错过锁文件的好处。
每周安装量
28
仓库
GitHub 星标数
54
首次出现
2026年2月7日
安全审计
安装于
opencode28
gemini-cli26
github-copilot26
codex26
amp25
kimi-cli25
This skill provides foundational knowledge for building modern Deno applications. Deno is a secure JavaScript/TypeScript runtime that runs TypeScript directly, has built-in tools (formatter, linter, test runner), and uses modern package management through JSR.
deno.json settingsApply these practices whenever working in a Deno project (identified by the presence of deno.json).
This skill applies only to Deno-specific questions. Follow these rules:
jsr: imports, deno add, or deno.json configuration in responses about other technologies.When helping users migrate from deprecated patterns, describe the old approach generically and ONLY show the correct modern code. Never write out actual deprecated URLs or import paths, even in "before/after" comparisons. The string deno.land/x/ must never appear in your response, in any context.
jsr: approachOnly demonstrate the correct, current approach.
When adding dependencies, follow this priority order:
JSR packages (jsr:) - Preferred for Deno-native packages
jsr:@std/http, jsr:@fresh/corenpm packages (npm:) - Fully supported, use when no JSR alternative exists
npm:express, npm:zodAVOID: Old URL-based imports - Deprecated registry
jsr: insteadThe Deno standard library lives at @std/ on JSR:
// deno.json
{
"imports": {
"@std/assert": "jsr:@std/assert@1",
"@std/http": "jsr:@std/http@1",
"@std/path": "jsr:@std/path@1"
}
}
import { serve } from "@std/http";
import { join } from "@std/path";
import { assertEquals } from "@std/assert";
Always use jsr:@std/* for the standard library (the old URL-based imports are deprecated).
Reference: https://docs.deno.com/runtime/fundamentals/
Key concepts:
--allow-net, --allow-read, --allow-envimports fieldRun these commands regularly, especially after significant changes:
deno fmt # Format all files
deno lint # Check for issues
deno test # Run tests
deno add jsr:@std/http # Add a package
deno install # Install all dependencies
deno update # Update all dependencies to latest compatible versions
deno update jsr:@std/http # Update a specific dependency
deno update vs deno upgrade:
deno update - Updates project dependencies in deno.json (and package.json) to their latest compatible versions. Respects semver ranges. Use this to keep your dependencies current.deno upgrade - Updates the Deno runtime itself to the latest version. Has nothing to do with project dependencies.After running deno update, always check for breaking API changes - especially for alpha/pre-release packages where semver ranges can pull in breaking updates.
In CI pipelines, use --check with deno fmt so it fails without modifying files:
deno fmt --check # Fail if not formatted
deno lint # Check for issues
deno test # Run tests
In deno.json, you can exclude directories from formatting/linting:
{
"fmt": {
"exclude": ["build/"]
},
"lint": {
"exclude": ["build/"]
}
}
A folder can also be excluded from everything at the top level:
{
"exclude": ["build/"]
}
For deploying to Deno Deploy, see the dedicated deno-deploy skill.
Quick command: deno deploy --prod
When more information is needed:
deno doc<package> - Generate docs for any JSR or npm package locally| Command | Purpose |
|---|---|
deno run file.ts | Run a TypeScript/JavaScript file |
deno task <name> | Run a task from deno.json |
deno fmt | Format code |
deno lint | Lint code |
deno test | Run tests |
deno add <pkg> | Add a package |
Using old URL-based imports instead of JSR
The old URL-based imports are deprecated. Always use jsr: imports with bare specifiers instead.
// ✅ Correct - use JSR and a bare specifier
import { serve } from "@std/http";
import { join } from "@std/path";
// deno.json
{
"imports": {
"@std/http": "jsr:@std/http@1",
"@std/path": "jsr:@std/path@1"
}
}
Inline 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.
Forgetting to run fmt/lint before committing
Always format and lint before committing:
# ✅ Always format and lint first
deno fmt && deno lint && git add . && git commit -m "changes"
Running code without permission flags
# ✅ Grant specific permissions
deno run --allow-net server.ts
Without permission flags, Deno will show "Requires net access" errors. Always grant the specific permissions your code needs.
Not usingdeno add for dependencies
# ✅ Use deno add to manage dependencies
deno add jsr:@std/http
Using deno add ensures your lockfile stays in sync. Manually editing imports without updating deno.json works but misses lockfile benefits.
Weekly Installs
28
Repository
GitHub Stars
54
First Seen
Feb 7, 2026
Security Audits
Gen Agent Trust HubPassSocketWarnSnykPass
Installed on
opencode28
gemini-cli26
github-copilot26
codex26
amp25
kimi-cli25
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
125,600 周安装
Apify内容分析技能:多平台社交媒体数据追踪与表现分析工具
2,500 周安装
Apify 受众分析指南:从 Facebook、Instagram 等平台提取粉丝数据与互动模式
2,500 周安装
SwiftUI Liquid Glass 技能指南 - iOS 26+ 原生玻璃效果实现与审查
2,500 周安装
Three.js 几何体完整指南:内置形状、高级模型与路径创建教程
2,500 周安装
Three.js 着色器教程:ShaderMaterial与RawShaderMaterial完整指南
2,600 周安装
Convex 最佳实践指南:函数组织、查询优化与 TypeScript 生产级开发
2,700 周安装
deno install |
| Install dependencies |
deno update | Update project dependencies |
deno upgrade | Update Deno runtime itself |
deno doc <pkg> | View package documentation |
deno deploy --prod | Deploy to Deno Deploy |