GitHub - steipete/agent-rules: Rules and Knowledge to work better with agents such as Claude Code or Cursor
Extracto
Rules and Knowledge to work better with agents such as Claude Code or Cursor - steipete/agent-rules
Resumen
Resumen Principal
Este documento detalla una colección de reglas y documentos de conocimiento reutilizables diseñados para potenciar asistentes de codificación de Inteligencia Artificial como Claude Code y Cursor. El repositorio está estructurado en dos secciones principales: project-rules/, que contiene reglas accionables y flujos de trabajo específicos para el desarrollo, abarcando desde la gestión de commits y revisiones de Pull Requests hasta la resolución de problemas y la generación de documentación; y docs/, que funciona como una base de conocimiento y referencia, incluyendo guías de migración para Swift, documentación de frameworks y mejores prácticas para el desarrollo de servidores Model Context Protocol (MCP). El sistema busca estandarizar prácticas, mejorar la calidad del código, optimizar la implementación de tareas y facilitar la mejora continua de las capacidades de los asistentes de IA, permitiendo a los desarrolladores integrar y aplicar estas directrices de manera flexible a nivel de proyecto o global.
Elementos Clave
- Estructura Modular y Funcional: El repositorio se organiza en
project-rules/para directrices accionables comocommit.mdc(commits estándar),pr-review.mdc(listas de verificación de revisión) eimplement-task.mdc(enfoque metódico para tareas), ydocs/para documentación de referencia y bases de conocimiento, incluyendo guías sobre Swift Development (swift6-migration.mdc) y MCP Development (mcp-best-practices.mdc), ofreciendo una clara separación entre la acción y el conocimiento. - Amplia Cobertura de Flujos de Trabajo de Desarrollo: Las reglas de
project-rules/cubren un espectro completo de actividades de desarrollo. Esto incluye Code Quality & Analysis (check.mdc,clean.mdc), Problem Solving & Implementation (bug-fix.mdc,five.mdcpara análisis de causa raíz), Documentation & Visualization (create-docs.mdc,mermaid.mdcpara diagramas) y Automation & Integration (safari-automation.mdc). Esta variedad permite a los asistentes de IA abordar casi cualquier fase del ciclo de vida del software. - Mecanismos de Uso Adaptados para Cada Asistente: Para usuarios de Cursor, las reglas se copian en el directorio
.cursor/rules/del proyecto, activándose automáticamente según patrones degloboalwaysApply: true. Para Claude Code, el contenido de los archivos.mdc(sin frontmatter) se copia enCLAUDE.md(a nivel de proyecto o global en~/.claude/CLAUDE.md), o se referencia directamente mediante la sintaxis@import, proporcionando flexibilidad para la integración. - Reglas Globales Potentes para Mejoras Transversales: La carpeta
global-rules/aloja configuraciones y scripts que pueden aplicarse a todos los proyectos a través de~/.claude/CLAUDE.md. Destacan reglas como GitHub Issue Creation (para transformar descripciones de características en
Contenido
Agent Rules
A collection of reusable rules and knowledge documents for AI coding assistants like Claude Code and Cursor.
Repository Structure
📁 project-rules/
Actionable rules for AI assistants to follow during development:
Development Workflows (Credit: @vincenthopf)
- commit.mdc - Standard commit with conventional format and emojis
- commit-fast.mdc - Fast commit workflow that auto-selects the first message
- add-to-changelog.mdc - Structured changelog updates following Keep a Changelog format
- pr-review.mdc - Multi-role pull request review checklist
Code Quality & Analysis
- check.mdc - Comprehensive code quality checks across different languages
- clean.mdc - Fix all formatting and linting issues
- code-analysis.mdc - Advanced multi-faceted code analysis options
Problem Solving & Implementation
- analyze-issue.mdc - GitHub issue analysis and implementation specification
- bug-fix.mdc - Complete bug-fixing workflow from issue to PR
- implement-task.mdc - Methodical task implementation approach
- five.mdc - Five Whys root cause analysis technique
Documentation & Visualization
- create-docs.mdc - Comprehensive documentation generation
- mermaid.mdc - Mermaid diagram generation for various visualizations
Project Setup & Meta
- context-prime.mdc - Load project context comprehensively
- create-command.mdc - Guide for creating new custom commands
- continuous-improvement.mdc - Systematic approach for improving AI assistant rules
- cursor-rules-meta-guide.mdc - Guidelines for creating and maintaining Cursor rules
Automation & Integration
- mcp-inspector-debugging.mdc - Debugging MCP servers with Inspector UI
- safari-automation.mdc - Advanced Safari browser automation techniques
- screenshot-automation.mdc - AppleScript patterns for automated screenshots
Language-Specific
- modern-swift.mdc - Modern SwiftUI architecture following Apple's latest best practices (Inspired by Dimillian's "Forget MVVM")
📁 docs/
Reference documentation and knowledge bases:
-
Swift Development
- swift-observable.mdc - Migration guide from ObservableObject to @Observable macro
- swift-observation.mdc - Swift Observation framework documentation
- swift-testing-api.mdc - Swift Testing framework API reference
- swift-testing-playbook.mdc - Comprehensive guide for migrating to Swift Testing
- swift-argument-parser.mdc - Swift Argument Parser framework documentation
- swift6-migration.mdc - Guide for migrating to Swift 6 with concurrency
-
MCP Development
- mcp-best-practices.mdc - Best practices for building Model Context Protocol servers
- mcp-releasing.mdc - Guide for releasing MCP servers as NPM packages
📁 global-rules/
Global Claude Code configuration and automation scripts (place in ~/.claude/CLAUDE.md):
- github-issue-creation.mdc - Creating well-structured GitHub issues (Credit: @nityeshaga)
- mcp-peekaboo-setup.mdc - Setup guide for Peekaboo vision-enabled MCP server
- terminal-title-wrapper.zsh - ZSH wrapper for dynamic terminal titles
- mcp-sync.sh - Script to sync MCP servers across Claude installations
- mcp-sync-rule.md - Documentation for MCP sync functionality
Usage
For Cursor Users
- Copy any
.mdcfile fromproject-rules/to your project's.cursor/rules/directory - Cursor will automatically apply rules based on the glob patterns in the frontmatter
- Rules with
alwaysApply: truewill be active for all files - Documentation from
docs/can be referenced or imported as needed
For Claude Code Users
- Copy the content of any
.mdcfile (excluding the frontmatter) into yourCLAUDE.mdfile - Or reference the entire file using the
@importsyntax in yourCLAUDE.md - Place in your project root or
~/.claude/CLAUDE.mdfor global rules - Both project rules and documentation can be included
Global Claude Code Rules
These are powerful global rules that can be placed in ~/.claude/CLAUDE.md to enhance Claude Code's capabilities across all projects. Based on strategies from "Commanding Your Claude Code Army".
Available Global Rules
1. GitHub Issue Creation
Transforms feature descriptions into well-structured GitHub issues following best practices.
- Credit: @nityeshaga
- Features: Repository research, convention analysis, automatic
gh issue createintegration - Usage: Provide a feature description and repository URL
2. MCP Server Setup - Peekaboo
Automated setup for the Peekaboo vision-enabled MCP server.
- Features: Screenshot capture with AI analysis, dual provider support (OpenAI/Ollama)
- Security: Secure API key extraction from
~/.zshrc - Requirements: Node.js 20.0+, macOS 14.0+
3. Terminal Title Management
Dynamic terminal titles for better multi-instance organization.
- Features: Shows
~/path/to/project — Claudeformat - Implementation: ZSH wrapper function (
cly) with background title persistence - Benefits: Easy identification of multiple Claude instances
Installation
-
Create Claude configuration directory:
-
Set up global rules:
# Create or edit global CLAUDE.md nano ~/.claude/CLAUDE.md # Add desired rules from this repository
-
For terminal title management:
# Copy wrapper script cp global-rules/terminal-title-wrapper.zsh ~/.config/zsh/claude-wrapper.zsh mkdir -p ~/.config/zsh # Add claude-wrapper.zsh content # Source in ~/.zshrc echo '[[ -f ~/.config/zsh/claude-wrapper.zsh ]] && source ~/.config/zsh/claude-wrapper.zsh' >> ~/.zshrc
Contributing
Feel free to contribute your own rules! Please ensure they:
- Use the
.mdcextension - Include proper YAML frontmatter with
description,globs, andalwaysApplyfields - Contain clear, actionable instructions
- Are generic enough to be reused across projects
- Are placed in the appropriate directory:
project-rules/for actionable AI assistant rulesdocs/for reference documentation
Why This Format?
This repository uses the .mdc (Markdown with Configuration) format, which provides a unified approach that works seamlessly with both Claude Code and Cursor:
- Cursor natively supports
.mdcfiles with YAML frontmatter for rule configuration - Claude Code reads the markdown content, ignoring the frontmatter metadata
- The YAML frontmatter provides optional metadata (description, file globs, alwaysApply) that Cursor uses for intelligent rule application
- Standard markdown content ensures compatibility across different AI assistants
This unified format means you can use the same rule files in both tools without modification.
License
MIT License - See LICENSE for details
Fuente: GitHub