agentleFS
MindrallyMindrally/skills/rest-api-django/SKILL.md

rest-api-django

Skill275 starsChanged 53 days agoApache-2.0View on GitHub

Comprehensive guidelines for Django REST API development covering project structure, views, models, serializers, authentication, performance, and error handling.

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 12 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use Django's built-in features wherever possible

    line 15
  2. Distinctive:

    Use descriptive names with lowercase underscores

    line 17
  3. Distinctive:

    Consider scalability in all design decisions

    line 19
  4. Distinctive:

    Use class-based views with DRF's APIViews

    line 48
  5. Distinctive:

    Follow RESTful principles for endpoint design

    line 49
  6. Distinctive:

    Keep business logic in models, not views

    line 50
  7. Very specific:

    Use select_related() and prefetch_related() to prevent N+1 queries

    line 55
  8. Very specific:

    Use transaction.atomic() for critical operations

    line 57
  9. Distinctive:

    Use DRF serializers for all data transformation

    line 60
  10. Distinctive:

    Keep serializers focused and composable

    line 63
  11. Very specific:

    Use djangorestframework_simplejwt for JWT authentication

    line 66
  12. Distinctive:

    Ensure CSRF protection for session-based auth

    line 68
  13. Distinctive:

    Use Redis or Memcached for caching

    line 74
  14. Distinctive:

    Use appropriate HTTP status codes

    line 89
  15. Distinctive:

    Never expose internal errors to clients

    line 92

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

REST API Development with Django

You are an expert in Django REST Framework for building scalable APIs.

Core Principles

  • Use Django's built-in features wherever possible
  • Prioritize readability following PEP 8 compliance
  • Use descriptive names with lowercase underscores
  • Structure projects using Django apps for reusability
  • Consider scalability in all design decisions

Project Structure

Application Structure

app_name/
  migrations/       # Database migrations
  admin.py          # Admin configuration
  models.py         # Data models
  managers.py       # Custom model managers
  signals.py        # Django signals
  tasks.py          # Celery tasks

API Structure

api/
  v1/
    urls.py         # URL routing
    serializers.py  # DRF serializers
    views.py        # API views
    permissions.py  # Custom permissions
    filters.py      # Query filters

Development Guidelines

Views and API Design

  • Use class-based views with DRF's APIViews
  • Follow RESTful principles for endpoint design
  • Keep business logic in models, not views
  • Maintain consistent response formats

Models and Database

  • Leverage Django ORM for all database operations
  • Use select_related() and prefetch_related() to prevent N+1 queries
  • Apply proper indexing on frequently queried fields
  • Use transaction.atomic() for critical operations

Serializers and Validation

  • Use DRF serializers for all data transformation
  • Implement custom validators for complex validation
  • Handle nested relationships properly
  • Keep serializers focused and composable

Authentication and Authorization

  • Use djangorestframework_simplejwt for JWT authentication
  • Implement granular permissions per endpoint
  • Ensure CSRF protection for session-based auth
  • Apply principle of least privilege

Performance Optimization

  • Prevent N+1 queries through eager loading
  • Implement database connection pooling
  • Use Redis or Memcached for caching
  • Apply standardized pagination to list endpoints

Error Handling

{
    "success": False,
    "message": "Validation failed",
    "errors": {
        "field_name": ["Error message"]
    },
    "error_code": "VALIDATION_ERROR"
}
  • Use appropriate HTTP status codes
  • Return consistent error response structure
  • Apply structured logging for debugging
  • Never expose internal errors to clients

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.