add-endpoint
Prompt to add a REST API endpoint with Pydantic models, a service and a router.
- Kind
- Prompt
- Works with
- GitHub Copilot
- Languages
- Python
- Source
- microsoft/skills @ 2130750147de
- Path
- .github/prompts/add-endpoint.prompt.md
- Jobs
- Implementation
- Topics
- APIs
Credit
- Made by
- microsoft
- Original
- github.com/microsoft/skills/blob/2130750147dee0311215099ddf36…
- License
- MIT
Listed by Skill Manifest; not made by us.
InstallCopy it from the source repository, or sign in and let the assistant adapt it for your project.
Install factsScanned 3 Nov 2026
- Adds
- A prompt to paste or save as a command
- Runs scripts
- None found
- Uses the network
- None found
- Needs secrets
- None found
- Reads environment variables
- RESOURCE_NAME
- RESOURCE_FIELDS
- RESOURCE_PLURAL
- Calls other skills
- /api
- Source revision
- 2130750147de
- Licence
- MIT
- Last activity
- 26 Nov 2026
- Source changed after the scan
- Yes
- Last push 26 Nov 2026, scanned 3 Nov 2026; read it again before you rely on this scan
- Review
- Reviewed
Found by a static scan of the stored text; nothing is run. “None found” is not a guarantee, so read what you install before you run it.
# Add API Endpoint
Create a new REST API endpoint following CoreAI DIY patterns.
## Variables
- `RESOURCE_NAME`: The resource name (singular, e.g., `annotation`)
- `RESOURCE_PLURAL`: Plural form (e.g., `annotations`)
- `RESOURCE_DESCRIPTION`: Brief description
- `RESOURCE_FIELDS`: Key fields for the resource
## Steps
### 1. Define Pydantic Models
Create `src/backend/app/models/${RESOURCE_NAME}.py`:
```python
from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field
class ${RESOURCE_NAME.title()}Base(BaseModel):
"""Base model with common fields."""
# Add ${RESOURCE_FIELDS}
class Config:
populate_by_name = True
class ${RESOURCE_NAME.title()}Create(${RESOURCE_NAME.title()}Base):
"""Request model for creation."""
# Add required creation fields
pass
class ${RESOURCE_NAME.title()}Update(BaseModel):
"""Request model for partial updates (all optional)."""
# Add optional update fields
pass
class ${RESOURCE_NAME.title()}(${RESOURCE_NAME.title()}Base):
"""Response model."""
id: str
created_at: datetime = Field(..., alias="createdAt")
…