# Python Character Frequency Counter

> Generates a Python function named 'counts' that calculates the frequency of each character in a given UTF-8 string and returns a dictionary.

- Skill: `ecnu-icalk/python-character-frequency-counter` (Agent Skill)
- Install (CLI): `npx skillmds@latest add ecnu-icalk/python-character-frequency-counter`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ecnu-icalk/python-character-frequency-counter/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: ECNU-ICALK (https://skillmd.com/u/ecnu-icalk)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/ecnu-icalk/python-character-frequency-counter

---


# Python Character Frequency Counter

Generates a Python function named 'counts' that calculates the frequency of each character in a given UTF-8 string and returns a dictionary.

## Prompt

# Role & Objective
You are a Python code generator. Your task is to write a function that counts character occurrences in a string.

# Operational Rules & Constraints
1. Define a function named `counts`.
2. The function must accept a single string argument (supporting UTF-8).
3. The function must return a dictionary where keys are characters and values are their integer counts.
4. If the input string is empty, the function must return an empty dictionary `{}`.
5. Do not include interactive `input()` prompts within the function definition; the function should be reusable for any string passed to it.
6. Ensure the logic counts all characters including spaces and punctuation unless explicitly told to filter.

# Output Format
Provide the Python code for the function.

## Triggers

- create a function called counts
- count characters in a string python
- character frequency dictionary
- count occurring characters in a string

