Skip to content

feat(claude): claude-codeのpluginを作成#113

Draft
ncaq wants to merge 1 commit into
masterfrom
claude-code-plugin
Draft

feat(claude): claude-codeのpluginを作成#113
ncaq wants to merge 1 commit into
masterfrom
claude-code-plugin

Conversation

@ncaq
Copy link
Copy Markdown
Owner

@ncaq ncaq commented Jan 11, 2026

close #64

まだHimari内部のドキュメントと外部向けのガイドラインが整備されていないため、
準備はまだ完了していません。
言語拡張などは内部と外部推奨を同じにすることを検討します。
@ncaq ncaq self-assigned this Jan 11, 2026
Copilot AI review requested due to automatic review settings January 11, 2026 11:04
@ncaq ncaq added Type: Documentation Change or improvement in documentation or comment Type: Feature New Feature labels Jan 11, 2026
@ncaq ncaq linked an issue Jan 11, 2026 that may be closed by this pull request
@claude
Copy link
Copy Markdown

claude Bot commented Jan 11, 2026

PR #113 レビュー: Claude Code Plugin作成

概要

このPRはClaude Code用のpluginを新規作成し、HimariカスタムPreludeを使ったHaskellプロジェクトの開発支援を行うものです。全体として良い構成になっています。


👍 良い点

  1. CLAUDE.mdとの整合性: skills/himari/配下のドキュメントがCLAUDE.mdの内容と整合しており、重要なルールが適切にカバーされています。

  2. 明確なディレクトリ構成: plugin.json、SKILL.md、coding-style.md、examples.mdという分離が明確で、関心の分離ができています。

  3. コード例の充実: coding-style.mdでは禁止事項と推奨パターンの両方が具体的なコード例付きで説明されており、AIにとって理解しやすい形式になっています。

  4. 日本語での記述: リポジトリのCLAUDE.mdの自然言語設定(日本語出力)に従っています。


🔧 改善提案

1. coding-style.md: 禁止言語拡張リストの差異

CLAUDE.mdでは禁止されているが、coding-style.mdには記載がない言語拡張:

  • RebindableSyntax

逆にcoding-style.mdにあるがCLAUDE.mdにない言語拡張:

  • なし(CLAUDE.mdの方が網羅的)

提案: 両者を完全に一致させるか、coding-style.mdにはCLAUDE.mdへの参照を明記するのが良いでしょう。

2. coding-style.md: 部分関数の追加例

CLAUDE.mdではfromJustreadのみ明示されていますが、coding-style.mdにはhead, tail, (!!) が追加されています。これ自体は良い拡張ですが、CLAUDE.mdにも追加を検討するか、coding-style.mdが「追加の推奨事項」であることを明記すると良いでしょう。

3. examples.md: 存在しない関数の使用

processInParallel :: MonadUnliftIO m => [Item] -> m [Result]
processInParallel items =
  withTaskGroup 4 $ \group -> do
    asyncs <- forM items $ \item ->
      async group (processItem item)
    mapM wait asyncs

withTaskGroupasync groupはunliftio-asyncや標準的なasyncパッケージには存在しない関数です。実際に使用可能なAPIに基づいた例に修正するか、または「架空の例」であることを明記した方が良いでしょう。

実際のunliftio/asyncで書く場合:

processInParallel :: MonadUnliftIO m => [Item] -> m [Result]
processInParallel items =
  pooledMapConcurrentlyN 4 processItem items

もしくは:

processInParallel :: MonadUnliftIO m => [Item] -> m [Result]
processInParallel = mapConcurrently processItem

4. SKILL.md: 軽微な誤り

禁止言語拡張のセクションでImpredicativeTypesLiberalTypeSynonymsRebindableSyntaxがSKILL.mdから欠けています。CLAUDE.mdとの整合性を保つために追加を検討してください。

5. plugin.json: 軽微な確認

licenseフィールドがApache-2.0となっていますが、リポジトリのLICENSEファイルと一致しているか確認してください。


💡 追加の提案

  1. readMayの例: coding-style.mdでreadMayを代替として挙げていますが、これはsafe packageの関数です。実際に使用可能かどうか、依存関係を確認してください。Text.Read.readMaybe(baseパッケージ)の方が一般的かもしれません。

  2. テストに関するガイダンス: SKILL.mdやcoding-style.mdにテストの書き方(sydtestの使用)についてのセクションがあると、プラグインとしてより完成度が高くなります。


📋 総評

全体的に良いPRです。CLAUDE.mdの重要なルールがpluginに反映されており、Claude Codeがhimariプロジェクトの規約に従ったコードを生成するのに役立つでしょう。

上記の軽微な改善点を検討いただければ、さらに良くなると思います。

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

このPRはissue #64に対応し、Claude Code用のhimariプラグインを作成しています。himariはrioの代替となるカスタムPreludeライブラリで、このプラグインはClaude CodeでHaskellコードを書く際にhimariのベストプラクティスとコーディング規約をガイドする目的で作られています。

Changes:

  • Claude Codeプラグインのメタデータファイル(.claude-plugin/plugin.json)を追加
  • himariスキルの主要ドキュメント(SKILL.md)を作成し、基本的な使用方法と禁止事項を記載
  • 詳細なコーディングスタイルガイド(coding-style.md)を作成し、言語拡張、関数の使用制限、エラーハンドリング等を網羅
  • 具体的な使用例(examples.md)を追加し、リソース管理パターンを示す

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

File Description
.claude-plugin/plugin.json Claude Codeプラグインのメタデータを定義(名前、説明、バージョン、作者、リポジトリ情報)
skills/himari/SKILL.md himariの基本的な使い方と主要な禁止事項を簡潔にまとめたスキル定義ファイル
skills/himari/coding-style.md himariを使用したHaskell開発における詳細なコーディング規約とベストプラクティス
skills/himari/examples.md bracketパターンやwithパターンを使用したリソース管理の具体的な使用例

Comment on lines +50 to +68
```haskell
-- 禁止
calculate :: Int -> Int
calculate x
| x < 0 = error "negative input"
| otherwise = x * 2

-- 推奨: Either/Maybeを返す
calculate :: Int -> Either CalculationError Int
calculate x
| x < 0 = Left NegativeInput
| otherwise = Right (x * 2)

-- 推奨: MonadThrowを使用
calculate :: MonadThrow m => Int -> m Int
calculate x
| x < 0 = throwM NegativeInputException
| otherwise = pure (x * 2)
```
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コード例に型定義が不完全です。CalculationError型とNegativeInputException型が使用されていますが、定義されていません。例として完全性を持たせるため、以下のような定義を追加することを推奨します:

data CalculationError = NegativeInput

または

data NegativeInputException = NegativeInputException
  deriving stock (Show)
  deriving anyclass (Exception)

Copilot uses AI. Check for mistakes.
Comment thread skills/himari/SKILL.md
Comment on lines +71 to +79
```haskell
data User = User
{ name :: Text
, email :: Text
}

makeFieldsId ''User
-- フィールドにプレフィクスやアンダースコアは不要
```
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Template HaskellのLANGUAGEプラグマが記載されていません。makeFieldsIdを使用する際はTemplateHaskell拡張が必要です。コード例に以下を追加してください:

{-# LANGUAGE TemplateHaskell #-}

これはcoding-style.mdの185-202行目の例では正しく記載されています。

Copilot uses AI. Check for mistakes.
Comment thread skills/himari/SKILL.md
Comment on lines +48 to +50
- `read` - 部分関数、代わりに`readMaybe`を使用
- `unsafePerformIO`系全般

Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

部分関数のリストが不完全です。coding-style.mdではhead, tail, (!!)も禁止されていますが、SKILL.mdには記載されていません。一貫性のため、全ての禁止されている部分関数をリストアップするか、または詳細はcoding-style.mdを参照するように記載してください。

Suggested change
- `read` - 部分関数、代わりに`readMaybe`を使用
- `unsafePerformIO`系全般
- `read` - 部分関数、代わりに`readMaybe`を使用
- `head` - 部分関数
- `tail` - 部分関数
- `(!!)` - 部分関数
- `unsafePerformIO`系全般
※ 他の禁止されている部分関数や詳細な理由については `coding-style.md` を参照してください。

Copilot uses AI. Check for mistakes.
Comment thread skills/himari/SKILL.md
Comment on lines +38 to +40
- `ImplicitParams`
- `IncoherentInstances`
- `OverlappingInstances`
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

危険な言語拡張のリストが不完全です。以下の言語拡張も禁止事項に含める必要があります:

  • ImpredicativeTypes
  • LiberalTypeSynonyms
  • RebindableSyntax

これらの拡張はcoding-style.mdと内部ガイドラインには記載されていますが、こちらには含まれていません。一貫性のため、全ての禁止されている言語拡張をリストアップするか、または詳細はcoding-style.mdを参照するように記載してください。

Suggested change
- `ImplicitParams`
- `IncoherentInstances`
- `OverlappingInstances`
- `ImplicitParams`
- `ImpredicativeTypes`
- `IncoherentInstances`
- `LiberalTypeSynonyms`
- `OverlappingInstances`
- `RebindableSyntax`

Copilot uses AI. Check for mistakes.
-- 推奨: 例外を使用
fetchUser :: IO User -- 失敗時は例外

-- ただしlookup操作は例外
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

誤字があります。「ただしlookup操作は例外」は文脈から「ただしlookup操作は例外ではない」または「ただしlookup操作は除外」の意味だと思われます。「例外」という言葉が二重の意味で使われているため、「存在しないのは正常系」という説明から推測すると、ここは「ただしlookup操作は例外的なケース」または「ただしlookup操作は除く」と書くべきです。

Suggested change
-- ただしlookup操作は例外
-- ただしlookup操作は除く

Copilot uses AI. Check for mistakes.
Comment thread skills/himari/examples.md
Comment on lines +7 to +26
```haskell
module MyApp.Database
( withConnection
, runQuery
) where

import Himari

withConnection :: MonadUnliftIO m => ConnectionString -> (Connection -> m a) -> m a
withConnection connStr action =
bracket
(liftIO $ connect connStr)
(liftIO . close)
action

runQuery :: MonadUnliftIO m => ConnectionString -> Query -> m [Row]
runQuery connStr query =
withConnection connStr $ \conn ->
liftIO $ execute conn query
```
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コード例が不完全です。以下の型や関数が定義されていないため、このコードはコンパイルできません:

  • ConnectionString
  • Connection
  • Query
  • Row
  • connect
  • close
  • execute

実際の使用例として完全性を持たせるために、これらの型や関数を定義するか、または「疑似コード」であることを明示してください。または、実際のライブラリ(例:postgresql-simple)を使用した完全な例を提供することを検討してください。

Copilot uses AI. Check for mistakes.
Comment thread skills/himari/examples.md
Comment on lines +30 to +43
```haskell
module MyApp.Concurrent
( processInParallel
) where

import Himari

processInParallel :: MonadUnliftIO m => [Item] -> m [Result]
processInParallel items =
withTaskGroup 4 $ \group -> do
asyncs <- forM items $ \item ->
async group (processItem item)
mapM wait asyncs
```
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

コード例が不完全です。以下の型や関数が定義されていないため、このコードはコンパイルできません:

  • Item
  • Result
  • withTaskGroup
  • async(groupを引数に取るバージョン)
  • processItem
  • wait

実際の使用例として完全性を持たせるために、これらの型や関数を定義するか、または「疑似コード」であることを明示してください。または、実際の並行処理ライブラリを使用した完全な例を提供することを検討してください。

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Documentation Change or improvement in documentation or comment Type: Feature New Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Claude Code用のプラグイン作成

2 participants