mcpbeat

Deterministic Scripts

microsoft/deterministic-scripts

Deterministic script execution skill for HASTE. Execute scripts instead of free-form LLM behavior for consistent, repeatable operations. Use when: 'run preprocessing', 'convert format', 'parse metadata', 'generate tiles', 'build wheel', 'deploy functions'. Prevents hallucinated scripts.

1k tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
82
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/microsoft/haste --skill deterministic-scripts

The instruction itself

11 sections, as written by the author

Deterministic Script Execution

Overview

HASTE has established scripts and commands for common operations. Agents must use these exact commands instead of generating free-form alternatives. This prevents hallucinated scripts, ensures consistency, and makes operations repeatable.

Key Concepts

Why Deterministic Scripts Matter

  • LLMs can "helpfully" generate plausible-looking but incorrect commands
  • HASTE has specific build tooling (hatch, conda) that must be used correctly
  • Azure Functions deployment has specific prerequisites and ordering
  • Geospatial processing requires exact GDAL/rasterio invocations

Patterns & Techniques

Build & Package Operations

| Operation | Exact Command | Notes |

|-----------|--------------|-------|

| Build core wheel | cd hastelib && hatch build -t wheel | Auto-increments version, copies to func apps |

| Run Python tests | cd hastelib && hatch run test:pytest | Uses conda env with GDAL |

| Build UI | cd ui && npm run build | Production build via Vite |

| Lint UI | cd ui && npm run lint | ESLint with React rules |

| Install UI deps | cd ui && npm install | Uses package-lock.json |

| Create conda env | conda env create -f env.yml | Full env with GDAL and dependencies |

| Update conda env | conda env update -f env.yml | Preserves existing packages |

| Install hastelib editable | pip install -e hastelib/ | For local development hot-reload |

Local Development

| Operation | Exact Command | Notes |

|-----------|--------------|-------|

| Start API locally | cd api/hastefuncapi && func host start | Requires .venv or conda env |

| Start UI locally | cd ui && swa start --app-devserver-url http://localhost:5173 --run 'npm run dev' | SWA CLI with Vite dev server |

| Start Azurite | azurite --silent --location ./data --debug ./data/debug.log | Local Azure Storage emulator |

| Start Docker stack | docker-compose -f docker/docker-compose.yml up | Full local stack |

Deployment

| Operation | Exact Command | Notes |

|-----------|--------------|-------|

| Deploy Azure Function | func azure functionapp publish <NAME> --subscription <SUB> --tenant <TENANT> | After hatch build |

| Deploy SWA | cd ui && swa deploy --app-location ./dist --app-name <NAME> | After npm run build |

| Build Docker images | ./build_and_push_images.sh | Builds training + imagery prep images |

Imagery Processing

| Operation | Approach | Notes |

|-----------|----------|-------|

| COG generation | Use rasterio with COG driver profile | Never use raw GDAL CLI unless wrapping in Python |

| Tile generation | Through ImageryPreProcessor | Not manual gdal2tiles |

| Reprojection | rasterio.warp.reproject() | Always specify src_crs and dst_crs |

| Format conversion | Through provider-specific adapter | Not generic gdal_translate |

Decision Framework

| Situation | Do This | NOT This |

|-----------|---------|----------|

| Need to run tests | hatch run test:pytest | pytest (wrong env) |

| Need to build wheel | hatch build -t wheel | python setup.py bdist_wheel |

| Need to start API | func host start | python function_app.py |

| Need Azure storage locally | azurite | Custom mock storage |

| Need to process imagery | Use ImageryPreProcessor | Write new GDAL script |

| Need to deploy | func azure functionapp publish | Manual zip deployment |

Common Pitfalls

  • Inventing new build commands — Use the established commands above
  • Running pytest directly — Use hatch run test:pytest to get the correct conda env
  • Starting the UI with npm start — HASTE uses swa start with Vite dev server
  • Using python setup.py — HASTE uses hatch/hatchling, not setuptools
  • Generating GDAL scripts from scratch — Use existing processor methods

How to use it

Copy the folder

Take microsoft/deterministic-scripts from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.

Install what it needs

The instructions reference pip, npm. Without those the skill loads but fails at the first command.