diff --git a/modules/home/claude-code/skills/article-extractor/SKILL.md b/modules/home/claude-code/skills/article-extractor/SKILL.md index 183c90d..7ad1f28 100644 --- a/modules/home/claude-code/skills/article-extractor/SKILL.md +++ b/modules/home/claude-code/skills/article-extractor/SKILL.md @@ -19,7 +19,13 @@ User wants to: ## Workflow +Extract article content and save it: + ```bash -@article-extractor@ "$URL" +CONTENT=$(@article-extractor@ "$URL") ``` +Then use the Write tool to save `$CONTENT` to the desired location with an appropriate filename. + +The script outputs clean markdown content to stdout. You decide where and how to save it based on the user's request. + diff --git a/modules/home/claude-code/skills/article-extractor/default.nix b/modules/home/claude-code/skills/article-extractor/default.nix index aa4c9ed..d9cf476 100644 --- a/modules/home/claude-code/skills/article-extractor/default.nix +++ b/modules/home/claude-code/skills/article-extractor/default.nix @@ -1,6 +1,5 @@ { writeShellApplication, curl, reader }: -# Inspired by https://github.com/michalparkola/tapestry-skills-for-claude-code/blob/main/article-extractor/SKILL.md writeShellApplication { name = "article-extractor"; @@ -9,26 +8,16 @@ writeShellApplication { text = '' URL="$1" + # Create unique temp file + TEMP_HTML=$(mktemp) + # Download HTML - curl -L "$URL" > /tmp/temp.html + curl -s -L "$URL" > "$TEMP_HTML" - # Extract article - reader /tmp/temp.html > /tmp/temp.txt - - # Get title from first line - TITLE=$(head -n 1 /tmp/temp.txt | sed 's/^# //') - - # Clean filename - FILENAME=$(echo "$TITLE" | tr '/:?"<>| ' '-' | cut -c 1-80 | sed 's/-*$//')".txt" - - # Save - mv /tmp/temp.txt "/tmp/$FILENAME" + # Extract and output article to stdout + reader "$TEMP_HTML" # Clean up - rm /tmp/temp.html - - # Show preview - echo "✓ Saved: /tmp/$FILENAME" - head -n 10 "/tmp/$FILENAME" + rm "$TEMP_HTML" ''; }