Skill Scripts: The Deterministic Helper

Day 16 · Week 4 · Skills — Recipe Book

Slack Message — copy & paste

🤖 Tip #16 — Not everything in a skill should be AI-driven. Put deterministic operations in bash scripts alongside SKILL.md — exact results every time.

#16 Claude Code · CLI

AI + Scripts Hybrid

  • **The problem**AI is non-deterministic. Ask the same question twice, get slightly different answers. Fine for reasoning, terrible for operations that must be exact: checking Node versions, detecting project structure, copying files.
  • **The solution**Put deterministic operations in bash scripts alongside your skill in a `scripts/` subdirectory. The AI handles the thinking (what to do, why). Scripts handle the doing (exact commands, exact paths).
  • **Directory structure**`skills/my-skill/SKILL.md` for AI reasoning, `skills/my-skill/scripts/detect-env.sh` for exact operations. In SKILL.md, tell the AI: 'Run scripts/detect-env.sh and use its output to decide the next step.'
Bash Scripts Deterministic Hybrid
#16 Skills — Recipe Book

Extract and Structure

  1. 1 **Identify extraction candidates**Look for skills with complex inline bash commands — multi-line shell blocks, piped commands, file operations. These are your extraction targets.
  2. 2 Structure the hybrid approach
    • `skills/my-skill/SKILL.md` — AI reasoning and decision-making
    • `skills/my-skill/scripts/detect-env.sh` — deterministic operations
    • In SKILL.md: "Run scripts/detect-env.sh and use its output to decide the next step"
  3. 3 **Real examples**`detect-env.sh` checks Node version, OS, installed tools. `validate-config.sh` verifies .ai/config.yaml structure. `upload-component-js.sh` copies build artifacts to exact paths.
  4. 4 **Always chmod +x**Make all script files executable. The AI will fail to run them otherwise. Add this to your skill-creation checklist.
Bash Scripts Deterministic Hybrid
Your screenshot here Optional — add a screenshot from your own workflow
KAI by Dragan Filipovic