Guide · Agent skill
How to use the Histolab Tile Extraction agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The Histolab Tile Extraction skill is a set of instructions and reference files that teaches an AI agent how to work with whole-slide histology images (WSI), the very large digital pathology scans that often run to gigapixels. Once it is installed, you can ask the agent in plain language to inspect a slide, find the tissue, cut it into image tiles and save those tiles to folders. This guide covers what the skill does, how to install it, what it needs, how to trigger it and where its limits are.
Quick start
- 1Download and unzip. Download the skill ZIP from the page and unzip it into ~/.claude/skills/ for personal use, or into a project's .claude/skills/ folder.
- 2Or upload it in the Claude apps. In the Claude apps, open Settings, go to Capabilities, then Skills, and upload the ZIP.
- 3Install the native OpenSlide library. Install OpenSlide for your operating system, following the OpenSlide download page. On macOS with Homebrew, use brew install openslide.
- 4Create an isolated Python environment. Create a dedicated environment with Python 3.10 and install histolab and the optional extras, as shown in the install section.
- 5Ask for a task with a local slide. Describe the goal in plain words, name your slide file and output folder, and ask for a mask or tile preview before the full run.
What does the Histolab skill make the agent do?
The skill gives the agent working knowledge of the Histolab Python package. With it, the agent can read slide metadata such as dimensions and pyramid levels, build tissue masks that separate tissue from the blank background, choose a tile strategy and save image tiles to disk. It can also apply H&E stain normalization and prepare tile datasets for later use.
The skill also tells the agent to keep scientific caveats in mind. Tissue masks and tile scores are image-processing heuristics. They are not diagnoses, cell counts or quality checks, and the agent is instructed to split data by patient before training or testing a model.
- Inspect slide dimensions, levels and metadata
- Build tissue masks (all tissue, or the bounding box of the largest section)
- Extract tiles with random, grid or score-ranked selection
- Save previews, tile images and score reports
- Apply H&E stain normalization
How do I install the Histolab skill?
Download the skill ZIP from the page you are reading, then unzip it. For a personal setup, place the unzipped folder in ~/.claude/skills/. For a single project, place it in that project's .claude/skills/ folder instead.
If you use the Claude apps, you can upload the ZIP instead. Open Settings, go to Capabilities, then Skills, and upload the file there.
- Personal install: ~/.claude/skills/
- Project install: .claude/skills/ inside your project folder
- Claude apps: Settings → Capabilities → Skills, then upload the ZIP
What do I need before the skill can run slides?
The skill needs Python 3.8 to 3.11 and the Histolab 0.7.0 Python package with its pinned dependencies. It also needs the native OpenSlide library, which is separate from the Python binding. The skill was tested with Python 3.10 and runs on Linux or macOS. Histolab 0.7.0 does not support Windows.
Optional extras are pooch (for downloading sample slides), matplotlib (for plots) and large-image with a source plugin (for exact physical resolution, or MPP, extraction). The skill's own install example creates a dedicated virtual environment so that its older pinned packages do not clash with your other tools.
On macOS with Homebrew, the skill suggests installing OpenSlide with brew. If the Python binding cannot find the library, the skill shows how to set DYLD_FALLBACK_LIBRARY_PATH for that one command.
- Python 3.8 to 3.11 (3.10 was tested)
- Histolab 0.7.0 and pinned dependencies, kept in an isolated environment
- Native OpenSlide library
- Optional: pooch, matplotlib, large-image plus a source plugin
- Linux or macOS
uv venv --python 3.10 .venv-histolab
uv pip install --python .venv-histolab/bin/python 'histolab==0.7.0' pooch matplotlib
.venv-histolab/bin/python -c 'import openslide; print(openslide.__library_version__)'How do I ask the agent to use the skill?
You do not need to name the skill. Describe the task in normal words that mention whole-slide images, tiles, tissue or staining, and the agent should pick it up. Include the slide file name and where you want the output saved, so the agent knows what to work on.
Good requests name the goal and the constraints. Ask for a preview before a large run, and ask the agent to report how many tiles it saved.
- "Find the tissue in slide.svs and save a mask preview to output/mask_preview.png."
- "Extract 100 random 512 by 512 tiles at level 0 from this WSI, keeping tiles that are at least 80 percent tissue."
- "Make a grid of tiles from this slide and tell me how many were saved."
- "Rank the tiles from this slide by nuclei score and keep the top 50."
- "Normalize the H&E staining of these tiles and check the output is not blank."
Which tile strategy should I choose?
RandomTiler picks seeded random locations, up to a set number of tiles. It can overlap or repeat tiles and may miss rare structures. GridTiler cuts tiles from a regular grid inside the mask, but boundary tiles and tissue checks can leave gaps. ScoreTiler scores every eligible grid candidate and saves the top-ranked tiles. Setting the count to 0 saves all eligible ranked tiles.
For grids, the step between tiles is the tile size minus the pixel overlap. Overlap must be smaller than the tile dimensions, and a negative overlap leaves gaps. Nuclei and cellularity scores estimate stained area fractions, so treat them as ranking aids, not tumor probabilities.
- RandomTiler: seeded, quick to set up, may overlap
- GridTiler: regular coverage, check for edge gaps
- ScoreTiler: ranks all candidates, slower than the count suggests
What safety points should I know about?
This skill runs scripts and uses the network. The agent may run Python code on your machine, and some optional sample functions download files, which the skill notes can be hundreds of megabytes. Review commands before they run, use a local slide where possible, and check the destination folders before you start a large extraction.
The skill is for research and data preparation. Its outputs should not be used to make clinical decisions, and it is not validated for diagnosing or detecting tumors. Keep patient identifiers out of file names and keep the training, validation and test splits separated by patient.
- Scripts run on your machine, so review them first
- Sample downloads may be large and need network access
- Not for clinical diagnosis or tumor detection
- Split data by patient before training
- Use pathml for multiplexed imaging or deep learning inference
Tips for reliable tile datasets
Start small. Run a short exploration with a small tiler, look at the mask and tile previews, then commit to the full run. Save each slide and strategy into its own folder, and keep the parameters, slide identifiers and quality flags with the output so the run can be reproduced.
If you get few or no tiles, check the mask and the output counts first. Lowering the tissue threshold relaxes quality control, so check any tiles it adds. If sections are missing, the default biggest-region box excludes the others, so pass the full tissue mask explicitly. Compare coordinates at level 0 rather than assuming the same seed lines up across levels.
- Preview with the same mask you use for extraction
- Count saved files and inspect a sample of tiles
- Record level, tile size, seed and thresholds
- If tiles are missing, check the mask and the level used
What people use it for
- Check the dimensions and pyramid levels of a slide before planning an analysis
- Build a tissue mask and save a preview to confirm the sections were found
- Create a dataset of random or grid tiles from a set of H&E slides, split by patient
- Rank tiles by a nuclei or cellularity score to pick the most stained-area-rich tiles for review
- Normalize H&E staining across tiles and check the output for blank or degenerate images
Frequently asked questions
Does the Histolab skill work on Windows?
No. The Histolab release this skill uses does not support Windows. The skill is meant for Linux or macOS, so Windows users may need a Linux or macOS machine or virtual environment.
Is the Histolab skill free to use?
The repository is listed under the MIT licence. However, the SKILL.md file's header names the Apache-2.0 licence, so check the LICENSE file in the repository before you redistribute the skill.
What is the difference between Histolab and PathML?
Histolab handles whole-slide image inspection, tissue masks, tile extraction and H&E stain normalization. The skill says that multiplexed imaging and deep learning inference pipelines should use PathML instead.
Can I use Histolab to diagnose cancer?
No. The skill states that its masks and scores are image-processing heuristics and do not diagnose cancer, count cells or establish image quality. Outputs should be treated as data preparation, not clinical results.
Why does installing OpenSlide fail on my Mac?
On macOS with Homebrew, install the library with brew install openslide. If the Python binding still cannot find it, set DYLD_FALLBACK_LIBRARY_PATH to the OpenSlide lib folder for that single command, as shown in the skill's installation notes.
Do I need a slide file to try the skill?
Not necessarily. The skill mentions a tiny bundled cmu_small_region sample for a first test. Other sample functions may download large files, and they need the optional pooch package.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use this skill if you prepare tile datasets from whole-slide histology images on Linux or macOS and want an agent to run documented, reproducible Histolab workflows. Pick something else if you need clinical diagnosis, multiplexed imaging or deep learning inference, which the skill itself directs to PathML, or if you work on Windows or cannot install native OpenSlide.
Download the skill