cross-platform

A command that reviews whether code works across Windows, Linux, macOS, and selected embedded environments.

In plain words
What is it for?
Use it on a module path to check conditional compilation, path handling, and the organization of shared and platform-specific implementations.
Why use it?
It finds platform-specific assumptions such as hard-coded paths, line endings, temporary directories, and poorly separated operating-system code before they cause build or runtime problems.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/awesome-embedded-learning-studio/cfdesktop/cross-platform
Clone the repo
git clone --depth 1 https://github.com/Awesome-Embedded-Learning-Studio/CFDesktop

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 920 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00920
Opus 5 $0.00000 $0.00460
Sonnet 5 $0.00000 $0.00184
Haiku 4.5 $0.00000 $0.00092

Measured 3d ago against content hash c062de354cec, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cross-platform scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/cross-platform.md · 117 lines

How it starts

The opening of the file, as written. The whole thing — 117 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/cross-platform — 跨平台兼容性检查

检查代码的跨平台兼容性,确保正确的平台抽象和隔离。

触发方式

  • /cross-platform <模块路径> — 检查跨平台兼容性
  • Review 流程内部调用

支持平台

平台 API 编译器
Windows 10/11 Win32, DWM MSVC, MinGW
Linux/WSL POSIX, X11, Wayland GCC, Clang
Embedded ARM EGLFS, LinuxFB (规划中) GCC交叉编译

检查流程

Step 1: 条件编译检查

合法的平台宏 (优先使用)
  • Q_OS_WIN — Windows 平台 (Qt 宏,首选)
  • Q_OS_LINUX — Linux 平台 (Qt 宏,首选)
  • Q_OS_MAC — macOS 平台 (Qt 宏)
  • _WIN32 / _MSC_VER — Windows 特定低层代码(可接受)
  • WIN32 — CMake 级别(可接受)
禁止的宏
  • __linux__ — 应使用 Q_OS_LINUX
  • __APPLE__ — 应使用 Q_OS_MAC
  • #ifdef _WIN64 — 应使用 Q_OS_WIN
路径处理
  • 硬编码路径分隔符 ("\""/") — 应使用 QDir/QFileInfo
  • 硬编码行尾 — 应使用 QFile 自动处理
  • 硬编码临时目录 — 应使用 QStandardPaths

Step 2: 平台抽象目录结构检查

验证平台特定代码的隔离模式:

正确模式 (base/system/):

base/system/cpu/
├── cfcpu.h              ← 公共头文件(平台无关接口)
├── cfcpu.cpp            ← 公共实现(调用 host.h)
└── private/
    ├── cpu_host.h       ← 平台选择器
    ├── linux_impl/      ← Linux 实现
    │   └── cpu_linux.cpp
    └── win_impl/        ← Windows 实现
        └── cpu_win.cpp

正确模式 (desktop/ui/platform/):

desktop/ui/platform/
├── interface.h          ← 平台无关接口
├── windows/             ← Windows 实现
└── linux_wsl/           ← Linux/WSL 实现

Step 3: 共享层纯度检查

以下位置禁止包含平台特定代码:

  • ui/core/ — 主题引擎
  • ui/widget/ — MD3 控件
  • ui/components/ — 动画框架
  • base/include/base/ — 工具头文件

平台特定代码必须隔离在:

  • base/system/*/private/
  • desktop/ui/platform/windows/
  • desktop/ui/platform/linux_wsl/

Step 4: DLL 导出宏检查

验证正确的导出宏使用:

  • base: CF_BASE_EXPORT
  • ui: CF_UI_EXPORT
  • desktop: CF_DESKTOP_EXPORT

每个导出宏应处理 Windows __declspec 和 Linux __attribute__((visibility))

Step 5: 输出报告 (中文)

# 跨平台兼容性报告: <scope>

## 条件编译检查
### 使用的平台宏
| 文件 | 行号 | 宏 | 合规 |
|------|------|-----|------|

### 不符合规范的宏
(需修改的项,含建议替换)

## 平台抽象层检查
### 正确隔离的代码
- ...

### 泄漏到共享层的平台代码
- ...

## 路径处理检查
- 合规项: ...
- 违规项: ...

## DLL 导出检查
- 合规项: ...
- 缺失导出宏: ...

## 修复建议
(按优先级排列的具体修改方案)

Read the full file on GitHub · 117 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 117 lines · 0 tokens per session scan A c062de354cec

Subscribe to this mod's changes

cross-platform is a command published in the GitHub repository Awesome-Embedded-Learning-Studio/CFDesktop (10 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 920 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other commands, from other repositories

fix-int

Fix integer type definitions for specified platform.

FastLED/FastLED · 7 tokens

verify-claim

验证一条 C++ 断言 —— 编译最小例子 + 查 cppreference,给出成立/不成立的实证(金科玉律固化版).

Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP · 37 tokens

explain

给 C++ 学习者讲一个概念 —— 先在仓库定位项目怎么讲、再验证、用项目声音讲解(learning track 4 守则固化版).

Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP · 41 tokens

rtos

You are an RTOS specialist using the rtos-engineer agent's expertise. Help the user design a correct, deterministic task structure with sized IPC primitives, identified priority inversion risks, and a real-board-aware implementation path.

HermeticOrmus/LibreEmbed-Claude-Code · 0 tokens

sync-go-engine

Synchronize the Go side — the engine runtime — with the current contract/workflow.yaml. The TypeScript side has its own sync command (/sync-ts-domain); this one does not touch ts/. Use this after the contract YAML has been edited (or pulled in from fh-backend) to add/remove/change nodes or their argument shapes.

ForestHubAI/edge-agents · 0 tokens

sync-ts-domain

Synchronize the TypeScript side — workflow-core domain layer (and any workflow-builder knock-on edits) — with the current contract/workflow.yaml. The Go engine side has its own sync command; this one does not touch go/. Use this after the contract YAML has been edited (or pulled in from fh-backend) to…

ForestHubAI/edge-agents · 0 tokens