Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions agents/country-models/ci-fixer.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,16 @@ policyengine-core test policyengine_us/tests/policy/baseline/gov/states/ar/dhs/t

#### Linting/Formatting
```bash
# CRITICAL: Use uv run to ensure correct black version from uv.lock
# CRITICAL: Use uv run to ensure correct ruff version from uv.lock
# This matches CI exactly
uv sync --extra dev
uv run black . -l 79
uv run ruff format

# DO NOT use bare 'black' command - may use wrong version!
# DO NOT use bare 'ruff' command - may use wrong version!

# Commit formatting fixes
git add -A
git commit -m "Fix: Apply black formatting"
git commit -m "Fix: Apply ruff formatting"
git push
```

Expand Down Expand Up @@ -513,7 +513,7 @@ gh pr edit --add-reviewer @reviewer-username

## Common CI Issues and Fixes

### 1. Black Formatting
### 1. Ruff Formatting
**Error**: `would reformat file.py`
**Fix**: Run `make format` and commit

Expand Down
24 changes: 12 additions & 12 deletions agents/country-models/pr-pusher.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ This ensures you have the complete patterns and standards loaded for reference t
## CRITICAL: Version Sync

**Always use `uv run` for Python tools to ensure versions match CI:**
- `uv run black . -l 79` - NOT `black . -l 79`
- `uv run ruff format` - NOT `ruff format`
- `uv run isort .` - NOT `isort .`
- `uv run pytest` - NOT `pytest`

Expand Down Expand Up @@ -76,14 +76,14 @@ python -c "import yaml; yaml.safe_load(open('changelog_entry.yaml'))" || exit 1
### Step 2: Run Formatters

```bash
# CRITICAL: Use uv to ensure correct black version from uv.lock
# CRITICAL: Use uv to ensure correct ruff version from uv.lock
# This matches CI exactly - both use the pinned version

# First ensure dependencies are installed
uv sync --extra dev

# Format Python code using uv run to use locked version
uv run black . -l 79
uv run ruff format

# Also run linecheck if available
uv run linecheck . --fix 2>/dev/null || true
Expand All @@ -96,7 +96,7 @@ git add -A
if ! git diff --cached --quiet; then
git commit -m "Apply code formatting

- Run black with 79 char line length (from uv.lock)
- Run ruff format (from uv.lock)
- Fix import ordering
- Apply standard formatting rules"
fi
Expand All @@ -117,7 +117,7 @@ if grep -q "error:" lint_output.txt; then
autoflake --remove-all-unused-imports --in-place --recursive .

# Fix import order
isort . --profile black --line-length 79
isort . --profile ruff --line-length 79

# Commit fixes
git add -A
Expand Down Expand Up @@ -182,7 +182,7 @@ $DESCRIPTION

## Checklist
- [ ] Changelog entry added
- [ ] Code formatted with black
- [ ] Code formatted with ruff format
- [ ] Linting passes
- [ ] Tests pass locally
- [ ] CI checks pass
Expand Down Expand Up @@ -234,18 +234,18 @@ fi

```bash
# Fix with isort
isort . --profile black --line-length 79
isort . --profile ruff --line-length 79
```

### Black Formatting
### Ruff Formatting

```bash
# CRITICAL: Use uv run to ensure correct black version from uv.lock
# CRITICAL: Use uv run to ensure correct ruff version from uv.lock
# This ensures local formatting matches CI exactly
uv sync --extra dev # Ensure black is installed
uv run black . -l 79
uv sync --extra dev # Ensure ruff is installed
uv run ruff format

# DO NOT use bare 'black' command - it may use wrong version!
# DO NOT use bare 'ruff' command - it may use wrong version!
```

### Unused Imports
Expand Down
4 changes: 2 additions & 2 deletions agents/country-models/rules-engineer.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,8 @@ Run through the skill's Quick Checklist before finalizing.
# CRITICAL: Use uv run to ensure correct tool versions from uv.lock
uv sync --extra dev # Ensure all dev dependencies installed

# Format code using locked black version
uv run black . -l 79
# Format code using locked ruff version
uv run ruff format

# Run tests to verify implementation
uv run pytest policyengine_us/tests/policy/baseline/gov/states/STATE/ -v --maxfail=5
Expand Down
1 change: 1 addition & 0 deletions changelog.d/update-ruff-references.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update skill and agent references from black to ruff format.
2 changes: 1 addition & 1 deletion commands/encode-reform.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ Validate the reform implementation. Check this reform-specific checklist:
Also check standard code quality:
- Parameter metadata complete (unit, period, label, reference)
- Variable patterns correct (adds vs add(), entity levels)
- Code style (black formatting, import ordering)
- Code style (ruff formatting, import ordering)
- Reference format (title with full section, href with #page=XX)

Write {PREFIX}-checkpoint.md (≤15 lines):
Expand Down
12 changes: 6 additions & 6 deletions skills/documentation/policyengine-standards-skill/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: policyengine-standards
description: |
PolicyEngine coding standards, formatters, CI requirements, and development best practices.
Triggers: "CI failing", "linting", "formatting", "before committing", "PR standards", "code style", "black formatter", "prettier", "pre-commit"
Triggers: "CI failing", "linting", "formatting", "before committing", "PR standards", "code style", "ruff formatter", "prettier", "pre-commit"
---

# PolicyEngine Standards Skill
Expand Down Expand Up @@ -152,16 +152,16 @@ bun test -- --watch # Watch mode
## Python Standards

### Formatting
- **Formatter**: Black with 79-character line length
- **Command**: `make format` or `black . -l 79`
- **Check without changes**: `black . -l 79 --check`
- **Formatter**: Ruff
- **Command**: `make format` or `ruff format .`
- **Check without changes**: `ruff format --check .`

```bash
# Format all Python files
make format

# Check if formatting is needed (CI-style)
black . -l 79 --check
ruff format --check .
```

### Code Style
Expand Down Expand Up @@ -350,7 +350,7 @@ If the renamed repo is embedded in another site (e.g., via iframe or GitHub Page
## Resources

- **Main CLAUDE.md**: `/PolicyEngine/CLAUDE.md`
- **Python Style**: PEP 8, Black documentation
- **Python Style**: PEP 8, Ruff documentation
- **React Style**: Airbnb React/JSX Style Guide
- **Testing**: pytest documentation, Jest/RTL documentation
- **Writing Style**: See policyengine-writing-skill for blog posts, PR descriptions, and documentation
Expand Down
2 changes: 1 addition & 1 deletion skills/tools-and-apis/policyengine-core-skill/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,6 @@ sim.calculate("variable", period)

**Development standards:**
- Python 3.10-3.13
- Black formatting (79-char)
- Ruff formatting (79-char)
- Comprehensive tests
- No breaking changes without discussion