Cross-Platform Hooks and Status Scripts

Develop cross-platform Claude Code hooks and status scripts for Windows, WSL, and Linux.

Updated Apr 11, 2023
One-click install
npx skills add https://github.com/salverius-tech/dotfiles --skill cross-platform-hooks-and-status-scripts
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Cross-Platform Hooks and Status Scripts
Source: https://github.com/salverius-tech/dotfiles/tree/main/home/dot_claude/skills/hooks-cross-platform
Command: npx skills add https://github.com/salverius-tech/dotfiles --skill cross-platform-hooks-and-status-scripts

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides essential guidelines and examples for creating Claude Code hooks and status scripts that function reliably across different operating systems, including Windows (PowerShell, Git Bash), WSL, and Linux.

Core Features & Use Cases

  • Cross-Platform Compatibility: Ensures scripts work seamlessly on Windows, WSL, and Linux.
  • Robust Scripting: Covers critical aspects like shebang lines, line endings, home directory detection, and tool availability checks.
  • Use Case: Develop a Git hook that automatically formats code before a commit, ensuring it runs correctly whether you're on Windows or Linux.

Quick Start

Follow the guidelines in this skill to ensure your shell scripts use LF line endings and the correct shebang for cross-platform compatibility.

Frequently Asked Questions about Cross-Platform Hooks and Status Scripts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write Claude Code hooks that work on both Windows and Linux?

To create cross-platform Claude Code hooks, you need to manage line endings as LF and use the correct shebang lines. This ensures your status scripts execute reliably across Windows, WSL, and Linux environments.

Why do my shell scripts fail when running hooks in WSL?

Shell scripts often fail in WSL due to incorrect line endings or missing tool availability checks. Normalizing to LF line endings and verifying tool paths ensures your cross-platform hooks run without execution errors.

What is the best way to handle home directory detection in cross-platform scripting?

The best way to handle home directory detection in cross-platform scripting is to implement platform-specific checks rather than assuming a static path. This approach accommodates differences between Windows PowerShell, Git Bash, and Linux.

Does Claude Code support cross-platform hooks for Git Bash and PowerShell?

Yes, Claude Code supports cross-platform hooks for Git Bash and PowerShell. You must account for platform-specific nuances like shebang lines and path conversion to ensure your automation scripts function correctly across these environments.

How do I convert file paths for automation scripts running on Windows and WSL?

Converting file paths for automation scripts on Windows and WSL requires implementing path conversion logic within your hooks. This addresses the directory structure differences between Windows and Linux file systems.

What are the limitations of using cross-platform hooks for AI-assisted development?

Limitations of cross-platform hooks include varying tool availability and platform-specific scripting nuances across Windows and Linux. You must explicitly check for dependencies and handle environment differences to maintain robust automation.