文档
English Docs
Rules

Rules

Rules allow you to customize OpenCode's behavior and responses.

Configuration

Rules can be defined in your configuration or through instruction files:

{
  "instructions": ["CONTRIBUTING.md", "docs/guidelines.md"]
}

Instruction Files

Place markdown files in your project to provide context:

  • AGENTS.md - Agent instructions
  • CONTRIBUTING.md - Contribution guidelines
  • Custom instruction files

Glob Patterns

Use glob patterns to include multiple files:

{
  "instructions": [".cursor/rules/*.md"]
}

Best Practices

  • Keep instructions concise
  • Focus on project-specific guidelines
  • Update instructions as the project evolves