using-lynx-api-docs
它能做什么
让助手在编写或修改 Lynx 代码之前,先查阅已安装的 Lynx API 文档。适合在 Lynx 渲染平台上开发应用的开发者。
适用场景
- ✓当你要求助手编写或修改 Lynx 页面、模板或组件时。
- ✓当 Lynx 的布局或 CSS 样式与网页上的表现不同时。
- ✓当你要求它审查 Lynx 代码或把网页迁移到 Lynx 时。
技能链接
https://github.com/lynx-family/lynx/blob/develop/ai/skills/lynx-api-docs/skills/using-lynx-api-docs/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请修复我 Lynx 页面的布局,使图片位于文字旁边,并使用正确的 Lynx 元素。”
每周 5 个新技能,1 分钟读完。
工作原理
助手会为任务找到相应的 Lynx 文档,阅读后再使用平台自身的元素和样式规则编写代码,而不是假设网页的行为。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Using Lynx API Docs
Overview
Pre-training knowledge is insufficient for Lynx. Lynx is a rendering platform (like a browser) with its own elements, non-standard CSS behavior, unique layout systems, and web-incompatible defaults. Always retrieve from the installed API docs before writing or modifying Lynx page code.
Core Rule
MUST ALWAYS read the relevant API docs BEFORE writing or editing any Lynx code.
Do not rely on web CSS knowledge. Do not assume standard HTML behavior. Do not guess element APIs. Lynx is a distinct platform with its own rules.
Why Web Knowledge Fails
Lynx is not a web browser. Web assumptions produce broken Lynx code:
- Elements:
<view>,<text>,<image>— not<div>,<span>,<img> - CSS defaults:
box-sizing: autonormally uses border-box sizing; no margin collapsing; Linear layout (not Flow) - Properties: Many CSS properties are unsupported or behave differently — always check
css/docs
Every web assumption is a potential bug.
How to Use the Docs
- Identify what you're working on (layout, CSS, element, migration, pattern)
- Look up the relevant doc file from the table below
- Read the doc BEFORE writing or editing code
- Apply the rules and constraints from the doc
- If uncertain, search the
elements/orcss/directories
Quick Reference
| Task | Read These Files First |
|---|---|
| Choose layout | layout/linear-layout.md (default), layout/flex-layout.md, layout/grid-layout.md, layout/relative-layout.md |
| CSS properties/units | css/supported-properties.md, css/values-and-units.md |
| CSS selectors | css/selectors.md, css/pseudo-classes.md |
| Use an element | elements/<element-name>.md |
| Migrate from web | lynx-vs-web/migration-guide.md, lynx-vs-web/css-differences.md |
| Theming/animation/responsive | patterns/theming.md, patterns/animation.md, patterns/responsive.md |
| General lookup | quick-reference.md, best-practices.md |
Core Rules
The compact layout decision rules and key CSS constraints are documented in quick-reference.md. Most critical:
- Text must use
<text>component - Box sizing initially uses
auto, normally with border-box sizing; set an explicit value when compatibility settings may differ - No margin collapsing
- Use
rem+vwfor screen adaptation
Red Flags — Stop and Read Docs
- Adding a
<div>or<span>→ Lynx uses<view>,<text> - Using
marginwithout checking if margin collapsing applies → It doesn't - Assuming
content-box→autonormally uses border-box sizing; checkcss/supported-properties.md#box-model - Using web CSS properties without checking
css/supported-properties.md - Guessing element attributes → Read
elements/<name>.md - Choosing
rpxfor web-portable code →rpxis Lynx-specific; userem+vwfor web compatibility - Writing plain text without
<text>wrapper → Invalid in Lynx - Using web pseudo-classes without checking
css/pseudo-classes.md - Assuming standard HTML flow layout → Lynx uses linear layout by default
常见问题
为什么不直接使用普通的网页知识?
Lynx 是独立的渲染平台,有自己的元素和布局默认值,因此网页的假设常常会产生错误的代码。
它涵盖哪些文件?
该指南涵盖 Lynx 专用文件,包括 .ttml 页面和 Lynx TSX 文件。
需要先安装文档吗?
需要。该技能要求助手在行动之前先搜索已安装的 API 文档。
详情
作者的原始描述
Provides authoritative guidance for Lynx development involving pages, templates, components, CSS, layouts, elements, web migration, rendering or styling bugs, and code review. Applies to *.ttml, Lynx *.tsx, and all Lynx-specific files, and requires searching the installed API docs before acting.
repo: lynx-family/lynx
热度
- GitHub 星标
- 15k
- 排名
- #10921
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …