CFDesktop: Command for Claude Code

.claude/commands/cross-platform.md

cross-platform is a command for Claude Code from Awesome-Embedded-Learning-Studio/CFDesktop. It costs 0 tokens per session (920 once invoked), scanned A, original, MIT.

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

Written for Claude Code: installed under .claude/.

This is Awesome-Embedded-Learning-Studio/CFDesktop's own configuration. It tells Claude Code how to work on CFDesktop itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything CFDesktop configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Awesome-Embedded-Learning-Studio/CFDesktop. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Awesome-Embedded-Learning-Studio/CFDesktop/main/.claude/commands/cross-platform.md
Clone the repo
git clone --depth 1 https://github.com/Awesome-Embedded-Learning-Studio/CFDesktop

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cross-platform

README.md
[![agentmods](https://agentmods.dev/badge/commands/awesome-embedded-learning-studio/cfdesktop/cross-platform/github.svg)](https://agentmods.dev/commands/awesome-embedded-learning-studio/cfdesktop/cross-platform)
Your own site
<a href="https://agentmods.dev/commands/awesome-embedded-learning-studio/cfdesktop/cross-platform"><img src="https://agentmods.dev/badge/commands/awesome-embedded-learning-studio/cfdesktop/cross-platform/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cross-platform

Your own site · 80×15
<a href="https://agentmods.dev/commands/awesome-embedded-learning-studio/cfdesktop/cross-platform"><img src="https://agentmods.dev/badge/commands/awesome-embedded-learning-studio/cfdesktop/cross-platform.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00000 $0.00920
Opus 5.5 $0.00000 $0.00368
Sonnet 5.5 $0.00000 $0.00184
Haiku 4.5 $0.00000 $0.00092

Measured 2mo ago against content hash c062de354cec, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 2mo 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. 2mo 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 (11 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.