val-town

使用 Val Town 即时编写和部署服务端 TypeScript 函数。适用于“快速部署函数”、“无服务器 TypeScript”、“快速 API 端点”、“Webhook 处理器”、“云端定时任务”等场景,涵盖 HTTP vals、定时 vals、邮件 vals、SQLite 存储以及 Val Town API。

仓库最近推送
GitHub Stars
219
Forks
38
Issues / PRs
7

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "val-town":https://skillpi.com/zh/skills/deepskill-f5f6632940d488352f4f5803dcc5a1f0299f141edc1ca85e6630d93d09d15ce3。安装前核对上游来源和版本:https://github.com/TerminalSkills/skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

使用 Val Town 即时编写和部署服务端 TypeScript 函数。适用于“快速部署函数”、“无服务器 TypeScript”、“快速 API 端点”、“Webhook 处理器”、“云端定时任务”等场景,涵盖 HTTP vals、定时 vals、邮件 vals、SQLite 存储以及 Val Town API。

0 下载

介绍来源: third_party · TerminalSkills · 1.0.0 参考来源

SkillPi 解读

适合谁
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: val-town
description: >-
  Write and deploy server-side TypeScript functions instantly with Val Town.
  Use when someone asks to "deploy a function quickly", "serverless TypeScript",
  "quick API endpoint", "webhook handler", "cron job in the cloud", "Val Town",
  "instant API without infrastructure", or "deploy a script without a server".
  Covers HTTP vals, cron vals, email vals, SQLite storage, and the Val Town API.
license: Apache-2.0
compatibility: "Browser or any HTTP client. Deno-compatible TypeScript runtime."
metadata:
  author: terminal-skills
  version: "1.0.0"
  category: development
  tags: ["serverless", "typescript", "functions", "val-town", "cron"]

Val Town

Overview

Val Town is a platform for writing and deploying TypeScript functions instantly — no infrastructure, no build step, no deployment pipeline. Write a function in the browser, get a URL. HTTP endpoints, cron jobs, email handlers, and persistent SQLite storage. Think "GitHub Gists that run."

When to Use

  • Need a quick API endpoint or webhook handler (minutes, not hours)
  • Scheduled tasks (cron) without managing servers
  • Prototyping an idea before building proper infrastructure
  • Webhook receivers for Stripe, GitHub, Slack integrations
  • Glue code between services (fetch from API A, transform, POST to API B)
  • Storing small amounts of data with built-in SQLite

Instructions

HTTP Val (API Endpoint)

// @user/myApi — Deployed instantly at https://user-myapi.web.val.run
export default async function(req: Request): Promise<Response> {
  const url = new URL(req.url);

  if (req.method === "GET") {
    const name = url.searchParams.get("name") || "World";
    return Response.json({ message: `Hello, ${name}!` });
  }

  if (req.method === "POST") {
    const body = await req.json();
    // Process the data
    return Response.json({ received: body, timestamp: Date.now() });
  }

  return new Response("Method not allowed", { status: 405 });
}

Cron Val (Scheduled Task)

// @user/dailyReport — Runs on a schedule
export default async function() {
  // Fetch data from an API
  const response = await fetch("https://api.example.com/stats");
  const stats = await response.json();

  // Send to Slack
  await fetch(Deno.env.get("SLACK_WEBHOOK")!, {
    method: "POST",
    body: JSON.stringify({
      text: `📊 Daily Report: ${stats.users} users, ${stats.revenue} revenue`,
    }),
  });
}

SQLite Storage

// @user/todoApi — CRUD API with persistent SQLite storage
import { sqlite } from "https://esm.town/v/std/sqlite";

// Initialize table
await sqlite.execute(`
  CREATE TABLE IF NOT EXISTS todos (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    title TEXT NOT NULL,
    done BOOLEAN DEFAULT FALSE,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP
  )
`);

export default async function(req: Request): Promise<Response> {
  const url = new URL(req.url);

  if (req.method === "GET") {
    const todos = await sqlite.execute("SELECT * FROM todos ORDER BY created_at DESC");
    return Response.json(todos.rows);
  }

  if (req.method === "POST") {
    const { title } = await req.json();
    await sqlite.execute("INSERT INTO todos (title) VALUES (?)", [title]);
    return Response.json({ ok: true }, { status: 201 });
  }

  if (req.method === "DELETE") {
    const id = url.searchParams.get("id");
    await sqlite.execute("DELETE FROM todos WHERE id = ?", [id]);
    return Response.json({ ok: true });
  }

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

Webhook Handler

// @user/stripeWebhook — Handle Stripe webhooks
export default async function(req: Request): Promise<Response> {
  const signature = req.headers.get("stripe-signature");
  const body = await req.text();

  // Verify webhook signature
  // In Val Town, use Deno.env.get() for secrets
  const secret = Deno.env.get("STRIPE_WEBHOOK_SECRET");

  const event = JSON.parse(body);

  switch (event.type) {
    case "checkout.session.completed":
      // Handle successful payment
      await fetch("https://api.myapp.com/activate", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ customerId: event.data.object.customer }),
      });
      break;

    case "customer.subscription.deleted":
      // Handle cancellation
      break;
  }

  return Response.json({ received: true });
}

Examples

Example 1: Quick monitoring endpoint

User prompt: "I need a quick URL that checks if my website is up and returns the status."

The agent will create an HTTP val that fetches the target URL, measures response time, and returns a JSON status report.

Example 2: GitHub webhook to Slack

User prompt: "When someone stars my GitHub repo, send a message to my Slack channel."

The agent will create an HTTP val that handles GitHub webhook events, filters for star events, and posts to a Slack webhook URL.

Guidelines

  • HTTP vals are standard Web API — Request in, Response out
  • Environment variables via Deno.env.get() — store secrets in Val Town settings
  • SQLite is per-account — shared across all your vals, persistent
  • Free tier: 10 vals, 100 cron runs/day — enough for prototyping
  • Import from URLs — import { x } from "https://esm.town/v/user/module"
  • Deno runtime — use Deno APIs, npm packages via npm:package specifier
  • No cold starts — vals are always warm, sub-50ms response times
  • Use for glue code — connect APIs, transform data, automate workflows
  • Not for production traffic — great for webhooks, cron, prototypes; use proper infra for high-traffic APIs

当前收录版本

1.0.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值85/100

亮点

  • 提供 Val Town 平台的使用指南,涵盖 HTTP 端点、定时任务、SQLite 存储、Webhook 处理等核心功能
  • 解决用户快速部署无服务器函数的明确需求,实用性强,受众广泛
触发精准90/100

亮点

  • 触发词覆盖多种变体(如“快速部署函数”、“无服务器 TypeScript”、“Webhook 处理器”等),边界清晰,能有效引导用户触发
结构规范95/100

亮点

  • 文档结构清晰,包含多个实用章节,步骤明确,有端到端代码示例,frontmatter 完整
执行可靠90/100

亮点

  • 提供了完整的 TypeScript 代码示例,涵盖了不同场景,工具来源明确,参数使用正确,覆盖了主要异常处理
证据可验 (前四项均值)90/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

文档引用的域名或地址

这些地址可能用于文档链接或示例,不是已批准的联网清单。使用前核对实际目的地及发送的数据。

  • api.example.com
  • api.myapp.com
  • esm.town
  • user-myapi.web.val.run

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。