Agent Skills › keychat-io/keychat-app

keychat-io/keychat-app

GitHub

阐述Keychat安全消息应用的架构,涵盖Nostr、Signal及MLS加密协议,Flutter与Rust FFI集成,GetX状态管理及Isar数据库,解析核心服务组件与端到端消息流转机制。

11 个 Skill 100

安装全部 Skills

npx skills add keychat-io/keychat-app --all -g -y
更多选项

预览集合内 Skills

npx skills add keychat-io/keychat-app --list

集合内 Skills (11)

阐述Keychat安全消息应用的架构,涵盖Nostr、Signal及MLS加密协议,Flutter与Rust FFI集成,GetX状态管理及Isar数据库,解析核心服务组件与端到端消息流转机制。
询问Keychat应用的技术架构 解释消息发送或加密流程 查找特定服务或模块的位置
.claude/skills/architecture/SKILL.md
npx skills add keychat-io/keychat-app --skill architecture -g -y
SKILL.md
Frontmatter
{
    "name": "architecture",
    "description": "Explains the Keychat app architecture and key components",
    "user-invocable": true,
    "disable-model-invocation": false
}

Keychat is a secure messaging app with a unique architecture. When explaining or working with the codebase, understand these key components:

Core Technologies

Technology Purpose Implementation
Nostr Protocol Message delivery/storage lib/nostr-core/, WebSocket connections
Signal Protocol 1:1 E2E encryption api_signal.rs via FFI
MLS Protocol Group E2E encryption api_mls.rs via FFI
Bitcoin Ecash Micropayments to relays api_cashu.rs, keychat_ecash/

Package Structure

packages/
├── app/                    # Main Flutter app
├── keychat_ecash/          # Ecash wallet functionality
└── keychat_rust_ffi_plugin/ # Native crypto via Rust

Key Services (packages/app/lib/service/)

  • signal_chat.service.dart - Signal protocol session management
  • mls_group.service.dart - MLS group key operations
  • websocket.service.dart - Nostr relay connections
  • chat.service.dart - High-level message routing
  • relay.service.dart - Relay management
  • identity.service.dart - User identity management

State Management

Uses GetX pattern:

  • Controllers in lib/controller/
  • Services are singleton instances
  • Reactive state with .obs observables

Database

Uses Isar (NoSQL for Flutter):

  • Models in lib/models/
  • Models use @collection annotation
  • Generated code via build_runner (*.g.dart, *.isar.dart)

Rust FFI Bridge

Native crypto operations use flutter_rust_bridge:

  • Rust code: packages/keychat_rust_ffi_plugin/rust/src/
  • Generated Dart bindings: packages/keychat_rust_ffi_plugin/lib/
  • Key APIs: Cashu, Nostr, Signal, MLS

Message Flow

  1. User composes message
  2. Signal/MLS encrypts content
  3. Message wrapped in Nostr event
  4. Ecash stamp attached (if relay requires payment)
  5. Sent via WebSocket to Nostr relay
  6. Recipient receives, decrypts, displays
用于在代码库中并行执行大规模变更。通过隔离的工作区代理,将修改分组为独立单元并行处理,涵盖研究计划、并行执行及审查合并阶段,确保高效且安全的批量代码更新。
需要对多个文件或模块应用相似更改 需要大规模重构或批量更新代码
.claude/skills/batch/SKILL.md
npx skills add keychat-io/keychat-app --skill batch -g -y
SKILL.md
Frontmatter
{
    "name": "batch",
    "invoke": "user",
    "description": "Orchestrate large-scale changes across the codebase using parallel worktree agents. Use when you need to apply similar changes to many files or modules simultaneously."
}

Batch

Research and plan a large-scale change, then execute it in parallel across isolated worktree agents.

Workflow

Phase 1: Research & Plan

  1. Understand the requested change thoroughly
  2. Identify all files and modules that need modification
  3. Group changes into independent, parallelizable units (max 10 units)
  4. Present the plan to the user for approval before proceeding

Phase 2: Execute

  1. For each unit of work, launch an Agent with isolation: "worktree" to make the changes independently
  2. Run agents in parallel where possible (up to 5 concurrent agents)
  3. Each agent should:
    • Make the required changes
    • Run relevant tests or lint checks
    • Commit changes with a clear message

Phase 3: Review & Merge

  1. Collect results from all agents
  2. Report successes and failures
  3. For successful changes, present diffs for user review
  4. Help merge changes back to the main branch

Rules

  • Always get user approval before executing changes
  • Never modify more than what was requested
  • If a unit fails, continue with others and report the failure
  • Keep the user informed of progress throughout
用于从零初始化或重置 Keychat 开发环境。通过更新 git 子模块、安装指定版本 Melos 并执行引导命令,确保所有包依赖正确解析且无错误完成,同时检查并提醒配置 .env 文件及 FCM 密钥。
初始化 Keychat 开发环境 重置 Keychat 项目依赖 解决 Melos bootstrap 失败问题
.claude/skills/bootstrap/SKILL.md
npx skills add keychat-io/keychat-app --skill bootstrap -g -y
SKILL.md
Frontmatter
{
    "name": "bootstrap",
    "description": "Initialize or reset the Keychat development environment",
    "allowed-tools": "Bash(git *), Bash(melos *), Bash(dart pub *)",
    "disable-model-invocation": true
}

Set up the Keychat development environment from scratch.

Steps

  1. Update git submodules

    git submodule update --init --recursive
    
  2. Ensure melos is installed

    dart pub global activate melos 7.3.0
    
  3. Bootstrap all packages

    melos bootstrap
    
  4. Check for .env file If packages/app/.env doesn't exist, remind the user:

    • Copy .env.example to .env
    • Configure FCM keys for push notifications

Success criteria

  • All submodules are cloned
  • Melos bootstrap completes without errors
  • Dependencies are resolved for all packages
为Keychat项目执行全面的Flutter质量检查流水线,包括代码分析、格式校验、单元测试及生成文件一致性检查。按顺序执行所有步骤,即使某步失败也继续运行,最终汇总报告结果并提供修复建议,适用于提交前确保代码质量。
用户要求运行Flutter代码质量检查 准备提交代码前进行预检 需要验证Dart分析警告和错误 需要确认代码格式是否符合规范
.claude/skills/flutter-check/SKILL.md
npx skills add keychat-io/keychat-app --skill flutter-check -g -y
SKILL.md
Frontmatter
{
    "name": "flutter-check",
    "invoke": "user",
    "description": "Run comprehensive Flutter checks including lint, analyze, test, and format verification. Use before commits to ensure code quality."
}

Flutter Check

Run a comprehensive Flutter quality check pipeline for the Keychat project.

Steps

  1. Analyze: Run melos run analyze to check for Dart analyzer warnings and errors
  2. Format Check: Run dart format --set-exit-if-changed . to verify formatting
  3. Test: Run melos run test:flutter to execute Flutter unit tests
  4. Generated Code: Check if generated files (.g.dart) are up to date by running melos run build:runner and verifying no diff

Behavior

  • Run all steps sequentially
  • Report results for each step clearly
  • If any step fails, continue running remaining steps but report all failures at the end
  • Provide actionable fix suggestions for any issues found
用于 Keychat 项目的代码生成工具,支持 Dart、Flutter、国际化及 Isar 模型序列化。可根据参数或场景自动执行 melos 命令,生成数据库模式、本地化文件或 JSON 序列化代码,并报告错误。
修改 Isar 模型文件后需要重新生成数据库模式 添加新翻译内容后需要重新生成本地化文件 修改包含 @JsonSerializable 的模型后需要重新生成 JSON 序列化代码 需要运行项目所有代码生成器时
.claude/skills/generate/SKILL.md
npx skills add keychat-io/keychat-app --skill generate -g -y
SKILL.md
Frontmatter
{
    "name": "generate",
    "description": "Run code generation for Isar models, JSON serialization, and i18n",
    "allowed-tools": "Bash(melos *), Bash(flutter pub run *)",
    "argument-hint": "[type]",
    "disable-model-invocation": true
}

Run code generation for the Keychat project.

Arguments

  • $ARGUMENTS - Optional: type of generation (all, dart, flutter, intl, runner)

Generation Commands

Type Command Description
all melos run generate:all Run all code generators
dart melos run generate:dart Dart package generators only
flutter melos run generate:flutter Flutter package generators only
intl melos run intl:generate Internationalization strings
runner melos run build:runner App build_runner only

Common scenarios

After modifying Isar model files

Run melos run build:runner to regenerate database schemas.

After adding new translations

Run melos run intl:generate to regenerate localization files.

After modifying any model with @JsonSerializable

Run melos run generate:all to regenerate JSON serialization code.

Workflow

  1. If no argument, run melos run generate:all
  2. If specific type provided, run the corresponding command
  3. Report any errors encountered during generation
用于对 Keychat 项目执行代码质量检查,包括静态分析、格式化和 lint。支持自动修复格式问题或全面检查,基于 very_good_analysis 规则确保代码规范。
用户要求检查代码质量 用户要求运行 lint 或格式化代码 用户明确要求修复代码格式
.claude/skills/lint/SKILL.md
npx skills add keychat-io/keychat-app --skill lint -g -y
SKILL.md
Frontmatter
{
    "name": "lint",
    "description": "Run linting, formatting, and static analysis on the codebase",
    "allowed-tools": "Bash(melos *), Bash(dart format *), Bash(dart analyze *)",
    "argument-hint": "[fix]",
    "disable-model-invocation": true
}

Run code quality checks on the Keychat project.

Arguments

  • $ARGUMENTS - Optional: "fix" to auto-fix formatting issues

Commands

Run all checks (analyze + format check)

melos run lint:all

Run analyzer only

melos run analyze

Check formatting

dart format --set-exit-if-changed .

Fix formatting

dart format .

Workflow

  1. If $ARGUMENTS is "fix":

    • Run dart format . to fix formatting
    • Then run melos run analyze to check for remaining issues
  2. Otherwise:

    • Run melos run lint:all to check everything
    • Report any issues found

Analysis configuration

The project uses very_good_analysis rules defined in analysis_options.yaml.

用于在 iOS 和 macOS 构建中更新及安装 CocoaPods 依赖。执行 melos pod:install 脚本,自动处理 packages/app/ios 和 packages/app/macos 目录下的 pod update 与 install。适用于新增原生依赖、Podfile.lock 不同步、升级 Flutter 或解决 'pod not found' 错误等场景。
添加新的原生 iOS/macOS 依赖后 Podfile.lock 文件不同步时 升级 Flutter 或相关插件后 遇到 'pod not found' 错误时
.claude/skills/pods/SKILL.md
npx skills add keychat-io/keychat-app --skill pods -g -y
SKILL.md
Frontmatter
{
    "name": "pods",
    "description": "Update and install CocoaPods dependencies for iOS and macOS",
    "allowed-tools": "Bash(pod *), Bash(cd *)",
    "disable-model-invocation": true
}

Update and install CocoaPods dependencies for iOS and macOS builds.

Command

Run the melos pods script:

melos run pod:install

This will:

  1. Navigate to packages/app/ios
  2. Run pod update && pod install --repo-update
  3. Navigate to packages/app/macos
  4. Run pod update && pod install --repo-update

When to use

  • After adding new native iOS/macOS dependencies
  • When Podfile.lock is out of sync
  • After upgrading Flutter or plugins
  • When getting "pod not found" errors

Troubleshooting

If pods fail to install:

  1. Try cleaning first: cd packages/app/ios && rm -rf Pods Podfile.lock
  2. Update CocoaPods: gem install cocoapods
  3. Clear pod cache: pod cache clean --all
清理 Flutter 构建产物并重置项目状态。适用于解决更新 Flutter 后的构建错误、包间状态不一致、依赖变更或缓存问题。支持全量 melos 清理、单应用快速清理及生成文件清理,并提供后续恢复步骤指引。
Flutter 更新后出现构建错误 多个包之间状态不一致 发生主要依赖变更后 Xcode 或 Gradle 缓存导致的问题
.claude/skills/clean/SKILL.md
npx skills add keychat-io/keychat-app --skill clean -g -y
SKILL.md
Frontmatter
{
    "name": "clean",
    "description": "Clean build artifacts and reset Flutter state",
    "allowed-tools": "Bash(melos *), Bash(flutter clean), Bash(rm *)",
    "disable-model-invocation": true
}

Clean build artifacts and reset the project state.

Commands

Full clean with melos

melos run clean:flutter

This runs in all Flutter packages:

  • flutter clean
  • flutter pub get
  • Removes ios/Podfile.lock
  • Runs pod repo update && pod install

Quick clean for app only

cd packages/app && flutter clean && flutter pub get

Clean generated files

cd packages/app && rm -rf lib/**/*.g.dart lib/**/*.isar.dart

When to use

  • Build errors after updating Flutter
  • Inconsistent state between packages
  • After major dependency changes
  • Xcode or Gradle cache issues

After cleaning

Remember to:

  1. Run melos bootstrap to restore dependencies
  2. Run melos run generate:all to regenerate code
  3. Run melos run pod:install for iOS/macOS
在设备或模拟器上运行 Keychat Flutter 应用。支持指定设备 ID,自动处理设备列表选择,并提供多种入口点(生产及多个开发环境)以适配不同部署场景。
用户请求启动或运行 Keychat 应用 需要指定特定设备进行调试或测试 需要切换不同的应用入口环境
.claude/skills/run/SKILL.md
npx skills add keychat-io/keychat-app --skill run -g -y
SKILL.md
Frontmatter
{
    "name": "run",
    "description": "Run the Keychat app on a device or simulator",
    "allowed-tools": "Bash(flutter *)",
    "argument-hint": "[device-id]",
    "disable-model-invocation": true
}

Run the Keychat app on a device or simulator.

Arguments

  • $ARGUMENTS - Optional: device ID to run on

Workflow

  1. First list available devices:

    flutter devices
    
  2. If $ARGUMENTS is provided, run on that device:

    cd packages/app && flutter run -d $ARGUMENTS
    
  3. If no device specified:

    • If only one device is available, use it
    • If multiple devices, show the list and ask user to specify

Alternative entry points

The app has multiple entry points for different environments:

  • lib/main.dart - Production
  • lib/main_dev1.dart - Development 1
  • lib/main_dev2.dart - Development 2
  • lib/main_dev3.dart - Development 3

To run with a specific entry point:

cd packages/app && flutter run -d <device> -t lib/main_dev1.dart
用于构建 keychat_rust_ffi_plugin 的 Rust 原生库。支持 iOS、Android、Linux、Windows 和 macOS 平台,涵盖环境配置、目标添加及编译流程,并提供生成 Dart 绑定的说明。
用户请求构建 Rust FFI 插件 需要为特定平台(如 iOS/Android)编译 Rust 库 提示缺少 rustup 目标或依赖时
.claude/skills/rust-build/SKILL.md
npx skills add keychat-io/keychat-app --skill rust-build -g -y
SKILL.md
Frontmatter
{
    "name": "rust-build",
    "description": "Build Rust native libraries for the FFI plugin",
    "allowed-tools": "Bash(cargo *), Bash(rustup *)",
    "argument-hint": "[target]",
    "disable-model-invocation": true
}

Build the Rust native libraries for the keychat_rust_ffi_plugin.

Arguments

  • $ARGUMENTS - Target platform: ios, android, linux, windows, macos

Prerequisites

Ensure flutter_rust_bridge codegen is installed:

cargo install flutter_rust_bridge_codegen@2.11.1

For Linux, install system dependencies:

apt install protobuf-compiler libsecret-1-dev

Target Setup and Build Commands

Platform Target Setup & Build
iOS aarch64-apple-ios rustup target add aarch64-apple-ios && cargo build --target aarch64-apple-ios --release
Android aarch64-linux-android rustup target add aarch64-linux-android && cargo build --target aarch64-linux-android --release
Linux x86_64-unknown-linux-gnu rustup target add x86_64-unknown-linux-gnu && cargo build --target x86_64-unknown-linux-gnu --release
Windows x86_64-pc-windows-msvc rustup target add x86_64-pc-windows-msvc && cargo build --target x86_64-pc-windows-msvc --release
macOS aarch64-apple-darwin rustup target add aarch64-apple-darwin && cargo build --target aarch64-apple-darwin --release

Workflow

  1. Change to the Rust plugin directory:

    cd packages/keychat_rust_ffi_plugin/rust
    
  2. If no target specified, ask which platform to build for

  3. Add the rustup target if not already added:

    rustup target add <target>
    
  4. Build the library:

    cargo build --target <target> --release --target-dir target
    
  5. Report build success or any errors

Regenerating Dart Bindings

After modifying Rust API files, regenerate the Dart bindings:

cd packages/keychat_rust_ffi_plugin
flutter_rust_bridge_codegen generate
用于运行 Keychat 项目的测试。支持执行全部测试、仅 Flutter/Dart 测试或指定文件,根据参数自动选择命令并清晰报告结果。
用户要求运行项目测试 用户询问测试结果 用户指定测试文件或包名
.claude/skills/test/SKILL.md
npx skills add keychat-io/keychat-app --skill test -g -y
SKILL.md
Frontmatter
{
    "name": "test",
    "description": "Run tests for Keychat packages",
    "allowed-tools": "Bash(melos *), Bash(flutter test *)",
    "argument-hint": "[test-file|package]",
    "disable-model-invocation": true
}

Run tests for the Keychat project.

Arguments

  • $ARGUMENTS - Optional: specific test file path or package name

Test Commands

Run all tests

melos run test:all

Run Flutter tests only

melos run test:flutter

Run Dart tests only

melos run test:dart

Run a specific test file

cd packages/app
flutter test $ARGUMENTS

Workflow

  1. If no arguments provided, run melos run test:all
  2. If a file path is provided (ends with .dart), run that specific test
  3. Report test results clearly, including any failures

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-13 22:52
浙ICP备14020137号-1 $访客地图$