Skip to main content
pdd split is the Refactoring workflow command. When a prompt file has grown too large or complex, pdd split extracts a cohesive portion of it into a separate sub-prompt file and updates the main prompt to reference the sub-prompt via an <include> directive. The example file defines the interface boundary between the two prompts.

Usage

pdd [GLOBAL OPTIONS] split [OPTIONS] INPUT_PROMPT INPUT_CODE EXAMPLE_CODE

Arguments

INPUT_PROMPT
string
required
The large prompt file to be split.
INPUT_CODE
string
required
The code file generated from the input prompt. Used to understand the implementation and determine how to divide responsibilities.
EXAMPLE_CODE
string
required
The example file that serves as the interface to the extracted sub-module. This file defines the public API boundary between the main prompt and the new sub-prompt.

Options

--output-sub
string
Where to save the generated sub-prompt file. Default: sub_<basename>.prompt. Also reads from PDD_SPLIT_SUB_PROMPT_OUTPUT_PATH.
--output-modified
string
Where to save the modified (reduced) main prompt file. Default: modified_<basename>.prompt. Also reads from PDD_SPLIT_MODIFIED_PROMPT_OUTPUT_PATH.

When to use

Use pdd split when:
  • A prompt file is approaching or exceeding the model’s context window.
  • A prompt has grown to cover multiple distinct responsibilities that should be managed independently.
  • You want to make a portion of functionality reusable across other prompts via <include>.
The PDD Restructuring Phase recommends splitting prompts that are too large or complex as a standard refactoring practice, analogous to extracting a function or module in traditional code.

What it produces

pdd split outputs two files:
  1. Sub-prompt (sub_<basename>.prompt) — Contains the extracted functionality. This becomes an independent prompt file that can be maintained and regenerated separately.
  2. Modified prompt (modified_<basename>.prompt) — The original prompt with the extracted content replaced by an <include> reference to the sub-prompt.

Example

pdd split \
  --output-sub prompts/sub_data_processing.prompt \
  --output-modified prompts/modified_main_pipeline.prompt \
  data_processing_pipeline_python.prompt \
  src/data_pipeline.py \
  examples/pipeline_interface.py
After splitting, verify both prompts regenerate correctly:
pdd sync sub_data_processing
pdd sync data_processing_pipeline
  • pdd sync — Run on both the new sub-prompt and the modified prompt after splitting to regenerate and verify the code.
  • pdd auto-deps — After splitting, auto-deps can insert the new sub-prompt as a dependency of the modified main prompt automatically.
  • pdd conflicts — Check for conflicts between the two prompts after splitting.

Build docs developers (and LLMs) love