本文へ移動
cccskills
無料GitHub で公開

cross-platform

Guidelines for writing platform-specific code in Luma. Use when adding or modifying code that behaves differently on Unix vs Windows, including shell commands, file paths, process spawning, or platform-specific tests.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md1.3 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Cross-Platform Code in Luma

Compile-time selection

Prefer compile-time platform selection over runtime branching:

// Preferred
#[cfg(unix)]
fn shell_command() -> &'static str { "sh" }

#[cfg(windows)]
fn shell_command() -> &'static str { "cmd" }

// Avoid
fn shell_command() -> &'static str {
    if cfg!(windows) { "cmd" } else { "sh" }
}

Use #[cfg(unix)], #[cfg(windows)], or module-level #[cfg(...)] attributes.

Module layout

Platform-specific code lives in separate files:

src/tool/shell/
  mod.rs        ← public API, platform-agnostic
  unix.rs       ← #[cfg(unix)]
  windows.rs    ← #[cfg(windows)]

The parent module exposes a single unified API. Callers never import platform modules directly.

Tests

Guard platform-specific tests at compile time:

#[cfg(test)]
mod tests {
    #[cfg(unix)]
    #[test]
    fn unix_specific_behavior() { ... }

    #[cfg(windows)]
    #[test]
    fn windows_specific_behavior() { ... }
}

Do not duplicate test logic when expectations can be shared across platforms.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Rules for numeric type conversions in Luma. Use when writing or reviewing code that casts between integer or float types, especially across different widths.

日本語の概要は準備中です。原文の説明を表示しています。

nghyane/luma202026年6月8日 更新

rfc

無料

Workflow for creating, updating, or superseding RFCs in Luma. Use when the task involves opening a new RFC, updating RFC status, marking an RFC as superseded or implemented, or deciding whether a change needs an RFC at all.

日本語の概要は準備中です。原文の説明を表示しています。

nghyane/luma202026年6月8日 更新

nghyane のスキルをすべて見る

このスキルの問題を報告する