agentleFS
wangyendtwangyendt/wayne-skills/shell-shortcuts/SKILL.md

shell-shortcuts

Skill9 starsChanged 9 months agoMITView on GitHub

Configure cross-platform terminal shortcut commands on a new machine, including proxy_on/proxy_off (env vars + git global proxy), goto (persistent path jump shortcuts), gpu (nvidia-smi helper), and optional Conda auto-activation. Use when setting up Windows PowerShell Profile / CMD AutoRun, or adding functions to macOS/Linux shell rc files.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Prefer PowerShell on Windows for the full goto experience.

    line 17
  2. Distinctive:

    Keep everything idempotent by putting functions/scripts behind a clearly-marked block.

    line 18
  3. Very specific:

    Add (or replace) a block like below.

    line 30
  4. Very specific:

    Put scripts in C:\Users\<You>\bin\

    line 197
  5. Distinctive:

    Add that folder to PATH (or do it in your CMD startup script)

    line 198
  6. Very specific:

    If you need exact templates, read shell-shortcuts/references/windows-cmd.md.

    line 227
  7. Very specific:

    Add functions to ~/.zshrc or ~/.bashrc:

    line 231

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Shell Shortcuts (proxy_on, proxy_off, goto, gpu, conda autostart)

Goal: make a fresh machine behave the same across Windows / macOS / Ubuntu with a small set of commands:

  • proxy_on / proxy_off: toggle terminal proxy (env vars + Git global proxy)
  • goto: persistent path shortcuts (e.g. goto work)
  • gpu: show NVIDIA GPU status (nvidia-smi wrapper; Windows/Ubuntu only)
  • Optional: auto-activate a Conda env when a new shell starts

This skill is intentionally opinionated:

  • Prefer PowerShell on Windows for the full goto experience.
  • Keep everything idempotent by putting functions/scripts behind a clearly-marked block.

Defaults (edit as needed)

  • HTTP/HTTPS proxy: http://127.0.0.1:7890
  • SOCKS5 proxy: socks5://127.0.0.1:7890
  • NO_PROXY: localhost,127.0.0.1,.qualcomm.com,*.amazonaws.com

Windows: PowerShell (recommended)

Edit your PowerShell profile: $PROFILE

Add (or replace) a block like below. The goto DB is $HOME\.goto_paths.json.

# >>> shell-shortcuts >>>

function proxy_off {
  param([switch]$Quiet)
  Remove-Item Env:http_proxy,Env:https_proxy,Env:all_proxy,Env:no_proxy -ErrorAction SilentlyContinue
  Remove-Item Env:HTTP_PROXY,Env:HTTPS_PROXY,Env:ALL_PROXY,Env:NO_PROXY -ErrorAction SilentlyContinue

  if (Get-Command git -ErrorAction SilentlyContinue) {
    git config --global --unset http.proxy 2>$null | Out-Null
    git config --global --unset https.proxy 2>$null | Out-Null
  }

  if (-not $Quiet) { Write-Host "Proxy is OFF" }
}

function proxy_on {
  param(
    [string]$HttpProxyUrl = "http://127.0.0.1:7890",
    [string]$SocksProxyUrl = "socks5://127.0.0.1:7890",
    [string]$NoProxyList = "localhost,127.0.0.1,.qualcomm.com,*.amazonaws.com"
  )

  proxy_off -Quiet

  $env:http_proxy  = $HttpProxyUrl
  $env:https_proxy = $HttpProxyUrl
  $env:HTTP_PROXY  = $HttpProxyUrl
  $env:HTTPS_PROXY = $HttpProxyUrl

  $env:all_proxy = $SocksProxyUrl
  $env:ALL_PROXY = $SocksProxyUrl

  $env:no_proxy = $NoProxyList
  $env:NO_PROXY = $NoProxyList

  if (Get-Command git -ErrorAction SilentlyContinue) {
    git config --global http.proxy  $HttpProxyUrl  | Out-Null
    git config --global https.proxy $HttpProxyUrl  | Out-Null
  }

  Write-Host "Proxy is ON"
  Write-Host "  HTTP/HTTPS: $HttpProxyUrl"
  Write-Host "  SOCKS5:     $SocksProxyUrl"
  Write-Host "  NO_PROXY:   $NoProxyList"
}

function _goto_db_path {
  Join-Path $HOME ".goto_paths.json"
}

function _goto_load {
  $db = _goto_db_path
  if (-not (Test-Path -LiteralPath $db)) { return @{} }
  try {
    $raw = Get-Content -Raw -Encoding UTF8 -LiteralPath $db
    if (-not $raw.Trim()) { return @{} }
    $obj = $raw | ConvertFrom-Json
    $ht = @{}
    foreach ($p in $obj.PSObject.Properties) { $ht[$p.Name] = [string]$p.Value }
    return $ht
  } catch {
    throw "Failed to parse goto DB: $db. Fix JSON or delete it."
  }
}

function _goto_save([hashtable]$ht) {
  $db = _goto_db_path
  $dir = Split-Path -Parent $db
  if (-not (Test-Path -LiteralPath $dir)) { New-Item -ItemType Directory -Path $dir | Out-Null }
  ($ht | ConvertTo-Json -Depth 5) | Set-Content -Encoding UTF8 -LiteralPath $db
}

function goto {
  param(
    [Parameter(Position = 0)][string]$Cmd,
    [Parameter(ValueFromRemainingArguments = $true)][string[]]$Rest
  )

  $ht = _goto_load

  switch ($Cmd) {
    { $_ -in @($null, "", "ls", "list") } {
      if ($ht.Count -eq 0) { Write-Host "No shortcuts. Use: goto add <key> <path>"; return }
      Write-Host "Available shortcuts:"
      foreach ($k in ($ht.Keys | Sort-Object)) {
        "{0,-12} -> {1}" -f $k, $ht[$k] | Write-Host
      }
      return
    }
    "add" {
      if ($Rest.Count -lt 2) { throw "Usage: goto add <shortcut> <path>" }
      $key = $Rest[0]
      $path = ($Rest | Select-Object -Skip 1) -join " "
      if ($path -like "~*") { $path = $path -replace "^~", $HOME }
      $resolved = Resolve-Path -LiteralPath $path -ErrorAction Stop
      $ht[$key] = $resolved.Path
      _goto_save $ht
      Write-Host "Added: $key -> $($ht[$key])"
      return
    }
    { $_ -in @("rm","remove","del") } {
      if ($Rest.Count -ne 1) { throw "Usage: goto remove <shortcut>" }
      $key = $Rest[0]
      $ht.Remove($key) | Out-Null
      _goto_save $ht
      Write-Host "Removed: $key"
      return
    }
    "clear" {
      _goto_save @{}
      Write-Host "All shortcuts cleared."
      return
    }
    default {
      if (-not $Cmd) { return }
      if (-not $ht.ContainsKey($Cmd)) {
        Write-Host "Unknown shortcut: $Cmd"
        Write-Host "Tip: goto list"
        return 1
      }
      Set-Location -LiteralPath $ht[$Cmd]
      return
    }
  }
}

function gpu {
  $cmd = Get-Command nvidia-smi -ErrorAction SilentlyContinue
  if (-not $cmd) {
    Write-Host "nvidia-smi not found (need NVIDIA driver/tools)."
    return 1
  }
  & $cmd.Path
}

# Optional: Conda auto-activate (edit these)
# $CondaRoot = "D:\\ProgramData\\miniconda3"
# $CondaEnv  = "wayne3.10"
# if (Test-Path -LiteralPath (Join-Path $CondaRoot "Scripts\\conda.exe")) {
#   $hook = (& (Join-Path $CondaRoot "Scripts\\conda.exe") "shell.powershell" "hook") 2>$null | Out-String
#   if ($hook) { Invoke-Expression $hook }
#   conda activate $CondaEnv
# }

# <<< shell-shortcuts <<<

Usage:

proxy_on
proxy_off
goto list
goto add work D:\work
goto work
gpu

Windows: CMD (optional)

CMD has a reserved goto keyword. Use jump as the real command, and optionally alias goto to jump for interactive sessions via doskey.

Recommended layout:

  • Put scripts in C:\Users\<You>\bin\
  • Add that folder to PATH (or do it in your CMD startup script)

Create C:\Users\<You>\cmd_startup.cmd:

@echo off
set "PATH=%USERPROFILE%\bin;%PATH%"

REM Optional: conda auto-activate (edit these)
REM call "D:\ProgramData\miniconda3\condabin\conda.bat" activate wayne3.10

REM Interactive alias only (scripts/cmd /c should call jump directly)
doskey goto=jump $*

Enable AutoRun (current user):

reg add "HKCU\Software\Microsoft\Command Processor" /v AutoRun /t REG_SZ /d "%USERPROFILE%\cmd_startup.cmd" /f

Implement these .cmd files under %USERPROFILE%\bin:

proxy_on.cmd / proxy_off.cmd: set/unset proxy env vars and set/unset Git global proxy.

gpu.cmd: run nvidia-smi.

jump.cmd: persistent shortcut DB at %USERPROFILE%\.goto_paths (format: key|C:\abs\path).

If you need exact templates, read shell-shortcuts/references/windows-cmd.md.

macOS / Ubuntu (bash/zsh)

Add functions to ~/.zshrc or ~/.bashrc:

  • proxy_on / proxy_off
  • goto (persistent DB at ~/.goto_paths)
  • Ubuntu: gpu (requires nvidia-smi)

Templates are in shell-shortcuts/references/unix.md (copy/paste and adjust proxy defaults).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.