src/dot-agents/skills/python-pybytesize/SKILL.md
Use for pybytesize/ByteSize tasks: parsing size strings, converting bytes to metric/binary units, formatting human-readable sizes, readable unit selection, block alignment, and ByteSize arithmetic. Triggers "pybytesize", "ByteSize", "format bytes", "human readable size", "MiB/MB", "GiB/GB", "bytes to string", "parse size string", or requests for block-aligned size calculations.
npx skillsauth add jjjermiah/dotagents python-pybytesizeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use pybytesize (imported as bytesize) to parse and manipulate byte sizes with consistent unit conversions and formatting. Provide concise, accurate examples that show how ByteSize objects behave with metric vs binary units.
Create a ByteSize from bytes or a size string and print a readable value.
from bytesize import ByteSize
size = ByteSize(1_048_576)
print(size) # 1.00 MiB
size = ByteSize("500MB")
print(size.bytes) # 500000000
print(size) # 476.84 MiB
Convert between metric and binary units using dynamic attributes.
from bytesize import ByteSize
size = ByteSize(1_073_741_824)
print(size.MB) # 1073.741824
print(size.MiB) # 1024.0
print(size.GiB) # 1.0
Pick a best-fit unit for display.
from bytesize import ByteSize
size = ByteSize(1_234_567)
unit, value = size.readable_metric
print(f"{value:.2f} {unit}") # 1.23 MB
unit, value = size.readable_binary
print(f"{value:.2f} {unit}") # 1.18 MiB
Format with precision and target units using format spec.
from bytesize import ByteSize
size = ByteSize(123_456_789)
print(f"{size:.2f:MB}") # 123.46 MB
print(f"{size:.2f:GiB}") # 0.11 GiB
Compute block-aligned apparent size.
from bytesize import ByteSize
size = ByteSize(123_456_789)
aligned = size.apparent_size(4096)
print(aligned.bytes) # 123457536
Arithmetic works on ByteSize objects and preserves units.
from bytesize import ByteSize
total = ByteSize("1GB") + ByteSize("512MB")
print(total) # 1.50 GiB
pybytesize provides specific exceptions you can catch for validation and UX.
from bytesize import (
ByteSize,
ByteSizeError,
NegativeByteSizeError,
UnrecognizedSizeStringError,
UnknownUnitError,
)
try:
size = ByteSize("not_a_size")
except UnrecognizedSizeStringError:
print("Could not parse size string")
try:
size = ByteSize("100XX")
except UnknownUnitError as e:
print(f"Unknown unit: {e}")
try:
size = ByteSize(-1000)
except NegativeByteSizeError as e:
print(f"Error: {e}")
try:
size = ByteSize("-50MB")
except ByteSizeError as e:
print(f"ByteSize error: {e}")
print(ByteSize(...)) defaults to a best-fit binary unit (base 1024).readable_metric uses base 1000, readable_binary uses base 1024; both return (unit, value).megabytes, gibibytes).apparent_size(block_bytes) requires block_bytes > 0; it raises ValueError otherwise.None.
development
Guides creation, validation, and packaging of AI agent skills with token-efficient design, progressive disclosure patterns, and YAML frontmatter best practices. Use when building new skills, updating existing skills, validating skill structure against standards, or packaging for distribution—e.g., "create skill", "validate SKILL.md", "package skill for sharing", "check description format".
tools
Investigate and integrate weakly documented SDK/library modules (especially Azure SDKs) into code. Use when asked to "investigate module", "SDK", "client class", or when docs are missing/weak and you need to discover APIs, models, or usage patterns to implement integration.
tools
Write production-ready one-off scripts and automation utilities with proper error handling and safety patterns. Use when developing bash automation, Python CLI tools, shell scripts, system administration scripts, or command-line batch processing—e.g., "write a script to process files", "python one-liner for data conversion", "bash automation for backups", "shell script with error handling".
development
R package testing with testthat 3rd edition. Use when writing R tests, fixing failing tests, debugging errors, or reviewing coverage—e.g., "write testthat tests", "fix failing R tests", "snapshot testing", "test coverage".