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.

referencessolid-python.md

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

SOLID in Python

Guidance

  • Single responsibility: keep classes and functions focused.
  • Open/closed: extend behavior without rewriting consumers.
  • Liskov substitution: subclasses must be safely substitutable.
  • Interface segregation: avoid forcing clients to depend on unused methods.
  • Dependency inversion: depend on abstractions, not concrete details.

Bad Example

class User(Model):
    def __init__(self, username: str):
        self.username = username

    def deactivate(self):
        self.is_active = False
        self.save()


class Admin(User):
    def deactivate(self):
        raise RuntimeError("admin can not be deactivated!")

Good Example

class User(Model):
    def __init__(self, username: str):
        self.username = username

    def allow_deactivate(self) -> bool:
        return True

    def deactivate(self):
        self.is_active = False
        self.save()


class Admin(User):
    def allow_deactivate(self) -> bool:
        return False


def deactivate_users(users):
    for user in users:
        if not user.allow_deactivate():
            logger.info(
                f"user {user.username} does not allow deactivating, skip."
            )
            continue
        user.deactivate()

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