document-scopes.mdc•5.61 kB
# Document Scopes
Defines the specific purpose and content for each documentation file.
## Reference Style (MANDATORY)
- Use @path for all local file references, repo-root relative (e.g., `@packages/mcp-server/src/server.ts`).
- Refer to sections by name: `See "Error Handling" in @docs/common-patterns.mdc`.
- Keep Markdown links only for external sites.
## Core Documents
### architecture.mdc
**Purpose**: Explain system design and package interactions
**Must Include**:
- Package responsibilities and boundaries
- Data flow between components
- Key architectural decisions and trade-offs
- How MCP concepts map to implementation
**Must Exclude**:
- Installation instructions
- Implementation details (link to code instead)
- General MCP protocol explanation
### common-patterns.mdc
**Purpose**: Reusable patterns used throughout the codebase
**Must Include**:
- Error handling patterns (UserInputError, ApiError)
- Zod schema patterns and conventions
- TypeScript type helpers
- Response formatting patterns
- Parameter validation patterns
**Must Exclude**:
- Tool/prompt/resource-specific patterns
- External library documentation
- One-off patterns used in single places
### quality-checks.mdc
**Purpose**: Required checks and commands for code quality
**Must Include**:
- Essential commands that must pass
- When to run each check
- What each check validates
- Common failure fixes
**Must Exclude**:
- Tool installation instructions
- Detailed explanations of what linting is
- CI/CD configuration
## Feature Implementation Guides
### adding-tools.mdc
**Purpose**: How to add new MCP tools
**Must Include**:
- Tool definition structure
- Handler implementation pattern
- Required tests (unit + eval)
- LLM-friendly descriptions
- References to existing tools
**Must Exclude**:
- What MCP tools are conceptually
- Duplicate testing patterns (link to testing.mdc)
- Full code examples (reference real implementations)
## Technical Guides
### testing.mdc
**Purpose**: Testing strategies and patterns
**Must Include**:
- Unit test patterns with snapshots
- Evaluation test setup
- Mock patterns with MSW
- When to update snapshots
- Test file organization
**Must Exclude**:
- Vitest documentation
- General testing philosophy
- Duplicate mock examples
### api-patterns.mdc
**Purpose**: Sentry API client usage and mocking
**Must Include**:
- apiServiceFromContext pattern
- Schema definitions with Zod
- Mock handler patterns
- Multi-region support
- Error handling
**Must Exclude**:
- HTTP basics
- Zod library documentation
- Duplicate error patterns (link to common-patterns.mdc)
## Operations Guides
### releases/cloudflare.mdc
**Purpose**: Cloudflare Workers release process
**Must Include**:
- Wrangler configuration
- Environment variables
- MCP handler setup
- OAuth provider configuration
- Deployment commands (manual and automated)
- Version uploads and gradual rollouts
- Monitoring and troubleshooting
**Must Exclude**:
- Cloudflare Workers concepts
- General deployment best practices
- npm package release process (see stdio.mdc)
### releases/stdio.mdc
**Purpose**: npm package release process
**Must Include**:
- Version management
- npm publishing workflow
- User installation instructions (Claude Desktop, Cursor)
- Environment variable configuration
- Testing releases locally
- Beta releases
**Must Exclude**:
- Cloudflare deployment (see cloudflare.mdc)
- General npm documentation
- IDE-specific setup details
### monitoring.mdc
**Purpose**: Observability and instrumentation
**Must Include**:
- Sentry integration patterns
- Telemetry setup
- Error tracking
- Performance monitoring
- Tag conventions
**Must Exclude**:
- What observability is
- Sentry product documentation
- General monitoring concepts
### security.mdc
**Purpose**: Authentication and security patterns
**Must Include**:
- OAuth implementation
- Token management
- Multi-tenant security
- CORS configuration
- Security headers
**Must Exclude**:
- OAuth protocol explanation
- General security best practices
- Duplicate deployment content
## Meta Documents
### README.md
**Purpose**: Documentation index and navigation
**Must Include**:
- Document listing with one-line descriptions
- Quick reference for common tasks
- Links to style guide and scopes
**Must Exclude**:
- Detailed explanations
- Duplicate content from other docs
- Installation instructions
### cursor.mdc
**Purpose**: Cursor IDE-specific configuration
**Must Include**:
- Cursor metadata header
- Link to documentation
- Critical quality checks
- Cursor-specific settings
**Must Exclude**:
- All content duplicated in other docs
- General coding guidelines
- Project overview
### AGENTS.md
**Purpose**: Agent entry point (Claude Code, Cursor, etc.)
**Must Include**:
- Brief project description
- Documentation directory reference
- Critical quality checks
- Agent-specific notes (tools, transports, auth defaults)
**Must Exclude**:
- Detailed architecture (link to architecture.mdc)
- Development setup (link to relevant docs)
- Integration instructions (keep minimal)
## Optimization Strategy
Focus on clarity and usefulness, not arbitrary line counts.
Key improvements needed:
- **security.mdc**: Too much OAuth theory → focus on implementation
- **api-patterns.mdc**: Redundant examples → consolidate patterns
- **releases/cloudflare.mdc**: Focus on MCP-specific config, not generic Cloudflare docs
- **monitoring.mdc**: Verbose explanations → code examples
The goal: Each document should be focused enough to be useful in a single context window while remaining comprehensive for its topic.