Skip to content

Instantly share code, notes, and snippets.

@lisaross
Created December 30, 2025 18:30
Show Gist options
  • Select an option

  • Save lisaross/66661e32ee3d5f7d577ee89fd2596848 to your computer and use it in GitHub Desktop.

Select an option

Save lisaross/66661e32ee3d5f7d577ee89fd2596848 to your computer and use it in GitHub Desktop.
Claude Code /codify command - capture discoveries from iteration and turn them into reusable infrastructure
name description argument-hint allowed-tools
codify
Capture a discovery from iteration and turn it into reusable infrastructure
[what you discovered]
Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion

Codify Command

Capture what you learned through iteration and turn it into reusable infrastructure.

The habit: After meaningful iteration, ask "What did I just learn that should become infrastructure?"

Arguments

  • discovery: What you discovered (optional—will prompt if not provided)

Instructions

1. Gather the Discovery

If no discovery provided, ask:

"What did you discover through iteration? Describe the pattern, adjustment, or insight that worked."

2. Classify Infrastructure Type

Ask the user to choose:

  • Skill: Reusable prompt pattern (.claude/skills/[name].md)
  • Command: User-invokable workflow (.claude/commands/[name].md)
  • Agent update: Modification to existing agent
  • Guardrail: Constraint or validation rule
  • Example: Good output for reference (examples/[name].md)
  • CLAUDE.md update: Project-level guidance

3. Gather Context

Ask relevant questions:

  • What triggers this / when should it be used?
  • What are the inputs and expected outputs?
  • What makes this pattern work?
  • If updating existing file: which one?

4. Check Existing Patterns

Use Glob and Read to find similar artifacts in the project:

Glob: .claude/skills/*.md
Glob: .claude/commands/*.md

Read 1-2 similar files to match project conventions.

5. Create the Artifact

Based on type, create the file:

Skill.claude/skills/[name].md:

---
name: [name]
description: [when to use this]
---

# [Name]

[Instructions for executing the pattern]

## When to Use
[triggers]

## Process
1. [step]
2. [step]

## Output
[what it produces]

Command.claude/commands/[name].md:

---
name: [name]
description: [what it does]
argument-hint: "[args]"
allowed-tools: [tools needed]
---

# [Name] Command

[Instructions]

## Arguments
- [arg]: [description]

## Instructions
[steps]

For updates: Read the existing file, then Edit to add the new pattern.

6. Test and Commit

Verify the file is valid, then:

git add [file]
git commit -m "feat(infra): add [name] [type] - [brief description]"

7. Report

Tell the user:

  • What was created
  • File location
  • How to invoke it
  • Commit hash

Example Usage

/codify "shorter paragraphs work better for chat contexts"
/codify "validation after generation catches 80% of issues"
/codify

Why This Matters

Every /codify invocation:

  • Captures knowledge that would otherwise evaporate
  • Improves all future work that touches that pattern
  • Builds compound returns from your iterations

This is meta-level investment. Don't skip it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment