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
Arguments
The large prompt file to be split.
The code file generated from the input prompt. Used to understand the implementation and determine how to divide responsibilities.
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
Where to save the generated sub-prompt file. Default:
sub_<basename>.prompt. Also reads from PDD_SPLIT_SUB_PROMPT_OUTPUT_PATH.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
Usepdd 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>.
What it produces
pdd split outputs two files:
- Sub-prompt (
sub_<basename>.prompt) — Contains the extracted functionality. This becomes an independent prompt file that can be maintained and regenerated separately. - Modified prompt (
modified_<basename>.prompt) — The original prompt with the extracted content replaced by an<include>reference to the sub-prompt.
Example
Related commands
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-depscan 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.