> ## Documentation Index
> Fetch the complete documentation index at: https://smithers.sh/llms.txt
> Use this file to discover all available pages before exploring further.

# extract-skill

> After a run, harvest a reusable skill or workflow and durable memory from the pattern.

`extract-skill` is an archived example, not installed by `init`. Copy it from `examples/init-pack/` with its dependency closure, or ask `create-workflow` to build an equivalent.

`extract-skill` looks back at a run (or a pattern you describe) and harvests the
durable, reusable part: an agent skill doc, a sketch for a new workflow, and
memory facts worth keeping. Reach for it right after a run, when you notice
yourself doing the same thing again.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bunx smithers-orchestrator workflow run extract-skill \
  --input '{"targetRunId":"RUN_ID","prompt":"Harvest the way we triage flaky tests into a reusable skill"}'
```

Pass `targetRunId` to let the analysis read the real run state (`bunx smithers-orchestrator inspect`,
`events`, `node`); leave it `null` to harvest purely from the `prompt` and
context.

## Stages

1. **analyze**: read the run (if given) and decide what's worth harvesting: the repeated pattern, whether it's skill- and/or workflow-shaped, and any durable memory facts.
2. **propose**: draft concrete proposals: a skill (name, description, body), a workflow sketch (id, sketch), and memory facts to persist.
3. **scaffold-skill**: when the pattern is reusable as a skill, write the proposed skill doc to `.smithers/skills/<name>.md`.

## Inputs

| Input         | Type           | Default                                                                                         |
| ------------- | -------------- | ----------------------------------------------------------------------------------------------- |
| `targetRunId` | string or null | `null` (analyze the prompt/context alone)                                                       |
| `prompt`      | string         | `"Describe the pattern or run you want to harvest into a reusable skill, workflow, or memory."` |

## Monitor it

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bunx smithers-orchestrator workflow run extract-skill --input '{"targetRunId":"RUN_ID","prompt":"…"}' -d   # detach
bunx smithers-orchestrator ps                                                                       # active / paused / recent
bunx smithers-orchestrator logs RUN_ID -f                                                          # follow events
bunx smithers-orchestrator inspect RUN_ID                                                          # full run state
```

Use this to close the loop after a run: harvest the approach once into a skill, a
workflow sketch, or memory the next run can lean on, instead of re-deriving it.
