---
applyTo: '**'
---
# Beast Mode Configuration
- Always apply Domain-Driven Design (DDD) principles to all code and architecture.
- Use separation of concerns: domain, application, and infrastructure layers.
- Never put business logic in handlers or server entrypoints.
- Use business-descriptive names and ubiquitous language.
- Prefer polymorphism, single object parameter functions, and loader/index patterns.
- Use TDD where possible.
- Follow all other “Beast Mode” best practices as described in the custom instructions.
# Coding Guidelines
Make sure to document your code thoroughly with comments to explain complex logic and decisions.
Follow best practices for the programming language and framework being used.
Use TypeScript for all applications and backend code involving JavaScript.
Always use tsx for TypeScript development and make sure dependencies are added
Try to apply Domain-Driven Design (DDD) principles to break down the problem into manageable parts.
look to find the core domain, subdomains, and bounded contexts within the problem space.
Always make service names, methods, and objects business descriptive not implementation centric
Prefer to make use of Value Objects, Entities, Aggregates, Repositories, and Services to structure your solution effectively.
Always separate service implementation logic from the handler or application domain that is requesting the service.
Never implement process logic in the server / handler component of the application
Prefer to use new directories to store different types of elements and load them in through index file loaders that implement a common pattern
Favor polymorphism over multiple switch or if/else statements.
prefer single object parameter functions and methods where possible.
Use test-driven development (TDD) where possible.
Put all code in a “src” directory
Add console logging to any initialization actions
In TypeScript include the .js extension in all relative imports and install @types/node with npm.
Make sure when creating classes or services to have the filename match the class or service name
# API Design:
Use RESTful or GraphQL conventions for APIs.
Document all endpoints, request/response schemas, and error codes.
Use OpenAPI Specs for REST implementations
Always start REST API design and changes by updating the OpenAPI spec first.
Keep the spec version-controlled and up to date with the codebase.
# Code Documentation:
Add JSDoc or TSDoc comments to public functions, classes, and modules.
Document business logic, edge cases, and any non-obvious decisions.
# Security Best Practices:
Never expose secrets or sensitive data in code or logs.
Validate and sanitize all user input.
Use secure authentication and authorization patterns
# Error Handling:
Handle errors gracefully and provide clear error messages.
Use try/catch blocks for async operations and log errors appropriately.
Default files for JavaScript Development:
Make sure there is a single entry point for the application in the src root directory
Use kebab-case for filenames
Class names, type names, and interface names should use PascalCase (capitalizing the first letter of each word)
use dynamic import() instead of “require” for loading modules at runtime.
Package.json
- name: Use lowercase, hyphen-separated, and descriptive names (e.g., "name": - "demo-mcp-server").
- version: Start with "1.0.0" and increment semantically (major.minor.patch).
- description: Provide a concise summary of the project’s purpose.
- main: Point to the main entry file (e.g., "main": "dist/server.js" for compiled output).
- type: Use "module" for ESM or "commonjs" for CJS; ESM is recommended for new projects.
- scripts: Include scripts for build, start, test, lint, and type-check:
- dependencies: Only include runtime dependencies.
- devDependencies: Place build, test, and type-check tools here (e.g., typescript, @types/node, eslint).
- license: Use a valid SPDX identifier (e.g., "license": "MIT").
- repository: Add a repository field for open source projects.
- author: Include your name and email.
- engines: Specify the minimum Node.js version (e.g., "engines": { "node": ">=18.0.0" }).
Tsconfig.json
- Enable strict type checking, target modern JS, and set outDir to dist/
.eslintrc.json
- Enforce code style and catch common errors.
MCP
Understand MCP as Model Context Protocol from Anthropic and an MCP server is an application that implements the MCP SDK to be used by chat agents
Use Anthropic’s official SDK to implement any MCP solution
If asked to add an MCP server for development make sure to configure type as “stdio” and command as “npx” be sure to argos and working directory configuration