Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/lazylagom/context-compose-mcp/best-practicesgit clone --depth 1 https://github.com/lazylagom/context-compose-mcpWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/lazylagom/context-compose-mcp/best-practices)<a href="https://agentmods.dev/rules/lazylagom/context-compose-mcp/best-practices"><img src="https://agentmods.dev/badge/rules/lazylagom/context-compose-mcp/best-practices.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.01808 |
| Opus 5 | $0.00000 | $0.00904 |
| Sonnet 5 | $0.00000 | $0.00362 |
| Haiku 4.5 | $0.00000 | $0.00181 |
Grade A, and why
best-practices scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 309 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Best Practices and Code Patterns
Code Writing Principles
Clean Code Principles
- Single Responsibility Principle: Each function and class has only one clear responsibility
- Clear Naming: Variable, function, and class names clearly express their purpose
- Small Functions: Functions are limited to a size that fits on one screen
- Dependency Injection: Use injection structure rather than hardcoded dependencies
TypeScript Best Practices
Type Definitions
// Good example: Clear and specific types
interface ContextConfig {
readonly version: number;
readonly kind: 'task' | 'role' | 'workflow';
readonly name: string;
readonly description: string;
readonly context: {
workflow?: string;
personas?: readonly string[];
rules?: readonly string[];
mcps?: readonly string[];
};
}
// 피해야 할 예시: any 타입 사용
const config: any = loadConfig();
유니온 타입 활용
// 상태 관리에 유니온 타입 사용
type LoadingState =
| { status: 'loading' }
| { status: 'success'; data: ContextConfig }
| { status: 'error'; error: string };
타입 가드 패턴
function isContextConfig(obj: unknown): obj is ContextConfig {
return typeof obj === 'object' &&
obj !== null &&
'version' in obj &&
'kind' in obj;
}
File Structure Best Practices
Module Separation Principles
src/
├── cli/
│ ├── commands/ # CLI command modules
│ ├── utils/ # CLI utilities
│ └── index.ts # CLI entry point
├── core/
│ ├── context/ # Context-related logic
│ ├── workflow/ # Workflow engine
│ ├── notification/ # Notification system
│ └── types.ts # Common type definitions
├── schemas/
│ ├── context.ts # Context schemas
│ ├── workflow.ts # Workflow schemas
│ └── index.ts # Schema exports
└── types/
├── cli.ts # CLI-related types
├── mcp.ts # MCP-related types
└── index.ts # Type exports
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 309 lines · 0 tokens per session scan A b1aa0c17dcc5
best-practices is a cursor rule published in the GitHub repository lazylagom/context-compose-mcp (1 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,808 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other cursor rules, from other repositories
auth
Auth architecture, middleware chain, and auth-specific coding standards.
tableau-mcp
Tableau MCP project context, architecture overview, and core principles.
tools
MCP tool development patterns — factory pattern, base class, callbacks, and descriptions.
testing
Testing standards — Vitest framework, test organization, mocking patterns.
cursorrules
Cursor rule "cursorrules" from dunialabs/peta-core, covering cursor ide scheduling rules, role positioning, task assignment rules, → assign to claude code (precise, controllable) and → assign to codex (complex, large-scale).
chrono-mcp-standards
Chrono MCP Project Standards and Guidelines.