coding-guidelines

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
This skill provides coding patterns. Load references based on what you're working with.
本技能提供编码模式支持。可根据你正在使用的技术加载对应的参考内容。

Formatting

格式规范

Detect project formatter from config files (biome.json, .prettierrc, .eslintrc, pyproject.toml, rustfmt.toml, etc.) and follow its conventions.
General rules:
  • Empty line at end of files
  • Whitespace between logical blocks
  • Property ordering: alphabetical by default (primitives first, then nested for mixed objects)
从配置文件(biome.json、.prettierrc、.eslintrc、pyproject.toml、rustfmt.toml等)中识别项目的格式化工具,并遵循其约定。
通用规则:
  • 文件末尾保留空行
  • 逻辑代码块之间保留空白
  • 属性排序:默认按字母顺序(基本类型在前,混合对象中的嵌套类型在后)

References

参考内容

TechnologyReferenceLoad When
TypeScript/JSreferences/typescript.mdWriting TypeScript or JavaScript code
Rustreferences/rust.mdWriting Rust code
SolidJSreferences/solidjs.mdWriting SolidJS components or JSX with SolidJS patterns
Tailwind CSSreferences/tailwind.mdUsing Tailwind utility classes
daisyUIreferences/daisyui.mdUsing daisyUI component classes
React Nativereferences/react-native.mdWriting React Native components (View, Text, etc.)
Exporeferences/expo.mdUsing Expo Router, Expo packages, or app.json config
NativeWindreferences/nativewind.mdUsing className prop in React Native
技术栈参考链接加载时机
TypeScript/JavaScriptreferences/typescript.md编写TypeScript或JavaScript代码时
Rustreferences/rust.md编写Rust代码时
SolidJSreferences/solidjs.md编写SolidJS组件或使用SolidJS模式的JSX时
Tailwind CSSreferences/tailwind.md使用Tailwind工具类时
daisyUIreferences/daisyui.md使用daisyUI组件类时
React Nativereferences/react-native.md编写React Native组件(View、Text等)时
Exporeferences/expo.md使用Expo Router、Expo包或配置app.json时
NativeWindreferences/nativewind.md在React Native中使用className属性时

When to Load References

何时加载参考内容

Load a reference when:
  • The code you're writing uses that technology
  • You see imports or patterns from that framework
  • The user mentions working with that technology
Each reference contains:
  • Core principles for that framework
  • Research guidance (use context7 to query current docs)
  • Research checklist before implementing
满足以下条件时加载参考内容:
  • 你编写的代码使用了对应技术
  • 代码中包含该框架的导入语句或模式
  • 用户提到正在使用该技术
每个参考内容包含:
  • 对应框架的核心原则
  • 调研指南(使用context7查询最新文档)
  • 实现前的调研检查清单

Research-First Approach

调研优先方法

These frameworks evolve - class names, APIs, and patterns change between versions. Each reference emphasizes:
  • Principles over specific syntax
  • Research checklists to verify current behavior
  • context7 for querying up-to-date documentation
这些框架一直在演进——类名、API和模式会随版本变化。每个参考内容都强调:
  • 原则优先于特定语法
  • 使用调研检查清单验证当前特性
  • 使用context7查询最新文档