Skip to content

Commit f27be97

Browse files
chore: llm instructions, ruff config
1 parent 6122fa8 commit f27be97

File tree

2 files changed

+112
-15
lines changed

2 files changed

+112
-15
lines changed

{{cookiecutter.project_slug}}/CLAUDE.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,37 @@
55
- Minimize inline comments
66
- Retain tabs, spaces, and encoding
77
- Fix linting errors before saving files.
8-
- Respect `.markdownlint.jsonc` rules for all markdown files
8+
- `markdownlint -c .markdownlint.jsonc --fix <MARKDOWN_FILE>`
99
- If under 50 lines of code (LOC), print the full function or class
1010
- If the token limit is close or it's over 50 LOC, print the line numbers and avoid comments altogether
1111
- Explain as much as possible in the chat unless asked to annotate (i.e., docstrings, newline comments, etc.)
1212

1313
## Build, Lint, and Test Commands
1414

15-
- Full test suite: `uv run pytest` or `task test`
16-
- Single test: `uv run pytest tests/test_filename.py::test_function_name`
17-
- Linting: `uv run ruff check --fix --respect-gitignore` or `task lint`
18-
- Formatting: `uv run ruff format --respect-gitignore` or `task format`
19-
- Check dependencies: `uv run deptry .` or `task deptry`
20-
- Pre-commit hooks: `pre-commit run --all-files` or `task pre-commit`
15+
| Operation | Direct Command | Task Shortcut |
16+
|:--------------------|:-----------------------------------------------------------|:------------------|
17+
| Full test suite | `uv run pytest` | `task test` |
18+
| Single test | `uv run pytest tests/test_filename.py::test_function_name` | - |
19+
| Linting | `uv run ruff --check --diff --respect-gitignore` | `task lint` |
20+
| Formatting | `uv run ruff format --respect-gitignore` | `task format` |
21+
| Check dependencies | `uv run deptry .` | - |
22+
| Pre-commit hooks | `pre-commit run --all-files` | `task pre-commit` |
2123

2224
## Code Style Guidelines
2325

24-
- **Formatting**: 4 spaces, 130-char line limit, LF line endings
25-
- **Imports**: Ordered by type, combined imports when possible
26-
- **Naming**: snake_case functions/vars, PascalCase classes, UPPERCASE constants
27-
- **Type Hints**: Use Optional for nullable params, pipe syntax for Union
28-
- **Error Handling**: Specific exception types, descriptive error messages
29-
- **File Structure**: Core logic in app/core/, utilities in app/utils/
30-
- **Docstrings**: Use double quotes for docstrings
31-
- **Tests**: Files in tests/, follow test_* naming convention
26+
- **Formatting**
27+
- 4 spaces, 130-char line limit, LF line endings
28+
- **Imports**
29+
- Ordered by type, combined imports when possible
30+
- **Naming**
31+
- snake_case functions/vars, PascalCase classes, UPPERCASE constants
32+
- **Type Hint**
33+
- Use Optional for nullable params, pipe syntax for Union
34+
- **Error Handling**
35+
- Specific exception types, descriptive error messages
36+
- **File Structure**
37+
- Core logic in app/core/, utilities in app/utils/
38+
- **Docstrings**
39+
- Use double quotes for docstrings
40+
- **Tests**
41+
- Files in tests/, follow test_* naming convention
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Fix without reporting on leftover violations
2+
fix-only = true
3+
4+
# Enumerate all fixed violations
5+
show-fixes = true
6+
7+
# Indent width (default: 4)
8+
indent-width = 4
9+
10+
# Black (default: 88)
11+
line-length = 130
12+
13+
# Exclude a variety of commonly ignored directories.
14+
exclude = [
15+
".bzr",
16+
".direnv",
17+
"dist",
18+
".eggs",
19+
".git",
20+
".git-rewrite",
21+
".hg",
22+
".mypy_cache",
23+
".nox",
24+
".pants.d",
25+
"__pycache__",
26+
".pytype",
27+
".ruff_cache",
28+
".svn",
29+
".tox",
30+
".venv",
31+
"__pypackages__",
32+
"_build",
33+
"buck-out",
34+
"build",
35+
"dist",
36+
"node_modules",
37+
"venv",
38+
]
39+
40+
# Assume Python 3.13
41+
target-version = "py313"
42+
43+
[format]
44+
# Use spaces instead of tabs
45+
indent-style = "space"
46+
47+
# Use `\n` line endings for all files
48+
line-ending = "lf"
49+
50+
# Set quote style for strings
51+
quote-style = "preserve"
52+
53+
[lint]
54+
select = [
55+
# pycodestyle
56+
"E",
57+
# Pyflakes
58+
"F",
59+
# pyupgrade
60+
"UP",
61+
# flake8-bugbear
62+
"B",
63+
# flake8-simplify
64+
"SIM",
65+
# isort
66+
"I",
67+
]
68+
ignore = ["D203", "E203", "E251", "E266", "E401", "E402", "E501", "F401", "F403", "F841"]
69+
70+
# Allow unused variables when underscore-prefixed.
71+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
72+
73+
# Allow autofix for all enabled rules (when `--fix`) is provided.
74+
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TID", "TRY", "UP", "YTT"]
75+
76+
[lint.isort]
77+
combine-as-imports = true
78+
from-first = false
79+
no-sections = true
80+
order-by-type = true
81+
82+
[lint.flake8-quotes]
83+
docstring-quotes = "double"
84+
85+
[lint.mccabe]
86+
# Unlike Flake8, default to a complexity level of 10.
87+
max-complexity = 10

0 commit comments

Comments
 (0)