Skip to content
Development
Command

/scaffold-deno-script

Scaffold production-ready Deno automation script with Dax integration and deno.json task registration

From plugin
claude-cmd
313180 skills180 commands

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/scaffold-deno-script

Context preview

What this command does when you run it.

Scaffold production-ready Deno automation script with Dax integration and deno.json task registration

Command definition

scaffold-deno-script.md
allowed-tools: Read, Write, MultiEdit, Bash(deno:*), Bash(fd:*), Bash(bat:*), Bash(jq:*), Bash(gdate:*), Bash(mkdir:*)
name: "Scaffold Deno Script"
description: "Scaffold production-ready Deno automation script with Dax integration and deno.json task registration"
author: "wcygan"
tags: ["scaffold","deno"]
version: "1.0.0"
created_at: "2025-07-14T00:00:00Z"
updated_at: "2025-07-14T00:00:00Z"

Context

  • Session ID: !`gdate +%s%N 2>/dev/null || date +%s%N 2>/dev/null || echo "$(date +%s)$(jot -r 1 100000 999999 2>/dev/null || shuf -i 100000-999999 -n 1 2>/dev/null || echo $RANDOM$RANDOM)"`
  • Current directory: !`pwd`
  • Script name: $ARGUMENTS
  • Project structure: !`fd "deno\.json" . -d 2 | head -3 || echo "No deno.json found - will create"`
  • Scripts directory status: !`fd scripts . -t d -d 2 | head -1 || echo "No scripts directory - will create"`
  • Existing scripts: !`fd "\.ts$" scripts/ 2>/dev/null | wc -l | tr -d ' ' || echo "0"` TypeScript files
  • Deno version: !`deno --version | head -1 2>/dev/null || echo "Deno not found"`
  • Modern tools status: !`echo "fd: $(which fd >/dev/null && echo ✓ || echo ✗) | bat: $(which bat >/dev/null && echo ✓ || echo ✗) | jq: $(which jq >/dev/null && echo ✓ || echo ✗)"`

Your Task

STEP 1: Initialize session state and validate project context

  • CREATE session state file: `/tmp/scaffold-script-session-$SESSION_ID.json`
  • VALIDATE script name from $ARGUMENTS (must be provided)
  • VERIFY Deno installation and project structure
  • DETERMINE project type and existing configuration
# Initialize scaffold session state
echo '{
  "sessionId": "'$SESSION_ID'",
  "scriptName": "'$ARGUMENTS'",
  "projectRoot": "'$(pwd)'",
  "timestamp": "'$(gdate -Iseconds 2>/dev/null || date -Iseconds)'",
  "scaffoldingSteps": [],
  "daxConfigured": false,
  "taskRegistered": false
}' > /tmp/scaffold-script-session-$SESSION_ID.json

IF script_name is empty:

  • DISPLAY usage guidance: "Usage: /scaffold-deno-script [script-name]"
  • SUGGEST examples: "cleanup-logs", "deploy-app", "sync-data"
  • EXIT with helpful message

STEP 2: Project structure analysis and preparation

TRY:

**Directory Structure Setup:**

# Ensure scripts directory exists
if ! fd scripts . -t d -d 1 >/dev/null 2>&1; then
  echo "📁 Creating scripts directory..."
  mkdir -p scripts
fi

# Check for deno.json configuration
if ! fd "deno\.json" . -d 1 >/dev/null 2>&1; then
  echo "⚠️ No deno.json found - will create minimal configuration"
fi

**Existing Script Analysis:**

# Check for naming conflicts
if [[ -f "scripts/$ARGUMENTS.ts" ]]; then
  echo "⚠️ Script scripts/$ARGUMENTS.ts already exists"
  echo "Options: 1) Choose different name 2) Overwrite existing"
fi

# Analyze existing scripts for patterns
existing_count=$(fd "\.ts$" scripts/ 2>/dev/null | wc -l | tr -d ' ')
echo "📊 Found $existing_count existing TypeScript scripts"

STEP 3: Deno configuration management with smart updates

**deno.json Configuration:**

IF deno.json exists:

  • READ current configuration
  • CHECK for existing Dax dependency in imports section
  • ADD Dax dependency if missing: `"@david/dax": "jsr:@david/dax@^0.42.0"`
  • ADD task entry: `"$ARGUMENTS": "deno run --allow-all scripts/$ARGUMENTS.ts"`
  • PRESERVE existing configuration structure

ELSE:

  • CREATE comprehensive deno.json with:
  • JSR imports for Dax and standard library
  • Task definitions including new script
  • TypeScript compiler options
  • Standard project structure
{
  "imports": {
    "@std/path": "jsr:@std/path@^1.0.9",
    "@std/fs": "jsr:@std/fs@^1.0.17",
    "@std/cli/parse-args": "jsr:@std/cli@^1.0.9",
    "@std/assert": "jsr:@std/assert@^1.0.9",
    "@david/dax": "jsr:@david/dax@^0.42.0"
  },
  "tasks": {
    "$ARGUMENTS": "deno run --allow-all scripts/$ARGUMENTS.ts",
    "check": "deno check **/*.ts",
    "fmt": "deno fmt",
    "lint": "deno lint"
  },
  "compilerOptions": {
    "strict": true
  }
}

STEP 4: Generate production-ready script template

**Comprehensive Script Template Creation:**

CREATE `scripts/$ARGUMENTS.ts` with:

  • **Shebang line** for direct execution
  • **JSR imports** for Dax and standard library
  • **CLI argument parsing** using @std/cli/parse-args
  • **Cross-platform operations** via Dax
  • **Progress indicators** and colored output
  • **Error handling** with proper exit codes
  • **Async/await patterns** for modern TypeScript
  • **Documentation** and usage examples
#!/usr/bin/env -S deno run --allow-all

/**
 * $ARGUMENTS - Auto-generated Deno script with Dax integration
 *
 * Generated by Claude Code scaffold-deno-script command
 * Session: $SESSION_ID
 * Created: $(gdate -Iseconds 2>/dev/null || date -Iseconds)
 */

import { parseArgs } from "@std/cli/parse-args";
import { $, Path } from "@david/dax";
import { cyan, green, red, yellow } from "@std/fmt/colors";

// CLI argument parsing
const args = parseArgs(Deno.args, {
  boolean: ["help", "verbose", "dry-run"],
  string: ["input", "output"],
  alias: { h: "help", v: "verbose", d: "dry-run" },
});

if (args.help) {
  console.log(`
${cyan("🛠️  $ARGUMENTS Script")}

Usage:
  deno task $ARGUMENTS [options]
  deno run --allow-all scripts/$ARGUMENTS.ts [options]

Options:
  -h, --help      Show this help message
  -v, --verbose   Enable verbose output
  -d, --dry-run   Show what would be done without executing
  --input <path>  Input file or directory
  --output <path> Output file or directory

Examples:
  deno task $ARGUMENTS --verbose
  deno task $ARGUMENTS --input ./data --output ./processed
  `);
  Deno.exit(0);
}

// Main script functionality
async function main(): Promise<void> {
  try {
    console.log(cyan(`🚀 Starting $ARGUMENTS script...`));

    if (args.verbose) {
      console.log(yellow(`📊 Arguments: ${JSON.stringify(args, null, 2)}`));
    }

    // Example: Cross-platform file operations
    const currentDir = new Path(".");
    console.log(green(`📁 Working directory: ${currentDir.toString()}`));

    // Ex
Read more
Ships withclaude-cmd

A lightweight (~46kB) and comprehensive CLI tool for managing Claude commands, configurations, and workflows.

Get the whole plugin