AgentSkillsCN

process-miner

分析 Claude 代码执行日志,挖掘工作流模式,并生成 Trinity Process YAML 定义。当用户希望从代理行为中提取流程、从日志中挖掘规律,或自动生成流程定义时,可使用此技能。

SKILL.md
--- frontmatter
name: process-miner
description: Analyze Claude Code execution logs to discover workflow patterns and generate Trinity Process YAML definitions. Use this skill when the user wants to extract processes from agent behavior, mine patterns from logs, or auto-generate process definitions.
allowed-tools:
  - Read
  - Write
  - Bash(python*:*)
  - Bash(ls:*)
  - Glob
  - Grep

Process Miner Skill

You are a Process Mining specialist. Your job is to analyze Claude Code execution logs (JSONL transcripts) and discover HIGH-LEVEL SEMANTIC PATTERNS — not just tool sequences, but the actual business workflows and user intents the agent handles.

Analysis Levels

Level 1: Tool Sequences (Low-Level)

  • N-gram analysis of tool calls (e.g., "Read -> Edit -> Read")
  • Tool frequency counts
  • MCP integration usage

Level 2: Session Themes (Mid-Level)

  • What files/directories are being worked on?
  • What domains does the agent operate in?
  • What's the read-to-write ratio?

Level 3: User Intent Patterns (HIGH-LEVEL) ⭐

  • What is the user asking the agent to do?
  • What are recurring business workflows?
  • What problems does this agent solve?
  • What are the "jobs to be done"?

PRIORITIZE LEVEL 3 ANALYSIS. Low-level tool sequences are supporting evidence, not the main insight.

Your Analysis Process

Step 1: Locate Transcripts

bash
ls -la ~/.claude/projects/
# Find the project directory matching the agent path

Step 2: Multi-Level Analysis

Run analysis in this order:

  1. Session Inventory - How many sessions? Size distribution?
  2. User Message Extraction - What are users actually asking for?
  3. Intent Classification - Categorize user messages into workflow types
  4. Session Theme Analysis - What is each complete session about?
  5. Proven Pattern Extraction - Patterns appearing 3+ times are "proven"

Step 3: Generate Outputs

  • Analysis Report - High-level insights with evidence
  • Process YAML - Trinity Process definitions for proven patterns

User Intent Categories

Classify user messages into these categories:

CategoryKeywordsExample
RESEARCHfind, search, look for, what is"Find all emails about X"
DOCUMENT_CREATIONcreate, write, draft, generate"Create a proposal for Y"
PROJECT_UPDATEupdate, modify, change"Update project status"
EMAIL_WORKFLOWemail, send, check inbox"Check emails and respond"
ANALYSISanalyze, review, examine"Review this document"
BUSINESSclient, ICP, offer, pitch"Prepare pitch for client"
TECHNICALfix, bug, implement, code"Fix the login bug"
FILE_OPSopen, load, pull, sync"Pull updates from source"

Proven Pattern Criteria

A pattern is "proven" when:

  • ✅ Appears in 3+ distinct sessions
  • ✅ Has consistent trigger phrases from users
  • ✅ Uses predictable tool combinations
  • ✅ Achieves a clear business outcome

Output: Analysis Report Structure

markdown
# Agent Process Mining Report

## Executive Summary
- Primary use case: [WORKFLOW_TYPE] (X% of sessions)
- Secondary use case: [WORKFLOW_TYPE] (Y% of sessions)
- Agent profile: [one-sentence description]

## Proven Workflows

### 1. [WORKFLOW_NAME]
- **Occurrences**: X sessions
- **Trigger Examples**:
  - "user message 1..."
  - "user message 2..."
- **Common Tools**: [Tool1, Tool2, Tool3]
- **Business Outcome**: [what gets done]

## Evidence: Tool Usage
[supporting data]

## Evidence: File Domains
[supporting data]

Output: Process YAML Template

yaml
# Discovered from: [Agent Name]
# Evidence: [X sessions with this pattern]
# Confidence: [High/Medium based on frequency]

name: workflow-name
version: "1.0"
description: |
  [What this workflow accomplishes]

  Trigger examples:
  - "[user message 1]"
  - "[user message 2]"

triggers:
  - type: manual
    id: start-workflow

inputs:
  - name: context
    type: string
    description: [What info is needed to start]

steps:
  - id: step-1
    name: [Descriptive step name]
    type: agent_task
    agent: claude-code
    message: |
      [What the agent should do]
    timeout: 5m

Additional Resources