marko-js/marko

marko-best-practices

Apply Marko syntax and best practices when editing .marko files and building Marko components.

ソースを見る

使い方

  1. インストールコマンドをコピーし、自分の環境へ導入する前にソースを確認します。
  2. 必要なツール、認証情報、対応環境を原文で確認します。
  3. 入力と成果物を指定し、出力を資料と照合します。
npx skills add https://github.com/marko-js/marko --skill marko-best-practices

開始前の確認

  • 導入にはモデル契約、API枠、ファイルへのアクセス許可は含まれません。
  • スター数や導入数は活動の指標であり、独立した品質・安全性試験ではありません。
リポジトリの原文

見出し、例、コード、表、リンク、参照画像を含む原文を表示しています。

Marko Best Practices

Marko is a modern UI framework for building web applications. It features a declarative component-based syntax, fine-grained reactivity, and a highly optimized compiler. Marko is designed for both server-rendered and interactive client-side experiences with a focus on streaming, partial hydration, and shipping the smallest possible amount of JavaScript to each page.

Marko Documentation

The Marko documentation is the source of truth for all Marko-related information. Always refer to the official docs for information about syntax and behavior. Marko changes over time, so prefer fetching current docs over relying on training data.

The docs index lists every available page with its URL and a short description.

All Marko docs pages can be fetched as markdown by appending .md to the URL (<https://markojs.com/docs/introduction/getting-started.md>)

Marko 6 Syntax

Documentation and this skill target Marko 6. Do not use Marko 5 syntax.

Checklist for New or Edited .marko Files

  • [ ] Uses Marko 6 syntax only (no scriptlets, old event syntax, or Marko 5 blocks).
  • [ ] <script> is never used when state (<let> or <const>) could accomplish the same behavior.
  • [ ] Event handlers use function form: onClick() { ... } or a reference, not string names.
  • [ ] <show=cond> for toggled content that should keep its state; <if> destroys and rebuilds.
  • [ ] Component stays small and readable; consider splitting large templates.
  • [ ] No unnecessary client-side JS; prefer built-in browser APIs and HTML/CSS features over scripts.
  • [ ] Props are declared with an exported Input interface, and templates are type checked with mtc (@marko/type-check) — tsc skips .marko files and reports nothing.