line-flex-message
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLINE Flex Message & Reliability Skill
LINE Flex Message 与可靠性技能
This skill extends Claude's ability to design high-quality, brand-consistent LINE Flex Messages and implement reliable messaging workflows.
本技能扩展了Claude的能力,使其能够设计高质量、符合品牌一致性的LINE Flex消息,并实现可靠的消息传递工作流。
Core Capabilities
核心能力
- Advanced Flex Layouts: Precise control over nested boxes, dynamic widths, and complex UI patterns (e.g., flight tickets, product lists).
- Video Integration: Guidelines and templates for embedding video components in the hero block.
- Reliable Communication: Implementing and exponential backoff strategies to handle 429/5xx errors.
X-Line-Retry-Key
- 高级Flex布局:精确控制嵌套盒子、动态宽度和复杂UI模式(如机票、产品列表)。
- 视频集成:在Hero区块中嵌入视频组件的指南和模板。
- 可靠通信:实现和指数退避策略以处理429/5xx错误。
X-Line-Retry-Key
Workflow Patterns
工作流模式
1. Designing a Complex Flex Message
1. 设计复杂的Flex消息
- Identify Layout: Determine if it's a single Bubble or a Carousel.
- Component Mapping: Map UI elements to Flex blocks (Header, Hero, Body, Footer).
- Refine Nesting: Use or reference
scripts/flex_builder.pyto create multi-layer box nesting.references/flex-elements.md - Add Actionability: Ensure all buttons and images have correct definitions.
action
- 确定布局:判断是单Bubble还是Carousel类型。
- 组件映射:将UI元素对应到Flex区块(Header、Hero、Body、Footer)。
- 优化嵌套结构:使用或参考
scripts/flex_builder.py创建多层盒子嵌套。references/flex-elements.md - 添加交互性:确保所有按钮和图片都有正确的定义。
action
2. Implementing API Retries
2. 实现API重试
- Generate Key: Use to generate a unique
scripts/flex_builder.py.X-Line-Retry-Key - Header Injection: Always include the retry key in the first request for supported APIs (Push, Multicast, etc.).
- Error Handling: Follow the decision matrix in :
references/retry-policy.md- 429/5xx/Timeout: Retry with exponential backoff.
- 409: Log as "already accepted" and proceed.
- 2xx: Success.
- 生成密钥:使用生成唯一的
scripts/flex_builder.py。X-Line-Retry-Key - 注入请求头:在支持的API(Push、Multicast等)的首次请求中始终包含重试密钥。
- 错误处理:遵循中的决策矩阵:
references/retry-policy.md- 429/5xx/超时:使用指数退避策略重试。
- 409:记录为“已接受”并继续执行。
- 2xx:请求成功。
Resources
资源
- Flex Elements & Layout Guide: Detailed component specifications.
- Flex Video Guide: Requirements and examples for video embedding.
- Retry & Reliability Policy: Strategic guide for headers and error handling.
- Flex Builder Script: Python utility for generating complex Flex JSON and retry headers.
- Flex元素与布局指南:详细的组件规格说明。
- Flex视频集成指南:视频嵌入的要求和示例。
- 重试与可靠性策略:请求头与错误处理的策略指南。
- Flex构建脚本:用于生成复杂Flex JSON和重试请求头的Python工具。
Layout Patterns Examples
布局模式示例
- Product List: Use nested horizontal boxes for image + text rows.
- Video Hero: Mega/Giga sized bubbles with in hero block.
type: video - Carousel: Side-scrolling bubbles for browsing multiple items.
- 产品列表:使用嵌套水平盒子实现图片+文本行布局。
- 视频Hero区块:Mega/Giga尺寸的气泡,在Hero区块中设置。
type: video - 轮播(Carousel):横向滚动的气泡,用于浏览多个项目。
Quality Standards
质量标准
- Consistency: Use and
spacingconsistently across bubbles.margin - Responsiveness: Use for text and test layouts with different font sizes.
wrap: true - Stability: Never send high-frequency messages without a retry strategy.
- 一致性:在所有气泡中统一使用和
spacing属性。margin - 响应式:为文本设置,并在不同字体大小下测试布局。
wrap: true - 稳定性:在未配置重试策略的情况下,切勿发送高频消息。