avalonia-layout-zafiro
它能做什么
本指南教你如何为 Avalonia 应用创建美观且易于维护的用户界面。重点在于使用智能组件和共享样式,避免重复代码,简化代码结构。
适用场景
- ✓开始一个新的 Avalonia 项目,并希望有良好结构时。
- ✓需要整理或优化应用视觉样式时。
- ✓页面布局难以组织时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/avalonia-layout-zafiro/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我该如何整理 Avalonia 应用中的视觉样式,让它们便于复用?”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会阅读关于如何在 Avalonia 中组织布局的说明,重点关注使用现成组件和共享样式。它会避免代码重复,并建议页面的最佳结构方式。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Avalonia Layout with Zafiro.Avalonia
Master modern, clean, and maintainable Avalonia UI layouts. Focus on semantic containers, shared styles, and minimal XAML.
🎯 Selective Reading Rule
Read ONLY files relevant to the layout challenge!
📑 Content Map
| File | Description | When to Read |
|---|---|---|
themes.md |
Theme organization and shared styles | Setting up or refining app themes |
containers.md |
Semantic containers (HeaderedContainer, EdgePanel, Card) |
Structuring views and layouts |
icons.md |
Icon usage with IconExtension and IconOptions |
Adding and customizing icons |
behaviors.md |
Xaml.Interaction.Behaviors and avoiding Converters |
Implementing complex interactions |
components.md |
Generic components and avoiding nesting | Creating reusable UI elements |
🔗 Related Project (Exemplary Implementation)
For a real-world example, refer to the Angor project:
/mnt/fast/Repos/angor/src/Angor/Avalonia/Angor.Avalonia.sln
✅ Checklist for Clean Layouts
- Used semantic containers? (e.g.,
HeaderedContainerinstead ofBorderwith manual header) - Avoided redundant properties? Use shared styles in
axamlfiles. - Minimized nesting? Flatten layouts using
EdgePanelor generic components. - Icons via extension? Use
{Icon fa-name}andIconOptionsfor styling. - Behaviors over code-behind? Use
Interaction.Behaviorsfor UI-logic. - Avoided Converters? Prefer ViewModel properties or Behaviors unless necessary.
❌ Anti-Patterns
DON'T:
- Use hardcoded colors or sizes (literals) in views.
- Create deep nesting of
GridandStackPanel. - Repeat visual properties across multiple elements (use Styles).
- Use
IValueConverterfor simple logic that belongs in the ViewModel.
DO:
- Use
DynamicResourcefor colors and brushes. - Extract repeated layouts into generic components.
- Leverage
Zafiro.Avaloniaspecific panels likeEdgePanelfor common UI patterns.
When to Use
This skill is applicable to execute the workflow or actions described in the overview.
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
常见问题
什么是“语义化容器”?
这些是功能明确的界面构建模块,例如页眉或侧边栏。你可以直接使用它们,而不必用通用元素再手动逐一配置。
为什么要避免“冗余属性”?
在多个地方重复设置同样的视觉参数(如颜色、尺寸)会让代码变得臃肿,也更难修改。使用共享样式可以解决这个问题。
什么是“反模式”?
指那些看似可行、但日后会带来问题的常见做法,比如难以维护或性能下降。本指南会告诉你应该避免哪些做法。
详情
作者的原始描述
Guidelines for modern Avalonia UI layout using Zafiro.Avalonia, emphasizing shared styles, generic components, and avoiding XAML redundancy.
热度
- GitHub 星标
- 48k
- 排名
- #3846
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。