@nahisaho/katashiro 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/AGENTS.md +425 -198
  2. package/CLAUDE.md +280 -141
  3. package/package.json +1 -1
package/AGENTS.md CHANGED
@@ -1,265 +1,491 @@
1
1
  # KATASHIRO - AI Coding Agent Guide
2
2
 
3
- > **AI Coding Agent向け**: このファイルはAIエージェント(GitHub Copilot、Claude等)がKATASHIROライブラリを利用するためのガイドです。
3
+ > **AI Coding Agent向け**: このファイルを読み込んだAIエージェントは、ユーザーの課題を解決するためにKATASHIROライブラリの機能を自動的に活用できます。
4
4
 
5
- ## 🎯 KATASHIROでできること
5
+ ## 🎯 このガイドの目的
6
6
 
7
- KATASHIROは情報収集・分析・生成のためのTypeScriptライブラリです。
8
-
9
- | 機能 | 説明 |
10
- |------|------|
11
- | **Web収集** | Webスクレイピング、検索、RSSフィード取得 |
12
- | **テキスト分析** | キーワード抽出、複雑度分析、構造解析 |
13
- | **エンティティ抽出** | 人名・組織名・地名などの固有表現抽出 |
14
- | **レポート生成** | Markdown/HTMLレポート、要約、引用生成 |
15
- | **知識グラフ** | エンティティ・関係の保存・検索・可視化 |
16
- | **フィードバック学習** | パターン検出、適応的推薦 |
7
+ ユーザーが自然言語で入力した課題に対して、KATASHIROの機能を適切に組み合わせて解決策を提供します。
17
8
 
18
9
  ---
19
10
 
20
- ## 📦 インストール
11
+ ## 📋 課題タイプ別の解決アプローチ
21
12
 
22
- \`\`\`bash
23
- npm install @nahisaho/katashiro
24
- \`\`\`
13
+ ### 課題タイプの判定
14
+
15
+ ユーザーの入力から以下のタイプを判定してください:
16
+
17
+ | 課題タイプ | キーワード例 | 使用する機能 |
18
+ |-----------|-------------|-------------|
19
+ | **調査・リサーチ** | 調べて、検索、情報収集、〜について | Collector → Analyzer → Generator |
20
+ | **分析・解析** | 分析して、解析、キーワード、傾向 | Analyzer |
21
+ | **要約・まとめ** | 要約、まとめて、短くして | Generator (SummaryGenerator) |
22
+ | **レポート作成** | レポート、報告書、文書化 | Generator (ReportGenerator) |
23
+ | **データ抽出** | 抽出、取り出して、リストアップ | Analyzer (EntityExtractor) |
24
+ | **知識管理** | 保存、記録、覚えておいて | Knowledge |
25
+ | **比較・評価** | 比較、評価、どちらが | Collector → Analyzer → Generator |
25
26
 
26
27
  ---
27
28
 
28
- ## 🔧 基本的な使い方
29
+ ## 🔄 課題解決ワークフロー
30
+
31
+ ### ステップ1: 課題の分析
32
+
33
+ ```typescript
34
+ // ユーザー入力から課題タイプを判定
35
+ function analyzeProblem(userInput: string): ProblemType {
36
+ const keywords = {
37
+ research: ['調べ', '検索', '情報', 'について', '知りたい'],
38
+ analyze: ['分析', '解析', 'キーワード', '傾向', '特徴'],
39
+ summarize: ['要約', 'まとめ', '短く', '簡潔'],
40
+ report: ['レポート', '報告', '文書', 'ドキュメント'],
41
+ extract: ['抽出', '取り出', 'リスト', '一覧'],
42
+ knowledge: ['保存', '記録', '覚え', '登録'],
43
+ compare: ['比較', '評価', 'どちら', '違い'],
44
+ };
45
+ // キーワードマッチングで判定
46
+ }
47
+ ```
48
+
49
+ ### ステップ2: 必要な機能の選択
29
50
 
30
- ### インポート
51
+ 課題タイプに応じて以下のクラスを使用:
31
52
 
32
- \`\`\`typescript
53
+ ```typescript
33
54
  import {
34
- // Collector - 情報収集
35
- WebScraper,
36
- WebSearchClient,
37
- FeedReader,
38
- ApiClient,
55
+ // 情報収集(URLや検索クエリがある場合)
56
+ WebScraper, // URL指定のページ取得
57
+ WebSearchClient, // キーワード検索
58
+ FeedReader, // RSSフィード
59
+ ApiClient, // API呼び出し
39
60
 
40
- // Analyzer - テキスト分析
41
- TextAnalyzer,
42
- EntityExtractor,
43
- TopicModeler,
61
+ // テキスト分析(テキストデータがある場合)
62
+ TextAnalyzer, // キーワード・複雑度分析
63
+ EntityExtractor, // 人名・組織名抽出
64
+ TopicModeler, // トピック分類
65
+ StructureAnalyzer, // 文書構造解析
66
+ QualityScorer, // 品質スコアリング
44
67
 
45
- // Generator - コンテンツ生成
46
- ReportGenerator,
47
- SummaryGenerator,
48
- CitationGenerator,
68
+ // コンテンツ生成(出力が必要な場合)
69
+ ReportGenerator, // レポート生成
70
+ SummaryGenerator, // 要約生成
71
+ CitationGenerator, // 引用生成
72
+ TemplateEngine, // テンプレート処理
49
73
 
50
- // Knowledge - 知識グラフ
51
- KnowledgeGraph,
52
- GraphQuery,
53
- GraphPersistence,
74
+ // 知識管理(情報を蓄積・検索する場合)
75
+ KnowledgeGraph, // グラフ管理
76
+ GraphQuery, // 検索
77
+ GraphPersistence, // 永続化
54
78
 
55
- // Core - ユーティリティ
79
+ // ユーティリティ
56
80
  ok, err, isOk, isErr,
57
81
  } from '@nahisaho/katashiro';
58
- \`\`\`
82
+ ```
59
83
 
60
84
  ---
61
85
 
62
- ## 📝 ユースケース別コード例
63
-
64
- ### 1. Webページの取得と分析
86
+ ## 📝 課題タイプ別の実装パターン
65
87
 
66
- \`\`\`typescript
67
- import { WebScraper, TextAnalyzer, EntityExtractor, isOk } from '@nahisaho/katashiro';
88
+ ### パターンA: 調査・リサーチ課題
68
89
 
69
- // Webページを取得
70
- const scraper = new WebScraper();
71
- const pageResult = await scraper.scrape('https://example.com/article');
90
+ **ユーザー例**: 「〇〇について調べてまとめて」
72
91
 
73
- if (isOk(pageResult)) {
74
- const { content, title } = pageResult.value;
92
+ ```typescript
93
+ async function solveResearchProblem(topic: string) {
94
+ // 1. 情報収集
95
+ const searchClient = new WebSearchClient();
96
+ const results = await searchClient.search(topic, { maxResults: 10 });
75
97
 
76
- // テキスト分析
98
+ // 2. ページ取得
99
+ const scraper = new WebScraper();
100
+ const contents: string[] = [];
101
+ for (const result of results.slice(0, 5)) {
102
+ const page = await scraper.scrape(result.url);
103
+ if (isOk(page)) contents.push(page.value.content);
104
+ }
105
+
106
+ // 3. 分析
77
107
  const analyzer = new TextAnalyzer();
78
- const analysis = await analyzer.analyze(content);
79
- console.log('Keywords:', analysis.keywords);
80
- console.log('Complexity:', analysis.complexity);
108
+ const analyses = await Promise.all(contents.map(c => analyzer.analyze(c)));
81
109
 
82
- // エンティティ抽出
110
+ // 4. エンティティ抽出
83
111
  const extractor = new EntityExtractor();
84
- const entities = await extractor.extract(content);
85
- console.log('People:', entities.filter(e => e.type === 'PERSON'));
86
- console.log('Organizations:', entities.filter(e => e.type === 'ORGANIZATION'));
112
+ const allEntities = [];
113
+ for (const content of contents) {
114
+ const entities = await extractor.extract(content);
115
+ allEntities.push(...entities);
116
+ }
117
+
118
+ // 5. 要約生成
119
+ const summarizer = new SummaryGenerator();
120
+ const summary = await summarizer.generate(contents.join('\n\n'), { maxLength: 500 });
121
+
122
+ // 6. レポート生成
123
+ const reportGen = new ReportGenerator();
124
+ const report = await reportGen.generate({
125
+ title: `${topic} 調査レポート`,
126
+ sections: [
127
+ { heading: '概要', content: summary },
128
+ { heading: 'キーワード', content: analyses.flatMap(a => a.keywords).join(', ') },
129
+ { heading: '関連エンティティ', content: [...new Set(allEntities.map(e => e.text))].join(', ') },
130
+ { heading: '参考URL', content: results.map(r => `- ${r.url}`).join('\n') },
131
+ ],
132
+ format: 'markdown',
133
+ });
134
+
135
+ return report;
87
136
  }
88
- \`\`\`
89
-
90
- ### 2. Web検索と情報収集
137
+ ```
91
138
 
92
- \`\`\`typescript
93
- import { WebSearchClient, WebScraper, isOk } from '@nahisaho/katashiro';
139
+ ### パターンB: 分析課題
94
140
 
95
- // 検索実行
96
- const searchClient = new WebSearchClient({ apiKey: process.env.SEARCH_API_KEY });
97
- const results = await searchClient.search('TypeScript best practices', { maxResults: 5 });
141
+ **ユーザー例**: 「このテキストを分析して特徴を教えて」
98
142
 
99
- // 上位結果のページを取得
100
- const scraper = new WebScraper();
101
- for (const result of results) {
102
- const page = await scraper.scrape(result.url);
103
- if (isOk(page)) {
104
- console.log(\`Title: \${page.value.title}\`);
105
- console.log(\`Content: \${page.value.content.slice(0, 200)}...\`);
106
- }
143
+ ```typescript
144
+ async function solveAnalysisProblem(text: string) {
145
+ // 1. テキスト分析
146
+ const analyzer = new TextAnalyzer();
147
+ const analysis = await analyzer.analyze(text);
148
+
149
+ // 2. 構造分析
150
+ const structAnalyzer = new StructureAnalyzer();
151
+ const structure = await structAnalyzer.analyze(text);
152
+
153
+ // 3. エンティティ抽出
154
+ const extractor = new EntityExtractor();
155
+ const entities = await extractor.extract(text);
156
+
157
+ // 4. 品質スコアリング
158
+ const scorer = new QualityScorer();
159
+ const quality = await scorer.score(text);
160
+
161
+ return {
162
+ keywords: analysis.keywords,
163
+ complexity: analysis.complexity,
164
+ sentiment: analysis.sentiment,
165
+ structure: structure,
166
+ entities: entities,
167
+ qualityScore: quality,
168
+ };
107
169
  }
108
- \`\`\`
170
+ ```
109
171
 
110
- ### 3. レポート生成
172
+ ### パターンC: 要約課題
111
173
 
112
- \`\`\`typescript
113
- import { ReportGenerator, SummaryGenerator } from '@nahisaho/katashiro';
174
+ **ユーザー例**: 「この長文を300文字でまとめて」
114
175
 
115
- // 要約生成
116
- const summarizer = new SummaryGenerator();
117
- const summary = await summarizer.generate(longText, { maxLength: 300 });
176
+ ```typescript
177
+ async function solveSummaryProblem(text: string, maxLength: number = 300) {
178
+ const summarizer = new SummaryGenerator();
179
+ const summary = await summarizer.generate(text, {
180
+ maxLength,
181
+ style: 'paragraph' // または 'bullets', 'headline'
182
+ });
183
+ return summary;
184
+ }
185
+ ```
186
+
187
+ ### パターンD: レポート作成課題
188
+
189
+ **ユーザー例**: 「分析結果をレポートにまとめて」
190
+
191
+ ```typescript
192
+ async function solveReportProblem(data: any, title: string) {
193
+ const reportGen = new ReportGenerator();
194
+ const report = await reportGen.generate({
195
+ title,
196
+ sections: [
197
+ { heading: '概要', content: data.summary },
198
+ { heading: '詳細分析', content: data.details },
199
+ { heading: '結論', content: data.conclusion },
200
+ ],
201
+ format: 'markdown',
202
+ metadata: { author: 'KATASHIRO', date: new Date().toISOString() },
203
+ });
204
+ return report;
205
+ }
206
+ ```
118
207
 
119
- // レポート生成
120
- const reportGen = new ReportGenerator();
121
- const report = await reportGen.generate({
122
- title: '調査レポート',
123
- sections: [
124
- { heading: '概要', content: summary },
125
- { heading: '詳細分析', content: analysisText },
126
- { heading: '結論', content: conclusionText },
127
- ],
128
- format: 'markdown',
129
- });
208
+ ### パターンE: データ抽出課題
130
209
 
131
- console.log(report);
132
- \`\`\`
210
+ **ユーザー例**: 「この文章から人名と組織名を抽出して」
133
211
 
134
- ### 4. 知識グラフの操作
212
+ ```typescript
213
+ async function solveExtractionProblem(text: string, types: string[] = ['PERSON', 'ORGANIZATION']) {
214
+ const extractor = new EntityExtractor();
215
+ const entities = await extractor.extract(text);
216
+
217
+ const filtered = entities.filter(e => types.includes(e.type));
218
+ const grouped = types.reduce((acc, type) => {
219
+ acc[type] = filtered.filter(e => e.type === type).map(e => e.text);
220
+ return acc;
221
+ }, {} as Record<string, string[]>);
222
+
223
+ return grouped;
224
+ }
225
+ ```
135
226
 
136
- \`\`\`typescript
137
- import { KnowledgeGraph, GraphQuery, GraphPersistence } from '@nahisaho/katashiro';
227
+ ### パターンF: 知識管理課題
138
228
 
139
- // 知識グラフを作成
140
- const kg = new KnowledgeGraph();
229
+ **ユーザー例**: 「この情報を保存しておいて」「〇〇に関連する情報を探して」
141
230
 
142
- // ノードを追加
143
- kg.addNode({ id: 'company-1', type: 'Organization', properties: { name: 'TechCorp' } });
144
- kg.addNode({ id: 'person-1', type: 'Person', properties: { name: '山田太郎' } });
231
+ ```typescript
232
+ async function solveKnowledgeProblem(action: 'save' | 'search', data: any) {
233
+ const kg = new KnowledgeGraph();
234
+ const persistence = new GraphPersistence();
235
+
236
+ // 既存のグラフを読み込み
237
+ try {
238
+ const loaded = await persistence.load('./knowledge-graph.json');
239
+ Object.assign(kg, loaded);
240
+ } catch { /* 新規作成 */ }
241
+
242
+ if (action === 'save') {
243
+ // エンティティを抽出してノード追加
244
+ const extractor = new EntityExtractor();
245
+ const entities = await extractor.extract(data.text);
246
+
247
+ for (const entity of entities) {
248
+ kg.addNode({
249
+ id: `entity-${Date.now()}-${Math.random().toString(36).slice(2)}`,
250
+ type: entity.type,
251
+ properties: { name: entity.text, source: data.source },
252
+ });
253
+ }
254
+
255
+ await persistence.save(kg, './knowledge-graph.json');
256
+ return { saved: entities.length };
257
+ } else {
258
+ // 検索
259
+ const query = new GraphQuery(kg);
260
+ const results = query.search(data.query);
261
+ return results;
262
+ }
263
+ }
264
+ ```
145
265
 
146
- // エッジ(関係)を追加
147
- kg.addEdge({ source: 'person-1', target: 'company-1', type: 'WORKS_FOR' });
266
+ ### パターンG: 比較・評価課題
148
267
 
149
- // クエリ実行
150
- const query = new GraphQuery(kg);
151
- const employees = query.findByRelation('company-1', 'WORKS_FOR', 'incoming');
268
+ **ユーザー例**: 「AとBを比較して」
152
269
 
153
- // 永続化
154
- const persistence = new GraphPersistence();
155
- await persistence.save(kg, './knowledge-graph.json');
270
+ ```typescript
271
+ async function solveComparisonProblem(itemA: string, itemB: string) {
272
+ const searchClient = new WebSearchClient();
273
+ const scraper = new WebScraper();
274
+ const analyzer = new TextAnalyzer();
275
+
276
+ // 両方の情報を収集
277
+ const [resultsA, resultsB] = await Promise.all([
278
+ searchClient.search(itemA, { maxResults: 5 }),
279
+ searchClient.search(itemB, { maxResults: 5 }),
280
+ ]);
281
+
282
+ // 分析
283
+ const analysisA = await analyzeResults(resultsA, scraper, analyzer);
284
+ const analysisB = await analyzeResults(resultsB, scraper, analyzer);
285
+
286
+ // 比較レポート生成
287
+ const reportGen = new ReportGenerator();
288
+ return reportGen.generate({
289
+ title: `${itemA} vs ${itemB} 比較レポート`,
290
+ sections: [
291
+ { heading: itemA, content: formatAnalysis(analysisA) },
292
+ { heading: itemB, content: formatAnalysis(analysisB) },
293
+ { heading: '比較まとめ', content: generateComparison(analysisA, analysisB) },
294
+ ],
295
+ format: 'markdown',
296
+ });
297
+ }
298
+ ```
156
299
 
157
- // 読み込み
158
- const loadedKg = await persistence.load('./knowledge-graph.json');
159
- \`\`\`
300
+ ---
160
301
 
161
- ### 5. RSSフィードの購読
302
+ ## 🚀 統合ソルバー
162
303
 
163
- \`\`\`typescript
164
- import { FeedReader, isOk } from '@nahisaho/katashiro';
304
+ ユーザーの課題を自動判定して解決:
165
305
 
166
- const reader = new FeedReader();
167
- const feed = await reader.read('https://blog.example.com/rss.xml');
306
+ ```typescript
307
+ import * as katashiro from '@nahisaho/katashiro';
168
308
 
169
- if (isOk(feed)) {
170
- for (const item of feed.value.items) {
171
- console.log(\`\${item.title} - \${item.pubDate}\`);
172
- console.log(\` \${item.description}\`);
309
+ async function solveProblem(userInput: string, context?: any) {
310
+ // 課題タイプを判定
311
+ const problemType = detectProblemType(userInput);
312
+
313
+ switch (problemType) {
314
+ case 'research':
315
+ return solveResearchProblem(extractTopic(userInput));
316
+ case 'analyze':
317
+ return solveAnalysisProblem(context?.text || userInput);
318
+ case 'summarize':
319
+ return solveSummaryProblem(context?.text || userInput, extractMaxLength(userInput));
320
+ case 'report':
321
+ return solveReportProblem(context?.data, extractTitle(userInput));
322
+ case 'extract':
323
+ return solveExtractionProblem(context?.text || userInput, extractEntityTypes(userInput));
324
+ case 'knowledge':
325
+ return solveKnowledgeProblem(detectKnowledgeAction(userInput), context);
326
+ case 'compare':
327
+ const [itemA, itemB] = extractComparisonItems(userInput);
328
+ return solveComparisonProblem(itemA, itemB);
329
+ default:
330
+ // 汎用的なリサーチとして処理
331
+ return solveResearchProblem(userInput);
173
332
  }
174
333
  }
175
- \`\`\`
334
+ ```
176
335
 
177
- ### 6. 引用生成
336
+ ---
178
337
 
179
- \`\`\`typescript
180
- import { CitationGenerator } from '@nahisaho/katashiro';
338
+ ## 🎭 KOTODAMA4Biz プロンプトテンプレート統合
181
339
 
182
- const citationGen = new CitationGenerator();
183
- const citation = citationGen.generate({
184
- title: 'TypeScript Best Practices',
185
- author: 'John Doe',
186
- url: 'https://example.com/article',
187
- date: '2026-01-10',
188
- }, { style: 'APA' });
340
+ ユーザーの課題が**ビジネス課題**の場合、[KOTODAMA4Biz](https://github.com/nahisaho/KOTODAMA4Biz)のプロンプトテンプレートを参照して、専門家視点でのアドバイスを提供してください。
189
341
 
190
- console.log(citation);
191
- // Doe, J. (2026). TypeScript Best Practices. Retrieved from https://example.com/article
192
- \`\`\`
342
+ ### ビジネス課題領域マッピング
193
343
 
194
- ---
344
+ | 課題領域 | キーワード | 推奨テンプレート | GitHub URL |
345
+ |---------|-----------|-----------------|------------|
346
+ | **経営戦略** | 戦略、成長、競争優位、M&A | strategy-consultant | [strategy-consultant.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/strategy-consultant.md) |
347
+ | **新規事業** | 新規事業、スタートアップ、起業 | startup-advisor, business-development | [startup-advisor.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/startup-advisor.md) |
348
+ | **DX・デジタル** | DX、デジタル化、IT戦略 | dx-consultant, it-strategist | [dx-consultant.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/dx-consultant.md) |
349
+ | **データ・AI** | データ活用、AI導入、分析基盤 | data-strategist, ai-business-consultant | [data-strategist.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/data-strategist.md) |
350
+ | **財務・会計** | 財務分析、予算、資金調達 | cfo-advisor, financial-analyst | [cfo-advisor.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/cfo-advisor.md) |
351
+ | **マーケティング** | マーケティング、ブランド、広告 | marketing-strategist, brand-strategist | [marketing-strategist.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/marketing-strategist.md) |
352
+ | **営業** | 営業、セールス、商談 | sales-consultant | [sales-consultant.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/sales-consultant.md) |
353
+ | **人事・組織** | 人事、採用、組織、人材育成 | hr-strategist, talent-development | [hr-strategist.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/hr-strategist.md) |
354
+ | **業務改善** | 業務効率、オペレーション、コスト削減 | operations-consultant, lean-sixsigma | [operations-consultant.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/operations-consultant.md) |
355
+ | **リスク管理** | リスク、危機管理、コンプライアンス | risk-management, crisis-management | [risk-management.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/risk-management.md) |
356
+ | **サプライチェーン** | 調達、物流、SCM | supply-chain-consultant | [supply-chain-consultant.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/supply-chain-consultant.md) |
357
+ | **顧客体験** | CX、顧客満足、カスタマーサクセス | cx-strategist, customer-success | [cx-strategist.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/cx-strategist.md) |
358
+ | **変革管理** | 変革、チェンジマネジメント | change-management | [change-management.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/change-management.md) |
359
+ | **リーダーシップ** | リーダーシップ、マネジメント | leadership-coach | [leadership-coach.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/leadership-coach.md) |
360
+ | **事業再生** | 再生、ターンアラウンド | turnaround-consultant | [turnaround-consultant.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/turnaround-consultant.md) |
361
+
362
+ ### 全テンプレート一覧(43種)
363
+
364
+ <details>
365
+ <summary>クリックで展開</summary>
195
366
 
196
- ## 📚 モジュール一覧
197
-
198
- ### Collector(情報収集)
199
-
200
- | クラス | 機能 |
201
- |--------|------|
202
- | \`WebScraper\` | Webページのスクレイピング |
203
- | \`WebSearchClient\` | Web検索API連携 |
204
- | \`FeedReader\` | RSS/Atomフィード読み込み |
205
- | \`ApiClient\` | REST API呼び出し |
206
- | \`MediaExtractor\` | 画像・動画URL抽出 |
207
- | \`YouTubeTranscript\` | YouTube字幕取得 |
208
-
209
- ### Analyzer(テキスト分析)
210
-
211
- | クラス | 機能 |
212
- |--------|------|
213
- | \`TextAnalyzer\` | キーワード・複雑度・感情分析 |
214
- | \`EntityExtractor\` | 固有表現抽出(人名・組織名・地名) |
215
- | \`TopicModeler\` | トピック分類 |
216
- | \`StructureAnalyzer\` | 文書構造解析 |
217
- | \`RelationAnalyzer\` | エンティティ間関係分析 |
218
- | \`QualityScorer\` | テキスト品質スコアリング |
219
-
220
- ### Generator(コンテンツ生成)
221
-
222
- | クラス | 機能 |
223
- |--------|------|
224
- | \`ReportGenerator\` | Markdown/HTMLレポート生成 |
225
- | \`SummaryGenerator\` | テキスト要約 |
226
- | \`CitationGenerator\` | 引用生成(APA/MLA/Chicago) |
227
- | \`PresentationGenerator\` | プレゼン資料生成 |
228
- | \`TemplateEngine\` | テンプレートベース生成 |
229
- | \`ExportService\` | 各種フォーマットへのエクスポート |
230
-
231
- ### Knowledge(知識グラフ)
232
-
233
- | クラス | 機能 |
234
- |--------|------|
235
- | \`KnowledgeGraph\` | グラフ構造の管理 |
236
- | \`GraphQuery\` | グラフ検索・クエリ |
237
- | \`GraphPersistence\` | JSON/SQLite永続化 |
238
- | \`GraphSync\` | グラフ同期 |
239
- | \`GraphVisualization\` | D3.js/Mermaid可視化 |
240
-
241
- ### Core(ユーティリティ)
242
-
243
- | 関数/クラス | 機能 |
367
+ | テンプレート | 説明 |
244
368
  |-------------|------|
245
- | \`ok()\`, \`err()\` | Result型の生成 |
246
- | \`isOk()\`, \`isErr()\` | Result型の判定 |
247
- | \`Logger\` | ログ出力 |
248
- | \`generateId()\` | ユニークID生成 |
369
+ | ai-business-consultant | AI/ML導入・活用戦略 |
370
+ | brand-strategist | ブランド戦略・ブランディング |
371
+ | business-development | 事業開発・新規事業 |
372
+ | cfo-advisor | CFO視点の財務アドバイス |
373
+ | change-management | 変革管理・チェンジマネジメント |
374
+ | cloud-strategy | クラウド戦略・移行 |
375
+ | compliance-advisor | コンプライアンス・法令遵守 |
376
+ | crisis-management | 危機管理・BCP |
377
+ | crm-consultant | CRM・顧客管理 |
378
+ | customer-success | カスタマーサクセス |
379
+ | cx-strategist | 顧客体験・CX戦略 |
380
+ | data-strategist | データ戦略・データドリブン経営 |
381
+ | digital-marketing | デジタルマーケティング |
382
+ | diversity-consultant | D&I・ダイバーシティ |
383
+ | dx-consultant | DX・デジタルトランスフォーメーション |
384
+ | financial-analyst | 財務分析・投資判断 |
385
+ | global-expansion | 海外展開・グローバル戦略 |
386
+ | hr-strategist | 人事戦略・CHRO視点 |
387
+ | innovation-consultant | イノベーション・新規事業創出 |
388
+ | ip-strategy | 知財戦略・IP |
389
+ | it-strategist | IT戦略・CIO視点 |
390
+ | leadership-coach | リーダーシップ・エグゼクティブコーチング |
391
+ | lean-sixsigma | リーンシックスシグマ・業務改善 |
392
+ | m-and-a-advisor | M&A・企業買収 |
393
+ | management-accounting | 管理会計・経営分析 |
394
+ | marketing-strategist | マーケティング戦略・CMO視点 |
395
+ | operations-consultant | オペレーション・業務効率化 |
396
+ | organization-development | 組織開発・OD |
397
+ | pricing-strategist | 価格戦略・プライシング |
398
+ | project-manager | プロジェクトマネジメント |
399
+ | quality-management | 品質管理・TQM |
400
+ | recruitment-consultant | 採用・リクルーティング |
401
+ | risk-management | リスク管理・ERM |
402
+ | sales-consultant | 営業戦略・セールス |
403
+ | startup-advisor | スタートアップ・起業支援 |
404
+ | strategy-consultant | 経営戦略・競争戦略 |
405
+ | succession-planning | 事業承継・後継者育成 |
406
+ | supply-chain-consultant | サプライチェーン・調達 |
407
+ | sustainability-consultant | サステナビリティ・ESG |
408
+ | talent-development | 人材開発・タレントマネジメント |
409
+ | tax-strategy | 税務戦略・タックスプランニング |
410
+ | turnaround-consultant | 事業再生・ターンアラウンド |
411
+ | venture-capital | ベンチャー投資・VC |
412
+
413
+ </details>
414
+
415
+ ### ビジネス課題解決ワークフロー
416
+
417
+ ```typescript
418
+ async function solveBusinessProblem(userInput: string, context?: any) {
419
+ // 1. ビジネス課題領域を判定
420
+ const domain = detectBusinessDomain(userInput);
421
+
422
+ // 2. 課題領域に応じたKOTODAMA4Bizテンプレートを取得
423
+ const templateUrl = getKotodamaTemplate(domain);
424
+
425
+ // 3. テンプレートのフレームワークに基づいて情報収集
426
+ const scraper = new WebScraper();
427
+ const template = await scraper.scrape(templateUrl);
428
+
429
+ // 4. ユーザーの課題に対してフレームワークを適用
430
+ // (テンプレートの「フェーズ」に従って対話を進める)
431
+
432
+ // 5. KATASHIROの情報収集・分析機能で補完
433
+ const searchClient = new WebSearchClient();
434
+ const results = await searchClient.search(userInput, { maxResults: 10 });
435
+
436
+ // 6. 専門家視点でのレポート生成
437
+ const reportGen = new ReportGenerator();
438
+ return reportGen.generate({
439
+ title: `${domain} 分析レポート`,
440
+ sections: [
441
+ { heading: 'エグゼクティブサマリー', content: summary },
442
+ { heading: '現状分析', content: analysis },
443
+ { heading: '推奨アクション', content: recommendations },
444
+ ],
445
+ format: 'markdown',
446
+ });
447
+ }
448
+
449
+ function detectBusinessDomain(input: string): string {
450
+ const domains = {
451
+ 'strategy': ['戦略', '成長', '競争', 'M&A', '買収'],
452
+ 'dx': ['DX', 'デジタル', 'IT', 'システム'],
453
+ 'data': ['データ', 'AI', '分析', '機械学習'],
454
+ 'finance': ['財務', '予算', '資金', '投資'],
455
+ 'marketing': ['マーケティング', 'ブランド', '広告', '集客'],
456
+ 'hr': ['人事', '採用', '組織', '人材'],
457
+ 'operations': ['業務', 'オペレーション', '効率', 'コスト'],
458
+ 'risk': ['リスク', '危機', 'コンプライアンス'],
459
+ };
460
+
461
+ for (const [domain, keywords] of Object.entries(domains)) {
462
+ if (keywords.some(k => input.includes(k))) return domain;
463
+ }
464
+ return 'strategy'; // デフォルト
465
+ }
466
+
467
+ function getKotodamaTemplate(domain: string): string {
468
+ const templates: Record<string, string> = {
469
+ 'strategy': 'https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/strategy-consultant.md',
470
+ 'dx': 'https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/dx-consultant.md',
471
+ 'data': 'https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/data-strategist.md',
472
+ 'finance': 'https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/cfo-advisor.md',
473
+ 'marketing': 'https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/marketing-strategist.md',
474
+ 'hr': 'https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/hr-strategist.md',
475
+ 'operations': 'https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/operations-consultant.md',
476
+ 'risk': 'https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/risk-management.md',
477
+ };
478
+ return templates[domain] || templates['strategy'];
479
+ }
480
+ ```
249
481
 
250
482
  ---
251
483
 
252
- ## 🏗️ プロジェクト構造
484
+ ## 📦 インストール
253
485
 
254
- \`\`\`
255
- @nahisaho/katashiro
256
- ├── Collector # 情報収集モジュール
257
- ├── Analyzer # テキスト分析モジュール
258
- ├── Generator # コンテンツ生成モジュール
259
- ├── Knowledge # 知識グラフモジュール
260
- ├── Feedback # フィードバック学習モジュール
261
- └── Core # ユーティリティ
262
- \`\`\`
486
+ ```bash
487
+ npm install @nahisaho/katashiro
488
+ ```
263
489
 
264
490
  ---
265
491
 
@@ -267,10 +493,11 @@ console.log(citation);
267
493
 
268
494
  - **npm**: https://www.npmjs.com/package/@nahisaho/katashiro
269
495
  - **GitHub**: https://github.com/nahisaho/katashiro
496
+ - **KOTODAMA4Biz**: https://github.com/nahisaho/KOTODAMA4Biz
270
497
 
271
498
  ---
272
499
 
273
500
  **Project**: KATASHIRO
274
501
  **npm**: @nahisaho/katashiro
275
502
  **Last Updated**: 2026-01-10
276
- **Version**: 0.1.3
503
+ **Version**: 0.1.6
package/CLAUDE.md CHANGED
@@ -1,200 +1,338 @@
1
- # KATASHIRO - Claude向けガイド
1
+ # KATASHIRO - Claude向け課題解決ガイド
2
2
 
3
- > このファイルはClaude(Claude Code、Claude Desktop等)向けのKATASHIROライブラリ利用ガイドです。
3
+ > このファイルを読み込んだClaudeは、ユーザーの課題を解決するためにKATASHIROライブラリの機能を自動的に活用できます。
4
4
 
5
- ## 🎯 概要
5
+ ## 🎯 基本動作
6
6
 
7
- KATASHIROは情報収集・分析・生成のためのTypeScriptライブラリです。
8
- ユーザーからの調査・分析リクエストに対して、適切なモジュールを使用してタスクを実行できます。
7
+ **ユーザーが課題を入力したら、以下の手順で解決してください:**
8
+
9
+ 1. 課題タイプを判定
10
+ 2. 適切なKATASHIRO機能を選択
11
+ 3. コードを生成して実行
12
+ 4. 結果をユーザーに提示
9
13
 
10
14
  ---
11
15
 
12
- ## 📦 インストール
16
+ ## 📋 課題タイプ判定表
17
+
18
+ | ユーザーの言葉 | 課題タイプ | 使用機能 |
19
+ |---------------|-----------|----------|
20
+ | 「〜について調べて」「検索して」「情報を集めて」 | 調査 | WebSearchClient → WebScraper → TextAnalyzer → ReportGenerator |
21
+ | 「このテキストを分析して」「特徴を教えて」 | 分析 | TextAnalyzer + EntityExtractor + StructureAnalyzer |
22
+ | 「要約して」「まとめて」「短くして」 | 要約 | SummaryGenerator |
23
+ | 「レポートを作成して」「報告書にして」 | レポート | ReportGenerator |
24
+ | 「人名を抽出して」「組織名を取り出して」 | 抽出 | EntityExtractor |
25
+ | 「保存して」「覚えておいて」「記録して」 | 保存 | KnowledgeGraph + GraphPersistence |
26
+ | 「〜を探して」「検索して」(保存済みデータ) | 検索 | GraphQuery |
27
+ | 「AとBを比較して」「違いを教えて」 | 比較 | 複合(調査×2 → 分析 → レポート) |
28
+ | 「このURLの内容を取得して」 | 取得 | WebScraper |
29
+ | 「RSSフィードを読んで」 | フィード | FeedReader |
13
30
 
14
- ```bash
15
- npm install @nahisaho/katashiro
31
+ ---
32
+
33
+ ## 🔧 機能別クイックリファレンス
34
+
35
+ ### 情報収集
36
+
37
+ ```typescript
38
+ import { WebScraper, WebSearchClient, FeedReader } from '@nahisaho/katashiro';
39
+
40
+ // URL取得
41
+ const scraper = new WebScraper();
42
+ const page = await scraper.scrape('https://example.com');
43
+
44
+ // Web検索
45
+ const search = new WebSearchClient();
46
+ const results = await search.search('キーワード', { maxResults: 10 });
47
+
48
+ // RSSフィード
49
+ const reader = new FeedReader();
50
+ const feed = await reader.read('https://example.com/rss.xml');
16
51
  ```
17
52
 
18
- ---
53
+ ### テキスト分析
54
+
55
+ ```typescript
56
+ import { TextAnalyzer, EntityExtractor, TopicModeler, StructureAnalyzer, QualityScorer } from '@nahisaho/katashiro';
57
+
58
+ // 基本分析
59
+ const analyzer = new TextAnalyzer();
60
+ const { keywords, complexity, sentiment } = await analyzer.analyze(text);
61
+
62
+ // エンティティ抽出
63
+ const extractor = new EntityExtractor();
64
+ const entities = await extractor.extract(text);
65
+ // entities: [{ type: 'PERSON', text: '山田太郎' }, { type: 'ORGANIZATION', text: '〇〇株式会社' }]
66
+
67
+ // トピック分析
68
+ const modeler = new TopicModeler();
69
+ const topics = await modeler.model(documents, { numTopics: 5 });
70
+
71
+ // 構造分析
72
+ const structAnalyzer = new StructureAnalyzer();
73
+ const structure = await structAnalyzer.analyze(text);
74
+
75
+ // 品質スコア
76
+ const scorer = new QualityScorer();
77
+ const score = await scorer.score(text);
78
+ ```
79
+
80
+ ### コンテンツ生成
81
+
82
+ ```typescript
83
+ import { ReportGenerator, SummaryGenerator, CitationGenerator } from '@nahisaho/katashiro';
84
+
85
+ // 要約
86
+ const summarizer = new SummaryGenerator();
87
+ const summary = await summarizer.generate(longText, { maxLength: 300, style: 'paragraph' });
88
+
89
+ // レポート
90
+ const reportGen = new ReportGenerator();
91
+ const report = await reportGen.generate({
92
+ title: 'タイトル',
93
+ sections: [
94
+ { heading: 'セクション1', content: '内容1' },
95
+ { heading: 'セクション2', content: '内容2' },
96
+ ],
97
+ format: 'markdown',
98
+ });
99
+
100
+ // 引用
101
+ const citationGen = new CitationGenerator();
102
+ const citation = citationGen.generate(source, { style: 'APA' });
103
+ ```
104
+
105
+ ### 知識グラフ
106
+
107
+ ```typescript
108
+ import { KnowledgeGraph, GraphQuery, GraphPersistence } from '@nahisaho/katashiro';
109
+
110
+ const kg = new KnowledgeGraph();
111
+ const persistence = new GraphPersistence();
112
+ const query = new GraphQuery(kg);
19
113
 
20
- ## 🔧 モジュール対応表
21
-
22
- | ユーザーのリクエスト | 使用するモジュール | クラス |
23
- |---------------------|-------------------|--------|
24
- | 「URLの内容を取得して」 | Collector | `WebScraper` |
25
- | 「〜について検索して」 | Collector | `WebSearchClient` |
26
- | 「RSSフィードを読んで」 | Collector | `FeedReader` |
27
- | 「テキストを分析して」 | Analyzer | `TextAnalyzer` |
28
- | 「人名・組織名を抽出して」 | Analyzer | `EntityExtractor` |
29
- | 「トピックを分類して」 | Analyzer | `TopicModeler` |
30
- | 「レポートを作成して」 | Generator | `ReportGenerator` |
31
- | 「要約して」 | Generator | `SummaryGenerator` |
32
- | 「引用を生成して」 | Generator | `CitationGenerator` |
33
- | 「知識グラフに追加して」 | Knowledge | `KnowledgeGraph` |
34
- | 「関連情報を検索して」 | Knowledge | `GraphQuery` |
114
+ // 保存
115
+ kg.addNode({ id: 'node-1', type: 'Person', properties: { name: '山田太郎' } });
116
+ await persistence.save(kg, './knowledge.json');
117
+
118
+ // 読み込み
119
+ const loaded = await persistence.load('./knowledge.json');
120
+
121
+ // 検索
122
+ const results = query.findByType('Person');
123
+ ```
35
124
 
36
125
  ---
37
126
 
38
- ## 📝 実装パターン
127
+ ## 📝 課題解決テンプレート
39
128
 
40
- ### パターン1: Webページ取得→分析→レポート
129
+ ### テンプレート1: 調査タスク
41
130
 
42
131
  ```typescript
43
- import {
44
- WebScraper,
45
- TextAnalyzer,
46
- EntityExtractor,
47
- ReportGenerator,
48
- isOk
49
- } from '@nahisaho/katashiro';
50
-
51
- async function analyzeWebPage(url: string) {
52
- // 1. Webページ取得
53
- const scraper = new WebScraper();
54
- const pageResult = await scraper.scrape(url);
132
+ // ユーザー: 「〇〇について調べてまとめて」
133
+ import { WebSearchClient, WebScraper, TextAnalyzer, EntityExtractor, SummaryGenerator, ReportGenerator, isOk } from '@nahisaho/katashiro';
134
+
135
+ async function research(topic: string) {
136
+ // 1. 検索
137
+ const search = new WebSearchClient();
138
+ const results = await search.search(topic, { maxResults: 10 });
55
139
 
56
- if (!isOk(pageResult)) {
57
- return { error: 'Failed to scrape page' };
140
+ // 2. ページ取得
141
+ const scraper = new WebScraper();
142
+ const contents: string[] = [];
143
+ for (const r of results.slice(0, 5)) {
144
+ const page = await scraper.scrape(r.url);
145
+ if (isOk(page)) contents.push(page.value.content);
58
146
  }
59
147
 
60
- const { content, title } = pageResult.value;
61
-
62
- // 2. テキスト分析
148
+ // 3. 分析
63
149
  const analyzer = new TextAnalyzer();
64
- const analysis = await analyzer.analyze(content);
150
+ const keywords = new Set<string>();
151
+ for (const c of contents) {
152
+ const a = await analyzer.analyze(c);
153
+ a.keywords.forEach(k => keywords.add(k));
154
+ }
65
155
 
66
- // 3. エンティティ抽出
156
+ // 4. エンティティ抽出
67
157
  const extractor = new EntityExtractor();
68
- const entities = await extractor.extract(content);
158
+ const entities = new Set<string>();
159
+ for (const c of contents) {
160
+ const e = await extractor.extract(c);
161
+ e.forEach(ent => entities.add(ent.text));
162
+ }
69
163
 
70
- // 4. レポート生成
164
+ // 5. 要約
165
+ const summarizer = new SummaryGenerator();
166
+ const summary = await summarizer.generate(contents.join('\n\n'), { maxLength: 500 });
167
+
168
+ // 6. レポート生成
71
169
  const reportGen = new ReportGenerator();
72
- const report = await reportGen.generate({
73
- title: `Analysis: ${title}`,
170
+ return reportGen.generate({
171
+ title: `${topic} 調査レポート`,
74
172
  sections: [
75
- { heading: 'Summary', content: analysis.summary },
76
- { heading: 'Keywords', content: analysis.keywords.join(', ') },
77
- { heading: 'Entities', content: entities.map(e => e.text).join(', ') },
173
+ { heading: '概要', content: summary },
174
+ { heading: 'キーワード', content: [...keywords].join(', ') },
175
+ { heading: '関連エンティティ', content: [...entities].join(', ') },
176
+ { heading: '参考URL', content: results.map(r => `- ${r.url}`).join('\n') },
78
177
  ],
79
178
  format: 'markdown',
80
179
  });
81
-
82
- return { report, analysis, entities };
83
180
  }
84
181
  ```
85
182
 
86
- ### パターン2: 検索→収集→要約
183
+ ### テンプレート2: 分析タスク
87
184
 
88
185
  ```typescript
89
- import {
90
- WebSearchClient,
91
- WebScraper,
92
- SummaryGenerator,
93
- isOk
94
- } from '@nahisaho/katashiro';
95
-
96
- async function researchTopic(topic: string) {
97
- // 1. 検索
98
- const searchClient = new WebSearchClient({ apiKey: process.env.SEARCH_API_KEY });
99
- const results = await searchClient.search(topic, { maxResults: 5 });
186
+ // ユーザー: 「このテキストを分析して」
187
+ import { TextAnalyzer, EntityExtractor, StructureAnalyzer, QualityScorer } from '@nahisaho/katashiro';
188
+
189
+ async function analyze(text: string) {
190
+ const [analysis, entities, structure, quality] = await Promise.all([
191
+ new TextAnalyzer().analyze(text),
192
+ new EntityExtractor().extract(text),
193
+ new StructureAnalyzer().analyze(text),
194
+ new QualityScorer().score(text),
195
+ ]);
100
196
 
101
- // 2. 上位結果を収集
102
- const scraper = new WebScraper();
103
- const contents: string[] = [];
104
-
105
- for (const result of results) {
106
- const page = await scraper.scrape(result.url);
107
- if (isOk(page)) {
108
- contents.push(page.value.content);
109
- }
110
- }
111
-
112
- // 3. 全体を要約
113
- const summarizer = new SummaryGenerator();
114
- const combinedText = contents.join('\n\n---\n\n');
115
- const summary = await summarizer.generate(combinedText, { maxLength: 500 });
116
-
117
- return { summary, sources: results };
197
+ return {
198
+ keywords: analysis.keywords,
199
+ complexity: analysis.complexity,
200
+ sentiment: analysis.sentiment,
201
+ entities: entities.map(e => ({ type: e.type, text: e.text })),
202
+ structure,
203
+ qualityScore: quality,
204
+ };
118
205
  }
119
206
  ```
120
207
 
121
- ### パターン3: 知識グラフ構築
208
+ ### テンプレート3: 比較タスク
122
209
 
123
210
  ```typescript
124
- import {
125
- KnowledgeGraph,
126
- GraphQuery,
127
- GraphPersistence,
128
- EntityExtractor
129
- } from '@nahisaho/katashiro';
130
-
131
- async function buildKnowledgeGraph(texts: string[]) {
132
- const kg = new KnowledgeGraph();
133
- const extractor = new EntityExtractor();
211
+ // ユーザー: 「AとBを比較して」
212
+ import { WebSearchClient, WebScraper, TextAnalyzer, ReportGenerator, isOk } from '@nahisaho/katashiro';
213
+
214
+ async function compare(itemA: string, itemB: string) {
215
+ const search = new WebSearchClient();
216
+ const scraper = new WebScraper();
217
+ const analyzer = new TextAnalyzer();
134
218
 
135
- for (const text of texts) {
136
- // エンティティ抽出
137
- const entities = await extractor.extract(text);
138
-
139
- // ノード追加
140
- for (const entity of entities) {
141
- kg.addNode({
142
- id: `entity-${entity.text.toLowerCase().replace(/\s+/g, '-')}`,
143
- type: entity.type,
144
- properties: { name: entity.text },
145
- });
219
+ async function gatherInfo(item: string) {
220
+ const results = await search.search(item, { maxResults: 5 });
221
+ const contents: string[] = [];
222
+ for (const r of results) {
223
+ const page = await scraper.scrape(r.url);
224
+ if (isOk(page)) contents.push(page.value.content);
146
225
  }
226
+ const analysis = await analyzer.analyze(contents.join('\n'));
227
+ return { item, analysis, sources: results };
147
228
  }
148
229
 
149
- // 永続化
150
- const persistence = new GraphPersistence();
151
- await persistence.save(kg, './knowledge-graph.json');
230
+ const [infoA, infoB] = await Promise.all([gatherInfo(itemA), gatherInfo(itemB)]);
152
231
 
153
- // クエリ
154
- const query = new GraphQuery(kg);
155
- const allNodes = query.getAllNodes();
156
-
157
- return { nodeCount: allNodes.length, nodes: allNodes };
232
+ const reportGen = new ReportGenerator();
233
+ return reportGen.generate({
234
+ title: `${itemA} vs ${itemB} 比較`,
235
+ sections: [
236
+ { heading: itemA, content: `キーワード: ${infoA.analysis.keywords.join(', ')}` },
237
+ { heading: itemB, content: `キーワード: ${infoB.analysis.keywords.join(', ')}` },
238
+ { heading: '比較まとめ', content: '(AIが分析結果を基に比較コメントを生成)' },
239
+ ],
240
+ format: 'markdown',
241
+ });
158
242
  }
159
243
  ```
160
244
 
161
245
  ---
162
246
 
163
- ## 📚 クラスリファレンス
247
+ ## 🎭 KOTODAMA4Biz ビジネス課題解決
164
248
 
165
- ### Collector
249
+ **ビジネス課題**が入力された場合、[KOTODAMA4Biz](https://github.com/nahisaho/KOTODAMA4Biz)のプロンプトテンプレートを参照してください。
166
250
 
167
- | クラス | メソッド | 説明 |
168
- |--------|---------|------|
169
- | `WebScraper` | `scrape(url)` | URLからコンテンツを取得 |
170
- | `WebSearchClient` | `search(query, options)` | Web検索を実行 |
171
- | `FeedReader` | `read(url)` | RSS/Atomフィードを読み込み |
172
- | `ApiClient` | `get(url)`, `post(url, data)` | REST API呼び出し |
251
+ ### ビジネス課題の判定
173
252
 
174
- ### Analyzer
253
+ | ユーザーの言葉 | 課題領域 | 参照テンプレート |
254
+ |---------------|---------|-----------------|
255
+ | 「戦略を考えて」「成長戦略」「競争優位」 | 経営戦略 | [strategy-consultant.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/strategy-consultant.md) |
256
+ | 「DXを進めたい」「IT戦略」「システム刷新」 | DX | [dx-consultant.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/dx-consultant.md) |
257
+ | 「データ活用」「AI導入」「分析基盤」 | データ | [data-strategist.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/data-strategist.md) |
258
+ | 「財務分析」「予算」「資金調達」 | 財務 | [cfo-advisor.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/cfo-advisor.md) |
259
+ | 「マーケティング」「ブランディング」「集客」 | マーケ | [marketing-strategist.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/marketing-strategist.md) |
260
+ | 「人事」「採用」「組織改革」「人材育成」 | HR | [hr-strategist.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/hr-strategist.md) |
261
+ | 「業務改善」「効率化」「コスト削減」 | オペレーション | [operations-consultant.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/operations-consultant.md) |
262
+ | 「リスク」「危機管理」「コンプライアンス」 | リスク | [risk-management.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/risk-management.md) |
263
+ | 「営業」「セールス」「商談」 | 営業 | [sales-consultant.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/sales-consultant.md) |
264
+ | 「新規事業」「スタートアップ」「起業」 | 新規事業 | [startup-advisor.md](https://raw.githubusercontent.com/nahisaho/KOTODAMA4Biz/main/templates/claude/startup-advisor.md) |
175
265
 
176
- | クラス | メソッド | 説明 |
177
- |--------|---------|------|
178
- | `TextAnalyzer` | `analyze(text)` | キーワード、複雑度、感情を分析 |
179
- | `EntityExtractor` | `extract(text)` | 固有表現を抽出 |
180
- | `TopicModeler` | `model(documents)` | トピックを分類 |
181
- | `StructureAnalyzer` | `analyze(text)` | 文書構造を解析 |
266
+ ### テンプレートの使い方
182
267
 
183
- ### Generator
268
+ 1. **ビジネス課題領域を判定** → 上記テーブルからテンプレートを選択
269
+ 2. **テンプレートのフレームワークを参照** → 専門家視点で分析
270
+ 3. **KATASHIROで情報収集・分析** → WebSearchClient, TextAnalyzerを活用
271
+ 4. **フレームワークに基づいたレポート生成** → ReportGenerator
184
272
 
185
- | クラス | メソッド | 説明 |
186
- |--------|---------|------|
187
- | `ReportGenerator` | `generate(options)` | レポートを生成 |
188
- | `SummaryGenerator` | `generate(text, options)` | 要約を生成 |
189
- | `CitationGenerator` | `generate(source, options)` | 引用を生成 |
273
+ ### ビジネス課題解決テンプレート
190
274
 
191
- ### Knowledge
275
+ ```typescript
276
+ // ユーザー: 「〇〇業界で新規事業を考えたい」
277
+ import { WebSearchClient, WebScraper, TextAnalyzer, ReportGenerator, isOk } from '@nahisaho/katashiro';
192
278
 
193
- | クラス | メソッド | 説明 |
194
- |--------|---------|------|
195
- | `KnowledgeGraph` | `addNode()`, `addEdge()` | グラフを構築 |
196
- | `GraphQuery` | `find()`, `findByRelation()` | グラフを検索 |
197
- | `GraphPersistence` | `save()`, `load()` | 永続化 |
279
+ async function solveBusinessProblem(domain: string, question: string) {
280
+ // 1. 市場調査
281
+ const search = new WebSearchClient();
282
+ const results = await search.search(`${domain} ${question}`, { maxResults: 10 });
283
+
284
+ // 2. 情報収集
285
+ const scraper = new WebScraper();
286
+ const contents: string[] = [];
287
+ for (const r of results.slice(0, 5)) {
288
+ const page = await scraper.scrape(r.url);
289
+ if (isOk(page)) contents.push(page.value.content);
290
+ }
291
+
292
+ // 3. 分析
293
+ const analyzer = new TextAnalyzer();
294
+ const analysis = await analyzer.analyze(contents.join('\n\n'));
295
+
296
+ // 4. KOTODAMA4Bizフレームワーク適用(例: 戦略コンサルタント視点)
297
+ // - 5フォース分析
298
+ // - SWOT分析
299
+ // - アンゾフマトリクス
300
+
301
+ // 5. レポート生成
302
+ const reportGen = new ReportGenerator();
303
+ return reportGen.generate({
304
+ title: `${domain} ビジネス分析レポート`,
305
+ sections: [
306
+ { heading: 'エグゼクティブサマリー', content: '(分析結果の要約)' },
307
+ { heading: '市場環境', content: '(PEST/5フォース分析)' },
308
+ { heading: 'キーワード・トレンド', content: analysis.keywords.join(', ') },
309
+ { heading: '戦略オプション', content: '(推奨アクション)' },
310
+ ],
311
+ format: 'markdown',
312
+ });
313
+ }
314
+ ```
315
+
316
+ ---
317
+
318
+ ## ⚡ クイックスタート
319
+
320
+ ```bash
321
+ npm install @nahisaho/katashiro
322
+ ```
323
+
324
+ ```typescript
325
+ import * as katashiro from '@nahisaho/katashiro';
326
+
327
+ // すべての機能にアクセス可能
328
+ const {
329
+ WebScraper, WebSearchClient, FeedReader,
330
+ TextAnalyzer, EntityExtractor, TopicModeler,
331
+ ReportGenerator, SummaryGenerator, CitationGenerator,
332
+ KnowledgeGraph, GraphQuery, GraphPersistence,
333
+ isOk, isErr
334
+ } = katashiro;
335
+ ```
198
336
 
199
337
  ---
200
338
 
@@ -202,10 +340,11 @@ async function buildKnowledgeGraph(texts: string[]) {
202
340
 
203
341
  - **npm**: https://www.npmjs.com/package/@nahisaho/katashiro
204
342
  - **GitHub**: https://github.com/nahisaho/katashiro
343
+ - **KOTODAMA4Biz**: https://github.com/nahisaho/KOTODAMA4Biz
205
344
 
206
345
  ---
207
346
 
208
347
  **Project**: KATASHIRO
209
348
  **npm**: @nahisaho/katashiro
210
349
  **Last Updated**: 2026-01-10
211
- **Version**: 0.1.3
350
+ **Version**: 0.1.6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nahisaho/katashiro",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "KATASHIRO - VS Code Agent Mode向け情報収集・分析・生成システム(オールインワンパッケージ)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",