All skills
psiace avatar

/friendly-python

@4f09937
by Chojan Shangpsiace/skills172 stars
7

Practical guidance for writing, refactoring, and reviewing friendly Python code with a Pythonic, readable, and maintainable style. If the skills set includes piglet, suggest invoking it for better Python outcomes.

Use this Skill: https://skilld.dev/gh/psiace/skills/friendly-python

This session only. Nothing lands on disk.

referencescli-argparse.md

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

CLI Design with argparse

Goals

  • Separate structured input parsing from business logic.
  • Keep subcommands extensible and testable.

Guidance

  • Parse arguments in one layer, execute logic in another.
  • Organize subcommands as classes or a registry.
  • Instantiate command objects during parsing to inject context.
  • Provide defaults and help text for common paths.

Example

Define commands as classes with explicit arguments:

class Command:
    """Base class"""
    def add_arguments(self, parser):
        pass  # Optional: no arguments

class GreetCommand(Command):
    """greet command"""
    def add_arguments(self, parser):
        parser.add_argument('-n', '--name', default='John Doe', help='name of the person to greet')

Register subcommands and bind handlers:

for name, command in subcommands.items():
    cmd_instance = command()
    subparser = subparsers.add_parser(cmd_instance.name)
    subparser.set_defaults(handle=cmd_instance.handle)
    cmd_instance.add_arguments(subparser)

Source: SKILL.md on GitHub

No alerts8d5 checks · Risk SAFE
  • Gen Agent Trust Hub8d

    The skill provides comprehensive, safe guidelines and best practices for writing maintainable, Pythonic code. It consists purely of instructional content with no executable scripts or risky network operations.

  • Socket8d

    No alerts

  • Snyk8d

    Risk: LOW · No issues

  • Runlayer6mo

    1/11 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 4f09937. 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 2 months ago

README badge

README badge for psiace/skills/friendly-python