codify
Skill4 starsChanged 9 months agoMITView on GitHub
Refactor any skill by extracting deterministic operations into a Python script and slimming the SKILL.md to only AI judgment parts. Use when user says /codify, codify a skill, or optimize a skill.
7 other projects use a version of this.
Adopted by
Most recently taken up by
- helmut-hoffer-von-ankershoffen/heinzeltheir own version, first seen Nov 8, 2026
- vic-lsh/agent-skillstheir own version, first seen Nov 8, 2026
- hollandkevint/thinkhaven-method-kittheir own version, first seen Oct 20, 2026
- DoKu67/claude-code-skilstheir own version, first seen Oct 16, 2026
- yuanhaorannnnnn/agent-skillstheir own version, first seen Sep 18, 2026
- treekey/claude-codifytheir own version, first seen Jul 6, 2026
Other versions7 projects use a version of this.
Word for word · 1
- anombyte93/atlas-ai-skills★ 0100% same
Edited · 0
None found.
Wrote their own version · 6
- DoKu67/claude-code-skils★ 4same name
- helmut-hoffer-von-ankershoffen/heinzel★ 2same name
- vic-lsh/agent-skills★ 2same name
- treekey/claude-codify★ 1same name
- hollandkevint/thinkhaven-method-kit★ 0same name
- yuanhaorannnnnn/agent-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. 0 are common, 5 are distinctive, and 10 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 73
Ask user to approve or adjust before proceeding.
- Very specific: line 77
Create ~/.claude/skills/<skill-name>/script.py following these rules:
- Very specific: line 81
ALL output is JSON via a shared _out(data) helper
- Distinctive: line 83
Use pathlib for all file operations
- Distinctive: line 87
No external dependencies — stdlib only
- Distinctive: line 111
Every deterministic operation becomes a code block showing the script call
- Very specific: line 117
Keep name, description, user-invocable unchanged
- Very specific: line 118
Add
allowed-tools: if missing — list tools the skill actually uses (Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion, etc.) - Very specific: line 119
Update description if the workflow changed significantly
- Distinctive: line 121
Add a Script Reference table at the bottom:
- Very specific: line 138
Run each script subcommand with --help to verify it parses.
- Very specific: line 139
Run preflight or equivalent read-only command against the current project to verify JSON output.
- Very specific: line 144
Before overwriting SKILL.md, save original as SKILL.md.pre-codify.
- Very specific: line 149
Skill already has a script.py: Ask whether to merge, replace, or abort.
- Very specific: line 151
SKILL.md references other files: Read those too and include in analysis.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Codify Skill
/codify <skill-name>— Extract deterministic logic from a skill's SKILL.md into a Python script.
What This Does
Takes a skill's SKILL.md and splits it into:
- Script (
<skill-dir>/script.py) — all deterministic operations (file ops, validation, parsing, template copying) - Slim SKILL.md — only AI judgment parts (questions, assessment, continuation logic) + calls to the script
Argument
/codify <skill-name> — the skill directory name under ~/.claude/skills/. If omitted, list available skills and ask.
Workflow
Phase 1: Analyze
- Read
~/.claude/skills/<skill-name>/SKILL.md - Classify every block of instructions into one of two buckets:
DETERMINISTIC (goes into script.py):
- File/directory creation, copying, moving, deleting
- Template validation and repair
- Reading files and extracting sections/data
- Writing structured content to files
- Git operations (status, branch, mv)
- Environment detection (checking if files/dirs exist)
- Any operation that always produces the same output given the same input
- Pattern matching, categorization by filename/extension
- JSON/YAML/TOML parsing or generation
- Archiving, rotating, or resetting files
JUDGMENT (stays in SKILL.md):
- Asking the user questions (AskUserQuestion)
- Deciding what to do based on context (if/else logic about user intent)
- Assessing completion status
- Choosing what to work on next
- Dispatching agents for tasks requiring reasoning
- Evaluating quality (e.g., "is this content worth promoting?")
- Any operation where different AI instances might reasonably make different choices
- Present the analysis to the user:
SKILL: <name> (<line-count> lines)
DETERMINISTIC operations found:
- <description of each operation that will become a script subcommand>
JUDGMENT operations (staying in SKILL.md):
- <description of each AI reasoning block>
Proposed script subcommands:
- <subcommand-name>: <what it does>
- <subcommand-name>: <what it does>Ask user to approve or adjust before proceeding.
Phase 2: Build Script
Create ~/.claude/skills/<skill-name>/script.py following these rules:
Script Architecture:
- argparse with subcommands (one per deterministic operation)
- ALL output is JSON via a shared
_out(data)helper - Handle markdown code blocks correctly when parsing sections (track ``` state)
- Use pathlib for all file operations
- Include
--helpfor every subcommand - Make executable (
chmod +x) - Use
#!/usr/bin/env python3 - No external dependencies — stdlib only
Subcommand Design:
- Each subcommand does ONE thing well
- Required args via
--flag(not positional) - Return
{"status": "ok", ...}on success - Return
{"status": "error", "message": "..."}and exit(1) on failure - Include enough detail in output for AI to make decisions without re-reading files
Code Quality:
- Proper error handling (file not found, permission denied)
- Idempotent where possible (safe to run twice)
- Comments only where logic is non-obvious
Phase 3: Rewrite SKILL.md
Rewrite the SKILL.md keeping:
- Frontmatter (name, description, user-invocable) — unchanged
- UX contracts, invariants, rules — preserved but condensed
- User question definitions — preserved
- Continuation/decision logic — preserved
- Self-assessment criteria — preserved
Replace with script calls:
- Every deterministic operation becomes a code block showing the script call
- Agent Ref / Agent Reference sections → deleted entirely
- Inline bash snippets → replaced with script subcommand calls
- Multi-step file operations → single script subcommand
Preserve and update frontmatter:
- Keep
name,description,user-invocableunchanged - Add
allowed-toolsif missing — list tools the skill actually uses (Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion, etc.) - Update
descriptionif the workflow changed significantly
Add a Script Reference table at the bottom:
## Script Reference
All commands output JSON. Run from skill directory.
| Command | Purpose |
|---------|---------|
| `subcommand-1 --flag` | What it does |
| `subcommand-2 --flag` | What it does |Target: Reduce SKILL.md by 50-70% while preserving all behavior.
Phase 4: Test
Run each script subcommand with --help to verify it parses.
Run preflight or equivalent read-only command against the current project to verify JSON output.
Report results.
Phase 5: Backup
Before overwriting SKILL.md, save original as SKILL.md.pre-codify.
Edge Cases
- Skill has no deterministic operations (pure judgment): Report "Nothing to extract" and skip.
- Skill already has a script.py: Ask whether to merge, replace, or abort.
- Skill is very short (<50 lines): Report "Too small to benefit from codification" and skip.
- SKILL.md references other files: Read those too and include in analysis.
Example
/codify startResult: The transformation we just did — 637-line SKILL.md with 7 Agent Ref sections became 204-line SKILL.md + 320-line session-init.py script with 9 subcommands.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

