Command Palette

Search for a command to run...

Назад к скиллам
скилл № 14392

case-study-generator

This skill generates case study entries for intelligent textbook projects from GitHub repositories. Use this skill when adding a new case study to the case…

БесплатноБез исполняемых скриптов
dmccrearyот dmccreary★ 38 звёзд на GitHub

Установить case-study-generator в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Case Study Generator

Overview

This skill automates the creation of case study entries for the intelligent textbooks case studies page. Given a GitHub repository URL, it extracts project information, generates or processes a thumbnail image compressed to ~70KB, and creates a properly formatted markdown entry for docs/case-studies/index.md.

Workflow

Step 1: Gather Repository Information

Extract the following from the GitHub repository:

  1. Repository URL - The full GitHub URL provided by the user
  2. Repository name - Extract from URL (e.g., dmccreary/geometry-course)
  3. GitHub Pages URL - Derive from repo: https://{username}.github.io/{repo-name}
  4. Project title - Check for a clear title in README.md or use repo name
  5. Description - Extract from README.md (first paragraph or project description)
  6. Metrics — ALWAYS check for {BOOK_BASE}/docs/learning-graph/book-metrics.json first, in every repo, whether you're adding a brand-new case study or refreshing an existing one. Do not re-count by hand if this file exists.
    • Canonical source: docs/learning-graph/book-metrics.json (produced by the book-metrics tool, validated against book-metrics.schema.json). Its metrics object is the single source of truth shared with the README and LinkedIn skills, so the case-study card shows identical numbers:

      # After cloning/locating the repo for analysis:
      python3 -c "import json; m=json.load(open('docs/learning-graph/book-metrics.json'))['metrics']; \
      print(m['concepts'], m['chapters'], m['microsims'], m['glossaryTerms'], m['faqs'], m['words'])"
      

      Available keys include concepts, chapters, microsims, stories, glossaryTerms, faqs, quizQuestions, references, diagrams, equations, words, links, equivalentPages, developmentStage.

    • If working from a local workspace clone (~/Documents/ws/{repo-name}), check whether it's behind origin/main before trusting this file — a stale checkout reports stale metrics:

      git rev-list --left-right --count HEAD...origin/main   # "0  N" = N commits behind
      

      If it's behind and the working tree is clean, just git pull. If there are uncommitted local changes, don't discard them — git stash push -u, pull, read book-metrics.json, then git stash pop to restore the local work exactly as it was.

    • When updating an already-listed case study, re-read this file rather than reusing the numbers already on the card — the file exists precisely because a book's metrics change between visits, so treat the existing card's numbers as stale until confirmed otherwise.

    • Fallback only if book-metrics.json is absent:

      • File count: find docs -type f -name "*.md" | wc -l
      • Word count: find docs -type f -name "*.md" -exec cat {} \; | wc -w
      • MicroSim count: Count directories in docs/sims/
      • Glossary term count: Parse docs/glossary.md if exists

Use the gh CLI or direct GitHub API to fetch repository information:

# Get repo description
gh repo view {owner}/{repo} --json description

# Clone repo temporarily for analysis
gh repo clone {owner}/{repo} /tmp/{repo} -- --depth 1

Step 2: Obtain or Generate Thumbnail Image

Check for existing thumbnail options in priority order:

  1. Existing social card image - Check docs/img/ for social-card.png or similar
  2. README banner image - Parse README.md for header images
  3. Custom image provided by user - User may specify an image path
  4. Generate with AI - If no image exists, suggest generating one with an AI image tool

Place the source image in docs/case-studies/img/ with a filename matching the repo name:

  • Use kebab-case: geometry-course.jpg, deep-learning-course.jpg

Step 3: Compress Thumbnail Image

Compress the thumbnail to approximately 70KB for fast page loading.

For Initial Compression

Run the thumbnail compression script:

python3 src/compress-thumbnails.py docs/case-studies/img 70

This script:

  • Targets 70KB file size
  • Maintains minimum 400px width
  • Preserves aspect ratio
  • Creates .backup files for safety

For PNG to JPEG Conversion (if needed)

If PNG compression cannot achieve 70KB target, convert to JPEG:

python3 src/convert-png-to-jpg.py docs/case-studies/img 70

This script:

  • Converts PNG to JPEG format
  • Fills transparent areas with white background
  • Achieves better compression for photographic images
  • Removes original PNG after successful conversion

Manual Single-Image Compression

For compressing a single new image without affecting others:

from PIL import Image, ImageOps

def compress_single_image(input_path, output_path, target_kb=70, min_width=400):
    """Compress a single image to target size."""
    img = Image.open(input_path)
    img = ImageOps.exif_transpose(img)
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • references/entry-format.md

FAQ

Что делает скилл case-study-generator?

This skill generates case study entries for intelligent textbook projects from GitHub repositories. Use this skill when adding a new case study to the case studies index page, when the user provides a GitHub repo URL and wants to create a case study card entry. The skill handles repo analysis, thumbnail generation/compression, and markdown entry formatting.

Как установить скилл case-study-generator?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл case-study-generator запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить case-study-generator с