best-practices-for-writing-deno-based-application

best-practices-for-writing-deno-based-application is a cursor rule for Cursor from fumito-ito/mdcvalult. It costs 0 tokens per session (1,592 once invoked), scanned A, original, MIT.

Coding guidelines for applications written with Deno, a JavaScript and TypeScript runtime. They cover types, functions, dependency adapters, comments, and tests using Deno's testing packages.

In plain words
What is it for?
Use them when building Deno scripts or modules, defining interfaces and types, choosing functions over classes, isolating dependencies for tests, and writing tests.
Why use it?
They help coding agents produce clearer, more testable Deno code with fewer vague types and less tightly coupled external code.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc). Also seen: built for cline.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is export { PI } from "../constants/mod.ts";.

Good fit Use them when building Deno scripts or modules, defining interfaces and types, choosing functions over classes, isolating dependencies for tests, and writing tests.

Compare 6 cursor rules from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/fumito-ito/mdcvalult
agentmods
npx agentmods add rules/fumito-ito/mdcvalult/best-practices-for-writing-deno-based-application

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for best-practices-for-writing-deno-based-application

README.md
[![agentmods](https://agentmods.dev/badge/rules/fumito-ito/mdcvalult/best-practices-for-writing-deno-based-application/github.svg)](https://agentmods.dev/rules/fumito-ito/mdcvalult/best-practices-for-writing-deno-based-application)
Your own site
<a href="https://agentmods.dev/rules/fumito-ito/mdcvalult/best-practices-for-writing-deno-based-application"><img src="https://agentmods.dev/badge/rules/fumito-ito/mdcvalult/best-practices-for-writing-deno-based-application/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for best-practices-for-writing-deno-based-application

Your own site · 80×15
<a href="https://agentmods.dev/rules/fumito-ito/mdcvalult/best-practices-for-writing-deno-based-application"><img src="https://agentmods.dev/badge/rules/fumito-ito/mdcvalult/best-practices-for-writing-deno-based-application.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,592 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01592
Opus 5 $0.00000 $0.00796
Sonnet 5 $0.00000 $0.00318
Haiku 4.5 $0.00000 $0.00159

Measured 10d ago against content hash ef936192a05f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

best-practices-for-writing-deno-based-application scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

mdc/best-practices-for-writing-deno-based-application.mdc · 265 lines

How it starts

The opening of the file, as written. The whole thing — 265 lines — stays where its author put it; the contents beside it link to each section on GitHub.

AI Coding with Deno: Best Practices

This document summarizes the best practices for writing code using Deno and AI. It is designed not only for human readers but also as a prompt for coding agents.

This project assumes two modes of operation: Script Mode and Module Mode. The details are explained below.

Coding Policy

  • First, define the types and the interface for the functions that process them.
  • Clearly document the specifications of each file in comments whenever possible.
  • If an implementation does not require maintaining internal state, prefer functions over classes.
  • Use the Adapter Pattern to abstract external dependencies, allowing in-memory adapters to be used in tests.

Type Definition Guidelines

  • Use the most specific types possible and avoid using any.
  • Utilize Utility Types for common type patterns.
  • Use meaningful type aliases to clarify intent.
// Good Example
type UserId = string;
type UserData = {
  id: UserId;
  createdAt: Date;
};

// Avoid this
type Data = any;

Writing Tests

Use @std/expect and @std/testing/bdd. Avoid nested describe blocks unless there is a strong reason.

import { expect } from "@std/expect";
import { test } from "@std/testing/bdd";

test("2+3=5", () => {
  expect(add(2, 3)).toBe(5);
});

Implementation Mode: Script Mode

  • Minimize external dependencies and keep all logic within a single file.
  • Include test code within the same file.
  • A script is identified if it contains @script in the code or is located under scripts/* or script/*.

Example of Script Mode

/* @script */
/**
A simple module for addition
 */
function add(a: number, b: number): number {
  return a + b;
}

// Entry point for execution via `deno run add.ts`
if (import.meta.main) {
  console.log(add(1, 2));
}

/// test
import { expect } from "@std/expect";
import { test } from "@std/testing/bdd";

test("add(1, 2) = 3", () => {
  expect(add(1, 2)).toBe(3);
});

Coding agents like CLINE/Roo should first execute deno run add.ts, then expand tests to be runnable with deno test -A <filename> as needed.

Read the full file on GitHub · 265 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 265 lines · 0 tokens per session scan A ef936192a05f

Subscribe to this mod's changes

best-practices-for-writing-deno-based-application is a cursor rule published in the GitHub repository fumito-ito/mdcvalult (33 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,592 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.