Agent Skills by ALSEL
Anthropic Claudeソフトウェア開発⭐ リポ 0品質スコア 50/100

mantine-custom-components

Mantineのテーマ・Styles API・コア機能と統合したカスタムコンポーネントを構築するスキルです。`factory()`・`polymorphicFactory()`・`genericFactory()`を使った新規コンポーネント作成、`classNames`・`styles`・`vars`・`unstyled`によるStyles APIサポートの追加、`createVarsResolver`を用いたCSS変数の実装、サブコンポーネントと共有コンテキストを持つ複合コンポーネントの構築、`Component.extend()`によるMantineProviderへの登録、および`@mantine/core`の`Factory`・`useProps`・`useStyles`・`BoxProps`・`StylesApiProps`・`ElementProps`を扱うあらゆる作業に使用してください。

description の原文を見る

> Build custom components that integrate with Mantine's theming, Styles API, and core features. Use this skill when: (1) creating a new component using factory(), polymorphicFactory(), or genericFactory(), (2) adding Styles API support (classNames, styles, vars, unstyled), (3) implementing CSS variables via createVarsResolver, (4) building compound components with sub-components and shared context, (5) registering a component with MantineProvider via Component.extend(), or (6) any task involving Factory, useProps, useStyles, BoxProps, StylesApiProps, or ElementProps in @mantine/core.

SKILL.md 本文

Mantine Custom Components スキル

コンポーネントテンプレート

import {
  Box, BoxProps, createVarsResolver, ElementProps,
  factory, Factory, getRadius, MantineRadius,
  StylesApiProps, useProps, useStyles,
} from '@mantine/core';
import classes from './MyComponent.module.css';

export type MyComponentStylesNames = 'root' | 'inner';
export type MyComponentVariant = 'filled' | 'outline';
export type MyComponentCssVariables = { root: '--my-radius' };

export interface MyComponentProps
  extends BoxProps, StylesApiProps<MyComponentFactory>, ElementProps<'div'> {
  radius?: MantineRadius;
}

export type MyComponentFactory = Factory<{
  props: MyComponentProps;
  ref: HTMLDivElement;
  stylesNames: MyComponentStylesNames;
  vars: MyComponentCssVariables;
  variant: MyComponentVariant;
}>;

const defaultProps = { radius: 'md' } satisfies Partial<MyComponentProps>;

const varsResolver = createVarsResolver<MyComponentFactory>((_theme, { radius }) => ({
  root: { '--my-radius': getRadius(radius) },
}));

export const MyComponent = factory<MyComponentFactory>((_props) => {
  const props = useProps('MyComponent', defaultProps, _props);
  const { classNames, className, style, styles, unstyled, vars, attributes, radius, ...others } = props;

  const getStyles = useStyles<MyComponentFactory>({
    name: 'MyComponent', classes, props,
    className, style, classNames, styles, unstyled, vars, attributes, varsResolver,
  });

  return <Box {...getStyles('root')} {...others} />;
});

MyComponent.displayName = '@mantine/core/MyComponent';
MyComponent.classes = classes;

Factory バリアント — どれを使用するか

シナリオFactory 関数
標準コンポーネントfactory()Factory<{}>
component プロップをサポート (ポリモーフィック)polymorphicFactory()PolymorphicFactory<{}>defaultComponentdefaultRef を追加
プロップが generic に基づいて変わる (例: multiple)genericFactory()Factory<{ signature: ... }>

polymorphicFactory は控えめに使用してください — TypeScript のオーバーヘッドが増加し、IDE のオートコンプリートが遅くなります。

Factory 型フィールド

Factory<{
  props: MyComponentProps;       // 必須
  ref: HTMLDivElement;           // 転送される ref のエレメント型
  stylesNames: 'root' | 'inner'; // Styles API セレクタの union
  vars: { root: '--my-var' };    // セレクタごとの CSS 変数マップ
  variant: 'filled' | 'outline'; // 受け入れられるバリアント文字列
  staticComponents: {            // サブコンポーネント (複合パターン)
    Item: typeof MyComponentItem;
  };
  compound?: boolean;            // true = サブコンポーネント; テーマの classNames/styles/vars を無効化
  ctx?: MyContextType;           // 3 番目の引数として styles/vars リゾルバに渡される
  signature?: (...) => JSX.Element; // genericFactory のみ
}>

テーマ統合

ユーザーとテーマは Component.extend() を経由してデフォルトをオーバーライドできます:

const theme = createTheme({
  components: {
    MyComponent: MyComponent.extend({
      defaultProps: { radius: 'xl' },
      classNames: { root: 'my-root' },
      styles: { root: { color: 'red' } },
      vars: (_theme, props) => ({ root: { '--my-radius': getRadius(props.radius) } }),
    }),
  },
});

リファレンス

  • references/api.md — すべてのインポート: factoryusePropsuseStylescreateVarsResolvercreateSafeContextStylesApiPropsCompoundStylesApiPropsBoxPropsElementProps、テーマヘルパー (getSizegetRadius など)
  • references/patterns.md — 完全な例: コンテキスト付き複合コンポーネント、ポリモーフィックコンポーネント、generic コンポーネント、テーマ統合

ライセンス: MIT(寛容ライセンスのため全文を引用しています) · 原本リポジトリ

詳細情報

作者
mantinedev
リポジトリ
mantinedev/skills
ライセンス
MIT
最終更新
不明

Source: https://github.com/mantinedev/skills / ライセンス: MIT

関連スキル

汎用ソフトウェア開発⭐ リポ 39,967

doubt-driven-development

重要な判断はすべて、本番環境への展開前に新しい視点から対抗的レビューを実施します。速度より正確性が重要な場合、不慣れなコードを扱う場合、本番環境・セキュリティに関わるロジック・取り消し不可の操作など影響度が高い場合、または後でバグを修正するよりも今検証する方が効率的な場合に活用してください。

by addyosmani
汎用ソフトウェア開発⭐ リポ 1,175

apprun-skills

TypeScriptを使用したAppRunアプリケーションのMVU設計に関する総合的なガイダンスが得られます。コンポーネントパターン、イベントハンドリング、状態管理(非同期ジェネレータを含む)、パラメータと保護機能を備えたルーティング・ナビゲーション、vistestを使用したテストに対応しています。AppRunコンポーネントの設計・レビュー、ルートの配線、状態フローの管理、AppRunテストの作成時に活用してください。

by yysun
OpenAIソフトウェア開発⭐ リポ 797

desloppify

コードベースのヘルスチェックと技術負債の追跡ツールです。コード品質、技術負債、デッドコード、大規模ファイル、ゴッドクラス、重複関数、コードスメル、命名規則の問題、インポートサイクル、結合度の問題についてユーザーが質問した場合に使用してください。また、ヘルススコアの確認、次の改善項目の提案、クリーンアップ計画の作成をリクエストされた際にも対応します。29言語に対応しています。

by Git-on-my-level
汎用ソフトウェア開発⭐ リポ 39,967

debugging-and-error-recovery

テストが失敗したり、ビルドが壊れたり、動作が期待と異なったり、予期しないエラーが発生したりした場合に、体系的な根本原因デバッグをガイドします。推測ではなく、根本原因を見つけて修正するための体系的なアプローチが必要な場合に使用してください。

by addyosmani
汎用ソフトウェア開発⭐ リポ 39,967

test-driven-development

テスト駆動開発により実装を進めます。ロジックの実装、バグの修正、動作の変更など、あらゆる場面で活用できます。コードが正常に動作することを証明する必要がある場合、バグ報告を受けた場合、既存機能を修正する予定がある場合に使用してください。

by addyosmani
汎用ソフトウェア開発⭐ リポ 39,967

incremental-implementation

変更を段階的に実施します。複数のファイルに影響する機能や変更を実装する場合に使用してください。大量のコードを一度に書こうとしている場合や、タスクが一度では完結できないほど大きい場合に活用します。

by addyosmani
本サイトは GitHub 上で公開されているオープンソースの SKILL.md ファイルをクロール・インデックス化したものです。 各スキルの著作権は原作者に帰属します。掲載に問題がある場合は info@alsel.co.jp または /takedown フォームよりご連絡ください。
原作者: mantinedev · mantinedev/skills · ライセンス: MIT