Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Cross Platform

ASecurity

Cross-platform development patterns for macOS, Windows, and Linux

288 stars
0 votes
0 copies
2 views
Added 2/6/2026
developmentgoshellbashtestinggitci/cd

Works with

terminal

Security Analysis

A100/100

Scanned 2/12/2026

Install to Claude Code

$npx -y skills add mylee04/code-notify --skill cross-platform --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cross Platform?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Cross Platform
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mylee04-cross-platform/badge)](https://www.skillsdirectory.com/skills/mylee04-cross-platform)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: cross-platform
description: Cross-platform development patterns for macOS, Windows, and Linux
---

# Cross-Platform Development

## When to Use

- Adding new platform support
- Writing platform-specific code
- Testing across platforms

## Platform Detection

### Bash (macOS/Linux)

```bash
detect_os() {
    case "$(uname -s)" in
        Darwin*)    echo "macos" ;;
        Linux*)
            # Check for WSL
            if grep -qi microsoft /proc/version 2>/dev/null; then
                echo "wsl"
            else
                echo "linux"
            fi
            ;;
        CYGWIN*|MINGW*|MSYS*) echo "windows" ;;
        *)          echo "unknown" ;;
    esac
}
```

### PowerShell (Windows)

```powershell
function Get-Platform {
    if ($IsWindows -or $env:OS -eq "Windows_NT") {
        return "windows"
    } elseif ($IsLinux) {
        return "linux"
    } elseif ($IsMacOS) {
        return "macos"
    }
    return "unknown"
}
```

## Notification Tools by Platform

| Platform | Primary           | Fallback             |
| -------- | ----------------- | -------------------- |
| macOS    | terminal-notifier | osascript            |
| Linux    | notify-send       | zenity, wall         |
| Windows  | BurntToast        | System.Windows.Forms |
| WSL      | wsl-notify-send   | notify-send          |

## Platform-Specific Patterns

### macOS

```bash
send_macos_notification() {
    local title="$1"
    local message="$2"

    if command -v terminal-notifier &> /dev/null; then
        terminal-notifier \
            -title "$title" \
            -message "$message" \
            -sound "Glass"
    else
        osascript -e "display notification \"$message\" with title \"$title\""
    fi
}
```

### Linux

```bash
send_linux_notification() {
    local title="$1"
    local message="$2"

    if command -v notify-send &> /dev/null; then
        notify-send "$title" "$message" \
            --urgency=normal \
            --app-name="Code-Notify"
    elif command -v zenity &> /dev/null; then
        zenity --notification --text="$title\n$message"
    else
        echo "[$title] $message" | wall 2>/dev/null
    fi
}
```

### Windows (PowerShell)

```powershell
function Send-WindowsNotification {
    param(
        [string]$Title,
        [string]$Message
    )

    if (Get-Module -ListAvailable -Name BurntToast) {
        New-BurntToastNotification -Text $Title, $Message
    } else {
        Add-Type -AssemblyName System.Windows.Forms
        $notification = New-Object System.Windows.Forms.NotifyIcon
        $notification.Icon = [System.Drawing.SystemIcons]::Information
        $notification.BalloonTipTitle = $Title
        $notification.BalloonTipText = $Message
        $notification.Visible = $true
        $notification.ShowBalloonTip(10000)
    }
}
```

### WSL

```bash
send_wsl_notification() {
    local title="$1"
    local message="$2"

    if command -v wsl-notify-send.exe &> /dev/null; then
        wsl-notify-send.exe --category "$title" "$message"
    else
        # Fall back to Linux notification
        send_linux_notification "$title" "$message"
    fi
}
```

## Path Handling

### Unix vs Windows Paths

```bash
# Convert Unix path to Windows path (in WSL)
to_windows_path() {
    local unix_path="$1"
    wslpath -w "$unix_path"
}

# Convert Windows path to Unix path (in WSL)
to_unix_path() {
    local win_path="$1"
    wslpath -u "$win_path"
}
```

### Home Directory

```bash
# Bash
HOME_DIR="$HOME"

# PowerShell
$HomeDir = $env:USERPROFILE
```

## Git Handling Across Platforms

### Safe Git Commands

```bash
# Works on all platforms
get_project_name() {
    local git_root
    if git rev-parse --git-dir &> /dev/null; then
        git_root=$(git rev-parse --show-toplevel 2>/dev/null)
        if [[ -n "$git_root" ]]; then
            basename "$git_root"
            return 0
        fi
    fi
    basename "$PWD"
}
```

### PowerShell Git Handling

```powershell
function Get-ProjectName {
    try {
        $gitRoot = & git rev-parse --show-toplevel 2>$null
        if ($LASTEXITCODE -eq 0 -and $gitRoot) {
            return Split-Path $gitRoot -Leaf
        }
    } catch {
        # Not in git repo
    }
    return Split-Path (Get-Location) -Leaf
}
```

## Testing Strategy

### CI/CD Matrix

```yaml
strategy:
  matrix:
    os: [macos-latest, ubuntu-latest, windows-latest]
```

### Platform-Specific Tests

```bash
# test/test-platform.sh
test_current_platform() {
    local os=$(detect_os)
    case "$os" in
        macos)  test_macos_notification ;;
        linux)  test_linux_notification ;;
        wsl)    test_wsl_notification ;;
        *)      echo "Unknown platform: $os" ;;
    esac
}
```

## Common Pitfalls

1. **Line Endings**: Windows uses CRLF, Unix uses LF
   - Use `.gitattributes` to enforce line endings

2. **Path Separators**: Windows uses `\`, Unix uses `/`
   - Use variables like `$HOME` instead of hardcoded paths

3. **Case Sensitivity**: Windows is case-insensitive
   - Be consistent with file naming

4. **Command Availability**: Commands differ by platform
   - Always check with `command -v` before use

## Success Metrics

- Works on macOS 10.14+
- Works on Ubuntu 20.04+
- Works on Windows 10+ (PowerShell 5.1+)
- Works on WSL2
- Graceful fallback when tools missing

Attribution

mylee04mylee04
View sourceMore from mylee04 →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

284072 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2192 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Tanstack Start

Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 + Cloudflare Workers app with file-based routing and server functions — even if they don't name TanStack Start specifically. No template repo — Claude generates every file fresh per ...

9881 votes

Pentest

PTES-aligned adversarial security audit for backend, frontend, and mobile applications. Produces a CVSS-scored Hacker Report with verified PoCs and phased remediation.

5491 votes
View all in development →