add-resource
/add-resource
Dodaje zasób REST do API Django REST Framework: model, migrację, admina, serializer, widoki, trasy i testy.
- Autor
- steamfield ↗
- Repozytorium
- stacks ↗
- Licencja
- Apache-2.0
- Ostatnia zmiana repozytorium
- 08.11.2026
Ocena i bezpieczeństwo
- Pliki w paczce
- 1
- Skrypty
- 0
- Komentarze HTML
- 0
- Adresy URL w SKILL.md
- 0
Brak sygnałów. Repozytorium zmienione 08.11.2026, bez odwołań do wycofanych modeli i API.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
Co robi i kiedy
Dodaje zasób REST do API Django REST Framework: model, migrację, admina, serializer, widoki, trasy i testy.
Oryginalny opis (EN)
Add a REST resource to this Django REST Framework API (model, migration, admin, serializer, viewset, routes, OpenAPI schema and tests). Use when the user asks for a new endpoint, a new kind of record the API stores, or a new app.
Jak działa
SKILL.md bez nagłówków drugiego poziomu · 16 linii, 235 słów
Podgląd SKILL.md
--- name: add-resource description: Add a REST resource to this Django REST Framework API (model, migration, admin, serializer, viewset, routes, OpenAPI schema and tests). Use when the user asks for a new endpoint, a new kind of record the API stores, or a new app. --- # Add a resource `notes/` is the shape to copy: `models.py`, `admin.py`, `serializers.py`, `views.py`, `urls.py`, `test_serializers.py` and `tests/test_notes_api.py`. Read them first. 1. New app: `uv run python manage.py startapp <app>`, delete the generated `tests.py` and `views.py` stub contents you won't use, add `"<app>"` to `INSTALLED_APPS`, add the app to the `paths:` list in `.claude/rules/django-api.md` and to `known-first-party` in `pyproject.toml`. 2. Model: fields, a `created_at = DateTimeField(auto_now_add=True)` (`CursorPage` orders by it, then id), `Meta.ordering`, `__str__`. Users are `ForeignKey(settings.AUTH_USER_MODEL, ...)`. 3. `make makemigrations`, read the generated file, then `make check-migrations`. Never write the migration by hand. 4. Register it in `admin.py` with `list_display` and `search_fields`. 5. Serializer: subclass `ResourceSerializer[<Model>]`, list `fields`, camelCase wire names with `source=`, `id` as a read-only `CharField`, limits in `extra_kwargs`, rules in `validate_<field>`. 6. Viewset: subclass `ResourceViewSet[<Model>]` with only the mixins it supports, `queryset`, `serializer_class`, `lookup_url_kwarg = "<resource>Id"`, `lookup_value_converter = "str"`, `get_success_headers` returning `Location`, and an `extend_schema_view` summary per action. Filters go in `filter_params` and `get_queryset`. 7. Routes: in `<app>/urls.py`, a `SimpleRouter(trailing_slash=False, use_regex_path=False)` registering the plural kebab-case noun; include it under `v1/` in `config/urls.py`. 8. `make openapi` and read the `openapi.json` diff: paths, parameter and schema names are public. 9. Tests: serializer rules beside the code, and `tests/test_<app>_api.py` with `pytestmark = pytest.mark.django_db`: create and read back through `Location`, list paging, each validation error, 404, a wrong method's 405 and `Allow`, each through `assert_error`. 10. `make format`, then `make lint typecheck coverage check-migrations check-openapi`.
Wersje
| Repozytorium | Wynik | Licencja |
|---|---|---|
| Ta strona · steamfield/stacks | 86 | Apache-2.0 |
| cyanheads/clinicaltrialsgov-mcp-server | 100 | Apache-2.0 |
| cyanheads/mcp-ts-core | 100 | Apache-2.0 |
| steamfield/stacks | 86 | Apache-2.0 |
| steamfield/stacks | 86 | Apache-2.0 |
Migawka bazy z 13.11.2026 · wersja paczki e682be508789 (skrót SHA-256 całej paczki)
Pobrania w ostatnich 30 dniach: 0 · ranking
Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.
Podobne skille
- 86add-model
Dodaje model Django wraz z migracją, panelem admina, formularzem, widokami, szablonami i testami. - 100django-expert
Buduje aplikacje Django i API w Django REST Framework: modele z indeksami, optymalizuje zapytania ORM i konfiguruje uwierzytelnianie JWT. - 100django
Pomaga zakładać projekty Django i pisać modele, widoki, adresy URL i admin, dodawać REST API w Django REST framework, uruchamiać migracje, konfigurować produkcję i pisać testy. - 100django-rest-framework-patterns
Prowadzi przez Django REST Framework: ViewSety i routery, granice serializerów, przepływ żądania, naprawę N+1 w get_queryset, drf-spectacular, django-filter, SimpleJWT i paginację. - 100django
Wspiera tworzenie niezawodnych aplikacji webowych i REST API w Django: ORM, modele, widoki klasowe, panel admina, migracje i Django REST Framework. - 100new-endpoint
Dodaje lub zmienia endpoint Django REST Framework w standardowy sposób: uprawnienia, stronicowanie, kontrola współbieżności i kontrakt OpenAPI.