code-style

Enforce Python code style with black, flake8, and mypy.

561|190|Updated May 16, 2024
One-click install
npx skills add https://github.com/microsoft/semantic-link-labs --skill code-style-microsoft
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-style
Source: https://github.com/microsoft/semantic-link-labs/tree/main/.claude/skills/code-style
Command: npx skills add https://github.com/microsoft/semantic-link-labs --skill code-style-microsoft

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the need for maintaining high code quality, consistency, and adherence to project standards by automating code style checks and formatting.

Core Features & Use Cases

  • Code Formatting: Automatically formats Python code using black to ensure a consistent style.
  • Linting: Checks code for style violations and potential errors using flake8.
  • Type Checking: Verifies type correctness with mypy to catch type-related bugs early.
  • Use Case: Before committing code, run this Skill to automatically format your changes and ensure they meet the project's coding standards, preventing style-related review comments.

Quick Start

Use the code-style skill to format all Python files in the src and tests directories.

Frequently Asked Questions about code-style

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automatically format Python code to ensure consistent style before committing?

Automatically format Python code using the black tool to enforce consistent style across your project, preventing style-related review comments and ensuring adherence to project coding standards before you commit changes.

What is the best way to combine linting and type checking for a Python project?

Combining flake8 for linting and mypy for type checking provides comprehensive Python code analysis, catching both style violations and type-related bugs early in your development workflow.

Can I run flake8 and mypy together to check for style violations and type errors?

Yes, you can run flake8 and mypy together to check Python code for style violations and verify type correctness, facilitating comprehensive code analysis and correction across your development workflow.

Does automated Python code formatting work with existing project directories like src and tests?

Automated Python code formatting works with existing project directories like src and tests, applying black formatting and quality checks to all Python files within those specified paths.

Why should I use automated code style checks instead of manual formatting for Python?

Automated code style checks eliminate manual formatting effort, ensure consistent adherence to project standards, and catch type-related bugs early using mypy, preventing style-related review comments during development.