Awesome-claude-code s1-api-conventions
Python API coding conventions for this BookStore project. Use when writing or reviewing Python code.
install
source · Clone the upstream repo
git clone https://github.com/pgagarinov/awesome-claude-code
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/pgagarinov/awesome-claude-code "$T" && mkdir -p ~/.claude/skills && cp -r "$T/examples/05-skills-n-agents/.claude/skills/s1-api-conventions" ~/.claude/skills/pgagarinov-awesome-claude-code-s1-api-conventions && rm -rf "$T"
manifest:
examples/05-skills-n-agents/.claude/skills/s1-api-conventions/SKILL.mdsource content
S1 — BookStore API Conventions
Follow these conventions when writing or reviewing Python code in this project.
Data Models
- Use
for all models@dataclass(slots=True) - Store monetary values as
in cents (e.g.,int
)price_cents: int - Use
for mutable defaultsfield(default_factory=list) - Type-annotate every field using modern syntax (
, notstr | None
)Optional[str]
API Functions
- All public API functions return
(not dataclass instances)dict - Include a
key in mutation responses ("status"
,"created"
,"updated"
)"deleted" - Use
with a verb prefix:snake_case
,create_book
,get_authorlist_books - Private helpers start with underscore:
,_to_dict_validate_input
Docstrings
Every public function must have a docstring with:
"""One-line summary. Args: param_name: Description. Returns: Description of return value. Raises: ValueError: When and why. """
Error Handling
- Raise
for invalid inputs (bad data from the caller)ValueError - Raise
for missing resources (not found)KeyError - Never silently swallow exceptions
Imports
- Standard library first, then third-party, then local
- Use absolute imports:
from models.book import Book - No wildcard imports