Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .claude/commands/n5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
使い方: /n5 <質問またはコマンド>

例:
- /n5 Nablarch 5でのバッチ処理の実装方法
- /n5 トランザクション管理の設定方法
- /n5 code-analysis

以下のタスクをサブエージェントに委譲して、別コンテキストで実行してください。

サブエージェントへの指示:
.claude/skills/nabledge-5/SKILL.md を読み、その指示に従って以下を処理せよ。
$ARGUMENTS

知識検索の場合は回答のサマリーを、それ以外はワークフローの実行結果を返すこと。
6 changes: 5 additions & 1 deletion .claude/marketplace/.claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@
"name": "Nablarch"
},
"metadata": {
"version": "0.3",
"version": "0.4",
"description": "Nablarch skills for AI-assisted development"
},
"plugins": [
{
"name": "nabledge-6",
"source": "./plugins/nabledge-6"
},
{
"name": "nabledge-5",
"source": "./plugins/nabledge-5"
}
]
}
2 changes: 1 addition & 1 deletion .claude/marketplace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Nabledgeは、NablarchによるAI支援開発スキルです。Claude CodeやGit
| プラグイン | 対応バージョン | 状態 |
|-----------|-------------|------|
| [nabledge-6](plugins/nabledge-6/README.md) | Nablarch 6u3 | 提供中 |
| nabledge-5 | Nablarch 5 | 今後提供予定 |
| [nabledge-5](plugins/nabledge-5/README.md) | Nablarch 5 | 提供中 |

インストール方法や使い方は各プラグインのREADMEを参照してください。

Expand Down
50 changes: 50 additions & 0 deletions .claude/skills/nabledge-5/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
name: nabledge-5
description: Nablarch 5フレームワークの構造化知識ベース。バッチ処理、RESTful Webサービス、ハンドラ、ライブラリ等のNablarch機能について質問に回答する。コード分析も可能。
---

# Nabledge-5: Nablarch 5 Knowledge Base

## トリガー条件

以下のいずれかに該当する場合にこのスキルが呼び出される:

- Nablarch 5に関する質問
- Nablarchの機能、API、設定、パターンについての質問
- Nablarchを使ったバッチ処理、RESTful Webサービスの実装に関する質問
- Nablarchのハンドラ、ライブラリ、テストフレームワークに関する質問
- Nablarchを使った既存コードの分析

## ワークフロー振り分け

入力を解析し、以下のワークフローに振り分ける:

- 「質問」「知りたい」「教えて」「使い方」等 → workflows/qa.md
- 「コード分析」「構造を理解」等 → workflows/code-analysis.md
- 判定できない場合 → workflows/qa.md(デフォルト)

## 知識制約

**重要**: 回答は知識ファイル(knowledge/**/*.json)の情報のみに基づく。

- LLMの学習データ、外部Webサイト、一般知識の使用は禁止
- 知識ファイルにない情報は「この情報は知識ファイルに含まれていません」と明示する

## 知識ファイルのパス

- 知識ファイル: knowledge/{type}/{category-id}/*.json
- インデックス: knowledge/index.toon
- 閲覧用Markdown: docs/

## ワークフロー一覧

| ワークフロー | 役割 |
|---|---|
| workflows/qa.md | 質問応答 |
| workflows/code-analysis.md | コード分析・ドキュメント生成 |
| workflows/_knowledge-search.md | 知識検索(内部。qa.md, code-analysis.mdから呼び出される) |

## エラーハンドリング

- 知識が見つからない場合: 「この情報は知識ファイルに含まれていません」+ index.toonから関連エントリを提示
- LLM学習データでの補完は行わない
267 changes: 267 additions & 0 deletions .claude/skills/nabledge-5/assets/code-analysis-template-examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
# Code Analysis Template Examples

This document contains detailed examples for generating code analysis documentation. Reference these examples when following the code-analysis workflow.

## Component Summary Table

**Purpose**: Provide a high-level overview of all components in the Architecture section.

**Format**: Markdown table with 4 columns

**Columns**:
- **Component**: Component name (class, file, or module)
- **Role**: Brief description of purpose (5-10 words)
- **Type**: Component type (Action, Form, Entity, DTO, SQL, Handler, Util, etc.)
- **Dependencies**: Key dependencies (comma-separated)

**Example 1: Batch Action**

```markdown
| Component | Role | Type | Dependencies |
|-----------|------|------|--------------|
| ExportProjectsInPeriodAction | 期間内プロジェクト一覧CSV出力 | Action | DatabaseRecordReader, ObjectMapper, FilePathSetting |
| ProjectDto | プロジェクト情報データ転送オブジェクト | DTO | なし |
| FIND_PROJECT_IN_PERIOD | 期間内プロジェクト検索クエリ | SQL | なし |
```

**Example 2: Web Action**

```markdown
| Component | Role | Type | Dependencies |
|-----------|------|------|--------------|
| LoginAction | ログイン認証処理 | Action | LoginForm, SystemAccountEntity, UniversalDao |
| LoginForm | ログイン入力検証 | Form | なし |
| SystemAccountEntity | システムアカウント情報 | Entity | なし |
```

**Tips**:
- Keep Role descriptions concise (avoid full sentences)
- Use Japanese for Role descriptions
- For "なし" (no dependencies), write "なし" instead of leaving blank
- Include all major components (3-10 components typically)

---

## Nablarch Usage with Important Points

**Purpose**: Explain how Nablarch components are used with practical guidance for developers.

**Structure** (for each component):
1. **クラス名**: Full class name
2. **説明**: Brief description (1-2 sentences)
3. **使用方法**: Code example (Java snippet)
4. **重要ポイント**: Critical points with emoji prefixes
5. **このコードでの使い方**: How it's used in analyzed code
6. **詳細**: Link to knowledge base

**Important Points Prefixes**:
- ✅ **Must do**: Critical actions that must be performed
- ⚠️ **Caution**: Gotchas, limitations, common mistakes
- 💡 **Benefit**: Why use this, advantages, design philosophy
- 🎯 **When to use**: Use cases, scenarios, applicability
- ⚡ **Performance**: Performance considerations, optimization tips

**Example 1: ObjectMapper**

```markdown
### ObjectMapper

**クラス**: `nablarch.common.databind.ObjectMapper`

**説明**: CSVやTSV、固定長データをJava Beansとして扱う機能を提供する

**使用方法**:
\`\`\`java
// 生成
ObjectMapper<ProjectDto> mapper = ObjectMapperFactory.create(ProjectDto.class, outputStream);

// 書き込み
mapper.write(dto);

// クローズ
mapper.close();
\`\`\`

**重要ポイント**:
- ✅ **必ず`close()`を呼ぶ**: バッファをフラッシュし、リソースを解放する(`terminate()`で実施)
- ⚠️ **大量データ処理時**: メモリに全データを保持しないため、大量データでも問題なく処理可能
- ⚠️ **型変換の制限**: `EntityUtil`と同様に、複雑な型変換が必要な項目は個別設定が必要
- 💡 **アノテーション駆動**: `@Csv`, `@CsvFormat`でフォーマットを宣言的に定義できる
- 💡 **保守性の高さ**: フォーマット変更時はアノテーションを変更するだけで対応可能

**このコードでの使い方**:
- `initialize()`でProjectDto用のObjectMapperを生成(Line 25-28)
- `handle()`で各レコードを`mapper.write(dto)`で出力(Line 52)
- `terminate()`で`mapper.close()`してリソース解放(Line 60)

**詳細**: [データバインド](../../.claude/skills/nabledge-5/docs/features/libraries/data-bind.md)
```

**Example 2: BusinessDateUtil**

```markdown
### BusinessDateUtil

**クラス**: `nablarch.core.date.BusinessDateUtil`

**説明**: システム全体で統一された業務日付を取得する機能を提供する

**使用方法**:
\`\`\`java
// デフォルト区分の業務日付
String bizDate = BusinessDateUtil.getDate();
// → "20260210"(yyyyMMdd形式)

// 区分別の業務日付
String batchDate = BusinessDateUtil.getDate("batch");
\`\`\`

**重要ポイント**:
- 💡 **システム横断の日付統一**: `System.currentTimeMillis()`や`LocalDate.now()`ではなく、これを使うことでバッチ処理と画面処理で同じ業務日付を共有できる
- ✅ **必ずDatabaseRecordReaderのパラメータに変換**: 取得した文字列は`java.sql.Date`に変換してSQLパラメータに設定する
- 🎯 **いつ使うか**: 日付ベースの検索条件、レポート生成、ファイル名の日付部分など
- ⚠️ **設定が必要**: システムリポジトリに業務日付テーブルまたは固定値を設定する必要がある

**このコードでの使い方**:
- `createReader()`で業務日付を取得(Line 38)
- `java.sql.Date`に変換してSQLパラメータに設定(Line 42-43)
- プロジェクトの開始日・終了日との比較条件として使用

**詳細**: [業務日付管理](../../.claude/skills/nabledge-5/docs/features/libraries/business-date.md)
```

**Tips**:
- Include 3-5 important points per component
- Focus on practical, actionable information
- Use emoji prefixes consistently
- Line references should be approximate (e.g., Line 25-28)

---

## File Links with Line References

**Purpose**: Link to source files with specific line number ranges for easy navigation.

**Format**: `[FileName.java:StartLine-EndLine](relative/path/to/FileName.java)`

**Path calculation**:
- Output location: `.nabledge/20260210/code-analysis-xxx.md`
- Source location: `proman-batch/src/main/java/.../Action.java`
- Relative path: `../../proman-batch/src/main/java/.../Action.java`

**Example 1: Component Details**

```markdown
### 1. ExportProjectsInPeriodAction

**File**: [ExportProjectsInPeriodAction.java:15-120](../../proman-batch/src/main/java/com/nablarch/example/proman/batch/project/ExportProjectsInPeriodAction.java)

**Role**: 期間内プロジェクト一覧出力の都度起動バッチアクションクラス

**Key Methods**:
- `initialize()` [:20-28] - ファイル出力先の準備とObjectMapper生成
- `createReader()` [:30-42] - DatabaseRecordReaderを生成してSQLを設定
- `handle()` [:44-58] - 1レコードをProjectDtoに変換してCSV出力
- `terminate()` [:60-65] - ObjectMapperをクローズ
```

**Example 2: Multiple Files**

```markdown
### 2. ProjectDto

**File**: [ProjectDto.java:1-85](../../proman-batch/src/main/java/com/nablarch/example/proman/batch/project/ProjectDto.java)

**Role**: 期間内プロジェクト一覧出力用のデータ転送オブジェクト

**Annotations**:
- `@Csv` [:10] - CSV出力項目順序とヘッダー定義
- `@CsvFormat` [:11-15] - CSV詳細設定(区切り文字、改行コード、文字コード)
```

**Tips**:
- Use `:StartLine-EndLine` for class/method ranges
- Use `[:LineNumber]` for single-line annotations
- Line numbers should be accurate (check with Read tool)
- Relative paths must be correct (use `../../` to go up from .nabledge/YYYYMMDD/)

---

## Source Files Links

**Purpose**: List all source files analyzed with descriptions.

**Format**: Bullet list with links and brief descriptions

**Example**:

```markdown
### Source Files

- [ExportProjectsInPeriodAction.java](../../proman-batch/src/main/java/com/nablarch/example/proman/batch/project/ExportProjectsInPeriodAction.java) - 期間内プロジェクト一覧出力バッチアクション
- [ProjectDto.java](../../proman-batch/src/main/java/com/nablarch/example/proman/batch/project/ProjectDto.java) - CSV出力用データ転送オブジェクト
- [ExportProjectsInPeriodAction.sql](../../proman-batch/src/main/resources/com/nablarch/example/proman/batch/project/ExportProjectsInPeriodAction.sql) - 期間内プロジェクト検索SQL
```

**Tips**:
- Include all major source files (typically 3-10 files)
- Use relative paths from output location
- Keep descriptions brief (5-10 words)
- Order by importance (Action → DTO → SQL → Config)

---

## Knowledge Base Links

**Purpose**: Link to relevant knowledge base files in `.claude/skills/nabledge-5/docs` for detailed information.

**Format**: Bullet list with links and descriptions of what's covered

**Path structure**:
- Output: `.nabledge/20260210/code-analysis-xxx.md`
- Knowledge base: `.claude/skills/nabledge-5/docs/features/libraries/xxx.md`
- Relative path: `../../.claude/skills/nabledge-5/docs/features/libraries/xxx.md`

**Example**:

```markdown
### Knowledge Base (Nabledge-6)

- [Nablarchバッチ処理](../../.claude/skills/nabledge-5/docs/features/processing/nablarch-batch.md) - BatchActionの詳細、DB to FILEパターン、都度起動バッチ
- [データバインド](../../.claude/skills/nabledge-5/docs/features/libraries/data-bind.md) - ObjectMapperの詳細仕様、@Csvアノテーション、フォーマット設定
- [業務日付管理](../../.claude/skills/nabledge-5/docs/features/libraries/business-date.md) - BusinessDateUtilの使い方、区分管理、テーブル設定
- [ファイルパス管理](../../.claude/skills/nabledge-5/docs/features/libraries/file-path-management.md) - FilePathSettingの設定方法、論理名と物理パスのマッピング
- [UniversalDao](../../.claude/skills/nabledge-5/docs/features/libraries/universal-dao.md) - データベースアクセスAPI、CRUD操作、トランザクション管理
```

**Tips**:
- Include 3-8 knowledge base links
- Describe what topics are covered in each file
- Use relative paths from output location
- Order by relevance to analyzed code

---

## Official Documentation Links

**Purpose**: Link to official Nablarch documentation for authoritative reference.

**Format**: Bullet list with absolute URLs

**Example**:

```markdown
### Official Documentation

- [Nablarchバッチ処理](https://nablarch.github.io/docs/LATEST/doc/application_framework/application_framework/batch/index.html)
- [データバインド](https://nablarch.github.io/docs/LATEST/doc/application_framework/application_framework/libraries/data_io/data_bind.html)
- [業務日付管理](https://nablarch.github.io/docs/LATEST/doc/application_framework/application_framework/libraries/system_utility/business_date.html)
- [ファイルパス管理](https://nablarch.github.io/docs/LATEST/doc/application_framework/application_framework/libraries/file_path_management.html)
- [UniversalDao](https://nablarch.github.io/docs/LATEST/doc/application_framework/application_framework/libraries/database/universal_dao.html)
```

**Tips**:
- Include 3-8 official documentation links
- Use full URLs (https://nablarch.github.io/docs/LATEST/doc/...)
- Match the topics covered in Knowledge Base Links
- Order by relevance to analyzed code
Loading