feishu-rich-card

Send rich interactive cards with embedded images in Feishu group chats. Use when reporting progress, sharing analysis results, or presenting any content that benefits from mixed text+image layout in Feishu. Combines SVG UI templates (or matplotlib/PIL charts) with Feishu Card Kit API.

42 stars

Best use case

feishu-rich-card is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Send rich interactive cards with embedded images in Feishu group chats. Use when reporting progress, sharing analysis results, or presenting any content that benefits from mixed text+image layout in Feishu. Combines SVG UI templates (or matplotlib/PIL charts) with Feishu Card Kit API.

Teams using feishu-rich-card should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/medge-feishu-rich-card/SKILL.md --create-dirs "https://raw.githubusercontent.com/Zaoqu-Liu/ScienceClaw/main/skills/medge-feishu-rich-card/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/medge-feishu-rich-card/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How feishu-rich-card Compares

Feature / Agentfeishu-rich-cardStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Send rich interactive cards with embedded images in Feishu group chats. Use when reporting progress, sharing analysis results, or presenting any content that benefits from mixed text+image layout in Feishu. Combines SVG UI templates (or matplotlib/PIL charts) with Feishu Card Kit API.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Feishu Rich Card — 飞书图文混排卡片

在飞书群聊中发送**图文并茂**的交互式卡片,用于汇报进展、展示分析结果、项目状态等。

## When to Use

- 汇报任务进展、项目状态
- 展示数据分析结果(图表 + 解读)
- 发送研究简报、阶段性成果
- 任何需要图文混排的飞书消息

## Architecture

```
生成图片(SVG→PNG / matplotlib / PIL)
        ↓
上传图片到飞书 → 获取 image_key
        ↓
构造 Card JSON (schema 2.0) → 嵌入 img 元素 + markdown 元素
        ↓
调用飞书 API 发送 interactive 消息
```

## Workflow

### Step 1: Prepare Images

图片来源可以是:
- **SVG UI 模板** → 用 `svg-ui-templates` skill 生成 SVG → cairosvg 转 PNG
- **matplotlib/seaborn** → 直接 savefig 为 PNG
- **PIL/Pillow** → 程序化生成图片
- **已有文件** → 直接使用本地 PNG/JPG

### Step 2: Upload & Send

使用 `references/send_card.py` 中的辅助函数:

```python
# 完整用法参见 references/send_card.py
from send_card import FeishuCardSender

sender = FeishuCardSender()  # 自动读取 openclaw.json 凭证

# 发送图文卡片
sender.send_rich_card(
    chat_id="oc_xxx",
    title="📊 分析报告",
    elements=[
        {"type": "markdown", "content": "## 结果摘要\n\n发现 **3 个**显著差异基因"},
        {"type": "image", "path": "/tmp/volcano_plot.png", "alt": "火山图"},
        {"type": "markdown", "content": "> Gene X: FC=2.5, p<0.001"},
        {"type": "hr"},
        {"type": "image", "path": "/tmp/heatmap.png", "alt": "热图"},
        {"type": "markdown", "content": "**结论:** 样本间差异显著,建议进一步验证。"},
    ],
    header_template="blue"  # blue/indigo/green/red/purple/violet/wathet/turquoise/yellow/grey
)
```

### Step 3: Quick One-liner (for simple cases)

```python
sender.send_image_report(
    chat_id="oc_xxx",
    title="🧬 单细胞分析完成",
    intro="UMAP 降维完成,共识别 12 个细胞群:",
    image_path="/tmp/umap.png",
    conclusion="Cluster 5 为目标细胞群,marker: CD8A, GZMB, PRF1",
    header_template="indigo"
)
```

## Card Elements Reference

| Element | Tag | 说明 |
|---------|-----|------|
| **Markdown** | `markdown` | 支持加粗、斜体、链接、列表、引用块、代码块 |
| **Image** | `img` | 需要 `image_key`(上传后获取) |
| **Divider** | `hr` | 水平分割线 |
| **Column Set** | `column_set` | 多列并排布局 |
| **Note** | `note` | 底部灰色备注 |

## Header Templates (颜色)

`blue` `wathet` `turquoise` `green` `yellow` `orange` `red` `carmine` `violet` `purple` `indigo` `grey`

## Key Rules

1. **图片必须先上传**到飞书获取 `image_key`,不能用 URL
2. **Card schema 必须是 `"2.0"`**
3. **每张卡片最多 50 个元素**
4. 图片建议宽度 600-1200px,飞书会自动缩放
5. markdown 中**不能嵌入图片**,图片必须是独立的 `img` 元素
6. 发送后 OpenClaw 的正常回复会重复,用 `NO_REPLY` 避免

## Integration with SVG UI Templates

当需要专业级可视化时,结合 `svg-ui-templates` skill:

```bash
# 1. 生成 SVG(用模板或自定义)
# 2. 转 PNG
python3 -c "import cairosvg; cairosvg.svg2png(url='report.svg', write_to='report.png', output_width=2400)"
# 3. 用本 skill 上传并发送卡片
```

## Default Chat ID

通过环境变量配置:`FEISHU_DEFAULT_CHAT_ID`(在 `.env` 中设置)

Related Skills

tooluniverse-gene-enrichment

42
from Zaoqu-Liu/ScienceClaw

Perform comprehensive gene enrichment and pathway analysis using gseapy (ORA and GSEA), PANTHER, STRING, Reactome, and 40+ ToolUniverse tools. Supports GO enrichment (BP, MF, CC), KEGG, Reactome, WikiPathways, MSigDB Hallmark, and 220+ Enrichr libraries. Handles multiple ID types (gene symbols, Ensembl, Entrez, UniProt), multiple organisms (human, mouse, rat, fly, worm, yeast), customizable backgrounds, and multiple testing correction (BH, Bonferroni). Use when users ask about gene enrichment, pathway analysis, GO term enrichment, KEGG pathway analysis, GSEA, over-representation analysis, functional annotation, or gene set analysis.

zinc-database

42
from Zaoqu-Liu/ScienceClaw

Access ZINC (230M+ purchasable compounds). Search by ZINC ID/SMILES, similarity searches, 3D-ready structures for docking, analog discovery, for virtual screening and drug discovery.

zarr-python

42
from Zaoqu-Liu/ScienceClaw

Chunked N-D arrays for cloud storage. Compressed arrays, parallel I/O, S3/GCS integration, NumPy/Dask/Xarray compatible, for large-scale scientific computing pipelines.

Academic Writing

42
from Zaoqu-Liu/ScienceClaw

## Overview

scientific-visualization

42
from Zaoqu-Liu/ScienceClaw

## Overview

venue-templates

42
from Zaoqu-Liu/ScienceClaw

Access comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.

vaex

42
from Zaoqu-Liu/ScienceClaw

Use this skill for processing and analyzing large tabular datasets (billions of rows) that exceed available RAM. Vaex excels at out-of-core DataFrame operations, lazy evaluation, fast aggregations, efficient visualization of big data, and machine learning on large datasets. Apply when users need to work with large CSV/HDF5/Arrow/Parquet files, perform fast statistics on massive datasets, create visualizations of big data, or build ML pipelines that do not fit in memory.

uspto-database

42
from Zaoqu-Liu/ScienceClaw

Access USPTO APIs for patent/trademark searches, examination history (PEDS), assignments, citations, office actions, TSDR, for IP analysis and prior art searches.

uniprot-database

42
from Zaoqu-Liu/ScienceClaw

Direct REST API access to UniProt. Protein searches, FASTA retrieval, ID mapping, Swiss-Prot/TrEMBL. For Python workflows with multiple databases, prefer bioservices (unified interface to 40+ services). Use this for direct HTTP/REST work or UniProt-specific control.

umap-learn

42
from Zaoqu-Liu/ScienceClaw

UMAP dimensionality reduction. Fast nonlinear manifold learning for 2D/3D visualization, clustering preprocessing (HDBSCAN), supervised/parametric UMAP, for high-dimensional data.

treatment-plans

42
from Zaoqu-Liu/ScienceClaw

Generate concise (3-4 page), focused medical treatment plans in LaTeX/PDF format for all clinical specialties. Supports general medical treatment, rehabilitation therapy, mental health care, chronic disease management, perioperative care, and pain management. Includes SMART goal frameworks, evidence-based interventions with minimal text citations, regulatory compliance (HIPAA), and professional formatting. Prioritizes brevity and clinical actionability.

transformers

42
from Zaoqu-Liu/ScienceClaw

This skill should be used when working with pre-trained transformer models for natural language processing, computer vision, audio, or multimodal tasks. Use for text generation, classification, question answering, translation, summarization, image classification, object detection, speech recognition, and fine-tuning models on custom datasets.