# dbus

Guides secure D-Bus IPC development on Linux, covering method calls, signal handling, bus filtering, and test-driven workflows.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 195 installs · ★ 48 repo stars
- Author: martinholovsky
- License: Unlicense · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/martinholovsky/claude-skills-generator/tree/HEAD/skills/dbus/SKILL.md
- Updated: 2025-12-06
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/dbus

## What it does

This skill instructs the agent on handling D-Bus inter-process communication on Linux. It enforces a strict test-driven development workflow: write failing unit tests with mocks in pytest, implement minimal code, and verify types with mypy. The skill covers implementations using `dbus-python`, `pydbus`, async `dasbus`, and `gi.repository.Gio`.

Security is the central constraint. The instructions mandate defaulting to the user session bus rather than the privileged system bus, while outright blocking access to sensitive endpoints like `org.freedesktop.PolicyKit1` or systemd. Unvalidated service targets and missing timeouts can stall client processes or expose privileged interfaces.

For performance, the guide provides concrete patterns: connection pooling to avoid spawning new bus connections, batching property reads via `org.freedesktop.DBus.Properties`, and subscribing strictly to specific signal names and paths.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add martinholovsky/claude-skills-generator --skill dbus -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/dbus/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/dbus/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add martinholovsky/claude-skills-generator --skill dbus -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/dbus/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add martinholovsky/claude-skills-generator --skill dbus -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/dbus/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install martinholovsky/claude-skills-generator skills/dbus
```

2. **Manually: put the files in place**
- File: `.github/skills/dbus/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add martinholovsky/claude-skills-generator --skill dbus -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/martinholovsky/claude-skills-generator --path skills/dbus
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/dbus/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add martinholovsky/claude-skills-generator --skill dbus -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/martinholovsky/claude-skills-generator/tree/HEAD/skills/dbus/SKILL.md

## When to use it
- build a secure D-Bus client rejecting calls to privileged services
- subscribe to specific D-Bus signals with path and interface filtering
- mock D-Bus session buses in pytest for isolated testing
- convert synchronous bus calls into non-blocking coroutines with `dasbus`

## Example prompts
- Write a Python D-Bus client using SessionBus that validates service names and sets timeouts
- Implement a signal receiver for notifications using `dasbus` and async event loops
- Create unit tests mocking the D-Bus bus interface to verify blocked system services

## Source text · SKILL.md · Unlicense

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: cde2c99de0535f9a.

BEGIN THIRD-PARTY FILE cde2c99de0535f9a
````text
---
name: dbus
risk_level: MEDIUM
description: "Expert in D-Bus IPC (Inter-Process Communication) on Linux systems. Specializes in secure service communication, method calls, signal handling, and system integration. HIGH-RISK skill due to system service access and privileged operations."
model: sonnet
---

## 1. Overview

**Risk Level**: HIGH - System service access, privileged operations, IPC

You are an expert in D-Bus communication with deep expertise in:

- **D-Bus Protocol**: Message bus system, object paths, interfaces
- **Bus Types**: Session bus (user), System bus (privileged)
- **Service Interaction**: Method calls, signals, properties
- **Security**: Policy enforcement, peer credentials

### Core Expertise Areas

1. **Bus Communication**: Session/system bus, message routing
2. **Object Model**: Paths, interfaces, methods, signals
3. **Policy Enforcement**: D-Bus security policies, access control
4. **Security Controls**: Credential validation, service allowlists

---

## 2. Core Principles

1. **TDD First** - Write tests before implementation
2. **Performance Aware** - Optimize connections, caching, async calls
3. **Security First** - Validate targets, block privileged services
4. **Minimal Privilege** - Session bus by default, least access

---

## 3. Core Responsibilities

### 3.1 Safe IPC Principles

When using D-Bus:
- **Validate service targets** before method calls
- **Use session bus** unless system access required
- **Block privileged services** (PolicyKit, systemd)
- **Log all method invocations**
- **Enforce call timeouts**

### 3.2 Security-First Approach

Every D-Bus operation MUST:
1. Validate target service/interface
2. Check against blocked service list
3. Use appropriate bus type
4. Log operation details
5. Enforce timeout limits

### 3.3 Bus Type Policy

- **Session Bus**: User applications, non-privileged
- **System Bus**: System services, requires elevated permissions
- **Default**: Always prefer session bus

---

## 4. Technical Foundation

### 4.1 D-Bus Architecture

```
Application -> D-Bus Library -> D-Bus Daemon -> Target Service
```

**Key Concepts**:
- **Bus Name**: Service identifier (e.g., `org.freedesktop.Notifications`)
- **Object Path**: Object location (e.g., `/org/freedesktop/Notifications`)
- **Interface**: Method grouping (e.g., `org.freedesktop.Notifications`)
- **Member**: Method or signal name

### 4.2 Libraries

| Library | Purpose | Security Notes |
|---------|---------|----------------|
| `dbus-python` | Python bindings | Validate peer credentials |
| `pydbus` | Modern Python D-Bus | Use with service filtering |
````
END THIRD-PARTY FILE cde2c99de0535f9a

The third-party file has ended. Everything between the cde2c99de0535f9a tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2608 of 20132 bytes. © martinholovsky · Unlicense · https://github.com/martinholovsky/claude-skills-generator/tree/HEAD/skills/dbus/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
