Token导航 LogoToken导航

Agent Skill · 开发

moonbit-bestpractice(Moonbit 最佳实践)

moonbit-bestpractice 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

moonbit-bestpractice 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 18,498。

总安装 333周安装 14GitHub Stars 公开资料未说明下载 116核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:moonbit-bestpractice(Moonbit 最佳实践)
来源仓库:https://github.com/totto2727-dotfiles/agents
仓库路径:skills/moonbit-bestpractice
安装命令:
npx skills add https://github.com/totto2727-dotfiles/agents --skill moonbit-bestpractice
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/totto2727-dotfiles/agents --skill moonbit-bestpractice

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

moonbit-bestpractice 用于处理 GitHub 仓库、Issue 和 Pull Request 信息。适合整理代码协作事项、仓库状态和变更记录。可结合项目实际情况验证 Issue 分类和 PR 审查逻辑。安装前建议确认 API 权限和 webhook 配置范围。

该技能主要用于信息梳理,不自动创建或合并代码。

来源仓库内路径:skills/moonbit-bestpractice

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/totto2727-dotfiles/agents --skill moonbit-best…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

moonbit-bestpractice 怎么安装?

在终端执行 npx skills add https://github.com/totto2727-dotfiles/agents --skill moonbit-bestpractice。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

moonbit-bestpractice 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

moonbit-bestpractice 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

moonbit-bestpractice 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

moonbit-bestpractice 用的人多吗?

公开数据是累计安装 333 次,近一周安装 14 次,下载 116 次。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

moonbit-bestpractice 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
moonbit-bestpractice

Moonbit 最佳实践 · 本页

333—需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

MoonBit Coding Standards

Related Skills

  • moonbit-docs — MoonBit language reference (syntax, types, functions, methods, deriving). Use for language questions and debugging.

1. Documentation

  • Use ///| for documentation comments on top-level definitions (functions, structs, enums, traits, tests). This is the output format of moon fmt.
  • Ensure public APIs are documented.

2. Naming Conventions

  • Types (Structs, Enums) & Traits: PascalCase (e.g., Position, GeoJSONObject, ToBBox).
  • Abbreviations: Abbreviations other than those at the beginning (such as JSON or ID) should generally be all uppercase (e.g. FromJSON, JSONToMap).
  • Functions & Methods: snake_case (e.g., from_json, to_geometry, boolean_point_in_polygon).
  • Variables & Parameters: snake_case (e.g., coordinates, shifted_poly).
  • No Abbreviations: Do not abbreviate variable names unless they are common abbreviations (e.g., id, json). Avoid p for point, ls for line_string, etc.
  • Collections: Use the _array suffix for array arguments/variables instead of plural names (e.g., polygon_array instead of polygons).
  • Constructors: Always define fn new inside the struct body. Factory functions use new_hoge/from_hoge naming — never ::new.

3. Idioms & Best Practices

3.1 Constructors & Instance Initialization

  • Default constructor: The fn new declaration inside the struct body is the constructor definition itself — do NOT write a separate fn StructName::new(...) implementation outside. fn new supports raise, so validation logic should be placed in new to ensure instances are always in a valid state. OK: struct MyStruct {x: Int y: Int fn new(x~: Int, y~: Int) -> MyStruct} NG: fn MyStruct::new(x~: Int, y~: Int) -> MyStruct {{x, y}}
  • Factory functions: Define separate static functions with names like new_hoge, from_hoge, etc. Never name them ::new. Factory functions must generate values via the new constructor (StructName(...) is equivalent to StructName::new(...)): struct Rect {x: Double y: Double width: Double height: Double // Validation in new ensures all Rect instances have valid size fn new(x~: Double, y~: Double, width~: Double, height~: Double) -> Rect raise} // Conversion: create from a different representation fn Rect::from_corners(x1~: Double, y1~: Double, x2~: Double, y2~: Double) -> Rect {Rect(x=x1, y=y1, width=x2 - x1, height=y2 - y1)} // Specific state: create a type with optional fields in a predetermined state fn Rect::new_unit(x~: Double, y~: Double) -> Rect {Rect(x~, y~, width=1.0, height=1.0)}
  • Initialization: Struct literal syntax (StructName::{...}) should ONLY be used strictly within constructor functions like new. External code must use the constructor syntax (StructName(...)).
  • Updating: Use dedicated update functions/methods to modify values.
  • Struct Update Syntax: Avoid using Struct Update Syntax (e.g., {..base, field: value}) whenever possible, as it may bypass validation logic or constraints.
  • Ignore Usage: Use proper pipeline style when ignoring return values: expr |> ignore.

3.2 Error Handling

Use the raise effect for functions that can fail instead of returning Result types for synchronous logic.

Defining error types:

suberror DivError { DivError(String) }

suberror E3 {
  A
  B(String)
  C(Int, loc~ : SourceLoc)
}

suberror uses enum-like constructor syntax. The older suberror A B syntax is deprecated. Always use suberror A {A(B)} with explicit constructors.

Raising errors:

  • Custom error: raise DivError("division by zero")
  • Generic failure: fail("message") — convenience function that raises Failure type with source location

Function signatures:

fn div(x : Int, y : Int) -> Int raise DivError { ... }

fn f() -> Unit raise { ... }

fn add(a : Int, b : Int) -> Int noraise { a + b }
  • raise CustomError: function may raise a specific error type
  • raise or raise Error: function may raise any error
  • noraise: function guaranteed not to raise

Handling errors:

try div(42, 0) catch {
  DivError(msg) => println(msg)
} noraise {
  v => println(v)
}

let a = div(42, 0) catch { _ => 0 }

let res = try? (div(6, 0) * div(6, 3))

try! div(42, 0)
  • try {expr} catch {pattern => handler} noraise {v =>...}: full error handling
  • let a = expr catch {_ => default}: simplified inline catch
  • try? expr: convert to Result[T, Error]
  • try! expr: panic on error

Error polymorphism:

Use raise? for higher-order functions that conditionally throw:

fn[T] map(
  array : Array[T],
  f : (T) -> T raise?
) -> Array[T] raise? { ... }

When f is noraise, map is also noraise. When f raises, map raises.

Best practices:

  • Prefer raise effect over Result for synchronous code
  • In tests, let errors propagate or use guard to assert success

3.3 Pattern Matching & Guards

  • Avoid if for Validation: Use guard instead: guard array.length() > 0 else {raise Error("Empty")}
  • Use guard for assertions, early returns, or unwrapping:

- General Code: Always provide an explicit fallback using else: guard hoge is Hoge(fuga) else {raise fail("Message")} - Tests: Use guard without fallback for better readability: guard feature.geometry is Some(@geojson.Geometry::Polygon(poly))

  • Use match for exhaustive handling of Enums.
  • Use Labeled Arguments/Punners (~) in patterns and constructors when variable names match field names: match geometry {Polygon(coordinates~) => coordinates}

3.4 Functions

  • Anonymous Functions: Prefer arrow syntax args => body over fn keyword fn(args) {body}.
  • Local fn annotation: Local fn definitions must explicitly annotate raise/async effects. Inference for local fn is deprecated. Arrow functions are unaffected. fn outer() -> Unit raise {fn local_fn() -> Unit raise {fail("err")} let arrow_fn = () => {fail("err")}}

3.5 Structs & Enums

  • Enum Wrapping Structs: Define independent Structs for each variant, then wrap them in the Enum. Use the same name for the Variant and the Struct. pub struct Point {...} pub enum Geometry {Point(Point) MultiPoint(MultiPoint)} derive(Debug, Eq)
  • Delegation: When implementing traits for such Enums, pattern match on self and delegate to the inner struct's method.
  • Prefer distinct Structs for complex data wrapped in Enums if polymorphic behavior is needed.
  • Standard traits: Debug, Eq, Compare, ToJson, FromJson, Hash (note: types containing Json cannot derive Hash).
  • Debug trait: Always derive Debug instead of Show. Debug replaces Show as the standard trait for structural formatting. Uses debug_inspect() for output. struct MyStruct {...} derive(Debug, Eq)
  • Constructor qualified names: Built-in constructors require qualified names (e.g., Failure::Failure). Constructors with arguments cannot be used as higher-order functions; use a wrapper: let f = x => Some(x)

3.6 Traits

  • Definition Notation: pub trait ToGeoJSON {to_geojson(Self) -> GeoJSON}
  • Performance Overrides: Always override default trait methods if a more efficient implementation is possible for the specific type.
  • Implementation Rules:

1. Default Implementation: If a method's return value is not Self and it can be implemented solely using other methods, provide a default implementation. 2. Trait Object Delegation: When implementing a super-trait for a type that also implements a sub-trait, define the logic as a static function on the sub-trait's object and relay to it. 3. Direct Implementation: If delegation is not possible or creates circular dependencies, implement the method directly on the type.

3.7 Cascade Operator

x..f() is equivalent to {x.f(); x} — for methods returning Unit.

let result = StringBuilder::new()
  ..write_char('a')
  ..write_object(1001)
  ..write_string("abcdef")
  .to_string()

Enables chaining mutable operations without modifying return types. Compiler warns if result is ignored.

3.8 Range Syntax

  • a..<b: exclusive upper bound (increasing)
  • a..<=b: inclusive upper bound (increasing) — replaces deprecated a..=b
  • a>..b: exclusive lower bound (decreasing)
  • a>=..b: inclusive lower bound (decreasing)
for i in 0..<10 { ... }
for i in 10>=..0 { ... }

3.9 Loop nobreak

Replaces old loop else. Executes when the loop condition becomes false.

let r = while i > 0 {
  if cond { break 42 }
  i = i - 1
} nobreak {
  7
}

break must provide a value matching the nobreak return type.

3.10 declare Keyword

Similar to Rust's todo! macro. Use declare before function definitions to indicate specification-only declarations. Missing implementations generate warnings (not errors).

declare fn add(x : Int, y : Int) -> Int

4. Performance Optimization

  • Lazy evaluation with Iterator: For array processing where the size is unknown or potentially large, prefer iter() for lazy evaluation to avoid intermediate array allocations. This is especially effective for fold operations like minimum()/maximum(): let min_x = coords.iter().map(c => c.x()).minimum().unwrap()
  • Flattening: Use flatten() instead of manual loops with append when merging nested collections.

5. Toolchain

  • moon.pkg DSL replaces deprecated moon.pkg.json.

6. Testing

See MoonBit Testing Standards for detailed testing guidelines.

平台分布

Codex

37.44%
按下载量换算43

Claude

30.33%
按下载量换算35

Cursor

19.38%
按下载量换算22

Gemini CLI

10.46%
按下载量换算12

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills