$npx -y skills add ai4protein/VenusFactory2 --skill workflow_skill_creatorDistills a completed user workflow or interaction into a reusable VenusFactory agent skill. Use when the user says "make this a skill", "create a skill from what we just did", "package this workflow" or similar. Adapts the workflow into the VenusFactory tools wiring + SKILL.md pa
| 1 | # Workflow-to-Skill Distiller |
| 2 | |
| 3 | Turns a completed VenusFactory workflow into a reusable agent skill. Extracts patterns from an interaction that **already happened** and packages them following the project's conventions. |
| 4 | |
| 5 | > [!CAUTION] **You MUST complete Phase 1 (Brainstorming) before writing any code or SKILL.md content.** Skipping brainstorming produces skills that are either too rigid or too vague. |
| 6 | |
| 7 | ## Phase 1: Brainstorming (MANDATORY) |
| 8 | |
| 9 | Have an **iterative back-and-forth conversation** with the user. Do NOT ask all questions at once. Pick 2-3 relevant questions per round, refine your understanding, and ask follow-ups. |
| 10 | |
| 11 | ### Round 1: Understand the Workflow |
| 12 | |
| 13 | Start by summarizing what you observed, then ask: |
| 14 | |
| 15 | 1. "Here's my understanding of the workflow: [summary]. Is this accurate?" |
| 16 | 2. "What are the expected inputs and outputs?" |
| 17 | 3. "How often will this run? One-off, recurring, or part of a larger pipeline?" |
| 18 | |
| 19 | ### Round 2: Flexibility and Error Handling |
| 20 | |
| 21 | For each step: |
| 22 | |
| 23 | 1. "If [step X] fails (API down, no results), should the agent (a) ask for guidance, (b) try alternatives automatically, or (c) fail loudly?" |
| 24 | 2. "Are there steps where the exact method matters (must use a specific database / model), vs. steps where any reasonable approach is fine?" |
| 25 | |
| 26 | ### Round 3: Reuse Existing VenusFactory Tools |
| 27 | |
| 28 | Before asking these questions, check `src/tools/database/`, `src/tools/visualize/`, `src/tools/predict/`, `src/tools/mutation/`, `src/tools/search/`, `src/tools/train/`, `src/tools/file/`, `src/tools/bioinfo/` for overlap. **If an existing tool covers a step, the new skill MUST reference it — do not reimplement.** |
| 29 | |
| 30 | 1. "I noticed the workflow uses [tool X, tool Y] that already exist. The new skill will reference these. Anything else to incorporate?" |
| 31 | 2. "Are there rate limits for new external APIs that aren't covered?" |
| 32 | 3. "Any reference docs (API specs, papers, datasets) I should include under `references/`?" |
| 33 | |
| 34 | ### Round 4: Scope, Code, and Naming |
| 35 | |
| 36 | 1. "Should the skill cover [X, Y, Z] from the workflow, or include/exclude anything?" |
| 37 | 2. Determine whether the skill needs new code: |
| 38 | - **Needs new code** if any step calls an external API not yet wrapped, processes files, or computes results not already in `src/tools/`. → Follow the **6-file wiring recipe** below. |
| 39 | - **Instruction-only** if every step orchestrates existing VenusFactory tools. → Write SKILL.md only, no Python. |
| 40 | 3. Propose a name: `{verb}_{noun}_database` for new DB wrappers, `{noun}` for analysis/visualization, matching existing folders (`alphafold_database`, `pymol`, `clustalo_msa`, etc.). |
| 41 | |
| 42 | ### Round 5: Validation (Optional) |
| 43 | |
| 44 | 1. "Sample query + expected answer I can use to verify? Optional but helpful." |
| 45 | |
| 46 | ### Brainstorming Completion Criteria |
| 47 | |
| 48 | Move to Phase 2 only when you can answer: |
| 49 | |
| 50 | - [ ] Purpose and scope |
| 51 | - [ ] Inputs and outputs |
| 52 | - [ ] Strict vs flexible steps |
| 53 | - [ ] Which existing VenusFactory tools are reused |
| 54 | - [ ] What new scripts (if any) are needed |
| 55 | - [ ] Rate limits |
| 56 | - [ ] Error handling strategy |
| 57 | - [ ] Code needed (→ 6-file wiring) or instruction-only (→ SKILL.md only) |
| 58 | - [ ] Sample query/answer |
| 59 | |
| 60 | ## Phase 2: Skill Design |
| 61 | |
| 62 | Produce a **design document** (markdown plan) and present for approval: |
| 63 | |
| 64 | 1. **Skill name and frontmatter** (see Rule 6). |
| 65 | 2. **Directory structure** showing all planned files. |
| 66 | 3. **Existing VenusFactory tools referenced** with rationale. |
| 67 | 4. **New code files** with proposed function signatures. |
| 68 | 5. **Rate limiting strategy** for any new external API. |
| 69 | 6. **Error handling strategy** per step. |
| 70 | |
| 71 | **Wait for explicit user approval before Phase 3.** |
| 72 | |
| 73 | ## Phase 3: Implementation |
| 74 | |
| 75 | ### Guiding Principles |
| 76 | |
| 77 | - Match the project's existing Python style — use the conda env at `~/miniconda3/envs/venus/bin/python` (see `environment.yaml`); do NOT introduce `uv` or per-script `# /// script` headers. |
| 78 | - Prefer `requests` + `urllib3.util.retry.Retry` for HTTP (this is the established pattern, e.g. `src/tools/database/alphafold/alphafold_structure.py`). |
| 79 | - All public download/query functions return a JSON **string** with the rich envelope: |
| 80 | - Success: `{"status": "success", "file_info": {...} | "content": "...", "content_preview": str, "biological_metadata": {...}, "execution_context": {...}}` |
| 81 | - Error: `{"status": "error", "error": {"type", "message", "suggestion"}, "file_info": null}` |
| 82 | - Use `to_client_file_path()` from `src/tools/path_sanitizer.py` for any `file_path` in responses. |
| 83 | - Document rate limits in comment |