Yida Density logo

Yida Density

Organization
openyida
yida-density

自定义页面信息密度设计规范。提供紧凑、舒适、宽松三种模式、切换 UI 和响应式降级;平台 JSX 组件页面的 didMount/this.utils.isMobile 仅作存量维护示例。

Overview

Publisheropenyida
Repositoryopenyida
Skill nameyida-density
Stars
228
Forks
50
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by openyida on GitHub. Read the source before you install it.

Installation

Install the Yida Density AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/openyida/openyida/tree/main/yida-skills/skills/yida-density
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/openyida/openyida.git /tmp/openyida
mkdir -p .claude/skills
cp -r /tmp/openyida/yida-skills/skills/yida-density .claude/skills/yida-density
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Yida Density in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Yida Density on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Yida Density is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

宜搭自定义页面信息密度设计规范

核心定位

信息密度是页面密度配置。DENSITY_CONFIG、场景选择、移动端降级和无障碍要求对自定义页面都适用;实现示例使用 React hooks。

维护已检测到的 .oyd.jsx / .oyb.jsx / renderJsx / 平台 Jsx 组件页面时,才参考 didMount / this.utils.isMobile() 的平台 JSX 组件写法。

严格要求

  • 每次生成列表/表格类自定义页面时都考虑密度,无需用户主动提及。
  • PC 列表/表格默认 comfortable,可提供紧凑/舒适切换。
  • 移动端固定 spacious,不显示密度切换 UI。
  • 固定展示大屏使用 spacious,不显示密度切换 UI。
  • 表单填写页交原生表单;若只讨论密度,固定 comfortable,不提供切换。
  • 间距、字号、行高、控件高度统一从密度 token 派生,避免散落魔法值。
  • 密度状态是页面本地状态,不依赖跨会话 memory。

场景选择

场景默认密度切换 UI
专业后台、运营列表、大数据表格compact 或 comfortablePC 提供
常规任务管理、审批列表comfortablePC 提供
引导页、展示页、固定大屏spacious不提供
移动端spacious不提供
原生表单填写comfortable不提供

用户明确说“紧凑/密集/一屏更多”时选 compact;说“宽松/大字体/更易读”时选 spacious。用户未指定时按页面类型和设备选择。

密度 token

同一页面可以把数值映射成 CSS variables、antd token 或 inline style;关键是所有相关组件都消费同一个配置。

javascript
const DENSITY_CONFIG = {
  compact: {
    cardPadding: '8px 12px',
    fontSize: 12,
    lineHeight: 1.4,
    tableRowHeight: 32,
    controlHeight: 24,
    sectionGap: 8,
  },
  comfortable: {
    cardPadding: '16px 20px',
    fontSize: 14,
    lineHeight: 1.6,
    tableRowHeight: 48,
    controlHeight: 32,
    sectionGap: 16,
  },
  spacious: {
    cardPadding: '24px 28px',
    fontSize: 16,
    lineHeight: 1.8,
    tableRowHeight: 64,
    controlHeight: 40,
    sectionGap: 24,
  },
};

React Hooks 实现

在 Canvas 中分别处理密度选择和布局宽度:

  • matchMedia + hooks 监听浏览器视口或输入方式的变化。下方示例用视口宽度切换密度;触控能力按对应媒体条件判断。
  • 页面分栏、筛选栏和主辅面板按实际内容容器宽度重排,iframe、侧栏或抽屉均读取自身可用空间。
  • 按 共享响应式规则 优先用 CSS 重排。需要参考时执行 openyida sample openyida-page-template canvas-responsive-layout,按需复用布局片段;组件需要读取实际宽度时,再复用带清理的测量 Hook,持续响应容器变化。
jsx
import React, { useEffect, useMemo, useState } from 'react';

function useIsMobile() {
  const query = '(max-width: 767px)';
  const [isMobile, setIsMobile] = useState(
    () => window.matchMedia(query).matches,
  );

  useEffect(() => {
    const media = window.matchMedia(query);
    const handleChange = (event) => setIsMobile(event.matches);
    media.addEventListener('change', handleChange);
    return () => media.removeEventListener('change', handleChange);
  }, []);

  return isMobile;
}

function DensityAwareList() {
  const isMobile = useIsMobile();
  const [desktopDensity, setDesktopDensity] = useState('comfortable');
  const density = isMobile ? 'spacious' : desktopDensity;
  const tokens = useMemo(() => DENSITY_CONFIG[density], [density]);

  return (
    <section style={{ '--row-height': `${tokens.tableRowHeight}px` }}>
      {!isMobile && (
        <DensitySwitch value={desktopDensity} onChange={setDesktopDensity} />
      )}
      <BusinessTable density={density} tokens={tokens} />
    </section>
  );
}

如果目标使用 antd Table / ConfigProvider,把密度映射到 size 和组件 token,同时保留业务级 DENSITY_CONFIG 作为唯一来源;不要一部分走 size="small"、另一部分继续写固定 padding。

响应式纪律

  • 移动端自动使用 spacious,回到桌面后恢复用户先前选择的桌面密度。
  • 切换密度不能清空筛选、分页、选中行和数据。
  • 触控目标仍需满足可点击尺寸;compact 只用于桌面高密度场景。
  • 系统字体缩放、长中文、英文和大数值下均不得截断关键字段。
  • 虚拟表格行高、骨架屏行高和真实行高必须使用同一密度 token。

平台 JSX 组件维护注意事项

已有普通自定义页面可以继续使用:

javascript
export function didMount() {
  if (this.utils.isMobile()) {
    _customState.density = 'spacious';
    this.forceUpdate();
  }
}

这段只用于平台 JSX 组件页面或 native 页面维护。React hooks 实现不得使用 didMount、this.utils.isMobile()、_customState 或 forceUpdate;应使用上面的 matchMedia hook 并 cleanup。

现有普通页面只能作为 native 兼容参考,不能据此改变当前页面的实现事实。

异常处理

场景处理
切换后局部样式没变检查是否仍有硬编码 padding/height,统一消费 token
移动端还显示切换 UI由 isMobile 派生 UI 和最终 density,不只改样式
回桌面后丢失用户选择分开保存 desktopDensity 与派生 density
字体放大后内容裁切避免固定内容高度,允许行高/单元格扩展
配置缺失回退 comfortable,同时暴露开发期错误

写操作边界

本技能负责生成规范,不自动授权发布。真实发布前必须展示代码/配置摘要并获得用户确认;发布后提供页面 URL 与 PC/移动端验证结果。

验收清单

  • 页面类型与默认密度匹配。
  • Canvas 示例优先;普通页生命周期只出现在 legacy 小节。
  • PC 切换真实改变表格/卡片/控件密度,不丢业务状态。
  • 移动端固定 spacious 且隐藏切换 UI。
  • 所有密度相关值来自统一 token。
  • matchMedia 监听或其他响应式副作用有 cleanup。
  • 桌面宽视口中的窄 iframe、侧栏和抽屉按自身宽度重排;分别验证设备对应的密度和容器对应的布局。

Frequently asked questions

What does the Yida Density AI skill do?

自定义页面信息密度设计规范。提供紧凑、舒适、宽松三种模式、切换 UI 和响应式降级;平台 JSX 组件页面的 didMount/this.utils.isMobile 仅作存量维护示例。

Why use Yida Density on TypingMind?

Because you install it once and use it with any model. Yida Density is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Yida Density in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/openyida/openyida/tree/main/yida-skills/skills/yida-density. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Yida Density?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Yida Density?

As many as you like. As long as a model supports skills, you can use Yida Density with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Yida Density AI skill free?

Yes. It is published on GitHub by openyida under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇