一键导入
validate-code
Run code validation checks (lint, format, type, docstring, doctest, test). Use when validating code quality after writing or modifying Python code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Run code validation checks (lint, format, type, docstring, doctest, test). Use when validating code quality after writing or modifying Python code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Google-style docstring conventions for Python code. Apply when writing or reviewing functions, classes, or modules that need documentation.
Python naming conventions for this codebase. Apply when writing or reviewing Python code including functions, classes, variables, and constants.
Python type hint conventions for this codebase. Apply when writing or reviewing Python code that needs type annotations on functions, classes, or variables.
Essential Pythonic idioms and conventions. Apply when writing or reviewing Python code to ensure idiomatic patterns like comprehensions, built-in functions, context managers, and unpacking.
Python code organization conventions for this codebase. Apply when structuring modules, organizing imports, designing file layouts, or moving functions/classes within or between files. Use PROACTIVELY when users request to check code organization, move code, or clean up and reorganize a module.
Refactoring complex functions into smaller, pure helper functions. Apply when function complexity is exceeded or when extracting helper functions during refactoring. If tasked with fixing ruff lint errors related to complexity, ALWAYS trigger this skill.
| name | validate-code |
| description | Run code validation checks (lint, format, type, docstring, doctest, test). Use when validating code quality after writing or modifying Python code. |
| user-invocable | true |
| argument-hint | [--lint] [--format] [--type] [--docstring] [--doctest] [--test] [paths...] |
Run code validation checks via a single centralized script. All checks run independently — a failure in one does not prevent others from running.
| Flag | Check | Underlying Command |
|---|---|---|
--lint | Linting | uv run ruff check |
--format | Formatting | uv run ruff format --check |
--type | Type checking | uv run ty check |
--docstring | Docstrings | uv tool run pydoclint --style=google --allow-init-docstring=True |
--doctest | Doctest examples | uv run pytest --doctest-modules |
--test | Tests + coverage | uv run pytest --cov |
# Run all checks on project root
uv run .claude/scripts/validate_code.py
# Run specific checks
uv run .claude/scripts/validate_code.py --lint --type
# Run on specific path
uv run .claude/scripts/validate_code.py --lint src/chain_reaction/
# Run on specific file
uv run .claude/scripts/validate_code.py --docstring src/chain_reaction/utils/parser.py
# Run tests on specific directory
uv run .claude/scripts/validate_code.py --test tests/unit/
| Code | Meaning |
|---|---|
| 0 | All selected checks passed |
| 1 | One or more checks failed |
The validate script is read-only — it checks but does not modify files. For auto-fixing, use these commands directly:
uv run ruff check --fix <paths> # auto-fix lint issues
uv run ruff format <paths> # auto-format code