---
title: "Python 钩子"
description: "> 本文档扩展了 [common/hooks.md](../common/hooks.md) 中关于 Python 的特定内容。"
type: skill
canonical_url: https://claudary.paisolsolutions.com/skills/hooks-16
source: "Claudary"
difficulty: intermediate
author: "Claude Code Knowledge Pack"
date: 2026-07-10T11:25:13.385Z
license: CC-BY-4.0
attribution: "Python 钩子 — Claudary (https://claudary.paisolsolutions.com/skills/hooks-16)"
---

# Python 钩子
> 本文档扩展了 [common/hooks.md](../common/hooks.md) 中关于 Python 的特定内容。

## Overview

---
paths:
  - "**/*.py"
  - "**/*.pyi"
---

# Python 钩子

> 本文档扩展了 [common/hooks.md](../common/hooks.md) 中关于 Python 的特定内容。

## PostToolUse 钩子

在 `~/.claude/settings.json` 中配置：

* **black/ruff**：编辑后自动格式化 `.py` 文件
* **mypy/pyright**：编辑 `.py` 文件后运行类型检查

## 警告

* 对编辑文件中的 `print()` 语句发出警告（应使用 `logging` 模块替代）

---

Source: [Claudary](https://claudary.paisolsolutions.com/skills/hooks-16) · https://claudary.paisolsolutions.com
