The Lock Trick: How to Write Portable Agent Skills with Reproducible External Dependencies A software engineer describes a technique for making agent skills portable across harnesses like Claude Cowork and ChatGPT Work by bundling external Python dependencies into a single self-contained script, since skill directories are mounted read-only in cloud sandboxes and standard `uv sync` or `pip install` setups fail. The approach keeps skills restricted to the standard library where possible, delegating deterministic sub-workflows to scripts to cut token costs and execution time. I've been writing a lot of agent skills https://agentskills.io/ at my day job. For many enterprises, the humble SKILL.md file gives them a compelling reason to finally document their workflows, processes, and protocols. These agent skills come in all shapes and sizes: Interestingly, many of these sub-workflows can be done deterministically e.g., JSON transformations, HTML rendering, condition checks, and basic classification . Their entry points and decision criteria just happen to be in fuzzy natural language, but the overall orchestration tends to be over mostly deterministic sub-procedures. That's why my job as a software engineer is to wrangle these skills and delegate as much bespoke logic as possible into deterministic scripts e.g., the scripts/ directory and even potentially hoist some of them to the infrastructure layer e.g., data pipelines, bespoke MCP connectors, custom harnesses, etc. . Not only does this make the skill more reliable, but it also significantly reduces token costs and workflow execution time.