Skip to content
Back to skills

Matrix Administration

ASecurity

Use when administering a Synapse / Matrix homeserver — list or snapshot all rooms, rate room health (public, unencrypted, orphaned), render a Graphviz map of the room/space tree, force-join users, promote room admins, harden rooms (add-to-space + restrict + encrypt), deactivate Matrix users (with GDPR erase), find biggest rooms by DB size, audit where a user is admin or member, replay join/leave timelines, or search unencrypted history. Trigger on any '/_synapse/admin', server-wide room opera...

  • 6 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 5, 2026
ai-agentspythonbashdockergitapi

Works with

  • terminal
  • cli
  • api

Security analysis

A100/100

Pro scans all 20 files and shows the line behind each finding

Scanned December 5, 2026

npx -y skills add lufox-digital/matrix-skill --skill matrix-administration --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Matrix Administration?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Matrix Administration
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/lufox-digital-matrix-administration/badge)](https://www.skillsdirectory.com/skills/lufox-digital-matrix-administration)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
# SPDX-License-Identifier: CC-BY-SA-4.0
# SPDX-FileCopyrightText: Lufox Digital GmbH
name: matrix-administration
description: "Use when administering a Synapse / Matrix homeserver — list or snapshot all rooms, rate room health (public, unencrypted, orphaned), render a Graphviz map of the room/space tree, force-join users, promote room admins, harden rooms (add-to-space + restrict + encrypt), deactivate Matrix users (with GDPR erase), find biggest rooms by DB size, audit where a user is admin or member, replay join/leave timelines, or search unencrypted history. Trigger on any '/_synapse/admin', server-wide room operation, Matrix user offboarding, or anything requiring a homeserver-admin token — even without 'admin API' in the prompt. Companion to matrix-communication."
license: "(MIT AND CC-BY-SA-4.0). See LICENSE-MIT and LICENSE-CC-BY-SA-4.0"
compatibility: "Requires uv (runs the scripts on Python 3.11 or later; stdlib only) + a Matrix access token belonging to a Synapse server-admin user. Optional: graphviz `dot` for SVG. Synapse 1.x with admin API enabled."
metadata:
  author: Lufox Digital GmbH
  version: "6.0.1"
  repository: https://github.com/lufox-digital/matrix-skill
allowed-tools: Bash(uv run ${CLAUDE_SKILL_DIR}/scripts/*) Bash(uv run skills/matrix-administration/scripts/*) Bash(dot:*) Read Write
---

# Matrix Administration

Stdlib-only Python wrappers around the Synapse [Admin API](https://element-hq.github.io/synapse/latest/usage/administration/admin_api/index.html) and the Client-Server API. Reads `~/.config/matrix/config.json` (the same file matrix-communication uses).

## Quick Reference

```bash
S=skills/matrix-administration/scripts

uv run ${CLAUDE_SKILL_DIR}/scripts/synapse-fetch-rooms.py [--server :example.com]
uv run ${CLAUDE_SKILL_DIR}/scripts/synapse-rate-rooms.py --space '!home:srv' [--language de]
uv run ${CLAUDE_SKILL_DIR}/scripts/synapse-graph.py --space '!home:srv'
uv run ${CLAUDE_SKILL_DIR}/scripts/synapse-biggest-rooms.py [-n 10]

uv run ${CLAUDE_SKILL_DIR}/scripts/synapse-join-room.py    '!room:srv' '@user:srv'
uv run ${CLAUDE_SKILL_DIR}/scripts/synapse-make-admin.py   '!room:srv' '@user:srv'
uv run ${CLAUDE_SKILL_DIR}/scripts/synapse-add-to-space.py '!room:srv' '!space:srv'
uv run ${CLAUDE_SKILL_DIR}/scripts/synapse-migrate-room.py '!room:srv' '@admin:srv' '!space:srv'   # DESTRUCTIVE, asks first

uv run ${CLAUDE_SKILL_DIR}/scripts/synapse-deactivate-user.py   '@user:srv'   # DESTRUCTIVE
uv run ${CLAUDE_SKILL_DIR}/scripts/synapse-user-rooms.py        '@user:srv'
uv run ${CLAUDE_SKILL_DIR}/scripts/synapse-user-admin-rooms.py  '@user:srv'
uv run ${CLAUDE_SKILL_DIR}/scripts/synapse-room-member-flow.py  '!room:srv'
uv run ${CLAUDE_SKILL_DIR}/scripts/synapse-search.py            '!room:srv' '@bot:srv' deploy
```

## Scripts

| Script | Purpose |
|--------|---------|
| `synapse-fetch-rooms.py` | Snapshot all rooms + state → `rooms.json` |
| `synapse-rate-rooms.py` | Health checks (EN/DE) on `rooms.json` |
| `synapse-graph.py` | Render `rooms.json` → Graphviz `.dot` + `.svg` |
| `synapse-biggest-rooms.py` | Top-N rooms by DB size |
| `synapse-join-room.py` | Force-join a user |
| `synapse-make-admin.py` | Promote to PL 100 |
| `synapse-add-to-space.py` | Send `m.space.child` |
| `synapse-migrate-room.py` | Add to space + restrict + encrypt |
| `synapse-deactivate-user.py` | **Destructive** deactivation (`--erase` for GDPR) |
| `synapse-user-admin-rooms.py` | Local: rooms where user is PL 100 |
| `synapse-user-rooms.py` | Local: rooms a user belongs to |
| `synapse-room-member-flow.py` | Join/leave timeline |
| `synapse-search.py` | Unencrypted history search |

## Setup

`~/.config/matrix/config.json` (respects `$XDG_CONFIG_HOME`):

```json
{
  "homeserver": "https://matrix.example.com",
  "admin_token": "syt_admin_…",
  "room_filter": ":example.com",
  "default_space_id": "!home:example.com",
  "home_space_ids": ["!home:example.com"]
}
```

`homeserver` is required. The token of a server admin comes from `MATRIX_ADMIN_TOKEN`, else the file named by `admin_token_file` (relative paths resolve against the config directory), else `admin_token`; with none of them set the scripts use the access token of matrix-communication's matrix-e2ee-cli session, sent to that session's homeserver, which works when that account is a server admin. `access_token` is not read. The other fields are optional. Env fallbacks: `MATRIX_USER_ID`, `MATRIX_SPACE_ID`, `LANGUAGE=en|de`, `NO_COLOR`.

## Safety

The token is server-admin. Read [`references/safety-guide.md`](references/safety-guide.md) before any destructive op.

- `synapse-deactivate-user.py` is irreversible.
- `synapse-migrate-room.py` enables encryption (one-way) and restricts joins; it prints the plan and asks before the first write (`--yes` skips, and is required without a terminal). Power-level changes restored on exit including Ctrl-C.
- `synapse-make-admin.py` raises PL 100 permanently.
- `synapse-search.py` cannot read E2EE — empty ≠ no messages.
- `rooms.json` exposes user IDs; never commit it.

## References

- [`references/synapse-admin-api.md`](references/synapse-admin-api.md) — endpoints + upstream docs
- [`references/room-health-checks.md`](references/room-health-checks.md) — rules + remediation
- [`references/room-graph-pipeline.md`](references/room-graph-pipeline.md) — Docker dashboard recipe
- [`references/safety-guide.md`](references/safety-guide.md) — destructive-op checklist
- Source: [lufox-digital/matrix-skill](https://github.com/lufox-digital/matrix-skill)

Files in this skill

  • README.md4.5 KB
  • SKILL.md5.4 KB
  • evals/evals.json4.6 KB
  • references/room-graph-pipeline.md3 KB
  • references/room-health-checks.md2.9 KB
  • references/safety-guide.md4.6 KB
  • references/synapse-admin-api.md9.5 KB
  • scripts/_lib/__init__.py927 B
  • scripts/_lib/admin_http.py5.9 KB
  • scripts/_lib/colors.py1.1 KB
  • scripts/_lib/condensing.py4.2 KB
  • scripts/_lib/config.py8.8 KB
  • scripts/_lib/pretty_bytes.py1.4 KB
  • scripts/_lib/rating.py6.5 KB
  • scripts/_lib/test_admin_http.py4.5 KB
  • scripts/_lib/test_config.py8.6 KB
  • scripts/synapse-add-to-space.py2.1 KB
  • scripts/synapse-biggest-rooms.py2 KB
  • scripts/synapse-deactivate-user.py2.8 KB
  • scripts/synapse-fetch-rooms.py3.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.