general-best-practices — скилл для Claude Code: правила разработки
Скилл задаёт агенту свод правил по качеству кода, тестам, безопасности и архитектуре. Пригодится, когда нужно, чтобы ИИ писал код в одном стиле во всём проекте.
npx skills add Mindrally/skills --skill general-best-practices -a claude-codeЧто делает general-best-practices
Скилл описывает практики, применимые к разным стекам. Внутри — разделы про читаемость и обработку ошибок, слоистую архитектуру, юнит- и интеграционные тесты, валидацию ввода, работу с секретами, кэширование, логи, метрики и трассировку. Есть блоки про документацию, коммиты и CI.
Устроено просто: это один файл SKILL.md, который агент подхватывает и держит в контексте. Никаких скриптов и внешних зависимостей он не тянет. Советует держать функции короче 30 строк, использовать параметризованные запросы и не коммитить секреты — это ориентиры, а не жёсткие лимиты, которые что-то проверяет автоматически.
Правила общие, под конкретный язык или фреймворк их придётся уточнять самому. Если в проекте уже есть свой свод соглашений, этот скилл будет с ним спорить за внимание агента — тогда лучше оставить что-то одно.
Какие задачи решает
- задать агенту единый стиль кода в проекте
- объяснить, как раскладывать логику по слоям
- подсказать, что проверять при работе с пользовательским вводом
- напомнить про параметризованные запросы и хранение секретов
- сформулировать требования к тестам и логированию
Примеры запросов агенту
- Проверь новый модуль по правилам скилла general-best-practices и скажи, что нарушено
- Разложи этот сервис по слоям так, как советует general-best-practices
- Прогони этот код на утечки секретов и небезопасный ввод по general-best-practices
Как установить general-best-practices
1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill general-best-practices -a claude-code2Вручную: положить файлы
~/.claude/skills/general-best-practices/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/general-best-practices/
1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill general-best-practices -a codex2Вручную: положить файлы
.agents/skills/general-best-practices/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill general-best-practices -a cursor2Вручную: положить файлы
.cursor/skills/general-best-practices/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install Mindrally/skills general-best-practices2Вручную: положить файлы
.github/skills/general-best-practices/SKILL.md1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill general-best-practices -a gemini-cli2Командой платформы
gemini skills install https://github.com/Mindrally/skills --path general-best-practicesВручную: положить файлы
.devin/skills/general-best-practices/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill general-best-practices -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о general-best-practices
Как установить general-best-practices в Claude?
Выполните npx skills add Mindrally/skills --skill general-best-practices -a claude-code. После этого файл скилла появится в ~/.claude/skills/general-best-practices/SKILL.md.
Что делает general-best-practices?
Даёт агенту набор правил по качеству кода, архитектуре, тестам, безопасности, производительности и наблюдаемости. Агент опирается на них, когда пишет или разбирает код.
Скилл привязан к конкретному языку или фреймворку?
Нет, правила общие для разных стеков. Под свой язык и фреймворк их придётся дополнять.
Исходный текст
SKILL.md · Apache-2.0
--- name: general-best-practices description: General software development best practices covering code quality, testing, security, performance, and maintainability across technology stacks metadata: maintainer: Mindrally source: https://github.com/Mindrally/skills --- # General Best Practices A comprehensive collection of software development best practices applicable across various technology stacks and project types. ## Code Quality ### Readability and Maintainability Write short, focused functions with a single responsibility. Use clear, descriptive names for variables, functions, and classes. Avoid deep nesting; prefer early returns and guard clauses. Keep functions and methods to a reasonable length (typically under 30 lines). ### Error Handling Always handle errors explicitly rather than silently ignoring them. Use wrapped errors for traceability and context. Provide meaningful error messages that help with debugging. Fail fast and fail loudly during development. ### Code Organization Organize code into logical modules and packages. Separate concerns: keep business logic separate from infrastructure code. Use consistent file and folder naming conventions. Follow the principle of least surprise in API design. ## Architecture ### Clean Architecture Principles Structure code into distinct layers: - **Presentation/Handlers**: Handle external requests and responses - **Application/Services**: Orchestrate business operations - **Domain**: Core business logic and entities - **Infrastructure**: External systems, databases, and frameworks ### Design Principles Prefer composition over inheritance. Program to interfaces, not implementations. Use dependency injection for testability and flexibility. Design for change: isolate business logic and minimize framework lock-in. Apply SOLID principles where appropriate. ## Testing ### Unit Testing Write tests that are fast, isolated, and repeatable. Use table-driven tests for testing multiple scenarios. Mock external dependencies cleanly. Aim for high test coverage of business-critical code. ### Integration Testing Test interactions between components and external systems. Use separate test configurations and databases. Clean up test data after each test run. ### Test Organization Separate fast unit tests from slower integration tests. Run fast tests frequently during development. Include tests in CI/CD pipelines. ## Security ### Input Validation Validate all inputs at service boundaries. Never trust user input; sanitize and validate everything. Use parameterized queries to prevent SQL injection. ### Authentication and Authorization Use secure defaults for tokens and sessions. Implement proper access control at every layer. Store secrets securely; never commit them to version control. ### Network Security Use HTTPS for all communications. Implement rate limiting to prevent abuse. Use circuit breakers for external service calls. ## Performance ### Optimization Principles Profile before optimizing; avoid premature optimization. Measure and benchmark regularly. Focus on hot paths and frequently executed code. ### Resource Management Minimize memory allocations in critical paths. Use connection pooling for database and network connections. Implement proper resource cleanup and disposal. ### Caching Cache expensive computations and frequently accessed data. Use appropriate cache invalidation strategies. Consider cache consistency and freshness requirements. ## Observability ### Logging Use structured logging (JSON format for production). Include relevant context: request IDs, user IDs, timestamps. Log at appropriate levels: DEBUG, INFO, WARN, ERROR. Avoid logging sensitive information. ### Metrics Track key metrics: latency, throughput, error rates. Set up alerts for anomalies and threshold violations. Use dashboards for visibility into system health. ### Tracing Implement distributed tracing for microservices. Propagate trace context across service boundaries. Record important attributes in spans for debugging. ## Documentation ### Code Documentation Document public APIs with clear descriptions. Explain the "why" not just the "what". Keep documentation close to the code it describes. Update documentation when code changes. ### Project Documentation Maintain a clear README with setup instructions. Document architecture decisions (ADRs). Provide contribution guidelines for team members. ## Version Control ### Commit Practices Write clear, concise commit messages. Make atomic commits that represent a single logical change. Keep commits small and focused. ### Branch Strategy Use feature branches for new development. Keep the main branch stable and deployable. Review code before merging to main. ## Tooling and Automation ### Continuous Integration Run tests automatically on every commit. Enforce code formatting and linting. Include security scanning in the pipeline. ### Development Environment Use consistent development environments across the team. Document setup steps and prerequisites. Automate common development tasks.
© Mindrally · Apache-2.0 · Mindrally/skills