Agent skill

Matrix Chat Guide

by mobazha in mobazha/mobazha-unified

Matrix 聊天前端开发指南(REST + WS 薄客户端)。当需要开发聊天 UI、修改消息处理、调试 WS 事件时使用。触发词:"Matrix", "聊天", "消息", "加密聊天", "端到端加密", "房间", "chat", "mautrix"。

MPL-2.0Auto-check passedBackend & APIs

Install Matrix Chat Guide

skills CLI
$ npx skills add mobazha/mobazha-unified --skill matrix-chat-guide -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install mobazha/mobazha-unified matrix-chat-guide --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/mobazha/mobazha-unified.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.cursor/skills/matrix-chat-guide .claude/skills/matrix-chat-guide && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
matrix-chat-guide
GitHub stars
165
Token cost
~709 tokens
SKILL.md length
141 words
Files
1
Skills in repo
29
Repo updated
First seen
Licence
MPL-2.0

At a glance

Matrix 聊天前端开发指南(REST + WS 薄客户端)。当需要开发聊天 UI、修改消息处理、调试 WS 事件时使用。触发词:"Matrix", "聊天", "消息", "加密聊天", "端到端加密", "房间", "chat", "mautrix"。

  • Works in 5 steps: 确认后端 API 已在… → 在 apiPaths.ts 添加 CHAT_* 常量 → 在 services/matrix/ 对应模块添加 REST 调用 → …
  • Backend & APIs work in your project
  • SKILL.md covers 架构, 文件结构, REST API 调用模式 and WS 事件消费, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Matrix Chat Guide is an agent skill from mobazha/mobazha-unified. Matrix 聊天前端开发指南(REST + WS 薄客户端)。当需要开发聊天 UI、修改消息处理、调试 WS 事件时使用。触发词:"Matrix", "聊天", "消息", "加密聊天", "端到端加密", "房间", "chat", "mautrix"。

Its SKILL.md is about 710 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs. The repository describes itself as: Open-source commerce frontend for storefronts, marketplaces, checkout, and seller management. The licence is MPL-2.0.

When your agent uses it

  • Backend & APIs work in your project

Example prompts

  • “Matrix”
  • “mautrix”
  • “/matrix-chat-guide”

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. 确认后端 API 已在 mobazha/internal/api/routes.go 注册
  2. 在 apiPaths.ts 添加 CHAT_* 常量
  3. 在 services/matrix/ 对应模块添加 REST 调用
  4. 如果是实时事件,在 event-listeners.ts 添加处理
  5. 在 UI 组件中消费

What it can do on your machine

Read from SKILL.md and the folder at commit 156c699. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Matrix Chat Guide loads about 709 tokens when it runs. Until then it costs about 37 tokens; SKILL.md has 141 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~37
When it runs · the whole SKILL.md, loaded when a task matches
~709

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from mobazha/mobazha-unified at commit 156c699, republished under its MPL-2.0 licence (© mobazha). 141 words, ~709 tokens.

Download SKILL.mdSave it as .claude/skills/matrix-chat-guide/SKILL.md (or your agent's skills folder).
name
matrix-chat-guide
description
Matrix 聊天前端开发指南(REST + WS 薄客户端)。当需要开发聊天 UI、修改消息处理、调试 WS 事件时使用。触发词:"Matrix", "聊天", "消息", "加密聊天", "端到端加密", "房间", "chat", "mautrix"。

Matrix 聊天前端开发指南

完整设计文档:mobazha_hosting/docs/chat/MATRIX_CHAT_DESIGN.md

架构

前端为纯 REST + WebSocket 薄客户端,不持有 matrix-js-sdk。所有 Matrix 协议交互(包括 E2EE)由后端 mautrix-go 处理。

前端 ─REST─→ 后端 /v1/chat/* API
前端 ◄──WS── 后端 chat.* 事件推送

文件结构

packages/core/services/matrix/
├── client.ts           # MatrixClient facade(代理到 REST API)
├── messages.ts         # 消息 CRUD(send/edit/redact/paginate)
├── rooms.ts            # 房间 CRUD + BackendRoom → MatrixRoom 映射
├── event-listeners.ts  # WS chat.* 事件处理分发
├── verification.ts     # SAS 验证 REST API 调用
├── types.ts            # TypeScript 类型(BackendRoom/Message/Member)
└── index.ts            # 导出

packages/core/config/apiPaths.ts    # NODE_API.CHAT_* 路径常量
packages/core/stores/chatStore.ts   # Zustand 聊天状态
apps/web/src/components/ChatDrawer/ # 聊天 UI 组件
└── hooks/useChatEffects.ts         # WS 事件消费 + 验证事件监听

REST API 调用模式

所有 Chat API 通过 authFetch + NODE_API 常量调用:

typescript
import { authFetch } from '../helpers';
import { NODE_API } from '../../config/apiPaths';

// 发送消息
const response = await authFetch(`${NODE_API.CHAT_ROOMS}/${roomId}/messages`, {
  method: 'POST',
  body: JSON.stringify({ body: content }),
});

// 获取房间列表
const rooms = await authFetch(NODE_API.CHAT_ROOMS);

WS 事件消费

后端通过 WebSocket 推送 chat.* 事件,前端在 event-listeners.ts 中处理:

事件处理
chat.message追加到对应房间消息列表
chat.message_edit更新已有消息内容
chat.message_redact从列表中移除消息
chat.typing更新打字指示器
chat.read_receipt更新已读状态
chat.room_invite根据 InvitePolicy 自动接受或弹出确认
chat.verification.*触发验证 UI 流程

数据类型映射

后端返回 → 前端类型转换在 rooms.ts 的 convertRoom()/convertMember() 中:

  • BackendRoom → MatrixRoom
  • BackendMember.peerID → MatrixUser.peerID(原始大小写,来自 state event)
  • BackendMessage.media → 处理加密房间 content.File.URL 路径

修改指引

新增 Chat 功能的前端部分
  1. 确认后端 API 已在 mobazha/internal/api/routes.go 注册
  2. 在 apiPaths.ts 添加 CHAT_* 常量
  3. 在 services/matrix/ 对应模块添加 REST 调用
  4. 如果是实时事件,在 event-listeners.ts 添加处理
  5. 在 UI 组件中消费
调试
  • REST API:浏览器 DevTools → Network 面板
  • WS 事件:DevTools → Network → WS 连接 → Messages 面板
  • 后端日志:grep matrix 在节点日志中(如启用 debug 模式)
  • 聊天状态:React DevTools 查看 Zustand chatStore
注意事项
  • 不要引入 matrix-js-sdk(已在迁移中移除)
  • 所有加密操作在后端完成,前端不接触密钥
  • 媒体使用 Authorization header 下载,不在 URL 中放 token
  • PeerID 使用 member.peerID 字段(原始大小写),不要从 userId 正则提取

© mobazha, MPL-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .cursor/skills/matrix-chat-guide of mobazha/mobazha-unified.

Open the folder on GitHubat commit 156c699

Compare with similar skills

Matrix Chat Guide next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Matrix Chat Guide compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Matrix Chat Guide this skillmobazha/mobazha-unified165—~709Automated safety check: PassMPL-2.0
Configuring Horizoncoollabsio/coolify63k4 repos~898Automated safety check: PassMIT
Nestjs Best Practicesrolling-scopes/rsschool-app10k6 repos~1.2kAutomated safety check: PassMIT
Sub2API AdminWei-Shaw/sub2api43k1 repos~717Automated safety check: PassLGPL-3.0
Firecrawl Build Onboardingfirecrawl/firecrawl190k1 repos~1.4kAutomated safety check: NotesISC
Obsidian BasesAtmosphere/atmosphere3.8k22 repos~3.2kAutomated safety check: PassApache-2.0

Similar skills

  • Configuring Horizon

    coollabsio/coolify

    A skill your agent uses whenever the user mentions Horizon by name in a Laravel context.

    63k GitHub starsUsed in 4 repos~898 tokens
    Backend & APIsAuto-check passed
  • Nestjs Best Practices

    rolling-scopes/rsschool-app

    NestJS best practices and architecture patterns for building production-ready applications.

    10k GitHub starsUsed in 6 repos~1.2k tokens
    Backend & APIsAuto-check passed
  • Sub2API Admin

    Wei-Shaw/sub2api

    Manages a Sub2API deployment from the command line: accounts, redeem and invitation codes, groups, proxies, imports, exports and raw admin API calls.

    43k GitHub starsUsed in 1 repo~717 tokens
    Backend & APIsAuto-check passed
  • Firecrawl Build Onboarding

    firecrawl/firecrawl

    Gets Firecrawl working in a project: signs you in through the browser, saves FIRECRAWL_API_KEY to .env and picks the first SDK or REST path.

    190k GitHub starsUsed in 1 repo~1.4k tokens
    Backend & APIsAuto-check: notes
  • Obsidian Bases

    Atmosphere/atmosphere

    Create and edit Obsidian Bases (.base files) with views, filters, formulas, and summaries.

    3.8k GitHub starsUsed in 22 repos~3.2k tokens
    Backend & APIsAuto-check passed
  • Fortify Development

    coollabsio/coolify

    ACTIVATE when the user works on authentication in Laravel. An agent skill from coollabsio/coolify.

    63k GitHub starsUsed in 4 repos~1.9k tokens
    Backend & APIsAuto-check passed

More from mobazha/mobazha-unified

All 29 skills in this repo
  • A11y Guide

    mobazha/mobazha-unified

    Accessibility guide for Mobazha following WCAG 2.1 AA standards including color contrast, reduced motion, ARIA patterns, keyboard navigation, focus management, and screen reader testing.

    165 GitHub stars~1.4k tokensUpdated 5 days ago
    Auto-check passed
  • API Reference

    mobazha/mobazha-unified

    Look up Mobazha backend API endpoints, request/response formats, and field mappings.

    165 GitHub stars~1.7k tokensUpdated 5 days ago
    Auto-check passed
  • Code Review

    mobazha/mobazha-unified

    Review code for quality, architecture consistency, and adherence to Mobazha project standards using confidence-based filtering.

    165 GitHub stars~464 tokensUpdated 5 days ago
    Auto-check passed
  • Code Simplifier

    mobazha/mobazha-unified

    Simplify and refine recently written code for clarity, consistency, and maintainability while preserving all functionality.

    165 GitHub stars~601 tokensUpdated 5 days ago
    Auto-check passed
  • Commit Helper

    mobazha/mobazha-unified

    Generate commit messages and run pre-commit validation following Mobazha conventions.

    165 GitHub stars~735 tokensUpdated 5 days ago
    Auto-check passed
  • Component Dev

    mobazha/mobazha-unified

    Create and modify UI components following Mobazha conventions including directory structure, spacing standards, accessibility, and testing.

    165 GitHub stars~638 tokensUpdated 5 days ago
    Auto-check passed

Categories

Questions about Matrix Chat Guide

What does Matrix Chat Guide do?

Matrix 聊天前端开发指南(REST + WS 薄客户端)。当需要开发聊天 UI、修改消息处理、调试 WS 事件时使用。触发词:"Matrix", "聊天", "消息", "加密聊天", "端到端加密", "房间", "chat", "mautrix"。. Matrix Chat Guide is an agent skill from mobazha/mobazha-unified.

When should I use Matrix Chat Guide?

Matrix Chat Guide fits situations like: backend & APIs work in your project.

How do I install Matrix Chat Guide in Claude Code?

Run `npx skills add mobazha/mobazha-unified --skill matrix-chat-guide -a claude-code`. Or copy the skill folder (.cursor/skills/matrix-chat-guide in mobazha/mobazha-unified) into .claude/skills/matrix-chat-guide in your project. Claude Code loads it when a task matches its description.

How do I install Matrix Chat Guide in Codex?

Run `npx skills add mobazha/mobazha-unified --skill matrix-chat-guide -a codex`. Or copy the skill folder (.cursor/skills/matrix-chat-guide in mobazha/mobazha-unified) into .agents/skills/matrix-chat-guide in your project. Codex loads it when a task matches its description.

Can I use Matrix Chat Guide in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add mobazha/mobazha-unified --skill matrix-chat-guide -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/matrix-chat-guide, .gemini/skills/matrix-chat-guide, .github/skills/matrix-chat-guide and .opencode/skills/matrix-chat-guide in your project.

What does Matrix Chat Guide need to run?

SKILL.md names no scripts, command-line tools or credentials: Matrix Chat Guide is instructions for the agent only.

Does Matrix Chat Guide access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Matrix Chat Guide safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Matrix Chat Guide use?

Matrix Chat Guide is published under the MPL-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Matrix Chat Guide use?

About 709 tokens (SKILL.md is roughly 2.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Matrix Chat Guide?

Skills that share tags, products or a category with Matrix Chat Guide: Configuring Horizon (coollabsio/coolify, 63k stars), Nestjs Best Practices (rolling-scopes/rsschool-app, 10k stars), Sub2API Admin (Wei-Shaw/sub2api, 43k stars) and Firecrawl Build Onboarding (firecrawl/firecrawl, 190k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Matrix Chat Guide?

mobazha (a GitHub organization) maintains it in mobazha/mobazha-unified, which has 165 GitHub stars. The repository holds 29 skills in this directory. The repository was last updated on October 3, 2026.

Source: mobazha/mobazha-unified on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.