This tool helps generate Shopify offer pages by analyzing requirements and creating implementation plans.
- Create and activate a Python virtual environment:
# Windows
python -m venv venv
venv\Scripts\activate
# macOS/Linux
python3 -m venv venv
source venv/bin/activate- Install required packages:
pip install -r requirements.txt- Set up environment variables:
# Create .env file
ANTHROPIC_API_KEY=your_api_key_here-
Create your initial requirements:
- Create a file named
simple_offer_requirement.txt - Add your basic offer page requirements in this file
- Create a file named
-
Enhance your requirements:
python enhance_prompt.pyThis will generate enhanced_prompt.txt with detailed requirements. Review and copy the content to offer_requirements_prompt.txt.
- Generate code examples:
python generate_examples_from_template.pyThis script:
- Reads from
offer_requirements_prompt.txt - Finds relevant examples from
example_components/anddataset/ - Creates
examples.txtwith implementation examples and UI component examples
- Generate the offer plan (multi-file plan recommended):
python generate_offer_plan_claude.pyThis script:
- Reads from
offer_requirements_prompt.txt - Uses
examples.txtif available - Fetches your Shopify store data
- Generates a detailed implementation plan in
offer_plan_claude.txt - The plan includes code for multiple files (sections, snippets, templates)
- Convert the plan into a single Liquid template (optional but recommended for deployment as one file):
python convert_plan_to_one_liquid_claude.pyThis script:
- Reads the multi-file plan from
offer_plan_claude.txt - Reads the grounding requirements from
offer_requirements_prompt.txt - Instructs the model to consolidate all code into one file
- Writes the single-file implementation to
one_page_offer_from_plan.txt
Optional environment overrides:
PLAN_PATH=offer_plan_claude.txt OUTPUT_PATH=one_page_offer_from_plan.txt python convert_plan_to_one_liquid_claude.py- Save the implementation:
# Save from converted single-file plan (default)
python save_implementations.py
# Save from the original multi-file plan
python save_implementations.py --source mainThis script extracts code blocks and writes files under claude_workspace/:
- Default mode (converted): reads
one_page_offer_from_plan.txtand saves a singletemplates/page.offer.liquidfile. - Main mode: reads
offer_plan_claude.txtand saves all referenced files (sections, snippets, templates) as defined in the plan.
- Align template styling (optional):
python align_template_styling.py --website your-store.com --template path/to/template.liquid --output-dir styled_templatesThis script:
- Analyzes a product page from your Shopify store to extract design elements
- Takes screenshots of each section and extracts HTML code
- Uses LLM to analyze design patterns, colors, typography, and layout
- Generates a design consistency document
- Applies styling changes to your template to match the product page design
- Saves the styled template to the output directory
Arguments:
--website: Your Shopify store domain (e.g., marsghc.com)--template: Path to the template file you want to style--output-dir: Directory to save the final styled template--int-dir: Intermediate files directory (default: styling_int_files)--log-dir: Log files directory (default: logs)
Requirements:
ANTHROPIC_API_KEYenvironment variable must be set- Requires
playwrightfor screenshot capture - Requires
PILfor image processing
Output:
- Screenshots and HTML files in
styling_int_files/screenshots/ - Design analysis in
styling_int_files/design_elements/ - Design consistency document in
styling_int_files/design_consistency.md - Suggested edits in
styling_int_files/suggested_edits.txt - Final styled template in your specified output directory
- Detailed logs in the logs directory
.
├── dataset/ # Example code dataset
├── example_components/ # Example UI components
├── venv/ # Python virtual environment
├── .env # Environment variables
├── requirements.txt # Python package requirements
├── simple_offer_requirement.txt # Initial requirements
├── enhanced_prompt.txt # Enhanced requirements
├── offer_requirements_prompt.txt # Final requirements
├── examples.txt # Generated code examples
├── offer_plan_claude.txt # Implementation plan
├── generate_examples_from_template.py # Generate examples
├── generate_offer_plan_claude.py # Generate multi-file plan
├── convert_plan_to_one_liquid_claude.py # Convert plan to single Liquid file
├── enhance_prompt.py # Requirements enhancement
├── save_implementations.py # Save files from plan
└── align_template_styling.py # Align template styling with store design
- Update
shopify_urlingenerate_offer_plan_claude.pyto your store's URL. - Environment variables:
- For both generation scripts, you'll need
ANTHROPIC_API_KEYin your.envfile
- For both generation scripts, you'll need
- The flow uses the same examples from
examples.txtif available. - Recommended flow:
- Generate a multi-file plan in
offer_plan_claude.txt - Convert it to a one-file template into
one_page_offer_from_plan.txt - Save implementations with
save_implementations.py(default uses the converted plan)
- Generate a multi-file plan in
- If you prefer to create multiple Liquid files instead of a single file, run
save_implementations.py --source mainto save from the original multi-file plan.
This section describes the workflow for making edits to the Shopify codebase using the editing tools.
The editing workflow consists of two main scripts:
generate_edits.py- Analyzes edit requirements and generates suggested editsapply_edits.py- Applies the suggested edits to create modified files
- Create an
edit_prompt.txtfile with your editing requirements - Ensure your
ANTHROPIC_API_KEYenvironment variable is set - Make sure your codebase is in the
claude_workspacedirectory
- Write your editing requirements in
edit_prompt.txt - Run the edit generation script:
python generate_edits.py
- Review the generated
suggested_edits.txtfile, which will contain:- A list of suggested changes
- Each change includes:
- File path
- Original code (SEARCH)
- New code (REPLACE)
- Explanation of the changes
- Review the suggested edits in
suggested_edits.txt - Run the apply edits script:
python apply_edits.py
- The script will:
- Create a new
claude_workspace_editsdirectory - Copy all files from
claude_workspace - Apply the suggested edits to files in the edits directory
- Leave the original workspace untouched
- Create a new
- Review the modified files in
claude_workspace_edits
.
├── claude_workspace/ # Original codebase
├── claude_workspace_edits/ # Modified files (created by apply_edits.py)
├── edit_prompt.txt # Your editing requirements
├── suggested_edits.txt # Generated edit suggestions
├── generate_edits.py # Script to generate edit suggestions
└── apply_edits.py # Script to apply the edits
- The editing workflow preserves your original codebase by creating a separate directory for modified files
- Each edit in
suggested_edits.txtfollows the code editing diff format (see diff format documentation) - The apply script handles whitespace differences and provides detailed feedback about each edit
- If an edit fails, check the error message for details about what went wrong
- You can safely delete the
claude_workspace_editsdirectory to start over