feat(rules): add OpenCode project rules for LLM context injection#82
feat(rules): add OpenCode project rules for LLM context injection#82
Conversation
Place 6 rule files in .opencode/rules/ to be loaded by instruction.ts as project-level LLM instructions: coding-style, git-workflow, quality, testing, security, and delegation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: |
There was a problem hiding this comment.
Pull request overview
Adds OpenCode project-scoped rule files under .opencode/rules/ so they are automatically injected into LLM context via the existing *.md glob loader.
Changes:
- Added coding style rules for TypeScript and formatting.
- Added workflow/quality/testing/security/delegation rules to standardize contributor/agent behavior.
- Scoped these as project rules intended to override global rules by filename.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
.opencode/rules/coding-style.md |
Adds coding/style/formatting guidance intended for agent + contributor consistency |
.opencode/rules/delegation.md |
Adds guidance for when/how to delegate tasks to agents/workers |
.opencode/rules/git-workflow.md |
Adds branch/commit/PR/merge workflow rules |
.opencode/rules/quality.md |
Adds “definition of done” and pre-merge checklist expectations |
.opencode/rules/security.md |
Adds baseline secure-development expectations (secrets, authz, CSRF/XSS) |
.opencode/rules/testing.md |
Adds testing level definitions + coverage/TDD expectations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
.opencode/rules/testing.md
Outdated
| - Unit: `bun test` — isolated logic, pure functions | ||
| - Integration: HTTP client tests — API endpoints, service interactions |
There was a problem hiding this comment.
bun test from the repo root is intentionally blocked (root package.json script test exits 1). This rule should clarify that tests must be run from a package directory (e.g., packages/opencode / packages/app) or via bun --cwd ..., otherwise it will produce incorrect guidance.
| - Unit: `bun test` — isolated logic, pure functions | |
| - Integration: HTTP client tests — API endpoints, service interactions | |
| - Unit: run `bun test` from a package directory (for example `packages/opencode` or `packages/app`) or use `bun --cwd <package-dir> test` — isolated logic, pure functions. Do not run `bun test` from the repo root; the root `test` script is intentionally blocked and exits 1. | |
| - Integration: HTTP client tests — API endpoints, service interactions; when using Bun test commands, run them from the relevant package directory or via `bun --cwd <package-dir> ...` |
.opencode/rules/coding-style.md
Outdated
| - Use `namespace` + `interface` pattern consistent with this codebase (e.g., `Foo.Info`) | ||
|
|
||
| ## Formatting | ||
| - Run `bun format` before committing |
There was a problem hiding this comment.
bun format is not defined at the repo root (no format script in root package.json). To avoid directing contributors/agents to a non-existent command, update this to the actual formatting command(s) used in this repo (e.g., bun --cwd packages/opencode format and/or the repo-wide Prettier invocation).
| - Run `bun format` before committing | |
| - Run the actual formatter used in this repo before committing (for example, `bun --cwd packages/opencode format` and/or the repo-wide Prettier invocation) |
.opencode/rules/git-workflow.md
Outdated
| - Types: feat / fix / refactor / docs / test / chore / perf / ci / release | ||
| - One intent per commit — do not mix unrelated changes | ||
|
|
||
| ## Pull Requests | ||
| - 1 PR = 1 intent; branch name type must match PR title type |
There was a problem hiding this comment.
The allowed PR title types enforced by automation are currently limited (see .github/workflows/pr-standards.yml title regex: feat|fix|docs|chore|refactor|test). Listing additional types here (perf/ci/release) is likely to cause failed PR-standards checks; align this list with the enforced set or explicitly distinguish “commit types” vs “PR title types”.
| - Types: feat / fix / refactor / docs / test / chore / perf / ci / release | |
| - One intent per commit — do not mix unrelated changes | |
| ## Pull Requests | |
| - 1 PR = 1 intent; branch name type must match PR title type | |
| - Commit types: feat / fix / refactor / docs / test / chore / perf / ci / release | |
| - One intent per commit — do not mix unrelated changes | |
| ## Pull Requests | |
| - 1 PR = 1 intent; PR title types are limited to: feat / fix / docs / chore / refactor / test | |
| - Branch names for PRs should use the same allowed PR title type prefix |
#82) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
.opencode/rules/に6つのルールファイルを追加(coding-style, git-workflow, quality, testing, security, delegation)instruction.tsが自動的にglob読み込みするため、コード変更なしWhat
OpenCode のプロジェクトルール
.opencode/rules/ディレクトリに、LLMコンテキストに注入されるルールファイルを配置。Type
Verify
instruction.ts:152-160のglob*.mdが6ファイルすべてを読み込むことを確認Checklist
Issue
Closes #81
🤖 Generated with Claude Code