Skip to content
Back to skills

Core Python Best Practices

ASecurity

--> --- name: 'core-python-best-practices' description: 'Essential guidelines for writing modern, type-safe, and idiomatic Python 3 code.' measurable_outcome: Execute skill workflow successfully with valid output within 15 minutes. allowed-tools: - read_file - run_shell_command - write_file --- This skill defines the coding standards for Python development within the project. It emphasizes modern features, type safety, and readability.

  • 6 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 8, 2026
toolspythongoshellrefactoring

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add mdbabumiamssm/AI-Agentic-Skills-by-Dr.-Mia --skill Core_Python_Best_Practices --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Core Python Best Practices?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Core Python Best Practices
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mdbabumiamssm-core-python-best-practices-ai-agentic-skills-by-dr-mia/badge)](https://www.skillsdirectory.com/skills/mdbabumiamssm-core-python-best-practices-ai-agentic-skills-by-dr-mia)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
<!--
# COPYRIGHT NOTICE
# This file is part of the "Universal AI Agentic Skills" project.
# Copyright (c) 2026 MD BABU MIA, PhD <md.babu.mia@mssm.edu>
# All Rights Reserved.
#
# This code is proprietary and confidential.
# Unauthorized copying of this file, via any medium is strictly prohibited.
#
# Provenance: Authenticated by MD BABU MIA

-->

---
name: 'core-python-best-practices'
description: 'Essential guidelines for writing modern, type-safe, and idiomatic Python 3 code.'
measurable_outcome: Execute skill workflow successfully with valid output within 15 minutes.
allowed-tools:
  - read_file
  - run_shell_command
  - write_file
---


# Core Python Best Practices

This skill defines the coding standards for Python development within the project. It emphasizes modern features, type safety, and readability.

## When to Use This Skill

*   **New Scripts**: Starting a new agent or tool.
*   **Refactoring**: Modernizing legacy code.
*   **Library Design**: Creating reusable modules.

## Core Capabilities

1.  **Type Hinting**: Mandatory use of `typing` module or native types (Python 3.9+).
2.  **Data Classes**: Using `@dataclass` or `Pydantic` for data containers instead of raw dictionaries/tuples.
3.  **Modern Control Flow**: Using `match/case` (Python 3.10) where appropriate.
4.  **Error Handling**: Proper use of `try/except` chains and custom exceptions.

## Workflow

1.  **Define Interface**: Start with function signatures and type hints.
2.  **Select Structure**: Choose between a simple function, a class, or a dataclass.
3.  **Implement**: Write logic using list comprehensions and generators where possible.
4.  **Document**: Add docstrings (Google or NumPy style).

## Example Usage

**User**: "Write a function to process a list of users."

**Agent Action**:
1.  Reads `references/rules.md`.
2.  Generates:
    ```python
    from dataclasses import dataclass
    
    @dataclass
    class User:
        id: int
        name: str

    def process_users(users: list[User]) -> None:
        """Processes a list of users."""
        for user in users:
            ...
    ```


<!-- AUTHOR_SIGNATURE: 9a7f3c2e-MD-BABU-MIA-2026-MSSM-SECURE -->

Files in this skill

  • SKILL.md2.1 KB
  • references/rules.md2.1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…