api-endpoint

api-endpoint is a command for Claude Code from smicolon/ai-kit. It costs 18 tokens per session (1,620 once invoked), scanned A, original, MIT.

A command that creates a Django REST API endpoint, including the code that formats data, handles requests, and tests the result.

In plain words
What is it for?
Use it when adding a new REST API route to a Django project and you want its serializer, view, and tests created together.
Why use it?
It removes the need to set up these connected files and basic tests by hand when adding an endpoint to a Django application.

Command for Claude Code

Written for Claude Code: a Claude Code command (commands/*.md).

Good fit Use it when adding a new REST API route to a Django project and you want its serializer, view, and tests created together.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/smicolon/ai-kit/api-endpoint
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/smicolon/ai-kit

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for api-endpoint

README.md
[![agentmods](https://agentmods.dev/badge/commands/smicolon/ai-kit/api-endpoint/github.svg)](https://agentmods.dev/commands/smicolon/ai-kit/api-endpoint)
Your own site
<a href="https://agentmods.dev/commands/smicolon/ai-kit/api-endpoint"><img src="https://agentmods.dev/badge/commands/smicolon/ai-kit/api-endpoint/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for api-endpoint

Your own site · 80×15
<a href="https://agentmods.dev/commands/smicolon/ai-kit/api-endpoint"><img src="https://agentmods.dev/badge/commands/smicolon/ai-kit/api-endpoint.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 18 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,620 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00018 $0.01620
Opus 5.5 $0.00007 $0.00648
Sonnet 5.5 $0.00004 $0.00324
Haiku 4.5 $0.00002 $0.00162

Measured 1mo ago against content hash c848a908672a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

api-endpoint scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

packs/django/commands/api-endpoint.md · 286 lines

How it starts

The opening of the file, as written. The whole thing — 286 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Django API Endpoint Creation

You are a Django REST Framework specialist. Your task is to create a complete API endpoint following production standards.

Core Requirements

Import Pattern (CRITICAL)

ALWAYS use absolute imports with module aliases:

# ✅ CORRECT
import users.models as _users_models
import users.serializers as _users_serializers
import users.services as _users_services
from rest_framework import viewsets, permissions

# ❌ WRONG
from .models import User
from .serializers import UserSerializer

Endpoint Components

Every endpoint needs:

  1. Serializer - Data validation and serialization
  2. Service Layer - Business logic (NOT in views)
  3. View/ViewSet - Request handling
  4. Permissions - Access control
  5. URL Configuration - Route registration
  6. Tests - 90%+ coverage

Workflow

  1. Understand Requirements:

    • What model/resource?
    • What operations (CRUD)?
    • Who has access?
    • What validation rules?
  2. Create Serializer:

    • Input validation
    • Output formatting
    • Nested relationships
  3. Create Service Layer:

    • Business logic
    • Transaction handling
    • Complex queries
  4. Create View:

    • Request handling
    • Permission checks
    • Error handling
  5. Configure URLs:

    • Route registration
    • Namespace
  6. Write Tests:

    • Test all operations
    • Test permissions
    • Test validation

Example Output

Serializer

# app/serializers.py
import users.models as _users_models
from rest_framework import serializers

class ProductSerializer(serializers.ModelSerializer):
    """Serializer for Product model"""

    created_by_name = serializers.CharField(
        source='created_by.get_full_name',
        read_only=True
    )

    class Meta:
        model = _models.Product
        fields = [
            'id',
            'name',
            'slug',
            'description',
            'price',
            'stock',
            'created_by',
            'created_by_name',
            'created_at',
            'updated_at',
        ]
        read_only_fields = ['id', 'created_at', 'updated_at', 'created_by']

    def validate_price(self, value):
        if value < 0:
            raise serializers.ValidationError("Price cannot be negative")
        return value

    def validate_stock(self, value):
        if value < 0:
            raise serializers.ValidationError("Stock cannot be negative")
        return value

Read the full file on GitHub · 286 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed c848a908672a
  2. 1mo ago First seen · 286 lines · 18 tokens per session scan A fd8ea04ae065

Subscribe to this mod's changes

api-endpoint is a command published in the GitHub repository smicolon/ai-kit (6 stars, last pushed 1mo ago), licensed MIT. It adds 18 tokens to every session and 1,620 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.