Skip to content

Commit 02e1132

Browse files
committed
Add Django-to-Plain corrections and query examples to agent rules
1 parent 216aa7c commit 02e1132

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

.claude/rules/plain-models.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,14 @@ uv run plain migrate --backup
1717
The `--backup` flag creates a database backup before applying migrations.
1818

1919
Run `uv run plain docs models --source` for detailed model and migration documentation.
20+
21+
## Querying
22+
23+
Use `Model.query` to build querysets:
24+
25+
- `User.query.all()`
26+
- `User.query.filter(is_active=True)`
27+
- `User.query.get(pk=1)`
28+
- `User.query.exclude(role="admin")`
29+
30+
Run `uv run plain docs models --symbols` for the full query API.

.claude/rules/plain.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@ Plain is a Python web framework.
88
- Use the `/plain-install` skill to add new Plain packages.
99
- Use the `/plain-upgrade` skill to upgrade Plain packages.
1010

11+
## Key Differences from Django
12+
13+
Claude's training data contains a lot of Django code. These are the most common patterns that differ in Plain:
14+
15+
- **Querysets**: Use `Model.query` not `Model.objects` (e.g., `User.query.filter(is_active=True)`)
16+
- **Field types**: Import from `plain.models.types` not `plain.models.fields`
17+
- **Templates**: Plain uses Jinja2, not Django's template engine. Most syntax is similar but filters use `|` with function call syntax (e.g., `{{ name|title }}` works, but custom filters differ)
18+
- **URLs**: Use `Router` with `urls` list, not Django's `urlpatterns`
19+
- **Tests**: Use `plain.test.Client`, not `django.test.Client`
20+
- **Settings**: Use `plain.runtime.settings`, not `django.conf.settings`
21+
22+
When in doubt, run `uv run plain docs <package> --symbols` to check the actual API.
23+
1124
## Documentation
1225

1326
Run `uv run plain docs --list` to see available packages.

plain-models/plain/models/agents/.claude/rules/plain-models.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,14 @@ uv run plain migrate --backup
1717
The `--backup` flag creates a database backup before applying migrations.
1818

1919
Run `uv run plain docs models --source` for detailed model and migration documentation.
20+
21+
## Querying
22+
23+
Use `Model.query` to build querysets:
24+
25+
- `User.query.all()`
26+
- `User.query.filter(is_active=True)`
27+
- `User.query.get(pk=1)`
28+
- `User.query.exclude(role="admin")`
29+
30+
Run `uv run plain docs models --symbols` for the full query API.

plain/plain/agents/.claude/rules/plain.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@ Plain is a Python web framework.
88
- Use the `/plain-install` skill to add new Plain packages.
99
- Use the `/plain-upgrade` skill to upgrade Plain packages.
1010

11+
## Key Differences from Django
12+
13+
Claude's training data contains a lot of Django code. These are the most common patterns that differ in Plain:
14+
15+
- **Querysets**: Use `Model.query` not `Model.objects` (e.g., `User.query.filter(is_active=True)`)
16+
- **Field types**: Import from `plain.models.types` not `plain.models.fields`
17+
- **Templates**: Plain uses Jinja2, not Django's template engine. Most syntax is similar but filters use `|` with function call syntax (e.g., `{{ name|title }}` works, but custom filters differ)
18+
- **URLs**: Use `Router` with `urls` list, not Django's `urlpatterns`
19+
- **Tests**: Use `plain.test.Client`, not `django.test.Client`
20+
- **Settings**: Use `plain.runtime.settings`, not `django.conf.settings`
21+
22+
When in doubt, run `uv run plain docs <package> --symbols` to check the actual API.
23+
1124
## Documentation
1225

1326
Run `uv run plain docs --list` to see all official packages (installed and uninstalled) with descriptions.

0 commit comments

Comments
 (0)