Create a Modernizer Pipeline Phase

VerifiedCaution

Step-by-step guide to add a new pipeline phase: Pydantic contract, deterministic logic, script, LLM expertise, and command.

Sby Skills Guide Bot
DevelopmentAdvanced
10/31/2026
Claude Code
#skill-authoring#pipeline-phases#pydantic-contracts#llm-workflow#claude-code

Recommended for

Automated summary

Guides the creation of a new pipeline phase from the Pydantic contract through the script, LLM expertise, command, and orchestrator integration.

Strengths

  • Sequences the work with explicit stop points and verification commands.
  • Clearly separates contract, deterministic logic, script, LLM expertise, and command.
  • Covers none/external/bedrock LLM modes and typed finalization through Pydantic.
  • Reminds the author to update the orchestrator and validate all skills.

Limitations

  • Assumes a specific repository layout (src/contracts, src/agents, scripts, uv) without adapting to alternatives.
  • Heavily tied to Claude Code commands (.claude/commands) and an existing /modernize orchestrator.
  • Does not cover domain modeling for the contract or test-quality criteria.
When to use it

Use it when adding a phase to an existing pipeline built around Pydantic contracts and Claude Code commands.

When not to use it

Avoid it for creating a generic skill or working in a repository that does not follow this phase architecture.

Security analysis

Caution
Quality score80/100

This is a meta-skill that guides an agent through scaffolding a new pipeline phase and running it. It uses bash, Python, and pytest, but only against the project's own code and artifacts; there is no destructive command, no network exfiltration, no obfuscated payload, and no attempt to disable safety controls. The instructions are internally consistent and even include STOP gates and mandatory validation, so the risk is limited to ordinary code-execution risk inherent to any dev-workflow skill — hence caution rather than risky.

Findings
  • •Instructs the agent to create and execute project scripts via `uv run python scripts/...` and `uv run pytest`, meaning arbitrary newly-written code is run — legitimate for the workflow but non-trivial execution risk
  • •Writes/modifies multiple files across src/, tests/, scripts/, and .claude/commands/, and edits an existing orchestrator command; no backup or review step beyond the STOP gates
  • •References external expertise files and artifact paths whose contents are not validated by this skill itself
  • •No allowed-tools declared, yet the workflow instructs the agent to run shell commands (`uv run python`, `uv run pytest`, `uv run python scripts/validate_skills.py`); the manifest should declare `Bash` so the capabilities are explicit rather than implicit.
  • •Placeholder paths such as `artifacts/{database_name}/{job_id}/...` and `--db test` are used without any guard against path traversal; a caller-supplied `job_id`/`database_name` containing `../` could read/write outside the repo. Low severity, since it is upstream project code that would do the resolution.
How this analysis is made

Examples

Add a cost-estimate phase
/add-modernizer-skill Add a phase called cost-estimate that estimates warehouse cost from the mapped schema. It needs LLM judgment, reads the mapping contract, and outputs a cost estimate contract.
Add a deterministic validation phase
Use the add-modernizer-skill workflow to create a deterministic validate-schema phase in this repo. It should read the DDL contract and output validation results with errors.
Add an LLM migration phase
I need to add a migrate-ddl phase that uses external LLM mode and writes a .claude command. Walk me through the contract first and stop for approval.

/add-modernizer-skill

Guides creation of a new pipeline phase. Follows strict priority order — each step must be complete before the next begins.

Required Input

Ask the user for:

  • Phase name: e.g. migrate-ddl, validate-schema, cost-estimate
  • Purpose: What this phase does in one sentence
  • Needs LLM?: Whether this phase requires LLM judgment (yes/no)
  • Input: What artifacts from previous phases it reads
  • Output: What it produces

Phase 1: Contract (MUST complete first)

  1. Create src/contracts/{phase_name}_output.py

  2. Define the output Pydantic model with:

    • Clear field descriptions
    • Appropriate types and constraints
    • Validators where needed
  3. If LLM is needed, define the LLM output model separately (keep it minimal — only what requires judgment)

  4. Verify:

    uv run python -c "from src.contracts.{phase_name}_output import *; print('OK')"
    

STOP: Do not proceed until the contract compiles and the user approves the field design.

Phase 2: Deterministic Logic

  1. Create src/agents/{phase_name}/handler.py

  2. Implement run_{phase_name}_deterministic(input) -> contract

  3. If LLM is needed, implement:

    • prepare_{phase_name}_llm_input(contract, input) -> dict
    • apply_{phase_name}_llm_output(contract, llm_typed) -> updated_contract
  4. Write tests in tests/agents/test_{phase_name}.py

  5. Verify:

    uv run pytest tests/agents/test_{phase_name}.py -v
    

STOP: Do not proceed until tests pass.

Phase 3: Script

  1. Create scripts/run_{phase_name}.py

  2. Must support: --job-id, --db, --llm-mode (none/external/bedrock), --finalize, --artifact-root

  3. In external mode, inject output_schema:

    llm_request["output_schema"] = LlmModel.model_json_schema()
    
  4. In finalize mode, deserialize through Pydantic:

    llm_typed = LlmModel.model_validate(llm_response)
    updated = apply_llm_output(contract, llm_typed)
    
  5. Output JSON to stdout: {"status": "complete"} or {"status": "awaiting_llm", "llm_request": "..."} or {"status": "validation_failed", "errors": [...]}

  6. Verify deterministic mode works:

    uv run python scripts/run_{phase_name}.py --job-id test --db test --llm-mode none
    

STOP: Do not proceed until the script runs successfully.

Phase 4: Domain Expertise (if LLM phase exists)

  1. Create src/skills/{phase_name}-expertise.md
  2. Write the domain knowledge the LLM needs to make good decisions
  3. Keep it focused — principles and anti-patterns, not implementation details

Phase 5: Command

  1. Create .claude/commands/{phase_name}.md
  2. No frontmatter. Follow this exact template, matching the other shipped commands:
# /{phase_name}

{Brief description.}

## Prerequisites

- {What must be true}

## Steps

1. **Run phase**

   ```bash
   uv run python scripts/run_{phase_name}.py --job-id {job_id} --db {database_name} --llm-mode external
  1. If status is awaiting_llm: a. Read: artifacts/{database_name}/{job_id}/llm_requests/{phase_name}.json

    • Contains context data and output_schema b. Read: src/skills/{phase_name}-expertise.md c. Produce JSON conforming to output_schema d. Write to: artifacts/{database_name}/{job_id}/llm_responses/{phase_name}.json e. Finalize:
    uv run python scripts/run_{phase_name}.py --job-id {job_id} --db {database_name} --finalize
    

    If validation fails, fix errors and retry up to 3 times.

  2. Update state Set phase_status.{phase_name} = "complete"


3. Validate:

   ```bash
   uv run python scripts/validate_skills.py

Phase 6: Integration

  1. Add the new phase to the /modernize orchestrator skill if it belongs in the main pipeline

  2. Update .claude/commands/modernize.md with the new step in the correct position

  3. Run the pre-commit hook to verify everything links up:

    uv run python scripts/validate_skills.py
    

Rules

  • NEVER skip a phase. Each phase depends on the previous.
  • NEVER put contract details in the skill. The script injects output_schema.
  • NEVER reference Python source files from skills.
  • Keep LLM output contracts minimal. If logic can be deterministic, it MUST be.
  • The script is the source of truth for validation — the skill just runs it.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/create-a-modernizer-pipeline-phase-mvda88r9/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/create-a-modernizer-pipeline-phase-mvda88r9' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/create-a-modernizer-pipeline-phase-mvda88r9/download' --output '.skill-downloads/create-a-modernizer-pipeline-phase-mvda88r9/SKILL.md.part' && mv '.skill-downloads/create-a-modernizer-pipeline-phase-mvda88r9/SKILL.md.part' '.skill-downloads/create-a-modernizer-pipeline-phase-mvda88r9/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/create-a-modernizer-pipeline-phase-mvda88r9/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills