Install command
Provided
Claude Code PostToolUse hook recipe that runs an installed Python linter after Write/Edit tool calls touch a .py file.
Open the source and read safety notes before installing.
Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.
Decision playbook
Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.
0
78
—
No baseline selected
No major trust-signal divergence detected in the current selection.
Confirm ownership and provenance before trusting install instructions.
Source link availableRequired
Open the canonical repository and verify ownership.
Source provenance statusRequired
Marked as source-backed.
Metadata reviewed
Registry metadata indicates a reviewed listing.
Validate risk disclosures before installation or API wiring.
Safety notes presentRequired
Review the listed safety guidance before running commands.
Privacy notes presentRequired
Review data handling notes before connecting accounts or secrets.
Trust level risk gateRequired
Trust level does not block evaluation.
Check package metadata and artifact integrity signals.
Install payload available
Install or copy payload is available for review.
Package verification flag
No package verification flag provided.
Checksum metadata
No checksum provided for downloaded artifact.
Use compare context to validate trade-offs before adoption.
Compare tray has multiple entries
Add at least one more entry to compare trust differences.
Baseline comparison available
No baseline peer selected yet.
Diverging trust signals identified
No major trust-signal divergence found.
Setup at a glance
Copy-ready — paste the snippet to get started.
Install command
Provided
Config snippet
Provided
Copy snippet
Provided
Prerequisites
None
Platforms
1 listed
Difficulty
20/100
Adoption plan
Current risk score 16/100. Use staged verification before broader rollout.
Validate source and review signals before any execution.
Confirm source provenanceRequired
Source URL/provenance metadata is present.
Confirm metadata review state
Listing has review metadata.
Verify install payload
Install/config payload exists and can be inspected.
Confirm safety, privacy, and package integrity signals.
Review safety notesRequired
Safety notes are present.
Review privacy notesRequired
Privacy notes are present.
Verify package integrity metadata
No package verification/checksum metadata.
Adopt in controlled steps based on the selected plan.
Run in isolated sandbox firstRequired
Use a constrained sandbox and observe behavior across multiple tasks.
Roll out graduallyRequired
Roll out to a small cohort before wider usage.
Set monitoring and fallback
Define rollback path and monitor errors after adoption.
Evidence readiness
Required evidence gates are covered (5/6 signals complete).
Source repository/provenance is listed.
Required in this preset
Review metadata is present.
Required in this preset
Safety notes are present.
Required in this preset
Privacy notes are present.
Optional in this preset
Package integrity metadata is missing.
Optional in this preset
Install payload is available.
Required in this preset
Required evidence gates are covered for this preset.
Decision timeline
5/6 steps complete with no blocking gaps for this preset.
triage
Source/provenance metadata is available.
triage
Review metadata is available.
verify
Safety notes are available.
verify
Privacy notes are available.
verify
Package integrity metadata is missing.
rollout
Install payload is available.
No required blockers for this timeline preset.
Safety & privacy surface
3 safety and 2 privacy notes across 4 risk areas. Review closely: credentials & tokens.
#!/usr/bin/env bash
set -euo pipefail
INPUT="$(cat)"
FILE_PATH="$(printf '%s' "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // empty')"
if [ -z "$FILE_PATH" ] || [ "${FILE_PATH##*.}" != "py" ]; then
exit 0
fi
if [ ! -f "$FILE_PATH" ]; then
echo "Python linter hook skipped: file not found: $FILE_PATH"
exit 0
fi
if command -v pylint >/dev/null 2>&1; then
pylint "$FILE_PATH" --score=yes --reports=no --msg-template="{line}:{column}: {category}: {msg} ({symbol})"
elif command -v flake8 >/dev/null 2>&1; then
flake8 "$FILE_PATH" --max-line-length=88
elif command -v pycodestyle >/dev/null 2>&1; then
pycodestyle "$FILE_PATH" --max-line-length=88
else
echo "Python linter hook skipped: install pylint, flake8, or pycodestyle."
fi{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/python-linter-integration.sh"
}
]
}
]
}
}This hook runs after Claude Code successfully uses a matching file-editing tool.
It checks only edited .py files and uses the first available linter in this
order: pylint, flake8, then pycodestyle.
It does not install a linter for you, aggregate multiple tools, run ruff, or calculate historical quality trends. Install and configure the linter you want the hook to use before enabling it.
Create the hook script:
mkdir -p .claude/hooks
touch .claude/hooks/python-linter-integration.sh
chmod +x .claude/hooks/python-linter-integration.sh
Save the script from this entry to
.claude/hooks/python-linter-integration.sh.
Add this to .claude/settings.json for a project-wide hook, or to
~/.claude/settings.json for a personal hook:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/python-linter-integration.sh"
}
]
}
]
}
}
#!/usr/bin/env bash
set -euo pipefail
INPUT="$(cat)"
FILE_PATH="$(printf '%s' "$INPUT" | jq -r '.tool_input.file_path // .tool_input.path // empty')"
if [ -z "$FILE_PATH" ] || [ "${FILE_PATH##*.}" != "py" ]; then
exit 0
fi
if [ ! -f "$FILE_PATH" ]; then
echo "Python linter hook skipped: file not found: $FILE_PATH"
exit 0
fi
if command -v pylint >/dev/null 2>&1; then
pylint "$FILE_PATH" --score=yes --reports=no --msg-template="{line}:{column}: {category}: {msg} ({symbol})"
elif command -v flake8 >/dev/null 2>&1; then
flake8 "$FILE_PATH" --max-line-length=88
elif command -v pycodestyle >/dev/null 2>&1; then
pycodestyle "$FILE_PATH" --max-line-length=88
else
echo "Python linter hook skipped: install pylint, flake8, or pycodestyle."
fi
jq available on PATH so the script can read hook input JSON.pylint, flake8, or
pycodestyle.Verified on 2026-06-19:
PostToolUse.PostToolUse and the matcher
covers the edit tool names used by your Claude Code version.jq path for the edited file.Show that Python Linter Integration - Hooks is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.
[](https://heyclau.de/entry/hooks/python-linter-integration)Python Linter Integration - Hooks side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
Next steps differ across entries — use the actions in the table below to copy install commands and source links per resource.
| Field | Claude Code PostToolUse hook recipe that runs an installed Python linter after Write/Edit tool calls touch a .py file. Open dossier | A PostToolUse hook that reminds you to enable native query logging for PostgreSQL, Prisma, Sequelize, and TypeORM, and flags possible N+1 patterns when you edit SQL or data-access files. Open dossier | Lints Vue 3 components for Composition API best practices and common issues. Open dossier | A Claude Code hook that flags files exceeding complexity thresholds after you edit them — estimating cyclomatic complexity, line and function counts, and nesting depth (via ESLint's complexity rule and Radon). Open dossier |
|---|---|---|---|---|
| Next stepsDiffers | ||||
| Trust | ||||
| Review status | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed | ReviewedMaintainer reviewed |
| Package trust | Package not verified | Package not verified | Package not verified | Package not verified |
| Source provenance | Source-backed | Source-backed | Source-backed | Source-backed |
| Submitter | — | — | — | — |
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ | Safety ✓ Privacy ✓ |
| Brand | — | — | — | — |
| Category | hooks | hooks | hooks | hooks |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | JSONbored | JSONbored | JSONbored | JSONbored |
| Added | 2025-09-19 | 2025-10-19 | 2025-09-19 | 2025-09-19 |
| Platforms | Claude Code | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — | — |
| Safety notes | ✓Hooks run local shell commands automatically after matching tool calls; review the script before enabling it in a shared repository. The hook executes whichever supported linter is first available on PATH and can fail the hook if that linter exits non-zero. Project-level hooks in .claude/settings.json are shared through git, so treat hook configuration as executable project policy. | ✓Runs automatically after bash, write, or edit activity and inspects files that look like query, model, repository, DAO, or SQL files. Creates .claude/logs/query-performance.log and appends database command or file-analysis events. Uses grep-based heuristics for query warnings and should not be treated as proof of a performance defect. | ✓Runs automatically on its configured Claude Code hook event and executes shell logic that can read, modify, or delete files in your project (and may run builds, installs, or network calls); review the script and scope it to expected paths before enabling. | ✓Runs after edits to JS/TS/Python files and prints advisory warnings only; the line/function/brace counts are heuristics, not a substitute for ESLint or Radon run on the full project. |
| Privacy notes | ✓The hook reads the edited Python file path from Claude Code's hook JSON input and passes that path to local lint tools. Lint output may include source lines, file paths, comments, TODOs, and other local code details in the Claude Code session. | ✓Reads query-related source files and may print file paths, query patterns, and database command strings to local hook output. Stores analyzed file paths and database command text in .claude/logs/query-performance.log. Database command text may include connection names, database names, or other operational details if typed directly into the command. | ✓Receives Claude Code hook input (session metadata, file paths, and tool output) and reads local project files; review what the script logs or forwards to external services and keep credentials out of its output. | ✓Reads the contents of files you edit to compute complexity locally; it prints warnings to hook output and does not transmit code, but those messages can reveal file structure. |
| Prerequisites | — none listed | — none listed | — none listed | — none listed |
| Install | | — | | |
| Config | | | | |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Source-backed guides for putting this to work.
Master MCP server development from scratch.
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.