agentleFS
MikeRobGITMikeRobGIT/lodgify-mcp/.cursor/rules/coding-standards.mdc

lodgify-mcp / rules

Cursor rule4 starsChanged 16 months agoMITView on GitHub

The file

Show its rules and text

We split this coding-standards.mdc into the rules it gives an agent

17 rules. About 0 are common, 13 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Follow the Biome configuration in biome.json:

    line 4
  2. Very specific:

    Follow the strict configuration in tsconfig.json:

    line 13
  3. Distinctive:

    Module Size: Keep each module under 250 lines for maintainability

    line 27
  4. Distinctive:

    Registry Pattern: Use central registries for tools and resources

    line 29
  5. Very specific:

    Dependency Injection: Use closure-based getClient() pattern

    line 30
  6. Distinctive:

    Centralized: All errors go through src/mcp/errors/

    line 33
  7. Distinctive:

    Sanitization: Remove sensitive data before returning to user

    line 34
  8. Distinctive:

    Type Safety: Use typed error classes from src/core/errors/

    line 35
  9. Distinctive:

    Logging: Use structured logging with appropriate levels

    line 36
  10. Distinctive:

    When creating new tools in src/mcp/tools/:

    line 39
  11. Very specific:

    Type Imports: Use import type for type-only imports

    line 71
  12. Distinctive:

    JSDoc: Use for public APIs and complex functions

    line 74
  13. Distinctive:

    README: Keep README.md updated with new features

    line 75
  14. Distinctive:

    Changelog: Update CHANGELOG.md for all changes

    line 76
  15. Distinctive:

    Examples: Add examples to examples/ for new features

    line 77
  16. Distinctive:

    API Keys: Never log or expose API keys

    line 80
  17. Distinctive:

    Input Validation: Always validate inputs with Zod schemas

    line 81

≈ “Common” is an estimate: at least 1 in 5 of the 7,111 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
coding-standards.mdc
# Coding Standards for Lodgify MCP Server

## Code Style (Biome Configuration)
Follow the Biome configuration in [biome.json](mdc:biome.json):
- **Indentation**: 2 spaces
- **Line Width**: 100 characters
- **Quotes**: Single quotes for strings
- **Semicolons**: As needed (automatic)
- **Trailing Commas**: Always
- **Line Endings**: LF

## TypeScript Standards
Follow the strict configuration in [tsconfig.json](mdc:tsconfig.json):
- **Strict Mode**: Enabled
- **Target**: ES2022
- **Module**: NodeNext
- **No Unused Locals/Parameters**: Enabled
- **No Implicit Returns**: Enabled

## Naming Conventions
- **Files**: `kebab-case` (e.g., `lodgify-orchestrator.ts`)
- **Types/Classes**: `PascalCase` (e.g., `LodgifyOrchestrator`)
- **Variables/Functions**: `camelCase` (e.g., `getClient`)
- **Constants**: `UPPER_SNAKE_CASE` (e.g., `MAX_RETRY_ATTEMPTS`)

## Module Organization
- **Module Size**: Keep each module under 250 lines for maintainability
- **Single Responsibility**: Each module should have one clear purpose
- **Registry Pattern**: Use central registries for tools and resources
- **Dependency Injection**: Use closure-based `getClient()` pattern

## Error Handling
- **Centralized**: All errors go through [src/mcp/errors/](mdc:src/mcp/errors/)
- **Sanitization**: Remove sensitive data before returning to user
- **Type Safety**: Use typed error classes from [src/core/errors/](mdc:src/core/errors/)
- **Logging**: Use structured logging with appropriate levels

## MCP Tool Implementation Pattern
When creating new tools in [src/mcp/tools/](mdc:src/mcp/tools/):

```typescript
// 1. Define Zod schema for input validation
const toolSchema = z.object({
  propertyId: z.string().min(1),
  // ... other parameters
});

// 2. Create tool registration object
export const myTool = {
  name: 'lodgify_my_tool',
  description: 'Description of what this tool does',
  inputSchema: toolSchema,
  handler: async (params) => {
    const client = getClient();
    // Implementation
  }
};
```

## Testing Standards
- **Test Location**: [tests/](mdc:tests/) mirroring [src/](mdc:src/) structure
- **Framework**: Bun test
- **Coverage**: Aim for ≥90% for client code
- **Mocking**: Mock external HTTP calls
- **Deterministic**: Tests should be deterministic and repeatable

## Import Organization
- **External Libraries**: First
- **Internal Modules**: Second (alphabetical)
- **Relative Imports**: Last
- **Type Imports**: Use `import type` for type-only imports

## Documentation
- **JSDoc**: Use for public APIs and complex functions
- **README**: Keep [README.md](mdc:README.md) updated with new features
- **Changelog**: Update [CHANGELOG.md](mdc:CHANGELOG.md) for all changes
- **Examples**: Add examples to [examples/](mdc:examples/) for new features

## Security Guidelines
- **API Keys**: Never log or expose API keys
- **Input Validation**: Always validate inputs with Zod schemas
- **Error Messages**: Sanitize error messages to avoid information leakage
- **Read-Only Mode**: Respect `LODGIFY_READ_ONLY` environment variable
description:
globs:
alwaysApply: true
---

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.