Skip to content

Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.

fix: preflight packaging resource sizes before loading blobs

Rudy Celekli6c8e404ab5c9
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json
index 39ddc4c..68a230d 100644
--- a/.claude-plugin/marketplace.json
+++ b/.claude-plugin/marketplace.json
@@ -6,7 +6,7 @@
},
"metadata": {
"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, and growth",
- "version": "2.11.26",
+ "version": "2.11.27",
"repository": "https://github.com/coreyhaines31/marketingskills"
},
"plugins": [
diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json
index f1a5cf8..aabe26f 100644
--- a/.claude-plugin/plugin.json
+++ b/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "marketing-skills",
"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, ad creative, and growth",
- "version": "2.11.26",
+ "version": "2.11.27",
"author": {
"name": "Corey Haines"
},
diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json
index 45d9d89..9cd1f4c 100644
--- a/.codex-plugin/plugin.json
+++ b/.codex-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "marketing-skills",
"description": "Marketing skills for AI agents — conversion optimization, copywriting, SEO, paid ads, ad creative, and growth",
- "version": "2.11.26",
+ "version": "2.11.27",
"author": {
"name": "Corey Haines"
},
diff --git a/VERSIONS.md b/VERSIONS.md
index dc6d5ce..2f9e426 100644
--- a/VERSIONS.md
+++ b/VERSIONS.md
@@ -57,6 +57,10 @@ Current versions of all skills. Agents can compare against local versions to che
## Recent Changes
+### 2.11.27 (2026-10-10)
+
+- Reject oversized packaging resources before reading their contents into memory.
+
### 2.11.26 (2026-10-08)
- **lead-magnets** (2.0.0 → 2.1.0): new `references/content-to-skill.md` (plus corpus design and release companions) on packaging a course, webinar series, podcast, or newsletter archive you own as an installable agent skill: a new kind of lead magnet. From @rudycelekli's #725 (closes #432), folded in rather than added as a new skill. Triggers added: 'course as a skill,' 'package our content as an agent skill.' **ai-seo** (2.7.5 → 2.7.6) points to it.
diff --git a/scripts/package_skills.py b/scripts/package_skills.py
index bd2f327..2708923 100644
--- a/scripts/package_skills.py
+++ b/scripts/package_skills.py
@@ -90,6 +90,9 @@ def build(repo, output, target="source", skills=None, revision="HEAD", descripti
license_entry = files.get("LICENSE")
if not license_entry or license_entry[0] not in {"100644", "100755"}:
raise ValueError("A tracked regular LICENSE file is required")
+ license_size = int(git(repo, "cat-file", "-s", license_entry[2]))
+ if license_size > max_bytes:
+ raise ValueError("Bundle exceeds the configured uncompressed size bound: LICENSE")
license_data = git(repo, "cat-file", "blob", license_entry[2])
overrides = {}
@@ -109,6 +112,7 @@ def build(repo, output, target="source", skills=None, revision="HEAD", descripti
for name in selected:
prefix = f"skills/{name}/"
resources = {}
+ source_bytes = license_size
for path, (mode, kind, object_id) in files.items():
if not path.startswith(prefix):
continue
@@ -122,7 +126,15 @@ def build(repo, output, target="source", skills=None, revision="HEAD", descripti
raise ValueError(f"Unsafe resource path: {path}")
if mode not in {"100644", "100755"} or kind != "blob":
raise ValueError(f"Resource must be a tracked regular file: {path}")
- resources[relative] = (git(repo, "cat-file", "blob", object_id), mode, path)
+ # SKILL.md may shrink when the web description is replaced; the
+ # final packaged-size check below accounts for its actual bytes.
+ if relative != "SKILL.md" or target == "source":
+ source_bytes += int(git(repo, "cat-file", "-s", object_id))
+ if source_bytes > max_bytes:
+ raise ValueError(f"Bundle exceeds the configured uncompressed size bound: {name}")
+ resources[relative] = (object_id, mode, path)
+ resources = {relative: (git(repo, "cat-file", "blob", object_id), mode, path)
+ for relative, (object_id, mode, path) in resources.items()}
original = resources["SKILL.md"][0]
fields = metadata(original)
if fields["name"] != name:
diff --git a/tests/test_skill_packaging.py b/tests/test_skill_packaging.py
index 30a29b6..db4c7b9 100644
--- a/tests/test_skill_packaging.py
+++ b/tests/test_skill_packaging.py
@@ -5,6 +5,7 @@ import os
import subprocess
import tempfile
import unittest
+from unittest.mock import patch
import zipfile
from pathlib import Path
@@ -188,6 +189,43 @@ class PackagingTests(unittest.TestCase):
packager.build(self.repo, self.output, max_bytes=10)
self.assertFalse(self.output.exists())
+ def test_oversized_resource_is_rejected_before_blob_loading(self):
+ self.write("skills/sample/assets/large.bin", b"x" * 4096)
+ self.commit()
+ object_id = self.git("rev-parse", "HEAD:skills/sample/assets/large.bin").decode().strip()
+ original_git = packager.git
+ with patch.object(packager, "git", wraps=original_git) as calls:
+ with self.assertRaisesRegex(ValueError, "size bound"):
+ packager.build(self.repo, self.output, max_bytes=2048)
+ self.assertFalse(any(call.args[1:] == ("cat-file", "blob", object_id) for call in calls.call_args_list))
+ self.assertFalse(self.output.exists())
+
+ def test_oversized_license_is_rejected_before_blob_loading(self):
+ self.write("LICENSE", b"x" * 4096)
+ self.commit()
+ object_id = self.git("rev-parse", "HEAD:LICENSE").decode().strip()
+ with patch.object(packager, "git", wraps=packager.git) as calls:
+ with self.assertRaisesRegex(ValueError, "size bound"):
+ packager.build(self.repo, self.output, max_bytes=2048)
+ self.assertFalse(any(call.args[1:] == ("cat-file", "blob", object_id) for call in calls.call_args_list))
+ self.assertFalse(self.output.exists())
+
+ def test_oversized_source_skill_is_rejected_before_blob_loading(self):
+ self.write("skills/sample/SKILL.md", self.skill + b"x" * 4096)
+ self.commit()
+ object_id = self.git("rev-parse", "HEAD:skills/sample/SKILL.md").decode().strip()
+ with patch.object(packager, "git", wraps=packager.git) as calls:
+ with self.assertRaisesRegex(ValueError, "size bound"):
+ packager.build(self.repo, self.output, max_bytes=2048)
+ self.assertFalse(any(call.args[1:] == ("cat-file", "blob", object_id) for call in calls.call_args_list))
+ self.assertFalse(self.output.exists())
+
+ def test_web_metadata_shrink_uses_packaged_size_bound(self):
+ source = packager.build(self.repo, self.output)
+ limit = source["bundles"][0]["uncompressed_bytes"] - 100
+ web = packager.build(self.repo, self.output, target="claude-web", max_bytes=limit)
+ self.assertLessEqual(web["bundles"][0]["uncompressed_bytes"], limit)
+
def test_crlf_body_and_quoted_description_are_preserved(self):
original = self.skill.replace(b"\n", b"\r\n")
updated = packager.replace_description(original, "Quote: \"hello\" and café.")