home / skills / michalparkola / tapestry-skills-for-claude-code / tapestry

tapestry skill

/tapestry

This skill extracts content from URLs (video, article, PDF) and automatically generates a concrete action plan to implement insights.

npx playbooks add skill michalparkola/tapestry-skills-for-claude-code --skill tapestry

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
12.3 KB
---
name: tapestry
description: Unified content extraction and action planning. Use when user says "tapestry <URL>", "weave <URL>", "help me plan <URL>", "extract and plan <URL>", "make this actionable <URL>", or similar phrases indicating they want to extract content and create an action plan. Automatically detects content type (YouTube video, article, PDF) and processes accordingly.
allowed-tools: Bash,Read,Write
---

# Tapestry: Unified Content Extraction + Action Planning

This is the **master skill** that orchestrates the entire Tapestry workflow:
1. Detect content type from URL
2. Extract content using appropriate skill
3. Automatically create a Ship-Learn-Next action plan

## When to Use This Skill

Activate when the user:
- Says "tapestry [URL]"
- Says "weave [URL]"
- Says "help me plan [URL]"
- Says "extract and plan [URL]"
- Says "make this actionable [URL]"
- Says "turn [URL] into a plan"
- Provides a URL and asks to "learn and implement from this"
- Wants the full Tapestry workflow (extract β†’ plan)

**Keywords to watch for**: tapestry, weave, plan, actionable, extract and plan, make a plan, turn into action

## How It Works

### Complete Workflow:
1. **Detect URL type** (YouTube, article, PDF)
2. **Extract content** using appropriate skill:
   - YouTube β†’ youtube-transcript skill
   - Article β†’ article-extractor skill
   - PDF β†’ download and extract text
3. **Create action plan** using ship-learn-next skill
4. **Save both** content file and plan file
5. **Present summary** to user

## URL Detection Logic

### YouTube Videos

**Patterns to detect:**
- `youtube.com/watch?v=`
- `youtu.be/`
- `youtube.com/shorts/`
- `m.youtube.com/watch?v=`

**Action:** Use youtube-transcript skill

### Web Articles/Blog Posts

**Patterns to detect:**
- `http://` or `https://`
- NOT YouTube, NOT PDF
- Common domains: medium.com, substack.com, dev.to, etc.
- Any HTML page

**Action:** Use article-extractor skill

### PDF Documents

**Patterns to detect:**
- URL ends with `.pdf`
- URL returns `Content-Type: application/pdf`

**Action:** Download and extract text

### Other Content

**Fallback:**
- Try article-extractor (works for most HTML)
- If fails, inform user of unsupported type

## Step-by-Step Workflow

### Step 1: Detect Content Type

```bash
URL="$1"

# Check for YouTube
if [[ "$URL" =~ youtube\.com/watch || "$URL" =~ youtu\.be/ || "$URL" =~ youtube\.com/shorts ]]; then
    CONTENT_TYPE="youtube"

# Check for PDF
elif [[ "$URL" =~ \.pdf$ ]]; then
    CONTENT_TYPE="pdf"

# Check if URL returns PDF
elif curl -sI "$URL" | grep -i "Content-Type: application/pdf" > /dev/null; then
    CONTENT_TYPE="pdf"

# Default to article
else
    CONTENT_TYPE="article"
fi

echo "πŸ“ Detected: $CONTENT_TYPE"
```

### Step 2: Extract Content (by Type)

#### YouTube Video

```bash
# Use youtube-transcript skill workflow
echo "πŸ“Ί Extracting YouTube transcript..."

# 1. Check for yt-dlp
if ! command -v yt-dlp &> /dev/null; then
    echo "Installing yt-dlp..."
    brew install yt-dlp
fi

# 2. Get video title
VIDEO_TITLE=$(yt-dlp --print "%(title)s" "$URL" | tr '/' '_' | tr ':' '-' | tr '?' '' | tr '"' '')

# 3. Download transcript
yt-dlp --write-auto-sub --skip-download --sub-langs en --output "temp_transcript" "$URL"

# 4. Convert to clean text (deduplicate)
python3 -c "
import sys, re
seen = set()
vtt_file = 'temp_transcript.en.vtt'
try:
    with open(vtt_file, 'r') as f:
        for line in f:
            line = line.strip()
            if line and not line.startswith('WEBVTT') and not line.startswith('Kind:') and not line.startswith('Language:') and '-->' not in line:
                clean = re.sub('<[^>]*>', '', line)
                clean = clean.replace('&amp;', '&').replace('&gt;', '>').replace('&lt;', '<')
                if clean and clean not in seen:
                    print(clean)
                    seen.add(clean)
except FileNotFoundError:
    print('Error: Could not find transcript file', file=sys.stderr)
    sys.exit(1)
" > "${VIDEO_TITLE}.txt"

# 5. Cleanup
rm -f temp_transcript.en.vtt

CONTENT_FILE="${VIDEO_TITLE}.txt"
echo "βœ“ Saved transcript: $CONTENT_FILE"
```

#### Article/Blog Post

```bash
# Use article-extractor skill workflow
echo "πŸ“„ Extracting article content..."

# 1. Check for extraction tools
if command -v reader &> /dev/null; then
    TOOL="reader"
elif command -v trafilatura &> /dev/null; then
    TOOL="trafilatura"
else
    TOOL="fallback"
fi

echo "Using: $TOOL"

# 2. Extract based on tool
case $TOOL in
    reader)
        reader "$URL" > temp_article.txt
        ARTICLE_TITLE=$(head -n 1 temp_article.txt | sed 's/^# //')
        ;;

    trafilatura)
        METADATA=$(trafilatura --URL "$URL" --json)
        ARTICLE_TITLE=$(echo "$METADATA" | python3 -c "import json, sys; print(json.load(sys.stdin).get('title', 'Article'))")
        trafilatura --URL "$URL" --output-format txt --no-comments > temp_article.txt
        ;;

    fallback)
        ARTICLE_TITLE=$(curl -s "$URL" | grep -oP '<title>\K[^<]+' | head -n 1)
        ARTICLE_TITLE=${ARTICLE_TITLE%% - *}
        curl -s "$URL" | python3 -c "
from html.parser import HTMLParser
import sys

class ArticleExtractor(HTMLParser):
    def __init__(self):
        super().__init__()
        self.content = []
        self.skip_tags = {'script', 'style', 'nav', 'header', 'footer', 'aside', 'form'}
        self.in_content = False

    def handle_starttag(self, tag, attrs):
        if tag not in self.skip_tags and tag in {'p', 'article', 'main'}:
            self.in_content = True

    def handle_data(self, data):
        if self.in_content and data.strip():
            self.content.append(data.strip())

    def get_content(self):
        return '\n\n'.join(self.content)

parser = ArticleExtractor()
parser.feed(sys.stdin.read())
print(parser.get_content())
" > temp_article.txt
        ;;
esac

# 3. Clean filename
FILENAME=$(echo "$ARTICLE_TITLE" | tr '/' '-' | tr ':' '-' | tr '?' '' | tr '"' '' | cut -c 1-80 | sed 's/ *$//')
CONTENT_FILE="${FILENAME}.txt"
mv temp_article.txt "$CONTENT_FILE"

echo "βœ“ Saved article: $CONTENT_FILE"
```

#### PDF Document

```bash
# Download and extract PDF
echo "πŸ“‘ Downloading PDF..."

# 1. Download PDF
PDF_FILENAME=$(basename "$URL")
curl -L -o "$PDF_FILENAME" "$URL"

# 2. Extract text using pdftotext (if available)
if command -v pdftotext &> /dev/null; then
    pdftotext "$PDF_FILENAME" temp_pdf.txt
    CONTENT_FILE="${PDF_FILENAME%.pdf}.txt"
    mv temp_pdf.txt "$CONTENT_FILE"
    echo "βœ“ Extracted text from PDF: $CONTENT_FILE"

    # Optionally keep PDF
    echo "Keep original PDF? (y/n)"
    read -r KEEP_PDF
    if [[ ! "$KEEP_PDF" =~ ^[Yy]$ ]]; then
        rm "$PDF_FILENAME"
    fi
else
    # No pdftotext available
    echo "⚠️  pdftotext not found. PDF downloaded but not extracted."
    echo "   Install with: brew install poppler"
    CONTENT_FILE="$PDF_FILENAME"
fi
```

### Step 3: Create Ship-Learn-Next Action Plan

**IMPORTANT**: Always create an action plan after extracting content.

```bash
# Read the extracted content
CONTENT_FILE="[from previous step]"

# Invoke ship-learn-next skill logic:
# 1. Read the content file
# 2. Extract core actionable lessons
# 3. Create 5-rep progression plan
# 4. Save as: Ship-Learn-Next Plan - [Quest Title].md

# See ship-learn-next/SKILL.md for full details
```

**Key points for plan creation:**
- Extract actionable lessons (not just summaries)
- Define a specific 4-8 week quest
- Create Rep 1 (shippable this week)
- Design Reps 2-5 (progressive iterations)
- Save plan to markdown file
- Use format: `Ship-Learn-Next Plan - [Brief Quest Title].md`

### Step 4: Present Results

Show user:
```
βœ… Tapestry Workflow Complete!

πŸ“₯ Content Extracted:
   βœ“ [Content type]: [Title]
   βœ“ Saved to: [filename.txt]
   βœ“ [X] words extracted

πŸ“‹ Action Plan Created:
   βœ“ Quest: [Quest title]
   βœ“ Saved to: Ship-Learn-Next Plan - [Title].md

🎯 Your Quest: [One-line summary]

πŸ“ Rep 1 (This Week): [Rep 1 goal]

When will you ship Rep 1?
```

## Complete Tapestry Workflow Script

```bash
#!/bin/bash

# Tapestry: Extract content + create action plan
# Usage: tapestry <URL>

URL="$1"

if [ -z "$URL" ]; then
    echo "Usage: tapestry <URL>"
    exit 1
fi

echo "🧡 Tapestry Workflow Starting..."
echo "URL: $URL"
echo ""

# Step 1: Detect content type
if [[ "$URL" =~ youtube\.com/watch || "$URL" =~ youtu\.be/ || "$URL" =~ youtube\.com/shorts ]]; then
    CONTENT_TYPE="youtube"
elif [[ "$URL" =~ \.pdf$ ]] || curl -sI "$URL" | grep -iq "Content-Type: application/pdf"; then
    CONTENT_TYPE="pdf"
else
    CONTENT_TYPE="article"
fi

echo "πŸ“ Detected: $CONTENT_TYPE"
echo ""

# Step 2: Extract content
case $CONTENT_TYPE in
    youtube)
        echo "πŸ“Ί Extracting YouTube transcript..."
        # [YouTube extraction code from above]
        ;;

    article)
        echo "πŸ“„ Extracting article..."
        # [Article extraction code from above]
        ;;

    pdf)
        echo "πŸ“‘ Downloading PDF..."
        # [PDF extraction code from above]
        ;;
esac

echo ""

# Step 3: Create action plan
echo "πŸš€ Creating Ship-Learn-Next action plan..."
# [Plan creation using ship-learn-next skill]

echo ""
echo "βœ… Tapestry Workflow Complete!"
echo ""
echo "πŸ“₯ Content: $CONTENT_FILE"
echo "πŸ“‹ Plan: Ship-Learn-Next Plan - [title].md"
echo ""
echo "🎯 Next: Review your action plan and ship Rep 1!"
```

## Error Handling

### Common Issues:

**1. Unsupported URL type**
- Try article extraction as fallback
- If fails: "Could not extract content from this URL type"

**2. No content extracted**
- Check if URL is accessible
- Try alternate extraction method
- Inform user: "Extraction failed. URL may require authentication."

**3. Tools not installed**
- Auto-install when possible (yt-dlp, reader, trafilatura)
- Provide install instructions if auto-install fails
- Use fallback methods when available

**4. Empty or invalid content**
- Verify file has content before creating plan
- Don't create plan if extraction failed
- Show preview to user before planning

## Best Practices

- βœ… Always show what was detected ("πŸ“ Detected: youtube")
- βœ… Display progress for each step
- βœ… Save both content file AND plan file
- βœ… Show preview of extracted content (first 10 lines)
- βœ… Create plan automatically (don't ask)
- βœ… Present clear summary at end
- βœ… Ask commitment question: "When will you ship Rep 1?"

## Usage Examples

### Example 1: YouTube Video (using "tapestry")

```
User: tapestry https://www.youtube.com/watch?v=dQw4w9WgXcQ

Claude:
🧡 Tapestry Workflow Starting...
πŸ“ Detected: youtube
πŸ“Ί Extracting YouTube transcript...
βœ“ Saved transcript: Never Gonna Give You Up.txt

πŸš€ Creating action plan...
βœ“ Quest: Master Video Production
βœ“ Saved plan: Ship-Learn-Next Plan - Master Video Production.md

βœ… Complete! When will you ship Rep 1?
```

### Example 2: Article (using "weave")

```
User: weave https://example.com/how-to-build-saas

Claude:
🧡 Tapestry Workflow Starting...
πŸ“ Detected: article
πŸ“„ Extracting article...
βœ“ Using reader (Mozilla Readability)
βœ“ Saved article: How to Build a SaaS.txt

πŸš€ Creating action plan...
βœ“ Quest: Build a SaaS MVP
βœ“ Saved plan: Ship-Learn-Next Plan - Build a SaaS MVP.md

βœ… Complete! When will you ship Rep 1?
```

### Example 3: PDF (using "help me plan")

```
User: help me plan https://example.com/research-paper.pdf

Claude:
🧡 Tapestry Workflow Starting...
πŸ“ Detected: pdf
πŸ“‘ Downloading PDF...
βœ“ Downloaded: research-paper.pdf
βœ“ Extracted text: research-paper.txt

πŸš€ Creating action plan...
βœ“ Quest: Apply Research Findings
βœ“ Saved plan: Ship-Learn-Next Plan - Apply Research Findings.md

βœ… Complete! When will you ship Rep 1?
```

## Dependencies

This skill orchestrates the other skills, so requires:

**For YouTube:**
- yt-dlp (auto-installed)
- Python 3 (for deduplication)

**For Articles:**
- reader (npm) OR trafilatura (pip)
- Falls back to basic curl if neither available

**For PDFs:**
- curl (built-in)
- pdftotext (optional - from poppler package)
  - Install: `brew install poppler` (macOS)
  - Install: `apt install poppler-utils` (Linux)

**For Planning:**
- No additional requirements (uses built-in tools)

## Philosophy

**Tapestry weaves learning content into action.**

The unified workflow ensures you never just consume content - you always create an implementation plan. This transforms passive learning into active building.

Extract β†’ Plan β†’ Ship β†’ Learn β†’ Next.

That's the Tapestry way.

Overview

This skill unifies content extraction and action planning for any URL. It detects the content type (YouTube, article, PDF), extracts the source text or transcript, then automatically generates a Ship-Learn-Next action plan. The workflow saves both the raw content file and a concise, multi-step implementation plan.

How this skill works

The skill first detects URL type using simple pattern checks and HTTP headers. It runs the appropriate extractor: YouTube transcripts via yt-dlp, HTML articles via reader/trafilatura or a fallback parser, and PDFs via download + pdftotext when available. After extraction it runs the Ship-Learn-Next planner to produce a 4–8 week, rep-based action plan and saves both files, then presents a summary and next-step prompt.

When to use it

  • You say: "tapestry <URL>", "weave <URL>", or similar intent to extract and plan
  • You have a YouTube video and want a transcript plus actionable tasks
  • You found an article or blog post you want turned into a repeatable learning quest
  • You have a PDF (paper/report) and need extracted text and a practical implementation plan
  • You want an end-to-end extractβ†’plan workflow without manual steps

Best practices

  • Provide a publicly accessible URL to avoid authentication failures
  • Prefer plain article or video links; PDFs should be direct links or return application/pdf
  • Review the first 10 lines of extracted content before acting on the plan
  • Commit to a specific date for Rep 1 when askedβ€”this improves follow-through
  • Install recommended tools (yt-dlp, reader/trafilatura, pdftotext) to maximize extraction quality
  • If extraction fails, try alternative extractor or provide the content file directly

Example use cases

  • User: "tapestry https://example.com/how-to-build-saas" β†’ extracts article and creates a 4-week build-and-test quest
  • User: "weave https://youtube.com/watch?v=..." β†’ downloads transcript and generates video-production practice reps
  • User: "help me plan https://example.com/research.pdf" β†’ downloads PDF, extracts text, and creates an applied-research implementation plan
  • User provides a blog post URL and asks to "make this actionable" β†’ returns saved content file plus Ship-Learn-Next Plan markdown
  • Fallback: user gives a complex site; skill attempts HTML extraction and reports if manual upload is needed

FAQ

What if the URL requires a login?

Extraction will likely fail. Provide a publicly accessible link or upload the file directly for extraction and planning.

Which file formats are supported?

Primary targets: YouTube videos, HTML articles, and PDFs. Other HTML pages are attempted with the article extractor as a fallback.

Can I skip automatic plan creation?

The workflow always creates a Ship-Learn-Next plan after successful extraction. You can ignore or discard it if you prefer.