mirror of
https://github.com/cursor/plugins.git
synced 2026-09-14 20:00:00 +08:00
5e55a3a3f1
- Add plugin specification README with complete schema documentation - Include boilerplate plugin demonstrating all components: - Rules (.mdc files with frontmatter) - Agents (specialized subagent definitions) - Skills (self-contained capabilities with SKILL.md) - Hooks (pre/post event automation) - MCP servers (external tool integrations) - Extensions directory structure Co-authored-by: Cursor <cursoragent@cursor.com>
37 lines
872 B
Plaintext
37 lines
872 B
Plaintext
---
|
|
description: Example rule demonstrating Cursor rule structure
|
|
globs:
|
|
- "**/*.ts"
|
|
- "**/*.tsx"
|
|
alwaysApply: false
|
|
---
|
|
|
|
# Example Coding Standards
|
|
|
|
When working with TypeScript files, follow these conventions:
|
|
|
|
1. **Use explicit types** - Avoid `any` unless absolutely necessary
|
|
2. **Prefer `const` over `let`** - Use immutable bindings when possible
|
|
3. **Use async/await** - Prefer async/await over raw Promises
|
|
4. **Handle errors explicitly** - Always catch and handle errors appropriately
|
|
|
|
## Example
|
|
|
|
```typescript
|
|
// ✅ Good
|
|
const fetchData = async (id: string): Promise<Data> => {
|
|
try {
|
|
const response = await api.get(`/data/${id}`);
|
|
return response.data;
|
|
} catch (error) {
|
|
console.error('Failed to fetch data:', error);
|
|
throw error;
|
|
}
|
|
};
|
|
|
|
// ❌ Bad
|
|
const fetchData = (id) => {
|
|
return api.get('/data/' + id).then(r => r.data);
|
|
};
|
|
```
|