Files
droideparanoico 94cfd80dd0 Initial commit: copilot-skill-factory v0.1.0
Meta-plugin for GitHub Copilot CLI that watches workflows and
auto-generates reusable agent skills.

- postToolUse hook: fingerprints and logs tool calls per session
- sessionEnd hook: sliding-window pattern detection across sessions
- sessionStart hook: injects context about proposed skills
- /skill-factory slash command for reviewing/managing skills
- 13 passing tests validating observer, analyzer, and edge cases

Inspired by hermes-skill-factory (Romanescu11/hermes-skill-factory)
2026-06-19 08:22:11 +00:00

195 lines
7.5 KiB
Markdown
Executable File

# 🏭 Copilot Skill Factory
> **The meta-plugin that creates skills.**
> Watches your GitHub Copilot CLI workflows and automatically turns them into reusable agent skills.
Built for [GitHub Copilot CLI](https://docs.github.com/copilot/concepts/agents/about-copilot-cli) (v1.0.52+).
Inspired by [hermes-skill-factory](https://github.com/Romanescu11/hermes-skill-factory) for [Hermes Agent](https://github.com/NousResearch/hermes-agent).
---
## What It Does
Every time you solve a problem with Copilot CLI, you're performing a workflow worth repeating. Skill Factory watches silently via hooks, detects patterns, and proposes reusable skills.
```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🏭 SKILL FACTORY — New Pattern Detected
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
You've repeated this workflow in 3 sessions:
1. bash (git commands)
2. grep (search code)
3. edit (apply changes)
4. bash (run tests)
Proposed Skill: git-edit-test
Status: Ready for review
Use /skill-factory review to inspect it.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```
## How It Works
### Architecture
```
┌──────────────────────────────────────────┐
│ Copilot CLI Session │
│ │
│ postToolUse ──┐ sessionEnd ──┐ │
│ ▼ ▼ │
│ ┌─────────────┐ ┌─────────────┐ │
│ │ observer.js │ │ analyzer │ │
│ │ (logs tools)│ │ (detects │ │
│ └──────┬───────┘ │ patterns) │ │
│ │ └──────┬──────┘ │
│ ▼ ▼ │
│ ┌─────────────────────────────┐ │
│ │ pattern-db.json │ │
│ │ (cross-session patterns) │ │
│ └─────────────┬───────────────┘ │
│ ▼ │
│ ┌─────────────────────────────┐ │
│ │ proposed/<name>/SKILL.md │ │
│ │ (auto-generated skills) │ │
│ └─────────────────────────────┘ │
└──────────────────────────────────────────┘
sessionStart ──► Injects notification about new skills
/skill-factory ──► User reviews & manages skills
```
### Plugin Components
| Component | File | Purpose |
|---|---|---|
| **Manifest** | `plugin.json` | Plugin metadata (name, version, hooks path) |
| **Hooks config** | `hooks/hooks.json` | Defines `postToolUse`, `sessionEnd`, `sessionStart` hooks |
| **Observer** | `bin/observer.js` | Main hook handler — logs, analyzes, notifies |
| **Skill** | `skills/skill-factory/SKILL.md` | `/skill-factory` slash command for user interaction |
### Detection Algorithm
1. **postToolUse hook** — Every successful tool call is fingerprinted (tool name + normalized args) and logged to a per-session JSONL file
2. **sessionEnd hook** — Analyzes the session using sliding windows (3-8 consecutive tool calls). Matching sequences across 2+ sessions are flagged as "patterns"
3. **Auto-generation** — Patterns seen in 2+ different sessions get a proposed `SKILL.md` generated automatically
4. **sessionStart hook** — Next session, the agent is notified about pending proposals via `additionalContext`
5. **User review** — The `/skill-factory` skill lets the user review, accept, edit, or dismiss proposals
## Installation
### Prerequisites
- [GitHub Copilot CLI](https://docs.github.com/copilot/concepts/agents/about-copilot-cli) v1.0.52+ installed and authenticated
- Node.js 18+ (for the hook scripts)
### Via Copilot CLI plugin install (recommended)
```bash
copilot plugin install droideparanoico/copilot-skill-factory
```
Then install the companion skill:
```bash
mkdir -p ~/.copilot/skills/skill-factory
cp skills/skill-factory/SKILL.md ~/.copilot/skills/skill-factory/
```
### Manual installation
```bash
# Clone the repo
git clone https://github.com/droideparanoico/copilot-skill-factory.git
cd copilot-skill-factory
# Install plugin
mkdir -p ~/.copilot/plugins/skill-factory
cp plugin.json ~/.copilot/plugins/skill-factory/
cp -r hooks/ ~/.copilot/plugins/skill-factory/
cp -r bin/ ~/.copilot/plugins/skill-factory/
chmod +x ~/.copilot/plugins/skill-factory/bin/observer.js
# Install companion skill
mkdir -p ~/.copilot/skills/skill-factory
cp skills/skill-factory/SKILL.md ~/.copilot/skills/skill-factory/
```
Then restart Copilot CLI.
## Usage
Once installed, Skill Factory runs silently in the background. Use the slash command to interact:
| Command | What it does |
|---|---|
| `/skill-factory` | Show available commands |
| `/skill-factory review` | Review proposed skills (accept/edit/dismiss) |
| `/skill-factory propose` | Force-analyze current session patterns |
| `/skill-factory list` | List all generated skills |
| `/skill-factory status` | Show detection statistics |
| `/skill-factory save <name>` | Save with custom name |
| `/skill-factory dismiss <name>` | Dismiss a proposal |
| `/skill-factory clear` | Reset all data |
You can also tell Copilot naturally:
- *"Review my skill factory proposals"*
- *"Save this workflow as a skill"*
- *"Turn this into a reusable skill"*
## Configuration
Skill Factory stores data in:
```
~/.copilot/skills/skill-factory/.data/
├── pattern-db.json # Cross-session pattern database
└── sessions/
└── <session-id>.jsonl # Per-session tool call logs (kept for last 20 sessions)
```
Proposed skills are stored in:
```
~/.copilot/skills/skill-factory/proposed/
└── <skill-name>/
├── SKILL.md # Generated skill definition
└── .proposal.json # Detection metadata
```
## Limitations
- **Not real-time**: Patterns are analyzed at session end, not during the session
- **Heuristic-based**: Detection uses fingerprint similarity — similar but not identical workflows may not match
- **No cross-device sync**: Pattern database is local to each machine
- **Windows**: PowerShell hooks are not yet implemented (contributions welcome!)
## Roadmap
- [ ] Real-time pattern suggestion during sessions
- [ ] Cross-device sync via GitHub Gist
- [ ] Pattern confidence scoring
- [ ] Automatic skill refinement (merge similar patterns)
- [ ] Web dashboard for pattern visualization
- [ ] Export/import pattern database
## Comparison with hermes-skill-factory
| Feature | hermes-skill-factory | copilot-skill-factory |
|---|---|---|
| Platform | Hermes Agent | GitHub Copilot CLI |
| Observation | In-process (Python plugin) | Hooks (external Node.js) |
| Detection | AI-assisted pattern analysis | Heuristic fingerprint matching |
| Skill format | SKILL.md + plugin.py | SKILL.md (Copilot agent skill) |
| User interaction | Inline prompt during session | Slash command + sessionStart context |
| Slash commands | `/skill-factory propose`, etc. | `/skill-factory review`, etc. |
## License
MIT