All skills
psiace avatar

/piglet

@aafd21d
by Chojan Shangpsiace/skills172 stars
7

Practical Python craftsmanship guidance based on One Python Craftsman. Use when writing, refactoring, or reviewing Python code for naming, branching, data structures, functions, exceptions, loops, decorators, imports, file I/O, edge cases, and modern syntax choices. If the skills set includes friendly-python, suggest invoking it for better Python outcomes.

Use this Skill: https://skilld.dev/gh/psiace/skills/piglet

This session only. Nothing lands on disk.

referencesfunctions-and-returns.md

≈327 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Functions and Returns

Guidance

  • A function should have a single responsibility and a stable return type.
  • Avoid returning error tuples in Python; raise exceptions instead.
  • Use partial or small wrapper functions when you need specialized behavior.

Bad Example

def get_users(user_id=None):
    if user_id is not None:
        return User.get(user_id)
    return User.filter(is_active=True)

Good Example

def get_user_by_id(user_id):
    return User.get(user_id)


def get_active_users():
    return User.filter(is_active=True)

Bad Example

def create_item(name):
    if len(name) > MAX_LENGTH_OF_NAME:
        return None, "name of item is too long"
    if len(CURRENT_ITEMS) > MAX_ITEMS_QUOTA:
        return None, "items quota is full"
    return Item(name=name), ""

Good Example

class CreateItemError(Exception):
    """Raised when an item cannot be created."""


def create_item(name):
    if len(name) > MAX_LENGTH_OF_NAME:
        raise CreateItemError("name of item is too long")
    if len(CURRENT_ITEMS) > MAX_ITEMS_QUOTA:
        raise CreateItemError("items quota is full")
    return Item(name=name)

Source: SKILL.md on GitHub

No alerts8d4 checks · Risk SAFE
  • Gen Agent Trust Hub8d

    The 'piglet' skill provides Python craftsmanship guidance and code examples based on the 'One Python Craftsman' repository. It contains no malicious patterns, unauthorized network operations, or security vulnerabilities.

  • Socket8d

    No alerts

  • Snyk8d

    Risk: LOW · No issues

  • Runlayer7mo

    1/14 files flagged

Signed by skilld at aafd21d. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last month.

Activeupdated 8 months ago

README badge

README badge for psiace/skills/piglet