angular-novo-elements-cursorrules-prompt-file — правило Cursor
Правило задаёт Cursor стиль работы с Angular и Novo Elements: небольшие изменения, проверка фактов и тесты. Подойдёт для проектов со standalone components.
.cursor/rules/angular-novo-elements-cursorrules-prompt-file.mdcЧто делает angular-novo-elements-cursorrules-prompt-file
Правило настраивает Cursor для Angular-проекта с библиотекой Novo Elements и standalone components. Оно просит проверять сведения до изменений, сохранять текущую структуру и делать diff как можно меньше. В рекомендациях также есть DRY, KISS, YAGNI, принцип одной ответственности и правило бойскаута.
Для каждой задачи правило предлагает двигаться небольшими шагами, писать понятные сообщения коммитов, добавлять unit-тесты для нового кода и проверять тесты перед слиянием. Оно также задаёт требования к именованию, структуре каталогов, логам отладки и отказу от устаревших функций. Правило не применяется автоматически: в настройках указано alwaysApply: false, хотя область файлов задана как **/*. Для UI-контекста используются Novo Elements и ссылки на его документацию.
Какие задачи решает
- сохранить существующую структуру Angular-кода
- сократить diff при исправлениях
- добавить unit-тесты к новому коду
- проверить изменения перед слиянием
- избежать дублирования и лишней сложности
Примеры запросов агенту
- Проверь этот Angular-компонент и внеси минимальное исправление с учётом Novo Elements.
- Добавь unit-тесты для новой логики в standalone component и проверь их перед слиянием.
- Разбери ошибку, сохрани текущую структуру проекта и опиши изменения в сообщении коммита.
Как установить angular-novo-elements-cursorrules-prompt-file
Вручную: положить файлы
.cursor/rules/angular-novo-elements-cursorrules-prompt-file.mdcВо frontmatter: description, globs, alwaysApply
Вручную: положить файлы
.claude/rules/angular-novo-elements-cursorrules-prompt-file.mdПоле paths во frontmatter ограничивает файлы: globs из источника → paths
AGENTS.md
Codex читает AGENTS.md: вставьте текст правила туда
Вручную: положить файлы
.github/instructions/angular-novo-elements-cursorrules-prompt-file.instructions.mdПоле applyTo задаёт, к каким файлам применять: globs из источника → applyTo
Вручную: положить файлы
.devin/rules/angular-novo-elements-cursorrules-prompt-file.mdВручную: положить файлы
.clinerules/angular-novo-elements-cursorrules-prompt-file.mdПо шагам, с командами для каждой платформы: Cursor rules: файлы .mdc, четыре режима и замена .cursorrules
Вопросы о angular-novo-elements-cursorrules-prompt-file
Как установить angular-novo-elements-cursorrules-prompt-file в Cursor?
Скопируйте файл правила в проект по пути .cursor/rules/angular-novo-elements-cursorrules-prompt-file.mdc.
Что делает angular-novo-elements-cursorrules-prompt-file?
Правило задаёт Cursor рекомендации для Angular с Novo Elements: проверять сведения перед правками, сохранять существующий код, делать небольшие изменения и добавлять тесты.
Работает ли правило с Angular standalone components?
Да. Оно рассчитано на standalone components и отдельно учитывает, что в проекте нет module file.
Исходный текст
angular-novo-elements-cursorrules-prompt-file.mdc · CC0-1.0
---
description: "Cursor rules for Angular development with Novo Elements UI library."
globs: **/*
alwaysApply: false
---
# .cursor
rules
# General rules
- Do not apologize
- Do not thank me
- Talk to me like a human
- Verify information before making changes
- Preserve existing code structures
- Provide concise and relevant responses
- Verify all information before making changes
You will be penalized if you:
- Skip steps in your thought process
- Add placeholders or TODOs for other developers
- Deliver code that is not production-ready
I'm tipping $9000 for an optimal, elegant, minimal world-class solution that meets all specifications. Your code changes should be specific and complete. Think through the problem step-by-step.
YOU MUST:
- Follow the User's intent PRECISELY
- NEVER break existing functionality by removing/modifying code or CSS without knowing exactly how to restore the same function
- Always strive to make your diff as tiny as possible
# File-by-file changes
- Make changes in small, incremental steps
- Test changes thoroughly before committing
- Document changes clearly in commit messages
# Code style and formatting
- Follow the project's coding standards
- Use consistent naming conventions
- Avoid using deprecated functions or libraries
# Debugging and testing
- Include debug information in log files
- Write unit tests for new code
- Ensure all tests pass before merging
# Project structure
- Maintain a clear and organized project structure
- Use meaningful names for files and directories
- Avoid clutter by removing unnecessary files
# Clean Code
Don't Repeat Yourself (DRY)
Duplication of code can make code very difficult to maintain. Any change in logic can make the code prone to bugs or can make the code change difficult. This can be fixed by doing code reuse (DRY Principle).
The DRY principle is stated as "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system".
The way to achieve DRY is by creating functions and classes to make sure that any logic should be written in only one place.
Curly's Law - Do One Thing
Curly's Law is about choosing a single, clearly defined goal for any particular bit of code: Do One Thing.
Curly's Law: A entity (class, function, variable) should mean one thing, and one thing only. It should not mean one thing in one circumstance and carry a different value from a different domain some other time. It should not mean two things at once. It should mean One Thing and should mean it all of the time.
Keep It Simple Stupid (KISS)
The KISS principle states that most systems work best if they are kept simple rather than made complicated; therefore, simplicity should be a key goal in design, and unnecessary complexity should be avoided.
Simple code has the following benefits:
less time to write
less chances of bugs
easier to understand, debug and modify
Do the simplest thing that could possibly work.
Don't make me think
Code should be easy to read and understand without much thinking. If it isn't then there is a prospect of simplification.
You Aren't Gonna Need It (YAGNI)
You Aren't Gonna Need It (YAGNI) is an Extreme Programming (XP) practice which states: "Always implement things when you actually need them, never when you just foresee that you need them."
Even if you're totally, totally, totally sure that you'll need a feature, later on, don't implement it now. Usually, it'll turn out either:
you don't need it after all, or
what you actually need is quite different from what you foresaw needing earlier.
This doesn't mean you should avoid building flexibility into your code. It means you shouldn't overengineer something based on what you think you might need later on.
There are two main reasons to practice YAGNI:
You save time because you avoid writing code that you turn out not to need.
Your code is better because you avoid polluting it with 'guesses' that turn out to be more or less wrong but stick around anyway.
Premature Optimization is the Root of All Evil
Programmers waste enormous amounts of time thinking about or worrying about, the speed of noncritical parts of their programs, and these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered.
We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil. Yet we should not pass up our opportunities in that critical 3%.
- Donald Knuth
Boy-Scout Rule
Any time someone sees some code that isn't as clear as it should be, they should take the opportunity to fix it right there and then - or at least within a few minutes.
This opportunistic refactoring is referred to by Uncle Bob as following the boy-scout rule - always leave the code behind in a better state than you found it.
The code quality tends to degrade with each change. This results in technical debt. The Boy-Scout Principle saves us from that.
Code for the Maintainer
Code maintenance is an expensive and difficult process. Always code considering someone else as the maintainer and making changes accordingly even if you're the maintainer. After a while, you'll remember the code as much as a stranger.
Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live.
Principle of Least Astonishment
Principle of Least Astonishment states that a component of a system should behave in a way that most users will expect it to behave. The behavior should not astonish or surprise users.
Code should do what the name and comments suggest. Conventions should be followed. Surprising side effects should be avoided as much as possible.
# Project specific rules
I'm using angular with standalone components
I'm integrating novo elements which is the novo-elements module
Documentation is here: https://bullhorn.github.io/novo-elements/docs/#/home
Github is here: https://github.com/bullhorn/novo-elements
I don''t have a module file. I am using standalone components
@Docs{
"library_name": "Novo Elements",
"documentation": "https://bullhorn.github.io/novo-elements/docs/#/home"
}
@Docs{
"library_name": "Novo Elements",
"documentation": "https://github.com/bullhorn/novo-elements"
}
© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules