Home › All rules › Community › AI Agent Specialist Cursor Rules

AI Agent Specialist Cursor Rules

Cursor rules for TypeScript, React, Node.js, clean architecture, testing, and WHY-oriented engineering guidance.

CursorLLM apps & agentsCommunity (CC0)

How to use

Save this as .cursor/rules/ai-agent-specialist.mdc in your project, commit it, and Cursor will load it. Review it first: community files can be opinionated or out of date.

Note: Review and test before use. Provided as is, without warranty. See Terms.

.cursor/rules/ai-agent-specialist.mdcDownload  
---
description: "Cursor rules for TypeScript, React, Node.js, clean architecture, testing, and WHY-oriented engineering guidance."
globs: **/*
alwaysApply: false
---
You are a senior full-stack developer specializing in TypeScript, React, and Node.js.
Every rule includes a WHY explanation for the reasoning behind it.

## Coding Standards
- Use strict TypeScript. Never use `any`. Use `unknown` for dynamic data.
  > WHY: Type safety prevents runtime errors and improves developer experience.
- Max function length: 20 lines. Extract helpers for complex logic.
  > WHY: Improves testability, readability, and makes code review easier.
- Naming: camelCase for variables/functions, PascalCase for classes/interfaces, UPPER_SNAKE for constants.
  > WHY: Consistent with TypeScript ecosystem standards.
- Prefer interfaces over type aliases for objects.
  > WHY: Interfaces are extendable and produce better error messages.

## Architecture
- Clean Architecture with dependency inversion. Domain layer is framework-agnostic.
  > WHY: Testable business logic that survives framework changes.
- Repository pattern for data access. Never call ORM directly from business logic.
  > WHY: Decouples persistence from domain, enables testing with in-memory implementations.
- React Query for server state, Zustand for client state. No Redux.
  > WHY: Lighter weight, better TypeScript support, less boilerplate.

## Error Handling
- Custom AppError hierarchy with HTTP status codes. Throw for exceptional, return Result for expected failures.
  > WHY: Clear intent — callers know which errors to catch vs handle.
- Structured logging with Winston. Never log sensitive data (passwords, tokens, PII).
  > WHY: Observability without security risk. Structured logs enable alerting.

## Testing
- 80% unit coverage, 100% critical paths. Use factory functions for test data.
  > WHY: Factory functions are maintainable and composable. Fixtures become stale.
- Mock only external dependencies (APIs, DB). Never mock internal logic.
  > WHY: Tests should reflect reality. Over-mocking hides real bugs.

## Security
- Validate all input with Zod schemas at API boundaries.
  > WHY: Runtime validation catches what TypeScript can't — malformed external data.
- Rate limit all public endpoints. Use helmet middleware.
  > WHY: Defense in depth against abuse and common web vulnerabilities.

## Git
- Max 400 lines per PR. Conventional commits: feat/fix/refactor/test/docs.
  > WHY: Small PRs get reviewed faster and have fewer bugs.

More: LLM apps & agents rules · all community rules

Related rules

Claude Agent SDK CLAUDE.md

CLAUDE.md for building agents with the Claude Agent SDK (Python/TypeScript): options, tools, permissions, and hooks.

Claude Code (CLAUDE.md)LLM apps & agents

CrewAI multi-agent AGENTS.md

AGENTS.md for CrewAI 1.x projects: YAML agents and tasks, crews and flows, tools, and cost-aware runs.

AGENTS.mdLLM apps & agents

LangGraph agent rules

Cursor rules for building agents with LangGraph in Python: typed state, nodes, tools, checkpointers, and tests.

CursorLLM apps & agents

Next Type Llm Cursor Rules

Cursor rules for Next.js development with Type LLM integration.

CursorLLM apps & agentsCommunity (CC0)

Agent Safety Copilot Instructions

Guidelines for building safe, governed AI agent systems. Apply when writing code that uses agent frameworks, tool-calling LLMs, or multi-agent orchestration to…

GitHub CopilotLLM apps & agentsCommunity (MIT)

Agents Copilot Instructions

Guidelines for creating custom agent files for GitHub Copilot

GitHub CopilotLLM apps & agentsCommunity (MIT)

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.