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