# Collect Context

> セッション内外のコンテキストを収集し、記事執筆用の素材ファイルを生成する

- **Type:** Skill
- **Install:** `agentstack add skill-shimo4228-claude-harness-collect-context`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [shimo4228](https://agentstack.voostack.com/s/shimo4228)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [shimo4228](https://github.com/shimo4228)
- **Source:** https://github.com/shimo4228/claude-harness/tree/main/skills/collect-context

## Install

```sh
agentstack add skill-shimo4228-claude-harness-collect-context
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# /collect-context — 記事コンテキスト収集

現在のセッション + 関連する過去セッション + プロジェクト知識から、記事執筆に必要なコンテキストを一箇所に集約する。

## Usage

```
/collect-context [テーマ] [--out ]
```

- `テーマ`: 記事のテーマやキーワード（省略時はセッション内容から自動推定）
- `--out `: 出力先パス（省略時は `~/MyAI_Lab/zenn-content/drafts/` に自動命名）

例:
```
/collect-context "Obsidian CLI × Claude Code"
/collect-context "タグ整理の自動化" --out ~/MyAI_Lab/zenn-content/drafts/obsidian-tag-cleanup.md
```

## Arguments

$ARGUMENTS はテーマ文字列 + オプションとして解釈する。
引数がない場合は、現在のセッション内容からテーマを自動推定する。

## Process

### Phase 1: 現在のセッションから収集

現在の会話を分析し、以下を抽出する:

1. **やったこと** — 実行した操作・コマンドの時系列リスト
2. **Before/After データ** — 定量的な変化（数値、件数）
3. **コード・コマンド例** — 実行した CLI コマンド、作成したスクリプト（抜粋）
4. **技術的発見** — 予想外の挙動、ハマりポイント、ワークアラウンド
5. **判断と理由** — なぜその方法を選んだか（Why）

### Phase 2: 関連する過去コンテキストから収集

以下のソースから関連情報を検索する:

```bash
# git ログから関連コミットを検索
git log --all --oneline --grep="" | head -20

# セッションスナップショットから検索
grep -rl "" ~/.claude/sessions/snapshots/ 2>/dev/null | head -10
```

以下を抽出する:

6. **前作・関連記事** — 同テーマの過去記事があれば差別化ポイントを特定
7. **過去の知見** — 同テーマで過去に学んだこと、失敗したこと
8. **蓄積データ** — 過去セッションの Before/After、スクリプト、設計判断

### Phase 3: プロジェクト知識から収集

9. **MEMORY.md** — プロジェクトの auto-memory から関連情報を抽出
10. **既存記事** — `~/MyAI_Lab/zenn-content/articles/` を Glob で検索し、関連する既存記事を特定
11. **スキル・パターン** — `~/.claude/skills/learned/` から関連する学習済みパターンを検索

### Phase 4: 構造化して出力

全コンテキストを以下のテンプレートに沿って1ファイルに統合する。

## Output Template

```markdown
---
title: ""
emoji: ""
type: "tech"
topics: []
published: false
---

## 記事の位置づけ

- テーマ: 
- ターゲット読者: 
- 差別化: 
- 前作との関係: 

## Before / After データ

| 指標 | Before | After | 方法 |
|------|--------|-------|------|
| ... | ... | ... | ... |

## やったことの時系列

1. ...
2. ...

## コード・コマンド例

### 

```

```

## 技術的発見・ハマりポイント

### 
- 現象: ...
- 原因: ...
- 解決: ...

## 判断と理由（Why）

| 判断 | 理由 | 他の選択肢 |
|------|------|-----------|
| ... | ... | ... |

## 過去セッションからの関連コンテキスト

### 
- 日付: ...
- 概要: ...
- この記事との関連: ...

## 記事構成案

### タイトル候補

1. ...
2. ...
3. ...

### 構成

1. **はじめに** — ...
2. ...

## 参考リンク

- ...

## 技術メモ（執筆時の注意点）

- ...
```

## Quality Gate

出力前に確認する:

- [ ] Before/After データに具体的な数値がある
- [ ] コード例は実際に実行したものである（推測ではない）
- [ ] 過去セッション情報はクロスチェック済み
- [ ] 既存記事との差別化ポイントが明確
- [ ] タイトル候補が3つ以上ある
- [ ] 構成案が具体的（各セクション1行の説明つき）

## Notes

- Obsidian MCP が利用可能な場合は、Vault 内の関連ノートも検索対象に含める
- 出力ファイルは Zenn の frontmatter 形式に準拠する（そのまま記事の骨格としても使える）
- テーマが広すぎる場合は AskUserQuestion でスコープを絞る

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [shimo4228](https://github.com/shimo4228)
- **Source:** [shimo4228/claude-harness](https://github.com/shimo4228/claude-harness)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-shimo4228-claude-harness-collect-context
- Seller: https://agentstack.voostack.com/s/shimo4228
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
