kdp-publisher
Helps agents create, format, and publish children's books and activity books to Amazon Kindle Direct Publishing (KDP). Covers the full pipeline from story generation through KDP upload.
Triggers
Load this skill when the user mentions:
- KDP, Kindle Direct Publishing, Amazon self-publishing
- Children's book creation, picture book, storybook
- Activity book, coloring book, workbook, puzzle book
- Book formatting, PDF for print, cover design, book cover wrap
- KDP upload, manuscript upload, interior PDF
Supported Book Types
| Type |
Trim Size |
Interior |
Notes |
| Children's picture book |
8.5×8.5" |
Full color |
Illustration + text spreads |
| Activity book |
8.5×11" |
Color or B&W |
I Spy, dot-to-dot, etc. |
| Coloring book |
8.5×11" |
B&W |
Thick clean lines, no shading |
| Math workbook |
8.5×11" |
B&W |
Practice problems + answer key |
| Puzzle book |
8.5×11" |
B&W |
Word search, sudoku, crossword |
Core Workflow
prompt → story generation → illustration → interior PDF → cover PDF → metadata → KDP upload
Step 1 — Generate story and plan
Use scripts/generate-book.py for picture books. For workbooks/puzzles, use a puzzle generator tool (BookBolt, custom scripts).
python3 scripts/generate-book.py "a curious octopus who learns to share" \
--type picture-book \
--age-group 3-5 \
--style watercolor \
--output-dir output/
Story requirements:
- Title ≤ 60 characters
- 12 spreads → 24 story pages → ~28 pages total (title + dedication + The End + author bio)
- Ages 3-5: 10-20 words per spread, simple/repetitive sentences
- Ages 5-8: 20-40 words per spread, clear story arc
- Always include moral/lesson, dedication, back-cover description, 7 keywords
Step 2 — Generate illustrations
Critical image rules:
- ALWAYS add "no text, no words, no letters, no writing" to every image prompt
- Define character reference (colors, features, accessories) before generating spread #1
- Reference first image style in all subsequent prompts: "match the watercolor style of page 1"
- Use 1:1 aspect ratio for 8.5×8.5 picture books; use 3:4 for 8.5×11 activity books
- Minimum 300 DPI for print — Imagen 1024px = ~3.4" at 300 DPI, which is fine for a scaled-up 8.5×8.5 page
- Inspect every image for AI text artifacts before embedding in PDF
Step 3 — Assemble interior PDF
See references/kdp-specs.md for exact dimensions.
8.5×8.5 No Bleed (picture books):
- Page size: 612×612 pt
- Content area: 576×576 pt (0.25" margins on all sides)
- Images MUST fit within the content area — do not let image touch trim edge on a no-bleed file
- Layout: odd pages = illustration, even pages = text (or full-spread alternate)
Text rules:
- Embed fonts (ReportLab: register TTFont before use)
- Font size ≥ 14pt for ages 3-5; use centered text, generous leading
- No text inside AI images — overlay programmatically after generation
Step 4 — Create cover
Use scripts/create-cover.py for the full wrap PDF (front + spine + back + bleed):
python3 scripts/create-cover.py \
--title "The Curious Octopus" \
--author "Your Name" \
--pages 28 \
--paper white \
--front-image output/curious-octopus/images/cover.png \
--back-text "Follow Otto the octopus as he discovers the joy of sharing..." \
--output output/curious-octopus/cover.pdf
Spine width formulas (KDP standard):
- White paper B&W: pages × 0.002252 inches
- Cream paper B&W: pages × 0.0025 inches
- White paper color: pages × 0.002347 inches
Cover dimensions (8.5×8.5, white color, 28 pages):
- Spine width: 28 × 0.002347 = 0.0657"
- Total cover width: 8.5 + 0.0657 + 8.5 + 0.25" bleed = 17.316"
- Total cover height: 8.5 + 0.25" bleed = 8.75"
Cover design rules:
- Put title + author text as a PDF overlay — never bake text into the AI cover image
- Leave bottom-right 2"×1.5" of back cover clear for ISBN barcode
- Spine text is optional for books < 100 pages (too narrow to read)
- KDP will overlay its own barcode on the back cover — leave space
Step 5 — Write metadata
Description rules:
- Write from the finished story, NOT from the prompt or outline
- Use character names exactly as they appear in the final text
- 2-3 sentences: hook + plot + moral/appeal
- Include age range in description text ("Perfect for ages 3-6")
- Do not keyword-stuff; Amazon indexes naturally
KDP metadata fields:
- Title + subtitle (subtitle is optional but good for search)
- Author: pen name
- 7 backend keywords (use all 7 slots; 50 chars each; use phrases not single words)
- 2 categories (research BSR before choosing)
- Language, publication date
- AI-generated content disclosure: required if text or images are AI-generated
Step 6 — Validate before upload
python3 scripts/validate-book.py \
--interior output/curious-octopus/interior.pdf \
--cover output/curious-octopus/cover.pdf \
--metadata output/curious-octopus/metadata.json
Checks: page count, trim dimensions, image resolution, no-text-in-images, description/story consistency.
Step 7 — Upload to KDP
Browser automation rules (critical):
- Do NOT use Playwright
type on KDP form fields — focus shifts and input breaks
- Use JavaScript
evaluate with element IDs:document.getElementById('data-print-book-title').value = 'The Curious Octopus';
document.getElementById('data-print-book-title').dispatchEvent(new Event('input', {bubbles:true}));
- File uploads require CDP
DOM.setFileInputFiles + change event (Playwright upload action doesn't work):// After DOM.setFileInputFiles:
document.querySelector('input[type=file]').dispatchEvent(new Event('change', {bubbles:true}));
- Wait for
#data-print-book-interior-processing-status to show COMPLETED before proceeding
- Reload KDP page before each upload session — stale form state causes silent failures
Category selection:
- Use the cascade-select dropdowns in the category modal
- After selecting all levels, JS-click the placement checkbox (don't Playwright-click)
Activity Books & Workbooks
For non-narrative books, skip the story generation step. Instead:
- Plan content structure (sections, problem counts, difficulty levels)
- Generate content programmatically or with a puzzle generator
- Layout with ReportLab or a worksheet template
- Apply the same cover + metadata workflow
Math workbook rules:
- Do NOT add answer lines below equations — kids write directly below the problem line
- Use ≥ 14pt font for problem numbers; ≥ 20pt for the math itself
- Include answer key as last section
- 8.5×11", 1" margins, B&W interior
Coloring book rules:
- Image prompts: "simple black and white coloring page, thick lines, no shading, age-appropriate"
- Do not use grayscale images — must be pure black line art on white background
- Leave blank back sides of pages to prevent marker bleed-through
Pricing Quick Reference
| Book Type |
Paperback Price |
Expected Royalty/Sale |
| Kids picture book |
$12.99 |
~$5.00 |
| Activity book (color) |
$8.99-$10.99 |
~$3.10-$4.50 |
| Math/puzzle workbook |
$9.99-$12.99 |
~$4.30-$6.00 |
| Coloring book |
$7.99-$9.99 |
~$3.30-$4.50 |
Use 70% royalty tier: price must be $2.99-$9.99 for ebooks. Paperbacks always use 60% tier.
Amazon Ads Quick-Start
See references/ads-quickstart.md for full setup. Summary:
- Start with Automatic Targeting, $5/day
- After 2 weeks, harvest converting search terms → Manual Exact Match campaign
- Target ACoS: 30-45%
- Kill keywords: 8+ clicks, 0 sales → reduce bid to $0.02
- Scale: increase bids 20% on keywords with ACoS < 20%
Key Lessons
These were learned through production and would not be obvious from KDP documentation:
KDP form automation: Use JS evaluate + element IDs. Never use browser type action — fields shift focus mid-input.
File upload via CDP: Standard Playwright upload fails on KDP. Use DOM.setFileInputFiles + dispatch change event. See TOOLS.md for full script path.
Spine width formula: White paper B&W = pages × 0.002252. White paper color = pages × 0.002347. This is what KDP Cover Calculator gives you.
8.5×8.5 No Bleed margin: Images must fit within 576×576 pt content area on a 612×612 pt page. Images touching the trim edge will fail KDP preflight.
No text in AI illustrations: Every image prompt must include "no text, no words, no letters". Text baked into AI images is often garbled. Always overlay text programmatically.
Descriptions from finished content: Never write the description from the original prompt. Write it after the story is final — use actual character names and plot.
KDP categories: Select via cascade dropdowns in the modal, then JS-click the placement checkbox. Don't rely on Playwright click for the final checkbox.
Math workbooks: No answer lines below equations. Kids write below the problem line.
Stale form state: Reload the KDP page before each upload session. Uploading a second file to a page already mid-process fails silently.
AI disclosure: Amazon requires disclosure if text OR images are AI-generated. Select Yes during upload. Non-disclosure can result in account action.
References
references/kdp-specs.md — Trim sizes, margins, bleed, spine width tables, file requirements
references/qa-checklist.md — Pre-upload quality checklist
references/niche-guide.md — Profitable niches with pricing and competition data
references/ads-quickstart.md — Amazon Ads campaign setup and optimization
Scripts
scripts/generate-book.py — Full book generation pipeline (story + illustrations + interior PDF)
scripts/create-cover.py — Standalone cover wrap PDF generator
scripts/validate-book.py — Pre-upload validator
Dependencies
pip install reportlab Pillow google-genai PyPDF2
# Optional for validation:
pip install pytesseract # OCR-based text-in-image detection
API key: Set GOOGLE_AI_API_KEY env var, or pass --api-key, or create ~/.clawdbot/credentials/google_ai.json with {"api_key": "..."}.
1---2name: kdp-publisher3description: Helps agents create, format, and publish children's books and activity books to Amazon KDP. Covers the full pipeline from story prompt through PDF assembly, cover creation, and upload guidance. Triggers on KDP publishing, children's book creation, activity book generation, book formatting, Amazon self-publishing, and book cover design.4---5
6# kdp-publisher
7
8Helps agents create, format, and publish children's books and activity books to Amazon Kindle Direct Publishing (KDP). Covers the full pipeline from story generation through KDP upload.
9
10## Triggers
11
12Load this skill when the user mentions:
13- KDP, Kindle Direct Publishing, Amazon self-publishing
14- Children's book creation, picture book, storybook
15- Activity book, coloring book, workbook, puzzle book
16- Book formatting, PDF for print, cover design, book cover wrap
17- KDP upload, manuscript upload, interior PDF
18
19---
20
21## Supported Book Types
22
23| Type | Trim Size | Interior | Notes |
24|------|-----------|----------|-------|
25| Children's picture book | 8.5×8.5" | Full color | Illustration + text spreads |
26| Activity book | 8.5×11" | Color or B&W | I Spy, dot-to-dot, etc. |
27| Coloring book | 8.5×11" | B&W | Thick clean lines, no shading |
28| Math workbook | 8.5×11" | B&W | Practice problems + answer key |
29| Puzzle book | 8.5×11" | B&W | Word search, sudoku, crossword |
30
31---
32
33## Core Workflow
34
35```
36prompt → story generation → illustration → interior PDF → cover PDF → metadata → KDP upload
37```
38
39### Step 1 — Generate story and plan
40
41Use `scripts/generate-book.py` for picture books. For workbooks/puzzles, use a puzzle generator tool (BookBolt, custom scripts).
42
43```bash
44python3 scripts/generate-book.py "a curious octopus who learns to share" \
45 --type picture-book \
46 --age-group 3-5 \
47 --style watercolor \
48 --output-dir output/
49```
50
51**Story requirements:**
52- Title ≤ 60 characters
53- 12 spreads → 24 story pages → ~28 pages total (title + dedication + The End + author bio)
54- Ages 3-5: 10-20 words per spread, simple/repetitive sentences
55- Ages 5-8: 20-40 words per spread, clear story arc
56- Always include moral/lesson, dedication, back-cover description, 7 keywords
57
58### Step 2 — Generate illustrations
59
60**Critical image rules:**
61- ALWAYS add "no text, no words, no letters, no writing" to every image prompt
62- Define character reference (colors, features, accessories) before generating spread #1
63- Reference first image style in all subsequent prompts: "match the watercolor style of page 1"
64- Use 1:1 aspect ratio for 8.5×8.5 picture books; use 3:4 for 8.5×11 activity books
65- Minimum 300 DPI for print — Imagen 1024px = ~3.4" at 300 DPI, which is fine for a scaled-up 8.5×8.5 page
66- Inspect every image for AI text artifacts before embedding in PDF
67
68### Step 3 — Assemble interior PDF
69
70See `references/kdp-specs.md` for exact dimensions.
71
72**8.5×8.5 No Bleed (picture books):**
73- Page size: 612×612 pt
74- Content area: 576×576 pt (0.25" margins on all sides)
75- Images MUST fit within the content area — do not let image touch trim edge on a no-bleed file
76- Layout: odd pages = illustration, even pages = text (or full-spread alternate)
77
78**Text rules:**
79- Embed fonts (ReportLab: register TTFont before use)
80- Font size ≥ 14pt for ages 3-5; use centered text, generous leading
81- No text inside AI images — overlay programmatically after generation
82
83### Step 4 — Create cover
84
85Use `scripts/create-cover.py` for the full wrap PDF (front + spine + back + bleed):
86
87```bash
88python3 scripts/create-cover.py \
89 --title "The Curious Octopus" \
90 --author "Your Name" \
91 --pages 28 \
92 --paper white \
93 --front-image output/curious-octopus/images/cover.png \
94 --back-text "Follow Otto the octopus as he discovers the joy of sharing..." \
95 --output output/curious-octopus/cover.pdf
96```
97
98**Spine width formulas (KDP standard):**
99- White paper B&W: pages × 0.002252 inches
100- Cream paper B&W: pages × 0.0025 inches
101- White paper color: pages × 0.002347 inches
102
103**Cover dimensions (8.5×8.5, white color, 28 pages):**
104- Spine width: 28 × 0.002347 = 0.0657"
105- Total cover width: 8.5 + 0.0657 + 8.5 + 0.25" bleed = 17.316"
106- Total cover height: 8.5 + 0.25" bleed = 8.75"
107
108**Cover design rules:**
109- Put title + author text as a PDF overlay — never bake text into the AI cover image
110- Leave bottom-right 2"×1.5" of back cover clear for ISBN barcode
111- Spine text is optional for books < 100 pages (too narrow to read)
112- KDP will overlay its own barcode on the back cover — leave space
113
114### Step 5 — Write metadata
115
116**Description rules:**
117- Write from the finished story, NOT from the prompt or outline
118- Use character names exactly as they appear in the final text
119- 2-3 sentences: hook + plot + moral/appeal
120- Include age range in description text ("Perfect for ages 3-6")
121- Do not keyword-stuff; Amazon indexes naturally
122
123**KDP metadata fields:**
124- Title + subtitle (subtitle is optional but good for search)
125- Author: pen name
126- 7 backend keywords (use all 7 slots; 50 chars each; use phrases not single words)
127- 2 categories (research BSR before choosing)
128- Language, publication date
129- AI-generated content disclosure: required if text or images are AI-generated
130
131### Step 6 — Validate before upload
132
133```bash
134python3 scripts/validate-book.py \
135 --interior output/curious-octopus/interior.pdf \
136 --cover output/curious-octopus/cover.pdf \
137 --metadata output/curious-octopus/metadata.json
138```
139
140Checks: page count, trim dimensions, image resolution, no-text-in-images, description/story consistency.
141
142### Step 7 — Upload to KDP
143
144**Browser automation rules (critical):**
145- Do NOT use Playwright `type` on KDP form fields — focus shifts and input breaks
146- Use JavaScript `evaluate` with element IDs:
147 ```js
148 document.getElementById('data-print-book-title').value = 'The Curious Octopus';
149 document.getElementById('data-print-book-title').dispatchEvent(new Event('input', {bubbles:true}));
150 ```
151- File uploads require CDP `DOM.setFileInputFiles` + change event (Playwright upload action doesn't work):
152 ```js
153 // After DOM.setFileInputFiles:
154 document.querySelector('input[type=file]').dispatchEvent(new Event('change', {bubbles:true}));
155 ```
156- Wait for `#data-print-book-interior-processing-status` to show COMPLETED before proceeding
157- Reload KDP page before each upload session — stale form state causes silent failures
158
159**Category selection:**
160- Use the cascade-select dropdowns in the category modal
161- After selecting all levels, JS-click the placement checkbox (don't Playwright-click)
162
163---
164
165## Activity Books & Workbooks
166
167For non-narrative books, skip the story generation step. Instead:
168
1691. Plan content structure (sections, problem counts, difficulty levels)
1702. Generate content programmatically or with a puzzle generator
1713. Layout with ReportLab or a worksheet template
1724. Apply the same cover + metadata workflow
173
174**Math workbook rules:**
175- Do NOT add answer lines below equations — kids write directly below the problem line
176- Use ≥ 14pt font for problem numbers; ≥ 20pt for the math itself
177- Include answer key as last section
178- 8.5×11", 1" margins, B&W interior
179
180**Coloring book rules:**
181- Image prompts: "simple black and white coloring page, thick lines, no shading, age-appropriate"
182- Do not use grayscale images — must be pure black line art on white background
183- Leave blank back sides of pages to prevent marker bleed-through
184
185---
186
187## Pricing Quick Reference
188
189| Book Type | Paperback Price | Expected Royalty/Sale |
190|-----------|----------------|-----------------------|
191| Kids picture book | $12.99 | ~$5.00 |
192| Activity book (color) | $8.99-$10.99 | ~$3.10-$4.50 |
193| Math/puzzle workbook | $9.99-$12.99 | ~$4.30-$6.00 |
194| Coloring book | $7.99-$9.99 | ~$3.30-$4.50 |
195
196Use 70% royalty tier: price must be $2.99-$9.99 for ebooks. Paperbacks always use 60% tier.
197
198---
199
200## Amazon Ads Quick-Start
201
202See `references/ads-quickstart.md` for full setup. Summary:
203- Start with Automatic Targeting, $5/day
204- After 2 weeks, harvest converting search terms → Manual Exact Match campaign
205- Target ACoS: 30-45%
206- Kill keywords: 8+ clicks, 0 sales → reduce bid to $0.02
207- Scale: increase bids 20% on keywords with ACoS < 20%
208
209---
210
211## Key Lessons
212
213These were learned through production and would not be obvious from KDP documentation:
214
2151. **KDP form automation**: Use JS evaluate + element IDs. Never use browser `type` action — fields shift focus mid-input.
216
2172. **File upload via CDP**: Standard Playwright upload fails on KDP. Use `DOM.setFileInputFiles` + dispatch change event. See TOOLS.md for full script path.
218
2193. **Spine width formula**: White paper B&W = `pages × 0.002252`. White paper color = `pages × 0.002347`. This is what KDP Cover Calculator gives you.
220
2214. **8.5×8.5 No Bleed margin**: Images must fit within 576×576 pt content area on a 612×612 pt page. Images touching the trim edge will fail KDP preflight.
222
2235. **No text in AI illustrations**: Every image prompt must include "no text, no words, no letters". Text baked into AI images is often garbled. Always overlay text programmatically.
224
2256. **Descriptions from finished content**: Never write the description from the original prompt. Write it after the story is final — use actual character names and plot.
226
2277. **KDP categories**: Select via cascade dropdowns in the modal, then JS-click the placement checkbox. Don't rely on Playwright click for the final checkbox.
228
2298. **Math workbooks**: No answer lines below equations. Kids write below the problem line.
230
2319. **Stale form state**: Reload the KDP page before each upload session. Uploading a second file to a page already mid-process fails silently.
232
23310. **AI disclosure**: Amazon requires disclosure if text OR images are AI-generated. Select Yes during upload. Non-disclosure can result in account action.
234
235---
236
237## References
238
239- `references/kdp-specs.md` — Trim sizes, margins, bleed, spine width tables, file requirements
240- `references/qa-checklist.md` — Pre-upload quality checklist
241- `references/niche-guide.md` — Profitable niches with pricing and competition data
242- `references/ads-quickstart.md` — Amazon Ads campaign setup and optimization
243
244## Scripts
245
246- `scripts/generate-book.py` — Full book generation pipeline (story + illustrations + interior PDF)
247- `scripts/create-cover.py` — Standalone cover wrap PDF generator
248- `scripts/validate-book.py` — Pre-upload validator
249
250## Dependencies
251
252```bash
253pip install reportlab Pillow google-genai PyPDF2
254# Optional for validation:
255pip install pytesseract # OCR-based text-in-image detection
256```
257
258API key: Set `GOOGLE_AI_API_KEY` env var, or pass `--api-key`, or create `~/.clawdbot/credentials/google_ai.json` with `{"api_key": "..."}`.