Agent Skills by ALSEL
Anthropic ClaudeLLM・AI開発⭐ リポ 0品質スコア 50/100

deno-typescript

Denoのセキュリティモデルやネイティブツールチェーンを活用し、モダンなランタイム機能を用いたTypeScript開発を行う際のガイドラインを提供するスキルです。DenoとTypeScriptを組み合わせたプロジェクトで、正しい設定・構成・実装パターンを適用したい場合に活用できます。

description の原文を見る

Guidelines for developing with Deno and TypeScript using modern runtime features, security model, and native tooling

SKILL.md 本文

Deno TypeScript 開発

Deno と TypeScript の開発に関する専門知識を持ち、Deno のネイティブ TypeScript サポートと組み込みツーリングを使用して、セキュアで最新のアプリケーション構築を行うエキスパートです。

TypeScript 一般的なガイドライン

基本原則

  • コードとドキュメントはすべて英語で記述
  • 変数と関数(パラメータと戻り値)には常に型を宣言
  • any 型の使用を避け、必要な型を作成する
  • JSDoc を使用して public なクラスとメソッドをドキュメント化
  • 簡潔でメンテナンス可能で技術的に正確なコードを記述
  • 関数型および宣言型プログラミングパターンを使用
  • 設定は不要 - Deno は TypeScript をネイティブで実行

命名規則

  • クラス、型、インターフェースに PascalCase を使用
  • 変数、関数、メソッドに camelCase を使用
  • ファイルとディレクトリ名に kebab-case を使用
  • 環境変数に UPPERCASE を使用
  • 補助動詞を含む説明的な変数名を使用: isLoading, hasError, canDelete
  • 各関数を動詞で開始

関数

  • 単一の目的を持つ短い関数を記述
  • 単純な操作にはアロー関数を使用
  • 非同期操作には async/await を使用
  • 複数のパラメータには RO-RO パターンを優先

型とインターフェース

  • オブジェクト形状にはタイプより型定義を優先
  • enum を避け、as const を使用した const オブジェクトを使用
  • ランタイム検証には Zod を使用し、型推論を行う
  • 不変プロパティに readonly を使用

Deno 固有のガイドライン

プロジェクト構成

src/
  routes/
    {resource}/
      mod.ts
      handlers.ts
      validators.ts
  middleware/
    auth.ts
    logger.ts
  services/
    {domain}_service.ts
  types/
    mod.ts
  utils/
    mod.ts
  deps.ts
  main.ts
deno.json

モジュールシステム

  • 明示的なファイル拡張子を使用した ES モジュールを使用
  • 一元化された依存関係管理に deps.ts パターンを使用
  • URL からインポートするか、deno.json でインポートマップを使用
  • JSR (jsr.io) を Deno ネイティブパッケージに使用
// deps.ts - centralized dependencies
export { serve } from "https://deno.land/std@0.208.0/http/server.ts";
export { z } from "https://deno.land/x/zod@v3.22.4/mod.ts";

// Using import maps in deno.json
{
  "imports": {
    "std/": "https://deno.land/std@0.208.0/",
    "hono": "https://deno.land/x/hono@v3.11.7/mod.ts"
  }
}

セキュリティモデル

Deno はデフォルトでセキュアです。必要な権限のみをリクエストします:

# Run with specific permissions
deno run --allow-net --allow-read=./data --allow-env main.ts

# Permission flags
--allow-net=example.com    # Network access to specific domains
--allow-read=./path        # File read access
--allow-write=./path       # File write access
--allow-env=API_KEY        # Environment variable access
--allow-run=cmd            # Subprocess execution
// Programmatic permission requests
const status = await Deno.permissions.request({ name: "net", host: "api.example.com" });
if (status.state === "granted") {
  // Network access granted
}

Deno.serve による HTTP サーバー

// Simple HTTP server
Deno.serve({ port: 8000 }, (req) => {
  const url = new URL(req.url);

  if (url.pathname === "/api/users" && req.method === "GET") {
    return Response.json({ users: [] });
  }

  return new Response("Not Found", { status: 404 });
});

Deno での Hono の使用

import { Hono } from "https://deno.land/x/hono/mod.ts";

const app = new Hono();

app.get("/", (c) => c.text("Hello Deno!"));
app.get("/api/users", (c) => c.json({ users: [] }));

Deno.serve(app.fetch);

Fresh フレームワークの使用

// routes/index.tsx
import { PageProps } from "$fresh/server.ts";

export default function Home(props: PageProps) {
  return (
    <div>
      <h1>Welcome to Fresh</h1>
    </div>
  );
}

// routes/api/users.ts
import { Handlers } from "$fresh/server.ts";

export const handler: Handlers = {
  async GET(_req, _ctx) {
    const users = await getUsers();
    return Response.json(users);
  },
};

データベース統合

// Using Deno KV (built-in key-value store)
const kv = await Deno.openKv();

// Set a value
await kv.set(["users", "1"], { name: "John", email: "john@example.com" });

// Get a value
const result = await kv.get(["users", "1"]);
console.log(result.value);

// List values
const entries = kv.list({ prefix: ["users"] });
for await (const entry of entries) {
  console.log(entry.key, entry.value);
}

環境変数

// Access environment variables (requires --allow-env)
const apiKey = Deno.env.get("API_KEY");

// Using dotenv
import { load } from "https://deno.land/std/dotenv/mod.ts";
const env = await load();

組み込みテストランナーでのテスト

// user_test.ts
import { assertEquals, assertRejects } from "https://deno.land/std/assert/mod.ts";
import { describe, it, beforeEach } from "https://deno.land/std/testing/bdd.ts";
import { getUser, createUser } from "./user_service.ts";

describe("User Service", () => {
  beforeEach(() => {
    // Setup
  });

  it("should create a user", async () => {
    const user = await createUser({ name: "John", email: "john@example.com" });
    assertEquals(user.name, "John");
  });

  it("should throw for invalid email", async () => {
    await assertRejects(
      () => createUser({ name: "John", email: "invalid" }),
      Error,
      "Invalid email"
    );
  });
});

// Run tests
// deno test --allow-net --allow-read

組み込みツーリング

# Formatting
deno fmt

# Linting
deno lint

# Type checking
deno check main.ts

# Bundle
deno bundle main.ts bundle.js

# Compile to executable
deno compile --allow-net main.ts

# Documentation generation
deno doc main.ts

# Dependency inspection
deno info main.ts

deno.json による設定

{
  "tasks": {
    "dev": "deno run --watch --allow-net --allow-env main.ts",
    "start": "deno run --allow-net --allow-env main.ts",
    "test": "deno test --allow-net",
    "lint": "deno lint",
    "fmt": "deno fmt"
  },
  "imports": {
    "std/": "https://deno.land/std@0.208.0/",
    "@/": "./src/"
  },
  "compilerOptions": {
    "strict": true,
    "lib": ["deno.window"]
  },
  "lint": {
    "rules": {
      "tags": ["recommended"]
    }
  },
  "fmt": {
    "indentWidth": 2,
    "singleQuote": true
  }
}

エラーハンドリング

class AppError extends Error {
  constructor(
    message: string,
    public statusCode: number = 500,
    public code: string = "INTERNAL_ERROR"
  ) {
    super(message);
    this.name = "AppError";
  }
}

const handleRequest = async (req: Request): Promise<Response> => {
  try {
    return await processRequest(req);
  } catch (error) {
    if (error instanceof AppError) {
      return Response.json(
        { error: error.message, code: error.code },
        { status: error.statusCode }
      );
    }
    console.error(error);
    return Response.json(
      { error: "Internal Server Error" },
      { status: 500 }
    );
  }
};

ウェブ標準

Deno はウェブ標準を採用しています。以下を使用してください:

  • HTTP リクエストに fetch() を使用
  • RequestResponse オブジェクト
  • URLURLSearchParams
  • 暗号化に Web Crypto API を使用
  • データストリーミングに Streams API を使用
  • マルチパートデータに FormData を使用

パフォーマンス

  • 大規模なデータ処理には web streams を使用
  • 高速キー値ストレージに Deno KV を活用
  • 高性能 HTTP には Deno.serve を使用
  • デプロイメント時には スタンドアロン実行可能ファイルにコンパイル

ライセンス: Apache-2.0(寛容ライセンスのため全文を引用しています) · 原本リポジトリ

詳細情報

作者
mindrally
リポジトリ
mindrally/skills
ライセンス
Apache-2.0
最終更新
不明

Source: https://github.com/mindrally/skills / ライセンス: Apache-2.0

関連スキル

OpenAILLM・AI開発⭐ リポ 6,054

agent-browser

AI エージェント向けのブラウザ自動化 CLI です。ウェブサイトとの対話が必要な場合に使用します。ページ遷移、フォーム入力、ボタンクリック、スクリーンショット取得、データ抽出、ウェブアプリのテスト、ブラウザ操作の自動化など、あらゆるブラウザタスクに対応できます。「ウェブサイトを開く」「フォームに記入する」「ボタンをクリックする」「スクリーンショットを取得する」「ページからデータを抽出する」「このウェブアプリをテストする」「サイトにログインする」「ブラウザ操作を自動化する」といった要求や、プログラマティックなウェブ操作が必要なタスクで起動します。

by JimmyLv
汎用LLM・AI開発⭐ リポ 1,982

anyskill

AnySkill — あなたのプライベート・スキルクラウド。GitHubを基盤としたリポジトリからエージェントスキルを管理、同期、動的にロードできます。自然言語でクラウドスキルを検索し、オンデマンドでプロンプトを自動ロード、カスタムスキルのアップロードと共有、スキルバンドルの一括インストールが可能です。OpenClaw、Antigravity、Claude Code、Cursorに対応しています。

by LeoYeAI
汎用LLM・AI開発⭐ リポ 1,982

engram

AIエージェント向けの永続的なメモリシステムです。バグ修正、意思決定、発見、設定変更の後はmem_saveを使用してください。ユーザーが「覚えている」「記憶している」と言及した場合、または以前のセッションと重複する作業を開始する際はmem_searchを使用します。セッション終了前にmem_session_summaryを使用して、コンテキストを保持してください。

by LeoYeAI
汎用LLM・AI開発⭐ リポ 21,584

skyvern

AI駆動のブラウザ自動化により、任意のウェブサイトを自動化できます。フォーム入力、データ抽出、ファイルダウンロード、ログイン、複数ステップのワークフロー実行など、ユーザーがウェブサイトと連携する必要があるときに使用します。Skyvernは、LLMとコンピュータビジョンを活用して、未知のサイトも自動操作可能です。Python SDK、TypeScript SDK、REST API、MCPサーバー、またはCLIを通じて統合できます。

by Skyvern-AI
汎用LLM・AI開発⭐ リポ 1,149

pinchbench

PinchBenchベンチマークを実行して、OpenClawエージェントの実世界タスクにおけるパフォーマンスを評価できます。モデルの機能テスト、モデル間の比較、ベンチマーク結果のリーダーボード提出、またはOpenClawのセットアップがカレンダー、メール、リサーチ、コーディング、複数ステップのワークフローにどの程度対応しているかを確認する際に使用します。

by pinchbench
汎用LLM・AI開発⭐ リポ 4,693

openui

OpenUIとOpenUI Langを使用してジェネレーティブUIアプリを構築できます。これらはLLM生成インターフェースのためのトークン効率的なオープン標準です。OpenUI、@openuidev、ジェネレーティブUI、LLMからのストリーミングUI、AI向けコンポーネントライブラリ、またはjson-render/A2UIの置き換えについて述べる際に使用します。スキャフォルディング、defineComponent、システムプロンプト、Renderer、およびOpenUI Lang出力のデバッグに対応しています。

by thesysdev
本サイトは GitHub 上で公開されているオープンソースの SKILL.md ファイルをクロール・インデックス化したものです。 各スキルの著作権は原作者に帰属します。掲載に問題がある場合は info@alsel.co.jp または /takedown フォームよりご連絡ください。
原作者: mindrally · mindrally/skills · ライセンス: Apache-2.0