diff --git a/.claude/commands/commit-push-pr.md b/.claude/commands/commit-push-pr.md new file mode 100644 index 000000000..0a624d60a --- /dev/null +++ b/.claude/commands/commit-push-pr.md @@ -0,0 +1,19 @@ +--- +allowed-tools: Bash(git checkout --branch:*), Bash(git add:*), Bash(git status:*), Bash(git push:*), Bash(git commit:*), Bash(gh pr create:*) +description: Commit, push, and open a PR +--- + +## Context + +- Current git status: !`git status` +- Current git diff (staged and unstaged changes): !`git diff HEAD` +- Current branch: !`git branch --show-current` + +## Your task + +Based on the above changes: +1. Create a new branch if on main +2. Create a single commit with an appropriate message +3. Push the branch to origin +4. Create a pull request using `gh pr create` +5. You have the capability to call multiple tools in a single response. You MUST do all of the above in a single message. Do not use any other tools or do anything else. Do not send any other text or messages besides these tool calls. diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 000000000..43d45b334 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,28 @@ +{ + "permissions": { + "allow": [ + "Bash(find:*)", + "Bash(make check:*)", + "Bash(make test:*)", + "Bash(make docs:*)", + "Bash(git fetch:*)", + "Bash(git commit:*)", + "Bash(git reset:*)", + "Bash(gh api:*)", + "Bash(git ls-tree:*)" + ] + }, + "hooks": { + "PostToolUse": [ + { + "matcher": "Write|Edit", + "hooks": [ + { + "type": "command", + "command": "make format" + } + ] + } + ] + } +} diff --git a/CLAUDE.md b/CLAUDE.md index 563d178c3..f46f63876 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,35 +1,40 @@ -# Developer Guide +# Development Workflow -## Commands +**Always use `uv run`, not python**. -Use `make` for common workflows: +```sh -```bash -make format # Format and lint -make type # Format, lint, and type-check -make test-fast # Run tests excluding slow ones -make test # Run the full test suite -make docs # Build documentation -``` +# 1. Make changes. + +# 2. Type check. +uv run ty check # Fast +uv run pyright # More thorough, but slower -You can also run individual commands directly with `uv`: +# 3. Run tests. +uv run pytest tests/ # Single suite +uv run pytest tests/.py # Specific file -```bash -uv run pytest tests/.py # Run a specific test file -uv run ty check # Run the ty type checker (faster) -uv run pyright # Run the pyright type checker (slower) +# 4. Format and lint before committing. +uv run ruff format +uv run ruff check --fix ``` -## General Guidelines +We've bundled common commands into a Makefile for convenience. -- Run `make check` frequently to format, lint, and type-check your code. This catches many issues before tests are executed. -- Before finalizing changes, run `make test-fast` to ensure nothing is broken. +```sh +make format # Format and lint +make type # Type-check +make check # make format && make type +make test-fast # Run tests excluding slow ones +make test # Run the full test suite +make docs # Build documentation +``` -## Style Guidelines +Before creating a PR, ensure all checks pass with `make test`. -- General - - Avoid local imports unless they are strictly necessary (e.g. circular imports). -- Tests +Some style guidelines to follow: +- Avoid local imports unless they are strictly necessary (e.g. circular imports). +- Tests should follow these principles: - Use functions and fixtures; do not use test classes. - Favor targeted, efficient tests over exhaustive edge-case coverage. - Prefer running individual tests rather than the full test suite to improve iteration speed.