Skip to content
Prompt

ai-template — Cursor Rules

by jasonstcyrx

AI Summary

Cursor rules booster providing RESTful API design standards and best practices, including resource-based URLs, HTTP methods, status codes, and NestJS implementation patterns for developers building consistent APIs.

Install

Copy this and paste it into Claude Code, Cursor, or any AI assistant:

I want to add the "ai-template — Cursor Rules" prompt rules to my project.
Repository: https://github.com/jasonstcyrx/ai-template

Please read the repo to find the rules/prompt file, then:
1. Download it to the correct location (.cursorrules, .windsurfrules, .github/prompts/, or project root — based on the file type)
2. If there's an existing rules file, merge the new rules in rather than overwriting
3. Confirm what was added

Description

RESTful API design standards and best practices

Resource-Based URLs

Use nouns, not verbs, and represent resources in a hierarchical manner: ` ✅ Good GET /api/users # Get all users GET /api/users/123 # Get user by ID POST /api/users # Create new user PUT /api/users/123 # Update user completely PATCH /api/users/123 # Update user partially DELETE /api/users/123 # Delete user GET /api/users/123/orders # Get orders for user POST /api/users/123/orders # Create order for user ❌ Bad GET /api/getUsers POST /api/createUser GET /api/user_orders/123 `

HTTP Methods

Use appropriate HTTP methods for different operations: • GET - Retrieve data (idempotent, no side effects) • POST - Create new resources or non-idempotent operations • PUT - Replace entire resource (idempotent) • PATCH - Partial update (may or may not be idempotent) • DELETE - Remove resource (idempotent)

Status Codes

Use standard HTTP status codes consistently: `typescript // Success 200 OK - Successful GET, PUT, PATCH 201 Created - Successful POST 204 No Content - Successful DELETE // Client Errors 400 Bad Request - Invalid request data 401 Unauthorized - Authentication required 403 Forbidden - Access denied 404 Not Found - Resource doesn't exist 409 Conflict - Resource already exists or conflict 422 Unprocessable Entity - Validation errors // Server Errors 500 Internal Server Error - Unexpected server error 502 Bad Gateway - Upstream service error 503 Service Unavailable - Service temporarily down `

Controller Structure

`typescript @Controller("users") @ApiTags("users") export class UsersController { constructor(private readonly usersService: UsersService) {} @Get() @ApiOperation({ summary: "Get all users" }) @ApiResponse({ status: 200, description: "Users retrieved successfully" }) async findAll( @Query() query: PaginationDto ): Promise<PaginatedResponse<User>> { return this.usersService.findAll(query); } @Get(":id") @ApiOperation({ summary: "Get user by ID" }) @ApiParam({ name: "id", description: "User ID" }) @ApiResponse({ status: 200, description: "User found" }) @ApiResponse({ status: 404, description: "User not found" }) async findOne(@Param("id") id: string): Promise<User> { return this.usersService.findOne(id); } @Post() @ApiOperation({ summary: "Create new user" }) @ApiResponse({ status: 201, description: "User created successfully" }) @ApiResponse({ status: 400, description: "Invalid input data" }) async create(@Body() createUserDto: CreateUserDto): Promise<User> { return this.usersService.create(createUserDto); } @Put(":id") @ApiOperation({ summary: "Update user completely" }) async update( @Param("id") id: string, @Body() updateUserDto: UpdateUserDto ): Promise<User> { return this.usersService.update(id, updateUserDto); } @Delete(":id") @ApiOperation({ summary: "Delete user" }) @ApiResponse({ status: 204, description: "User deleted successfully" }) async remove(@Param("id") id: string): Promise<void> { return this.usersService.remove(id); } } `

Discussion

0/2000
Loading comments...

Health Signals

MaintenanceCommitted 9mo ago
Stale
AdoptionUnder 100 stars
1 ★ · Niche
DocsMissing or thin
Undocumented

GitHub Signals

Stars1
Issues0
Updated9mo ago
View on GitHub
No License

My Fox Den

Community Rating

Sign in to rate this booster

Works With

Any AI assistant that accepts custom rules or system prompts

Claude
ChatGPT
Cursor
Windsurf
Copilot
+ more