---
name: post-to-yad2
description: Post a product listing to Yad2 using the browser. Reads listing data from the product's LISTING.md, navigates to Yad2, and fills in the listing form.
user_invocable: true
argument: (optional) product name (subfolder name under marketplace/)
---

# Post to Yad2

{% if argument %}
You are posting the listing for **{{ argument }}** to Yad2 using the browser MCP tools.

Use **{{ argument }}** as the PRODUCT_NAME throughout the steps below.
{% else %}
## Step 0 – Select a Product

No product was specified. You need to find a product that hasn't been posted to Yad2 yet.

1. Use `Glob` to find all `LISTING.md` files under the project directory.
2. For each `LISTING.md`, read it and check if it contains a **פוסט יד2** row in the **פרטי מוצר** table.
3. Collect all products that do NOT have a פוסט יד2 entry (i.e., no Yad2 post URL yet).
4. If all products already have a Yad2 post, tell the user "All listings already have a Yad2 post URL" and stop.
5. If there are multiple products without a Yad2 post, pick the first one alphabetically and tell the user which product you selected.
6. Use the selected product's subfolder name as the **PRODUCT_NAME** throughout the steps below.

{% endif %}

**In all steps below, replace `PRODUCT_NAME` with the resolved product name (either from the argument or from Step 0).**

## Task Tracking

At the start of this skill, create a task list using `TaskCreate` to track progress. Create one task per step:

1. "Read listing data from LISTING.md"
2. "Navigate to Yad2 publish page"
3. "Fill in listing form"
4. "Review before publishing"
5. "Publish listing"
6. "Update index.html dashboard"

As you begin each step, update its task to `in_progress`. When a step completes, update it to `completed`. If a step is blocked or fails, update it to `blocked` or note the issue.

## Step 1 – Read Listing Data

1. Read `PRODUCT_NAME/LISTING.md`
2. Extract all listing fields:
   - **Title**: from כותרת לפוסט section
   - **Description**: from תיאור לפוסט section
   - **Price**: מחיר מבוקש from מחירי שוק table
   - **Category**: קטגוריה from פרטי מוצר table
   - **Photos**: all image files (*.jpeg, *.jpg, *.png, *.webp) in the `PRODUCT_NAME/` directory
3. If the title, description, or price is empty, STOP and tell the user to run `/research-product PRODUCT_NAME` first.
4. Check if there is an `archive/` subdirectory in the product folder. If there is NO `archive/` directory, the photos haven't been processed yet — automatically run the `/process-photos PRODUCT_NAME` skill to process them before continuing. After processing completes, re-scan the directory for the updated photo list.

## Step 2 – Navigate to Yad2

1. First, create a new browser tab using `browser_tab_create` to avoid conflicting with other browser sessions.
2. Use `browser_navigate` to go to: `https://www.yad2.co.il/publish-ad-products/create`
3. Take a snapshot to see the current page state
4. If not logged in, take a screenshot and ask the user to log in manually, then wait and retry

## Step 3 – Fill in the Listing Form

Yad2's product listing form has fields that need to be filled. Fill them in order, taking a snapshot after each major action to verify state.

### Photos
1. Look for the photo upload area
2. Photo upload requires file paths — tell the user the absolute paths of the **processed** photos (from Step 1) they need to upload manually:
   - List each processed photo with its full path
3. Wait for the user to confirm photos are uploaded before continuing

### Title / כותרת
1. Find the title/כותרת input field
2. Type the value from כותרת לפוסט

### Category / קטגוריה
1. Find the category field
2. Click it and search for or select the appropriate category based on קטגוריה
3. Use snapshot to find matching options and click the best match

### Description / תיאור
1. Find the description/תיאור text area
2. Type the full description from תיאור לפוסט
3. Note: newlines should be typed as-is

### Price / מחיר
1. Find the price/מחיר input field
2. Type the מחיר מבוקש value — numbers only, no currency symbol

### Condition / מצב המוצר
1. If a condition field is present, select "משומש" or "יד שנייה" (used)

### Location / מיקום
1. If a location field is present and empty, type "תל אביב" or "Tel Aviv"
2. Select the first suggestion from the dropdown

### Contact / פרטי התקשרות
1. If contact details are required, take a snapshot and ask the user to fill them in manually
2. Wait for user confirmation before continuing

## Step 4 – Review Before Publishing

1. Take a screenshot of the completed form
2. Show the screenshot to the user
3. Present a summary of what was filled in:
   - Title
   - Price
   - Category
   - Description (first 2 lines)
   - Number of photos
4. **Ask the user for explicit confirmation before clicking "Publish" / "פרסם"**
5. Do NOT click publish without user approval

## Step 5 – Publish (only after user confirms)

1. Once the user approves, click through all remaining steps ("הבא" / "פרסם" / "אישור") **without asking for additional confirmations**. Just click Next, then Publish, navigating through any review/confirmation pages automatically.
2. Take a snapshot/screenshot to verify the listing was posted successfully.
3. Once published, copy the URL of the new listing from the browser.
4. Add a **פוסט יד2** row to the **פרטי מוצר** table in `PRODUCT_NAME/LISTING.md` with the listing URL.

## Step 6 – Update index.html

1. Open `index.html` in the project root.
2. In the **dashboard summary table**, find the row for **PRODUCT_NAME** and:
   - If there is a Facebook post link, add the Yad2 listing URL next to it.
   - If the status is `ממתין`, change it to `פורסם` (with class `status-listed`).
   - Add the Yad2 listing URL in the לינק לפוסט column.
3. In the **product card** for PRODUCT_NAME, add a Yad2 post link button (class `yad2-post-link`) with the listing URL, if one doesn't already exist. Place it after the badge (and after the Facebook link if present), before the price tag, matching the format of other link buttons.

## Important Notes

- **Always snapshot before interacting** — Yad2's UI changes frequently; never assume element refs from a previous snapshot are still valid.
- **Never guess refs** — always take a fresh snapshot to get current element references.
- **If something fails**, take a screenshot, show it to the user, and ask how to proceed.
- **RTL text**: Hebrew text may render RTL. When typing Hebrew, type it as-is — the browser handles directionality.
- **Photos cannot be uploaded programmatically** via browser_click on file inputs in most cases. Provide the user with the file paths and ask them to drag-and-drop or use the file picker manually.
- **Yad2 may show popups or modals** (login, cookie consent, etc.) — dismiss them before proceeding with the form.
