agentleFS
shaoleishenshaoleishen/scrna-skills/skills/workflow-skill-creator/SKILL.md

workflow-skill-creator

Skill4 starsChanged 5 months agoMITView on GitHub

Use when the user says 'make this a skill', 'package this workflow', or 'save this as a reusable skill'. Converts a completed analysis workflow into a reusable Rhine Life Lab skill with SKILL.md, wrapper scripts, and tests.

8 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use skill-creator.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SentrySkill

    skill-creator

    Create new agent skills following the Agent Skills specification. Use when asked to "create a skill", "add a new skill", "write a skill", "make a skill", "build a skill", or scaffold a new skill with SKILL.md. Guides through requirements, writing, registration, and verification.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 0 are common, 10 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create a new skill from scratch following best practices

    line 13
  2. Distinctive:

    Run an existing skill → use the specific skill directly

    line 16
  3. Distinctive:

    Before writing any code, answer these questions:

    line 26
  4. Distinctive:

    Create the directory structure:

    line 38
  5. Distinctive:

    Use bold skill names in parentheses:

    line 68
  6. Very specific:

    Reuse scrnatools: Import from ~/.agents/skills/_shared/scrnatools/ for I/O, QC, stats, output

    line 76
  7. Very specific:

    Wrapper script pattern: Use argparse with subcommands, --input/--output required

    line 77
  8. Very specific:

    File output: All results go to JSON file via SkillOutput, stdout for status only

    line 78
  9. Distinctive:

    Error handling: Use try/except with fallback for every optional dependency

    line 79
  10. Very specific:

    Sparse-first: Always check sparse.issparse(X) and prefer sparse operations

    line 80
  11. Very specific:

    NaN handling: Call clean_nan() before any computation

    line 81
  12. Distinctive:

    Test with real data (at least one h5ad file)

    line 115
  13. Distinctive:

    Verify JSON output is valid and complete

    line 116
  14. Distinctive:

    Check all cross-references point to existing skills

    line 117
  15. Distinctive:

    Ensure error messages are clear and actionable

    line 118

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Workflow Skill Creator

When to Use

Use when you need to:

  • Convert a completed analysis workflow into a reusable skill
  • Package a successful analysis session for future reuse
  • Create a new skill from scratch following best practices

Do NOT use when you need to:

  • Run an existing skill → use the specific skill directly
  • Fix a broken skill → edit the skill files directly
  • Understand skill architecture → read the existing skills as examples

Overview

This meta-skill guides the creation of new analysis skills following the Rhine Life Lab skill format. It enforces a structured 4-phase process to ensure high-quality, reusable skills.

Phase 1: Understand the Workflow (MANDATORY)

Before writing any code, answer these questions:

  1. What is the input? (h5ad format? what preprocessing state?)
  2. What is the output? (h5ad? CSV? plots? JSON results?)
  3. What are the key steps? (list each analysis step)
  4. What dependencies are needed? (scanpy? squidpy? scipy?)
  5. What can go wrong? (edge cases, missing data, convergence failures)
  6. What other skills does this depend on? (prerequisite skills)
  7. What skills does this feed into? (downstream skills)

Phase 2: Skill Design

Create the directory structure:

~/.agents/skills/<skill-name>/
  SKILL.md              # Skill definition
  scripts/
    <script>.py         # CLI wrapper script

SKILL.md Template

---
name: <kebab-case-name>
description: "<trigger phrase starting with 'Use when'>"
---

Required sections (in order):

  1. # Title
  2. ## Prerequisites
  3. ## When to Use (with "Do NOT use" subsection and cross-references)
  4. ## Core Rules
  5. ## Workflow (with Step N subsections)
  6. ## Common Mistakes
  7. ## Troubleshooting (table format)
  8. ## Output (JSON schema)

Cross-Reference Format

Use bold skill names in parentheses:

  • → (use **scrna-qc-preprocess**) for prerequisites
  • → (use **scrna-clustering-umap**) for downstream skills

Phase 3: Implementation

Rules

  1. Reuse scrnatools: Import from ~/.agents/skills/_shared/scrnatools/ for I/O, QC, stats, output
  2. Wrapper script pattern: Use argparse with subcommands, --input/--output required
  3. File output: All results go to JSON file via SkillOutput, stdout for status only
  4. Error handling: Use try/except with fallback for every optional dependency
  5. Sparse-first: Always check sparse.issparse(X) and prefer sparse operations
  6. NaN handling: Call clean_nan() before any computation

Wrapper Script Template

#!/usr/bin/env python3
"""<Skill description>."""
import argparse, sys, os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "../../_shared"))
from scrnatools.io import load_h5ad, save_h5ad
from scrnatools.output import SkillOutput

def run(input_path, output_path, **kwargs):
    output = SkillOutput("<skill-name>", output_path)
    adata = load_h5ad(input_path)
    # ... analysis steps ...
    output.finalize(status="success")

def main():
    parser = argparse.ArgumentParser()
    sub = parser.add_subparsers(dest="command")
    p = sub.add_parser("run")
    p.add_argument("--input", required=True)
    p.add_argument("--output", required=True)
    args = parser.parse_args()
    if args.command == "run":
        run(args.input, args.output)

if __name__ == "__main__":
    main()

Phase 4: Validation

  1. Test with real data (at least one h5ad file)
  2. Verify JSON output is valid and complete
  3. Check all cross-references point to existing skills
  4. Ensure error messages are clear and actionable

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.