agentleFS
enunoenuno/unifi-mcp-server/.cursor/rules/common-mistakes.mdc

unifi-mcp-server / rules

Cursor rule294 starsChanged 18 days agoApache-2.0View on GitHub

Common mistakes to avoid and best practices to follow

We split this common-mistakes.mdc into the rules it gives an agent

8 rules. About 0 are common, 7 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Use synchronous blocking calls in async functions

    line 11
  2. Distinctive:

    Commit without running pre-commit hooks

    line 16
  3. Distinctive:

    Use async/await consistently

    line 23
  4. Distinctive:

    Write tests first (TDD)

    line 25
  5. Distinctive:

    Run full test suite before committing

    line 28
  6. Very specific:

    Use async with for resource management

    line 29
  7. Distinctive:

    Follow project guidelines in CLAUDE.md and AGENTS.md for consistent development practices

    line 31
  8. Distinctive:

    Security Matters: Never expose credentials or sensitive data

    line 71

≈ “Common” is an estimate: at least 1 in 5 of the 6,350 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
common-mistakes.mdc
---
description: Common mistakes to avoid and best practices to follow
globs: ["src/**/*.py"]
alwaysApply: false
---

# Common Mistakes to Avoid

## ❌ DON'T

- Use synchronous blocking calls in async functions
- Omit type hints or use `Any` unnecessarily
- Skip tests for new features
- Forget `confirm=True` safety checks on mutating operations
- Expose sensitive data in logs
- Commit without running pre-commit hooks
- Mix sync and async code improperly
- Return untyped dicts when Pydantic models are appropriate
- Ignore project guidelines (`CLAUDE.md`, `AGENTS.md`) when editing command/agent assets or MCP tool instructions

## ✅ DO

- Use async/await consistently
- Provide comprehensive type hints
- Write tests first (TDD)
- Implement dry-run mode for dangerous operations
- Mask passwords and keys in logs
- Run full test suite before committing
- Use `async with` for resource management
- Define Pydantic models for complex data structures
- Follow project guidelines in `CLAUDE.md` and `AGENTS.md` for consistent development practices

## Quick Commands

```bash
# Development
uv run mcp dev src/main.py      # Run with MCP Inspector

# Testing
pytest                          # Run all tests
pytest -m unit                  # Unit tests only
pytest -m integration           # Integration tests only
pytest --cov=src --cov-report=html  # With coverage report

# Code Quality
black src/ tests/               # Format
isort src/ tests/               # Sort imports
ruff check src/ tests/ --fix   # Lint and fix
mypy src/                       # Type check
bandit -r src/                  # Security scan

# Pre-commit
pre-commit run --all-files      # Run all hooks
```

## Key Resources

- **Project Documentation**: README.md, API.md, CONTRIBUTING.md, SECURITY.md
- **MCP Specification**: https://modelcontextprotocol.io/
- **FastMCP Docs**: https://gofastmcp.com/
- **UniFi API**: Official UniFi Controller API documentation
- **Pydantic**: https://docs.pydantic.dev/

## Remember

- **Safety First**: Require `confirm=True` for all network modifications
- **Test Everything**: 80%+ coverage is not optional
- **Type Everything**: Type hints improve code quality and catch bugs
- **Document Well**: Future you (and other developers) will thank you
- **Async Always**: This is an async-first project - respect the pattern
- **Security Matters**: Never expose credentials or sensitive data

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.

Reviews can't be read right now.

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.