Generate presentation slides from images or PDF files. Use when user wants to create slides, generate presentations, or convert PDF to slides for the training camp website...
Generate presentation slides for the AI training camp website from a directory of images or a PDF file.
User provides a directory name (e.g., test1), and this skill will:
./site/public/slides/<directory-name>Check if the directory exists:
ls ./site/public/slides/<directory-name>
If directory doesn't exist, inform the user and stop.
Check what's in the directory:
.pdf file and no image files → Go to Step 3 (PDF conversion).jpg, .jpeg, .png, .gif, .webp) → Go to Step 4 (Generate slides)If directory contains only a PDF file:
Check if pdf2jpg command exists:
which pdf2jpg
If not found, install swiss-knife:
cargo install swiss-knife
Convert PDF to JPG images:
cd ./site/public/slides/<directory-name> && pdf2jpg <filename>.pdf
This generates 001.jpg, 002.jpg, etc. in the current directory.
Delete the original PDF file after successful conversion (if it still exists). Since we're still in the slides directory, use the filename directly:
rm -f <filename>.pdf
Note: Use -f flag in case pdf2jpg already deleted the file.
Proceed to Step 4.
List all image files in sorted order:
ls -1 ./site/public/slides/<directory-name>/*.{jpg,jpeg,png,gif,webp} 2>/dev/null | sort
Read each image to understand its content and generate appropriate captions.
Ask the user for:
Create MDX file at ./site/src/pages/presentations/<directory-name>.mdx following this template:
---
layout: ../../layouts/PresentationLayout.astro
title: <TITLE>
description: <DESCRIPTION>
category: <CATEGORY>
---
import PresentationCarousel from '../../components/presentations/PresentationCarousel';
import { getUrl } from '../../utils/url';
# <TITLE>
<BRIEF_INTRO>
<PresentationCarousel
client:load
title="<TITLE>"
slides={[
{
image: "/slides/<directory-name>/<image-filename>",
alt: "<alt-text>",
caption: "<caption>"
},
// ... more slides
]}
/>
## 核心要点
<KEY_POINTS_BASED_ON_CONTENT>
## 延伸阅读
- [查看课程大纲](/curriculum) - 了解 AI 编程训练营完整内容
- [探索工具生态](/tools) - 学习 AI 编程工具的使用
- [浏览学习资料](/materials) - 获取更多技术学习资源
Read ./site/src/pages/presentations/index.astro
Add a new entry to the presentations array:
{
title: "<TITLE>",
description: "<DESCRIPTION>",
href: getUrl("presentations/<directory-name>"),
thumbnail: getUrl("slides/<directory-name>/<first-image>"),
slideCount: <NUMBER_OF_SLIDES>,
date: "<YYYY-MM-DD>", // Today's date
category: "<CATEGORY>",
},
Use the first image as the thumbnail (or ask the user to pick one).
User: "Create slides from the vogels-keynote directory"
./site/public/slides/vogels-keynote exists ✓./site/src/pages/presentations/vogels-keynote.mdx./site/src/pages/presentations/index.astrodate field in index.astro/slides/When generating captions and alt text, NEVER use Chinese quotation marks (" and ") inside JSX string attributes. These characters cause MDX parsing errors.
Bad example:
caption: "真正的问题不是"AI会取代我吗?"而是..."
Good example (use 「」 instead):
caption: "真正的问题不是「AI会取代我吗?」而是..."
Also avoid: