# Validate Code

> Run code validation checks (lint, format, type, docstring, doctest, test). Use when validating code quality after writing or modifying Python code. Use when this capability is needed.

- Skill: `tomevault-io/validate-code` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/validate-code`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/validate-code/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/validate-code

---


# Validate

Run code validation checks via a single centralized script. All checks run independently — a failure in one does not prevent others from running.

## Quick Reference

| 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` |

## Usage

```bash
# 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/
```

## Exit Codes

| Code | Meaning |
|------|---------|
| 0 | All selected checks passed |
| 1 | One or more checks failed |

## When to Use

- **After writing code** — run all checks to verify quality
- **After modifying code** — run checks scoped to changed files
- **Before committing** — run full validation as a final gate
- **During review** — verify code meets quality standards

## Mutation Commands (Not Part of Validation)

The validate script is **read-only** — it checks but does not modify files. For auto-fixing, use these commands directly:

```bash
uv run ruff check --fix <paths>   # auto-fix lint issues
uv run ruff format <paths>        # auto-format code
```

---
> Converted and distributed by [TomeVault](https://tomevault.io/claim/libertininick) — claim your Tome and manage your conversions.
<!-- tomevault:4.0:skill_md:2026-04-16 -->

