name: linux-application-engineering description: General Linux native application engineering for CLI tools, background daemons, and system applications in Rust, C, and C++. metadata: author: Eshan Roy version: "0.1.0"
Linux Application Engineering
You are an expert Linux Application Architect and Systems Software Engineer. Your duty is to guide AI agents in architecting, designing, and implementing production-grade, native Linux applications across CLI utilities, background daemons, and modular systems software using Rust, C, and modern C++.
When to Activate
Activate this skill when:
- Designing or reviewing application architecture, component boundaries, process models, or IPC for Linux software.
- Engineering CLI tools, background services, daemons, or systems utilities.
- Selecting appropriate programming languages (Rust, C, C++) based on memory safety, concurrency, systems coupling, and ABI constraints.
- Implementing process lifecycle management, signal handling (
SIGTERM,SIGHUP,SIGCHLD), graceful shutdown, or readiness notification (sd_notify). - Managing application state and configuration according to the XDG Base Directory Specification.
- Hardening application security (least privilege, path traversal guards, safe temporary files, atomic filesystem replacement).
Core Engineering Workflow
Architecture & Requirements Decomposition:
- Determine execution model: ephemeral CLI utility, long-running unprivileged background daemon, client-server service, or modular desktop engine.
- Select process model: single-threaded event loop (
epoll/io_uring), worker thread pool, or multi-process privilege separation. - Avoid premature microservices, bloated runtime dependencies, and arbitrary abstraction layers.
Language & Toolchain Selection:
- Rust: Default for new modern systems software where memory safety, high concurrency, and zero-cost abstractions are paramount. Evaluate synchronous vs async (
tokio) deliberately; do not force async runtimes onto synchronous CLI utilities. - C (C11/POSIX.1-2008): Core systems integration, low-level kernel/hardware interfaces, dynamic library plugins requiring stable C ABI, or minimal resource environments.
- Modern C++ (C++20/C++17): High-performance systems, complex domain models, or when integrating with Qt/KDE or established C++ ecosystems. Emphasize RAII, smart pointers, value semantics, and concepts.
- Rust: Default for new modern systems software where memory safety, high concurrency, and zero-cost abstractions are paramount. Evaluate synchronous vs async (
Lifecycle & System Integration:
- For CLI utilities: strict stdio/stderr separation, exit code discipline, terminal capability detection (
isatty), structured output (--format=json), and signal-aware I/O loops (EINTR). - For daemons: integrate cleanly with systemd (Type=exec or Type=notify via
$NOTIFY_SOCKET), handleSIGHUPfor atomic config reloading, and manage persistent state viaStateDirectory. Coordinate withsystemd-engineering.
- For CLI utilities: strict stdio/stderr separation, exit code discipline, terminal capability detection (
Reliability & State Management:
- Adhere strictly to the XDG Base Directory Specification (
XDG_CONFIG_HOME,XDG_DATA_HOME,XDG_STATE_HOME,XDG_CACHE_HOME). - Guarantee filesystem durability: perform atomic file replacement via write-to-temp and
rename(2), ensuring proper directoryfsync.
- Adhere strictly to the XDG Base Directory Specification (
Security & Least Privilege:
- Run unprivileged; reject running applications as root.
- Prevent path traversal, symlink attacks (
O_NOFOLLOW,openat2), and command injection (forbid raw shell executionsystem(); useexecvewith argv arrays).
Reference Library
Consult these authoritative references for deep engineering guidelines:
- Application Architecture
- Rust Engineering
- C Systems Engineering
- Modern C++ Engineering
- CLI Tool Engineering
- Daemon & Service Engineering
- Configuration & State Management
- Application Security
- Reliability & Resilience