SO

source-coding

Applies mathematical proofs and algorithms for source coding problems in information theory.

Install

mkdir -p .claude/skills/source-coding && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/7084" && unzip -o skill.zip -d .claude/skills/source-coding && rm skill.zip

Installs to .claude/skills/source-coding

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Problem-solving strategies for source coding in information theory
66 charsno explicit “when” trigger
Advanced

Key capabilities

  • Verify Kraft inequality for prefix-free codes
  • Calculate expected code length
  • Optimize rate-distortion thresholds
  • Prove Shannon bounds
  • Implement Huffman coding

How it works

The skill uses scripts like z3_solve.py and sympy_compute.py to solve information theory problems, verify inequalities, and optimize compression parameters.

Inputs & outputs

You give it
Probability distribution or code lengths
You get back
Mathematical proof or optimal code structure

When to use source-coding

  • Calculating expected code length
  • Verifying the Kraft inequality
  • Optimizing rate-distortion thresholds

About this skill

Source Coding

When to Use

Use this skill when working on source-coding problems in information theory.

Decision Tree

  1. Source Coding Theorem

    • Minimum average code length >= H(X)
    • Achievable with optimal codes
    • z3_solve.py prove "shannon_bound"
  2. Huffman Coding

    • Optimal prefix-free code for known distribution
    • Build tree: combine two least probable symbols
    • Average length: H(X) <= L < H(X) + 1
    • sympy_compute.py simplify "expected_code_length"
  3. Kraft Inequality

    • For prefix-free code: sum 2^{-l_i} <= 1
    • Necessary and sufficient
    • z3_solve.py prove "kraft_inequality"
  4. Arithmetic Coding

    • Approaches entropy for any distribution
    • Encodes entire message as interval [0,1)
    • Practical for adaptive/unknown distributions
  5. Rate-Distortion Theory

    • Lossy compression: trade rate for distortion
    • R(D) = min_{p(x_hat|x): E[d(X,X_hat)]<=D} I(X;X_hat)
    • Minimum rate to achieve distortion D
    • sympy_compute.py minimize "I(X;X_hat)" --constraint "E[d] <= D"

Tool Commands

Scipy_Huffman

uv run python -c "print('Huffman codes for a=0.5, b=0.25, c=0.125, d=0.125: a=0, b=10, c=110, d=111')"

Sympy_Kraft

uv run python -m runtime.harness scripts/sympy_compute.py simplify "2**(-l1) + 2**(-l2) + 2**(-l3) + 2**(-l4)"

Z3_Shannon_Bound

uv run python -m runtime.harness scripts/z3_solve.py prove "expected_length >= entropy"

Key Techniques

From indexed textbooks:

  • [Elements of Information Theory] Elements of Information Theory -- Thomas M_ Cover & Joy A_ Thomas -- 2_, Auflage, New York, NY, 2012 -- Wiley-Interscience -- 9780470303153 -- 2fcfe3e8a16b3aeefeaf9429fcf9a513 -- Anna’s Archive. The Shannon–Fano–Elias coding procedure can also be applied to sequences of random variables. The key idea is to use the cumulative distribution function of the sequence, expressed to the appropriate accuracy, as a code for the sequence.
  • [Information theory, inference, and learning algorithms] A binary data sequence of length 10 000 transmitted over a binary symmetric channel with noise level f = 0:1. Dilbert image Copyright c Syndicate, Inc. The physical solution is to improve the physical characteristics of the commu- nication channel to reduce its error probability.
  • [Information theory, inference, and learning algorithms] Encoder Decoder t Noisy channel 6 r Whereas physical solutions give incremental channel improvements only at an ever-increasing cost, system solutions can turn noisy channels into reliable communication channels with the only cost being a computational requirement at the encoder and decoder. Coding theory is concerned with the creation of practical encoding and We now consider examples of encoding and decoding systems. What is the simplest way to add useful redundancy to a transmission?

Cognitive Tools Reference

See .claude/skills/math-mode/SKILL.md for full tool documentation.

When not to use it

  • When solving non-information theory problems
  • When manual calculation is preferred over automated scripts

Limitations

  • Limited to information theory source coding problems

How it compares

It automates the verification of theorems and code construction instead of requiring manual derivation.

Compared to similar skills

source-coding side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
source-coding (this skill)17moReviewAdvanced
jupyter-notebook306moReviewIntermediate
obspy-data-api16moNo flagsIntermediate
biopython17moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

jupyter-notebook

davila7

Use when the user asks to create, scaffold, or edit Jupyter notebooks (`.ipynb`) for experiments, explorations, or tutorials; prefer the bundled templates and run the helper script `new_notebook.py` to generate a clean starting notebook.

30158

obspy-data-api

benchflow-ai

An overview of the core data API of ObsPy, a Python framework for processing seismological data. It is useful for parsing common seismological file formats, or manipulating custom data into standard objects for downstream use cases such as ObsPy's signal processing routines or SeisBench's modeling API.

12

biopython

davila7

Primary Python toolkit for molecular biology. Preferred for Python-based PubMed/NCBI queries (Bio.Entrez), sequence manipulation, file parsing (FASTA, GenBank, FASTQ, PDB), advanced BLAST workflows, structures, phylogenetics. For quick BLAST, use gget. For direct REST API, use pubmed-database.

10

graph-algorithms

parcadei

Problem-solving strategies for graph algorithms in graph number theory

10

rlm

brainqub3

Run a Recursive Language Model-style loop for long-context tasks. Uses a persistent local Python REPL and an rlm-subcall subagent as the sub-LLM (llm_query).

10

tooluniverse-sdk

mims-harvard

Build AI scientist systems using ToolUniverse Python SDK for scientific research. Use when users need to access 1000++ scientific tools through Python code, create scientific workflows, perform drug discovery, protein analysis, genomics analysis, literature research, or any computational biology task. Triggers include requests to use scientific tools programmatically, build research pipelines, analyze biological data, search literature, predict drug properties, or create AI-powered scientific workflows.

01

Search skills

Search the agent skills registry