24111999/claude-skills / slide-studio
slide-studio
UnverifiedCreate and modify PowerPoint presentations (PPTX) through direct XML manipulation. Use this skill when: (1) Creating presentations from scratch, (2) Adding/editing/deleting slides, (3) Inserting images or custom shapes, (4) Applying POTX templates for consistent branding, (5) Editing existing PPTX files, (6) Working with slide layouts and placeholders, (7) User asks to make a "presentation", "slides", "deck", or mentions ".pptx". Supports all 11 standard Office slide layouts.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 10.3 KB |
| assets/base.pptx | binary | 17.6 KB |
| assets/claude-skills-v1.5.zip | binary | 1.3 MB |
| package-lock.json | manifest | 4.5 KB |
| package.json | manifest | 422 B |
| references/ooxml-reference.md | markdown | 4.5 KB |
| references/slide-patterns.md | markdown | 5.2 KB |
| scripts/add-image.js | script | 7.0 KB |
| scripts/add-shape.js | script | 7.9 KB |
| scripts/add-slide.js | script | 9.2 KB |
| scripts/apply-potx.js | script | 9.0 KB |
| scripts/clone-slide.js | script | 5.3 KB |
| scripts/create-base.js | script | 16.0 KB |
| scripts/delete-slide.js | script | 3.2 KB |
| scripts/edit-text.js | script | 5.8 KB |
| scripts/generate-base.js | script | 24.7 KB |
| scripts/lib/constants.js | script | 3.2 KB |
| scripts/lib/content-types.js | script | 3.8 KB |
| scripts/lib/relationships.js | script | 3.9 KB |
| scripts/lib/xml-utils.js | script | 4.6 KB |
| scripts/list-layouts.js | script | 2.2 KB |
| scripts/list-slides.js | script | 3.4 KB |
| scripts/pack.js | script | 3.0 KB |
| scripts/skills_claude_poetship.zip | binary | 498.2 KB |
| scripts/unpack.js | script | 1.6 KB |
| scripts/visualize-slide.js | script | 6.0 KB |
scripts/visualize-slide.js
View on GitHub#!/usr/bin/env node
/**
* Visualizes slide structure as ASCII art
* Helps LLM understand shape positions and sizes
*
* Usage: node visualize-slide.js <working-directory> [--slide <n>]
*/
const fs = require('fs');
const path = require('path');
// Standard slide size (16:9 widescreen)
const SLIDE_WIDTH = 12192000; // EMU
const SLIDE_HEIGHT = 6858000; // EMU
// ASCII grid size
const GRID_WIDTH = 72;
const GRID_HEIGHT = 24;
/**
* Convert EMU to grid position
*/
function emuToGrid(emuX, emuY) {
const x = Math.round((emuX / SLIDE_WIDTH) * GRID_WIDTH);
const y = Math.round((emuY / SLIDE_HEIGHT) * GRID_HEIGHT);
return { x: Math.min(x, GRID_WIDTH - 1), y: Math.min(y, GRID_HEIGHT - 1) };
}
/**
* Convert EMU to inches for display
*/
function emuToInches(emu) {
return (emu / 914400).toFixed(2);
}
/**
* Extract shapes from slide XML
*/
function extractShapes(slideXml) {
const shapes = [];
// Match <p:sp> elements
const spPattern = /<p:sp>[\s\S]*?<\/p:sp>/g;
let match;
let id = 1;
while ((match = spPattern.exec(slideXml)) !== null) {
const spXml = match[0];
// Extract name
const nameMatch = spXml.match(/<p:cNvPr[^>]*name="([^"]*)"/);
const name = nameMatch ? nameMatch[1] : `Shape ${id}`;
// Extract position
const offMatch = spXml.match(/<a:off x="(\d+)" y="(\d+)"\/>/);
const x = offMatch ? parseInt(offMatch[1], 10) : 0;
const y = offMatch ? parseInt(offMatch[2], 10) : 0;
// Extract size
const extMatch = spXml.match(/<a:ext cx="(\d+)" cy="(\d+)"\/>/);
const width = extMatch ? parseInt(extMatch[1], 10) : 0;
const height = extMatch ? parseInt(extMatch[2], 10) : 0;
// Extract placeholder type if present
const phMatch = spXml.match(/<p:ph[^>]*type="([^"]*)"/);
const phType = phMatch ? phMatch[1] : null;
// Extract text content
const textMatches = spXml.match(/<a:t>([^<]*)<\/a:t>/g);
const text = textMatches
? textMatches.map(t => t.replace(/<\/?a:t>/g, '')).join(' ').substring(0, 30)
: '';
shapes.push({
id: id++,
name,
x, y, width, height,
phType,
text: text.trim(),
});
}
return shapes;
}
/**
* Render ASCII grid
*/
function renderGrid(shapes) {
// Initialize grid
const grid = Array(GRID_HEIGHT).fill(null).map(() => Array(GRID_WIDTH).fill(' '));
// Draw border
for (let x = 0; x < GRID_WIDTH; x++) {
grid[0][x] = '-';
grid[GRID_HEIGHT - 1][x] = '-';
}
for (let y = 0; y < GRID_HEIGHT; y++) {
grid[y][0] = '|';
grid[y][GRID_WIDTH - 1] = '|';
}
grid[0][0] = '+';
grid[0][GRID_WIDTH - 1] = '+';
grid[GRID_HEIGHT - 1][0] = '+';
grid[GRID_HEIGHT - 1][GRID_WIDTH - 1] = '+';
// Draw shapes
for (const shape of shapes) {
const start = emuToGrid(shape.x, shape.y);
const end = emuToGrid(shape.x + shape.width, shape.y + shape.height);
// Clamp to grid bounds (inside border)
const x1 = Math.max(1, Math.min(start.x, GRID_WIDTH - 2));
const y1 = Math.max(1, Math.min(start.y, GRID_HEIGHT - 2));
const x2 = Math.max(1, Math.min(end.x, GRID_WIDTH - 2));
const y2 = Math.max(1, Math.min(end.y, GRID_HEIGHT - 2));
// Draw shape boundary
for (let x = x1; x <= x2; x++) {
if (y1 > 0 && y1 < GRID_HEIGHT - 1) grid[y1][x] = '-';
if (y2 > 0 && y2 < GRID_HEIGHT - 1) grid[y2][x] = '-';
}
for (let y = y1; y <= y2; y++) {
if (x1 > 0 && x1 < GRID_WIDTH - 1) grid[y][x1] = '|';
if (x2 > 0 && x2 < GRID_WIDTH - 1) grid[y][x2] = '|';
}
// Draw corners
if (y1 > 0 && x1 > 0) grid[y1][x1] = '+';
if (y1 > 0 && x2 < GRID_WIDTH - 1) grid[y1][x2] = '+';
if (y2 < GRID_HEIGHT - 1 && x1 > 0) grid[y2][x1] = '+';
if (y2 < GRID_HEIGHT - 1 && x2 < GRID_WIDTH - 1) grid[y2][x2] = '+';
// Draw shape ID in center
const centerX = Math.floor((x1 + x2) / 2);
const centerY = Math.floor((y1 + y2) / 2);
const label = `[${shape.id}]`;
if (centerY > 0 && centerY < GRID_HEIGHT - 1) {
for (let i = 0; i < label.length && centerX + i < GRID_WIDTH - 1; i++) {
grid[centerY][centerX + i] = label[i];
}
}
}
return grid.map(row => row.join('')).join('\n');
}
/**
* Generate shape legend
*/
function generateLegend(shapes) {
const lines = ['', 'Shapes:'];
lines.push('─'.repeat(70));
for (const shape of shapes) {
const pos = `(${emuToInches(shape.x)}", ${emuToInches(shape.y)}")`;
const size = `${emuToInches(shape.width)}" × ${emuToInches(shape.height)}"`;
const type = shape.phType ? `[${shape.phType}]` : '';
const text = shape.text ? `"${shape.text}..."` : '';
lines.push(`[${shape.id}] ${shape.name} ${type}`);
lines.push(` Position: ${pos} Size: ${size}`);
if (text) lines.push(` Text: ${text}`);
}
lines.push('─'.repeat(70));
lines.push(`Slide: ${emuToInches(SLIDE_WIDTH)}" × ${emuToInches(SLIDE_HEIGHT)}" (16:9)`);
return lines.join('\n');
}
function visualizeSlide(workDir, slideNum = 1) {
const absWork = path.resolve(workDir);
const slidePath = path.join(absWork, 'ppt', 'slides', `slide${slideNum}.xml`);
if (!fs.existsSync(slidePath)) {
throw new Error(`Slide not found: ${slidePath}`);
}
const slideXml = fs.readFileSync(slidePath, 'utf-8');
const shapes = extractShapes(slideXml);
console.log(`\nSlide ${slideNum} Layout:`);
console.log(renderGrid(shapes));
console.log(generateLegend(shapes));
return shapes;
}
// CLI execution
if (require.main === module) {
const args = process.argv.slice(2);
let workDir = null;
let slideNum = 1;
for (let i = 0; i < args.length; i++) {
if (args[i] === '--slide' && args[i + 1]) {
slideNum = parseInt(args[i + 1], 10);
i++; // Skip next arg
} else if (!args[i].startsWith('--')) {
workDir = args[i];
}
}
if (!workDir) {
console.error('Usage: node visualize-slide.js <working-directory> [--slide <n>]');
process.exit(1);
}
try {
visualizeSlide(workDir, slideNum);
} catch (err) {
console.error('Error:', err.message);
process.exit(1);
}
}
module.exports = { visualizeSlide, extractShapes };
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |