home / skills / tkersey / dotfiles / ms

ms skill

/codex/skills/ms

This skill creates or refactors Codex skills with minimal diffs, updating frontmatter, SKILL.md, and agents/openai.yaml while keeping lean.

npx playbooks add skill tkersey/dotfiles --skill ms

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
6.0 KB
---
name: ms
description: Create, update, or refactor Codex skills in this repo, including SKILL.md, frontmatter trigger text, agents/openai.yaml, and scripts/references/assets. Use when asked to create or improve a skill, tighten trigger descriptions from usage evidence (for example via $seq), regenerate/verify agents/openai.yaml, or adjust skill metadata/workflows.
---

# ms

## Overview

Create and update Codex skills with minimal diffs. Work directly in the skill folder (no external registry) and keep the skill lean.

## Hard constraints

- Minimal diff: change only what is needed to satisfy the new requirement.
- No extra docs: do not add README/INSTALL/CHANGELOG-style files.
- Frontmatter:
  - Default: only `name` and `description`.
  - Preserve existing allowed keys (e.g., `metadata`, `license`, `allowed-tools`) when updating system skills.
  - `name` must be hyphen-case (<=64 chars) and match the folder name.
  - `description` is the trigger surface: include "when to use" cues; no angle brackets; <=1024 chars.
- SKILL.md body:
  - Imperative voice.
  - Keep under 500 lines; spill deep details into `references/`.
  - Do not put trigger guidance in the body; put it in frontmatter `description`.
- `agents/openai.yaml` (if present/needed):
  - Prefer generating via `generate_openai_yaml.py`.
  - `short_description` must be 25-64 chars.
  - `default_prompt` must be one short sentence and mention `$skill-name`.
- Proof of completion (required):
  - Record `agents/openai.yaml` disposition as one of: `regenerated`, `verified unchanged`, or `not present`.
  - Include the exact `quick_validate.py` command used and its pass/fail result in the final summary.
- Always run `quick_validate.py` before calling it done.
  - Recommended (no global installs):
    - `uv run --with pyyaml -- python3 codex/skills/.system/skill-creator/scripts/quick_validate.py <path/to/skill>`
  - Note: skill-creator scripts require PyYAML (`import yaml`).

## Workflow Decision Tree

- If a matching skill already exists: run Update Workflow.
- If no matching skill exists: run Create Workflow.
- If the name, location, or triggers are unclear: ask 1-3 targeted questions, then proceed.
- If refining `ms` itself: run the Seq Feedback Loop first and use that evidence to choose the smallest update set.

## Create Workflow

1. De-duplicate: search for an existing skill that already covers the intent; prefer updating over creating a near-duplicate.
2. Discover and define: collect 2-3 concrete user prompts, then write:
   - Problem statement (1 line)
   - Success criteria (how we'll know it works)
3. Plan reusable assets: decide whether `scripts/`, `references/`, or `assets/` are required; create only what is necessary.
4. Initialize (scaffold):
   - `uv run --with pyyaml -- python3 codex/skills/.system/skill-creator/scripts/init_skill.py <skill-name> --path codex/skills`
   - Add `--resources scripts,references,assets` only when needed.
   - If you need UI metadata now, pass `--interface key=value` (repeatable).
5. Author `SKILL.md`:
   - Update frontmatter `description` to include concrete triggers (file types, tools, tasks, key phrases).
   - Keep the body procedural and composable (decision tree + steps + pointers into `references/`).
6. Sync UI metadata (optional but recommended for new skills):
   - Generate or regenerate: `uv run --with pyyaml -- python3 codex/skills/.system/skill-creator/scripts/generate_openai_yaml.py codex/skills/<skill-name> --interface key=value`
   - If the skill already had `default_prompt`, include it again in overrides (generator does not infer it).
   - For field constraints, read `codex/skills/.system/skill-creator/references/openai_yaml.md`.
7. Validate:
   - `uv run --with pyyaml -- python3 codex/skills/.system/skill-creator/scripts/quick_validate.py codex/skills/<skill-name>`
8. Iterate with the user: tighten triggers, remove redundancy, and promote repeatable code into `scripts/`.

## Update Workflow (In Place)

1. Locate the target skill folder in `codex/skills` (or `codex/skills/.system` for system skills).
2. Read the current `SKILL.md` and resources to identify the smallest set of required changes.
3. Edit in place:
   - Update frontmatter `description` if triggers changed.
   - Adjust workflows, tasks, or references with minimal diffs (no formatting churn).
   - Add or remove resource folders only when they create real reuse.
4. Sync UI metadata:
   - If `agents/openai.yaml` exists, keep it consistent with the skill and regenerate if stale.
   - If missing and UI metadata is desired, create it with `uv run --with pyyaml -- python3 codex/skills/.system/skill-creator/scripts/generate_openai_yaml.py <path/to/skill> --interface key=value`.
5. Validate with `uv run --with pyyaml -- python3 codex/skills/.system/skill-creator/scripts/quick_validate.py <path/to/skill>`.
6. Summarize changes and next steps.
   - Include `openai_yaml: regenerated|verified unchanged|not present`.
   - Include `quick_validate: <exact command> -> <result>`.

## Seq Feedback Loop (for improving `ms`)

When the target skill is `ms`, mine recent sessions before editing:

1. Collect assistant outputs that mention `$ms`:
   - `uv run codex/skills/seq/scripts/seq.py query --root ~/.codex/sessions --spec '{"dataset":"messages","where":[{"field":"role","op":"eq","value":"assistant"},{"field":"text","op":"contains","value":"$ms"}],"select":["path","timestamp","text"],"sort":["timestamp"],"format":"jsonl"}'`
2. Compute adherence rates for required proof markers:
   - `quick_validate.py`
   - `uv run --with pyyaml -- python3 codex/skills/.system/skill-creator/scripts/quick_validate.py`
   - `agents/openai.yaml`
   - `generate_openai_yaml.py`
3. Promote repeated misses into minimal-incision SKILL.md constraints/workflow edits.

## Trigger Examples

- "Create a skill to manage OpenAPI specs and generate SDKs."
- "Update skill X to include a new workflow and regenerate agents/openai.yaml."
- "Refactor this skill's SKILL.md and add references/ for schemas."
- "Refactor this skill's SKILL.md, move deep details into references/, and keep it under 500 lines."

Overview

This skill creates, updates, and refactors Codex skills in-place with minimal diffs. It focuses on tight trigger descriptions, consistent frontmatter, and optional UI metadata while enforcing validation and proof-of-completion steps.

How this skill works

It inspects the target skill folder and applies the smallest possible changes to satisfy a request: updating frontmatter, editing the procedural guidance, adding reusable assets only when needed, and regenerating or verifying agents/openai.yaml. The workflow always runs the provided quick validation script and records the validation command and result as proof of completion.

When to use it

  • Create a new Codex skill for a specific intent and keep it lean.
  • Tighten or clarify trigger text in a skill's frontmatter based on usage evidence.
  • Refactor a skill to move deep details into a references folder and simplify the main guidance.
  • Regenerate or verify agents/openai.yaml to keep UI metadata consistent.
  • Make minimal in-place edits to an existing skill without adding extra docs or churn.

Best practices

  • Change only what is necessary—preserve unrelated files and keys to minimize diffs.
  • Keep frontmatter minimal: name and description are required; include trigger cues in description.
  • Use the provided generator to create agents/openai.yaml when needed and follow its field constraints.
  • Run the quick validation command before finishing and record the exact command and pass/fail result.
  • Add scripts/references/assets only when they enable real reuse across edits or workflows.

Example use cases

  • Add a new workflow step and update the frontmatter trigger text to reflect supported file types.
  • Refactor a skill's long procedural content into a concise decision tree and place details in references.
  • Regenerate agents/openai.yaml after changing UI fields, then record openai_yaml: regenerated.
  • Verify an unchanged agents/openai.yaml and record openai_yaml: verified unchanged.
  • Create a new skill scaffolded with minimal resources and validate it with quick_validate.py.

FAQ

What proof is required when changes are complete?

Record the agents/openai.yaml disposition (regenerated, verified unchanged, or not present) and include the exact quick_validate.py command plus its pass/fail result.

How do you keep diffs minimal?

Identify the smallest set of files and frontmatter keys that must change, avoid formatting churn, and only add resource folders when they provide reuse.