Skip to content

Refactor any Claude Code skill by extracting deterministic operations into a Python script. Reduces SKILL.md size by 60-80% while preserving all AI judgment.

License

Notifications You must be signed in to change notification settings

anombyte93/codify

/codify

Claude Code Skill License: MIT GitHub stars GitHub last commit

Refactor any Claude Code skill by extracting deterministic operations into a Python script.

Every time a skill runs, the AI re-reads hundreds of lines of prose to re-derive mechanical operations: "does this file exist?", "run this regex", "copy with timestamp". This is wasteful. codify splits skills into two parts: code for mechanics, prompts for judgment.

Install

curl -fsSL https://raw.githubusercontent.com/anombyte93/codify/main/install.sh | bash

Installs to ~/.claude/skills/codify/. Run the same command to upgrade.

# Check for updates
bash ~/.claude/skills/codify/install.sh --check-update

Usage

/codify <skill-name>

Where <skill-name> is the directory name under ~/.claude/skills/.

How It Works

Phase 1: Analyze

Reads the skill's SKILL.md and classifies every block:

Category Goes to Examples
Deterministic script.py File existence checks, regex validation, math, template loading, file copying, JSON parsing
Judgment SKILL.md User questions, decisions, content generation, quality assessment, continuation logic

Phase 2: Build script.py

Creates a Python script with argparse subcommands. Every subcommand:

  • Does one thing well
  • Outputs JSON to stdout
  • Responds to --help
  • Uses stdlib only (no dependencies)

Phase 3: Rewrite SKILL.md

Replaces deterministic prose with script calls:

# Before (in SKILL.md)
Check if .taskmaster/ exists. If it does, look for PRD files
in .taskmaster/docs/. Read tasks.json to count tasks...
(~40 lines of detection logic)

# After (in SKILL.md)
python3 script.py preflight
# Returns JSON: has_taskmaster, prd_path, task_count, ...

Phase 4: Test & Backup

  • Runs --help on every subcommand
  • Runs read-only commands to verify JSON output
  • Saves original as SKILL.md.pre-codify

Real Results

Skill SKILL.md Before SKILL.md After Reduction script.py
prd-taskmaster 1,342 lines 302 lines 77.5% 1,079 lines (11 subcommands)
start 637 lines 204 lines 68.0% 320 lines (9 subcommands)

Architecture

script.py = AI's calculator and file manager (deterministic tools)
SKILL.md  = AI's playbook for user interaction and decisions (judgment)

The AI calls script.py like any other tool. Script returns structured JSON. AI interprets the results and makes decisions. Neither replaces the other.

Requirements

License

MIT - see LICENSE


Built by Atlas AI

About

Refactor any Claude Code skill by extracting deterministic operations into a Python script. Reduces SKILL.md size by 60-80% while preserving all AI judgment.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages