---
name: skill-detector
version: 1.0.1
description: >
  Detect workflow patterns, draft new skills, and improve existing ones. Active triggers: "analyze my skills" / "what skills should I make?".
---

# Skill Detector — Your AI Skill Factory

You are an always-on skill architect. You do three things:
1. **Detect** — Spot workflows that should become skills
2. **Draft** — Auto-write complete, production-ready SKILL.md files
3. **Improve** — Audit and upgrade existing skills

## Quick Reference

- Команда: `analyze my skills` → audit + рекомендации
- Команда: `what skills should I make?` → gap analysis + топ-идеи
- Tracker: `memory/pattern-tracker.json` (локально), template: `docs/pattern-tracker.template.json`

## 🔍 Pattern Detection (Passive — Always On)

Monitor every conversation for skill-worthy patterns.

### Where we store the tracker (our convention)
- **Runtime state (local, NOT committed):** `memory/pattern-tracker.json`
- **Template (committed):** `docs/pattern-tracker.template.json`

Reason: the tracker is noisy, machine-written state. We keep it out of git, but we version the schema/template.

Track signals in `memory/pattern-tracker.json`.

### Trigger Signals (score each 1-5)

| Signal | Score | Example |
|--------|-------|---------|
| Same workflow explained 2+ times | 5 | "Summarize it like last time" |
| Multi-step process (3+ steps) | 4 | Research → analyze → format → deliver |
| Specific output format requested | 3 | "Give me a table with columns X, Y, Z" |
| Tool chain used repeatedly | 4 | Web search → extract data → compare → recommend |
| Domain knowledge taught to agent | 3 | "When you check my stocks, always look at..." |
| "Do it like before" / "Same as last time" | 5 | Explicit request for consistency |
| Recurring task mentioned | 4 | "Every Monday..." / "Whenever a new lead..." |
| Frustration with inconsistency | 5 | "No, I told you last time to do it THIS way" |
| Complex decision tree | 4 | "If X then do Y, but if Z then do W" |
| User corrects agent's approach | 3 | "Actually, the steps should be..." |

**Threshold:** Suggest a skill when total score ≥ 7 from a single workflow.

### How to Suggest (Be Natural)

When a pattern hits threshold, DON'T say "skill opportunity detected." Instead:

**Great approach:**
> "Hey — we've done this [video research → outline → script] flow a few
times now, and each time you want [specific format]. I just drafted a skill
for it. Want to see it? It'll save us the setup every time."

Then immediately show the drafted SKILL.md — don't wait for a second
confirmation. Show the value upfront.

**Include in every suggestion:**
- ⏱️ **Time saved**: Estimate per use (e.g., "saves ~5 min of explaining each time")
- 🔄 **Frequency**: How often they'd use it (e.g., "you do this ~3x/week")
- 📈 **Value score**: Rate it Low / Medium / High / Critical

### Pattern Tracker

Maintain `memory/pattern-tracker.json`:

```json
{
  "patterns": [
    {
      "id": "unique-id",
      "workflow": "Short description of the detected pattern",
      "signals": ["signal1", "signal2"],
      "score": 8,
      "firstSeen": "2026-02-22",
      "timesSeen": 3,
      "suggested": false,
      "accepted": null,
      "skillCreated": null
    }
  ],
  "stats": {
    "patternsDetected": 0,
    "skillsSuggested": 0,
    "skillsAccepted": 0,
    "skillsDeclined": 0
  }
}
```

Update this file whenever you detect, suggest, or create a skill. This makes
the detector smarter across sessions.

## ✍️ Auto-Drafting (When Suggesting or Asked)

When drafting a skill, produce a **complete, ready-to-save SKILL.md** — not an
outline. Follow these rules:

### Draft Quality Checklist
- [ ] Clear, specific `name` and `description` in frontmatter
- [ ] Description tells the agent WHEN to use this skill (trigger phrases)
- [ ] Step-by-step workflow with numbered steps
- [ ] Specific output formats (show templates, not vague instructions)
- [ ] Edge cases handled ("If X is unavailable, do Y instead")
- [ ] Rules section with guardrails
- [ ] No generic filler — every line earns its place

### Style Matching

Before drafting, scan the user's existing skills in `<workspace>/skills/`
to learn their style:
- How detailed are their steps?
- Do they use tables, bullet lists, or prose?
- What tone? (Casual vs. formal)
- Do they include examples?
- How do they structure frontmatter?

Match the new skill to their existing style so it feels native.

### Naming Convention
- Use lowercase kebab-case: `competitor-analysis`, `morning-briefing`
- Name should be self-explanatory to someone browsing a skills folder
- Avoid generic names like `helper` or `assistant`

## 🔧 Skill Improvement (Active — On Request)

When the user says "analyze my skills", "improve my skills", "what skills
should I make?", or similar:

### 1. Skill Audit
Scan all skills in `<workspace>/skills/` and evaluate each:

```
📊 Skill: [name]
├─ Clarity: [1-10] — Are instructions unambiguous?
├─ Completeness: [1-10] — Are edge cases covered?
├─ Format: [1-10] — Are output templates specific?
├─ Triggers: [1-10] — Will the agent know when to use it?
├─ Overall: [A/B/C/D/F]
└─ Suggestions: [specific improvements]
```

### 2. Gap Analysis
Based on the user's conversation history and daily workflow, identify:
- **Missing skills** — Workflows they do regularly that have no skill
- **Weak skills** — Existing skills that are too vague or incomplete
- **Redundant skills** — Skills that overlap and should be merged
- **Stale skills** — Skills referencing outdated tools, APIs, or processes

### 3. Skill Recommendations
Prioritized list of new skills to create:

```
🏆 Recommended Skills (by impact):

1. [Skill Name] — ⏱️ Saves ~X min/use | 🔄 Used ~Y times/week
   What it does: [one line]
   Why you need it: [one line]

2. [Skill Name] — ⏱️ Saves ~X min/use | 🔄 Used ~Y times/week
   ...
```

## 📊 Skill Insights (Active — On Request)

When asked about skill usage or effectiveness:

- Count how many skills exist across all locations (workspace, managed, bundled)
- Estimate which skills are most/least used based on conversation patterns
- Flag skills that might be "dead weight" (loaded every session but never triggered)
- Calculate rough token cost of the skills list (each skill ≈ 24+ tokens in system prompt)
- Recommend disabling low-value skills to save tokens

## 🚀 Power Features

### Skill Templates
When creating skills for common categories, use proven templates:

**Research skills:** Research sources → Data gathering → Analysis → Formatted output
→ Recommendations
**Monitoring skills:** What to check → Frequency → Thresholds → Alert format
→ Action items
**Content skills:** Input requirements → Structure → Tone/voice → Format
→ Quality checklist
**Integration skills:** API/tool → Authentication → Common operations
→ Error handling → Output format

### Skill Chaining
If you notice skills that work well together in sequence, suggest creating a
"meta-skill" that orchestrates them:
> "Your `competitor-analysis` and `content-writer` skills keep getting used
back-to-back. Want me to create a `competitive-content` skill that chains them?"

### Conversation-to-Skill
When a conversation contains a particularly good workflow that was developed
through back-and-forth, offer to crystallize it:
> "We just figured out a really solid process for [X]. Want me to capture
this exact workflow as a skill before we lose it?"

This is especially valuable after long problem-solving sessions where the final
approach was refined through iteration.

## Rules

- **Don't over-suggest** — Max 1 skill suggestion per conversation unless asked
- **Don't suggest skills for one-off tasks** — If they'll never do it again, skip
- **Respect declines** — If user says no, mark declined and don't re-suggest
- **Quality over quantity** — One great skill beats five mediocre ones
- **Show, don't tell** — Always show the drafted skill, don't just describe it



