name: systemd-engineering
description: Specialist skill for systemd system and service management, unit architecture, sandboxing, cgroups v2 resource control, and diagnostic troubleshooting. Covers service types (simple, exec, notify with sd_notify), socket activation, timers, dependency vs ordering directives (Wants, Requires, BindsTo, Before, After), security hardening (DynamicUser, ProtectSystem=strict, capability dropping, SystemCallFilter), and non-destructive validation via systemd-analyze verify. Use when authoring unit files, hardening daemons, fixing startup timeouts, or investigating failed units.
license: Apache-2.0
compatibility: Requires Linux environment with systemd userspace tooling (systemd-analyze, systemctl).
metadata:
author: Eshan Roy
version: "0.1.0"
claude_context: "fork"
claude_agent: "general"
systemd Systems & Service Engineering
The systemd-engineering skill provides specialist capabilities for designing, configuring, hardening, and troubleshooting Linux systemd services, targets, sockets, timers, and resource management slices.
1. Operating Principles & Invariants
- Dependency Does Not Imply Ordering: Always pair
Wants= or Requires= with explicit Before= or After= ordering directives to prevent parallel startup race conditions.
- Never Blindly Apply Sandboxing: Hardening directives (
ProtectSystem=strict, DynamicUser=yes) restrict filesystem and capability access. Always pair sandboxing with managed directories (StateDirectory=, RuntimeDirectory=) and verify required syscalls before deploying.
- Validate Statically Before Reloading: Always validate unit syntax with
systemd-analyze verify /path/to/unit before requesting system activation.
- Safety Tier Gating: Enabling, disabling, restarting, or masking host system services (
systemctl restart, systemctl enable) are Tier 3 operations requiring explicit human authorization. Never silently disable system services.
2. Intent Classification & Workflow Routing
flowchart TD
REQ["systemd Engineering Request"] --> CLASS{"Classify Task"}
CLASS -->|Unit Creation / Refactoring| DSN["1. Service Engineering\n(Type=notify, ExecStart, StateDirectory, dependencies)"]
CLASS -->|Security Hardening| SEC["2. Sandboxing Audit\n(systemd-analyze security, DynamicUser, syscall filters)"]
CLASS -->|Resource Management| RES["3. Resource Control\n(cgroups v2, CPUQuota, MemoryMax, TasksMax, slices)"]
CLASS -->|Failure / Timeout Diagnosis| DIAG["4. Troubleshooting\n(journalctl -u, systemd-analyze verify, ordering cycles)"]
DSN --> EXEC["Execute systemd Workflow"]
SEC --> EXEC
RES --> EXEC
DIAG --> EXEC
3. The 5-Step Service Hardening Workflow
- Baseline Assessment: Run
systemd-analyze security <unit> to obtain current exposure score.
- Privilege Dropping: Enforce
NoNewPrivileges=yes and DynamicUser=yes (or specify unprivileged User= and Group=).
- Filesystem Lockdown: Apply
ProtectSystem=strict, ProtectHome=yes, PrivateTmp=yes, and PrivateDevices=yes. Declare writable directories via StateDirectory= and RuntimeDirectory=.
- Kernel & Syscall Restriction: Set
ProtectKernelTunables=yes, ProtectControlGroups=yes, and whitelist syscalls with SystemCallFilter=@system-service.
- Static Verification: Execute
systemd-analyze verify and check that the security exposure score drops below 2.5.
4. Cross-Specialist Coordination
| Task |
Coordinating Specialists |
Interaction |
| Packaged service unit file |
systemd-engineering + arch-packaging |
systemd-engineering authors unit; arch-packaging places it in /usr/lib/systemd/system/. |
| Network-dependent daemon |
systemd-engineering + linux-networking |
linux-networking verifies interfaces; systemd-engineering orders After=network-online.target. |
| Mount or encrypted swap unit |
systemd-engineering + linux-storage |
linux-storage defines UUIDs/options; systemd-engineering configures .mount or .swap. |
5. Authoritative References Directory
- Unit Architecture & Dependency Model
- Service Engineering & Notification Protocol
- Sandboxing & Security Scoring
- Resource Control & cgroups v2
- Diagnostics & Troubleshooting
- Safety Policy
1---2name: systemd-engineering3description: Specialist skill for systemd system and service management, unit architecture, sandboxing, cgroups v2 resource control, and diagnostic troubleshooting. Covers s4---5---6name: systemd-engineering7description: Specialist skill for systemd system and service management, unit architecture, sandboxing, cgroups v2 resource control, and diagnostic troubleshooting. Covers service types (simple, exec, notify with sd_notify), socket activation, timers, dependency vs ordering directives (Wants, Requires, BindsTo, Before, After), security hardening (DynamicUser, ProtectSystem=strict, capability dropping, SystemCallFilter), and non-destructive validation via systemd-analyze verify. Use when authoring unit files, hardening daemons, fixing startup timeouts, or investigating failed units.8license: Apache-2.09compatibility: Requires Linux environment with systemd userspace tooling (systemd-analyze, systemctl).10metadata:11 author: Eshan Roy12 version: "0.1.0"13 claude_context: "fork"14 claude_agent: "general"15---1617# systemd Systems & Service Engineering1819The `systemd-engineering` skill provides specialist capabilities for designing, configuring, hardening, and troubleshooting Linux systemd services, targets, sockets, timers, and resource management slices.2021---2223## 1. Operating Principles & Invariants24251. **Dependency Does Not Imply Ordering**: Always pair `Wants=` or `Requires=` with explicit `Before=` or `After=` ordering directives to prevent parallel startup race conditions.262. **Never Blindly Apply Sandboxing**: Hardening directives (`ProtectSystem=strict`, `DynamicUser=yes`) restrict filesystem and capability access. Always pair sandboxing with managed directories (`StateDirectory=`, `RuntimeDirectory=`) and verify required syscalls before deploying.273. **Validate Statically Before Reloading**: Always validate unit syntax with `systemd-analyze verify /path/to/unit` before requesting system activation.284. **Safety Tier Gating**: Enabling, disabling, restarting, or masking host system services (`systemctl restart`, `systemctl enable`) are Tier 3 operations requiring explicit human authorization. Never silently disable system services.2930---3132## 2. Intent Classification & Workflow Routing3334```mermaid35flowchart TD36 REQ["systemd Engineering Request"] --> CLASS{"Classify Task"}3738 CLASS -->|Unit Creation / Refactoring| DSN["1. Service Engineering\n(Type=notify, ExecStart, StateDirectory, dependencies)"]39 CLASS -->|Security Hardening| SEC["2. Sandboxing Audit\n(systemd-analyze security, DynamicUser, syscall filters)"]40 CLASS -->|Resource Management| RES["3. Resource Control\n(cgroups v2, CPUQuota, MemoryMax, TasksMax, slices)"]41 CLASS -->|Failure / Timeout Diagnosis| DIAG["4. Troubleshooting\n(journalctl -u, systemd-analyze verify, ordering cycles)"]4243 DSN --> EXEC["Execute systemd Workflow"]44 SEC --> EXEC45 RES --> EXEC46 DIAG --> EXEC47```4849---5051## 3. The 5-Step Service Hardening Workflow52531. **Baseline Assessment**: Run `systemd-analyze security <unit>` to obtain current exposure score.542. **Privilege Dropping**: Enforce `NoNewPrivileges=yes` and `DynamicUser=yes` (or specify unprivileged `User=` and `Group=`).553. **Filesystem Lockdown**: Apply `ProtectSystem=strict`, `ProtectHome=yes`, `PrivateTmp=yes`, and `PrivateDevices=yes`. Declare writable directories via `StateDirectory=` and `RuntimeDirectory=`.564. **Kernel & Syscall Restriction**: Set `ProtectKernelTunables=yes`, `ProtectControlGroups=yes`, and whitelist syscalls with `SystemCallFilter=@system-service`.575. **Static Verification**: Execute `systemd-analyze verify` and check that the security exposure score drops below `2.5`.5859---6061## 4. Cross-Specialist Coordination6263| Task | Coordinating Specialists | Interaction |64|:---|:---|:---|65| Packaged service unit file | `systemd-engineering` + `arch-packaging` | `systemd-engineering` authors unit; `arch-packaging` places it in `/usr/lib/systemd/system/`. |66| Network-dependent daemon | `systemd-engineering` + `linux-networking` | `linux-networking` verifies interfaces; `systemd-engineering` orders `After=network-online.target`. |67| Mount or encrypted swap unit | `systemd-engineering` + `linux-storage` | `linux-storage` defines UUIDs/options; `systemd-engineering` configures `.mount` or `.swap`. |6869---7071## 5. Authoritative References Directory7273- [Unit Architecture & Dependency Model](references/unit-architecture.md)74- [Service Engineering & Notification Protocol](references/service-engineering.md)75- [Sandboxing & Security Scoring](references/sandboxing.md)76- [Resource Control & cgroups v2](references/resource-control.md)77- [Diagnostics & Troubleshooting](references/troubleshooting.md)78- [Safety Policy](../../references/safety-policy.md)