ワンクリックで
session-reflection-analysis
Use when asked to reflect on how the session went
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when asked to reflect on how the session went
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Use when evaluating, designing, or pressure-testing the business model of an AI agent product. Triggers on "agent business model", "agent economics", "agent canvas", "evaluate agent product", "agent pricing", "agent unit economics", "agentic business", "AI agent company", "agent cost structure".
Use when someone wants to launch a content brand from scratch on any platform. Triggers on "launch a channel", "start a YouTube channel", "build a podcast", "start a newsletter", "content brand", "creator launchpad", "build my audience", "start creating content", "grow on TikTok", "start a blog".
Use when you have an existing pipeline DOT file that needs review, fixing, or validation. Use when validation produces warnings or errors, when a DOT file was hand-written or generated by another tool, or when you want to verify a pipeline covers 100% of a spec before running it.
Use when you want to build a project but don't have a spec yet and need to brainstorm the idea into a design doc structured for pipeline DOT generation. Use when starting from a vague idea, project concept, or feature request that needs to become a headless autonomous build pipeline.
Use when you have a spec, design doc, structured plan, or prompt_plan and need to generate a pipeline Graphviz DOT file for headless autonomous building. The agent reads the spec, extracts build pipeline phases, determines tech stack, asks about human gates and model preferences, generates a validated DOT digraph with rich self-contained prompts, and saves it to the project root. Handles any language or framework.
Use when a pipeline DOT file has passed structural validation but may still have flow inefficiencies, spec fidelity gaps, or information loss in prompts. Use after dotfile-audit or dotfile-from-spec when you want to deeply verify a pipeline captures everything from the original spec. Use when prompts might be missing critical domain rules, data models, or invariants.
| name | session-reflection-analysis |
| description | Use when asked to reflect on how the session went |
Analyze recent chat history to identify improvement opportunities and reduce token waste in future sessions.
This skill helps identify patterns of inefficiency in Claude Code sessions by analyzing session history. The analysis focuses on actionable improvements to documentation, automation, and workflows.
First, find the correct project folder. Claude Code stores sessions at ~/.claude/projects/ with folder names derived from the project path (slashes become dashes, colons become double-dashes).
# List available project folders
ls -la ~/.claude/projects/
# Find the current project's session folder by matching the working directory
# Example: /Users/harper/src/myproject -> -Users-harper-src-myproject
CURRENT_PATH=$(pwd | sed 's|^/||; s|/|-|g')
PROJECT_DIR="$HOME/.claude/projects/-${CURRENT_PATH}"
# Verify it exists
if [ -d "$PROJECT_DIR" ]; then
echo "Found project dir: $PROJECT_DIR"
ls -la "$PROJECT_DIR"/*.jsonl 2>/dev/null | head -5
else
echo "No session folder found for current project"
echo "Available projects:"
ls ~/.claude/projects/
fi
CRITICAL: Do NOT read raw session files directly. They are massive and will consume your entire token budget.
First, verify jq is available:
if ! command -v jq &> /dev/null; then
echo "ERROR: jq is required but not installed"
echo "Install with: brew install jq (macOS) or apt install jq (Linux)"
exit 1
fi
Then use jq to generate a 98% token-reduced summary:
# Set project dir (adjust if auto-detection didn't work)
PROJECT_DIR="$HOME/.claude/projects/-Users-harper-Public-src-2389-matrix-productivity" # Update this path!
OUTPUT="/tmp/session-summary.jsonl"
# Optional: Only analyze sessions from last N days
DAYS_BACK=7
CUTOFF_DATE=$(date -v-${DAYS_BACK}d +%Y-%m-%d 2>/dev/null || date -d "${DAYS_BACK} days ago" +%Y-%m-%d)
# Summarize: extract user requests, tool names, assistant text (truncated)
cat "$PROJECT_DIR"/*.jsonl 2>/dev/null | jq -c '
select(.type == "user" or .type == "assistant") |
{
type,
ts: .timestamp,
content: (
if .message.content | type == "string" then
.message.content[0:300]
elif .message.content | type == "array" then
[.message.content[] |
if .type == "text" then {t: "text", v: .text[0:300]}
elif .type == "tool_use" then {t: "tool", v: .name}
elif .type == "tool_result" then {t: "result", len: (.content | length)}
elif .type == "thinking" then empty
else {t: .type}
end
]
else null
end
)
}' > "$OUTPUT" 2>/dev/null
echo "Summary: $(wc -l < "$OUTPUT") messages, $(wc -c < "$OUTPUT" | xargs) bytes"
This extracts:
Use the Task tool to spawn an analysis subagent:
Task tool parameters:
- subagent_type: "Explore"
- prompt: |
Analyze the session summary at /tmp/session-summary.jsonl for inefficiency patterns.
Read the file and look for these patterns:
| Pattern | Example | Impact |
|---------|---------|--------|
| **Wasted tokens** | Re-reading same file 5+ times | High |
| **Wrong paths taken** | Implemented feature, then discovered existing code | Medium-High |
| **Repeated mistakes** | Same error type in 3+ instances | Medium |
| **Missing automation** | Manual steps repeated across sessions | Medium |
| **Missing documentation** | Had to figure out what should be in CLAUDE.md | Medium |
| **Unnecessary tool calls** | Called multiple tools when one would work | Low-Medium |
| **Context loss after compaction** | Info that should survive in persistent docs | High |
| **Assumption without verification** | Decisions made without checking existing code | High |
For each pattern found, propose improvements as:
1. CLAUDE.md updates
2. New skills for .claude/skills/
3. New slash commands for .claude/commands/
4. Script automation
5. Git hooks
6. Workflow changes
Make all proposals copy-paste ready with complete text/code.
Quantify impact where possible (tokens saved, time saved).
Be specific with examples from the actual session data.
The subagent should generate a document with this structure:
# Session Reflection: YYYY-MM-DD
## Summary Statistics
- Session date range: [start] to [end]
- Messages analyzed: [count]
- Major inefficiencies found: [count]
## Proposed Improvements
### High Priority
#### 1. [Problem Title]
**Problem observed**: [What went wrong - be specific with examples]
**Proposed solution**:
[Complete text/code to add or change - copy-paste ready]
**File to modify**: `path/to/file.md`
**Cost**: [Effort to implement, any downsides]
**Benefit**: [Time/tokens saved - quantify if possible]
---
### Medium Priority
...
### Low Priority
...
## Implementation Notes
[Cross-cutting concerns, dependencies, warnings]
After analysis completes:
High Priority Issues Found:
1. **Re-reading the same file repeatedly** (7 times in one session)
- Propose: Add key architecture summaries to CLAUDE.md
- Benefit: Save ~15K tokens per session
2. **Implemented feature without checking existing code first**
- Took 3 iterations to match actual behavior
- Propose: Add "Check existing code FIRST" rule to CLAUDE.md
- Benefit: Prevent wrong-path implementations
3. **Manual repetitive commands**
- Same shell commands typed each session
- Propose: Create slash commands for common operations
- Benefit: Save 2-3 minutes per session, prevent typos
# List all projects with recent activity
ls -lt ~/.claude/projects/ | head -10
# Search for a keyword in project names
ls ~/.claude/projects/ | grep -i "keyword"
Sessions may not have been saved yet, or the project path detection failed. Check the folder manually.
# macOS
brew install jq
# Ubuntu/Debian
sudo apt install jq
# Or use the standalone binary
curl -Lo /usr/local/bin/jq https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-macos-arm64
chmod +x /usr/local/bin/jq