|
1 | 1 | # AGENTS.md |
2 | 2 |
|
3 | | -## 目的 |
4 | | -このリポジトリで作業するコーディングエージェント向けの指示です。 |
| 3 | +This document defines mandatory rules for AI coding agents working in this repository. |
| 4 | +Follow these instructions exactly. |
5 | 5 |
|
6 | | -## 作業範囲 |
7 | | -- 変更は原則このリポジトリ内に限定する。 |
8 | | -- 生成ファイルは明示的な依頼がない限り編集しない。 |
| 6 | +--- |
9 | 7 |
|
10 | | -## 実行方針 |
11 | | -- 可能なら、変更後に最小限のテストやチェックを実行する。 |
12 | | -- テストが重い場合は、実行前に確認する。 |
13 | | -- 通常のテストコマンドは `./gradlew clean test`。 |
14 | | -- ドキュメント表示用のJavaScriptのみ編集した場合は `npm run test` を実行する。 |
15 | | - - 対象パスは `jig-core/src/main/resources/templates/assets` と `jig-core/src/test/js`。 |
| 8 | +## Principles |
16 | 9 |
|
17 | | -## コーディング指針 |
18 | | -- 既存の実装パターンに合わせる。 |
19 | | -- 変更は最小限・依頼内容に集中させる。 |
20 | | -- コメントは日本語を使用する。 |
| 10 | +- Choose safe and reversible actions. |
| 11 | +- Make the smallest change necessary to accomplish the task. |
| 12 | +- Preserve the existing architecture and conventions. |
| 13 | +- When unsure, stop and ask for clarification. |
21 | 14 |
|
22 | | -## 変更ポリシー |
23 | | -- 明示的な指示がない限り、外部仕様(公開挙動)を変えない。 |
24 | | -- 依頼と無関係なリファクタリングは避ける。 |
| 15 | +--- |
25 | 16 |
|
26 | | -## エスカレーション |
27 | | -- 新規依存追加、重いコマンド実行、破壊的操作の前に確認する。 |
| 17 | +## Language Policy |
28 | 18 |
|
29 | | -## コミット方針 |
30 | | -- 変更が完了したらコミットする。 |
| 19 | +- All commit messages must be written in Japanese. |
| 20 | +- All agent responses must be written in Japanese. |
| 21 | +- Code comments should be written in Japanese unless the existing codebase uses English-only comments. |
| 22 | + |
| 23 | +--- |
31 | 24 |
|
32 | | -## ブランチ運用 |
33 | | -- 依頼ごとに `agent/<topic>` 形式のブランチを作成して作業する。 |
| 25 | +## Guardrails (Must Follow) |
34 | 26 |
|
35 | | -## 参照 |
36 | | -- 詳細はこのリポジトリ内の README や docs を参照する。 |
| 27 | +- Never perform destructive operations. |
| 28 | +- Never rewrite shared history (e.g., force push, unsafe rebase). |
| 29 | +- Never modify repository internals (e.g., `.git`). |
| 30 | +- Do not make large or unrelated changes in a single task. |
| 31 | + |
| 32 | +If a task appears to require any of the above, **stop and ask for instructions**. |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## Scope of Work |
| 37 | + |
| 38 | +- Limit all changes to this repository. |
| 39 | +- Do not edit generated files or directories such as: |
| 40 | + - `build/` |
| 41 | + - `coverage/` |
| 42 | + - `node_modules/` |
| 43 | + - `dist/` |
| 44 | + |
| 45 | +If modification seems necessary, **stop and ask**. |
| 46 | + |
| 47 | +--- |
| 48 | + |
| 49 | +## Testing Policy |
| 50 | + |
| 51 | +Never bypass failing tests.Prefer fixing the root cause over disabling tests. |
| 52 | + |
| 53 | +Do not skip tests to save time. |
| 54 | + |
| 55 | +Run tests based on the type of change: |
| 56 | + |
| 57 | +- **JavaScript-only changes** → `npm run test` |
| 58 | +- **All other changes** → `./gradlew clean test` |
| 59 | + |
| 60 | +If tests cannot be executed, report: |
| 61 | + |
| 62 | +- the reason (e.g., permissions, environment issues) |
| 63 | +- that the tests were not run |
| 64 | + |
| 65 | +### Test Exceptions |
| 66 | + |
| 67 | +Tests are not required for the following changes: |
| 68 | + |
| 69 | +- CSS-only changes that do not affect JavaScript behavior |
| 70 | +- Documentation-only changes (e.g., `README.md`, files under `docs/`) |
| 71 | + |
| 72 | +If there is any possibility that runtime behavior is affected, run the tests. |
| 73 | + |
| 74 | +When unsure, run the tests. |
| 75 | + |
| 76 | +--- |
| 77 | + |
| 78 | +## Coding Guidelines |
| 79 | + |
| 80 | +- Follow existing implementation patterns. |
| 81 | +- Keep changes minimal and focused on the request. |
| 82 | +- Write comments in Japanese. |
| 83 | +- If existing comments are English-only, do not force translation — mixed language is acceptable. |
| 84 | + |
| 85 | +--- |
| 86 | + |
| 87 | +## Change Policy |
| 88 | + |
| 89 | +- Avoid refactoring unrelated to the request. |
| 90 | +- For new features or bug fixes, prefer adding a failing test before making the change when feasible. |
| 91 | +- After changes, check for duplication and refactor if it is clearly safe. |
| 92 | +- If uncertain whether refactoring is appropriate, report instead of modifying. |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +## Commit Policy |
| 97 | + |
| 98 | +- Commit in meaningful, minimal units. |
| 99 | +- Split commits when a task naturally involves multiple steps. |
| 100 | +- Always run tests before committing. |
| 101 | + |
| 102 | +### Commit Messages |
| 103 | + |
| 104 | +Use **Conventional Commits**: |
| 105 | + |
| 106 | +``` |
| 107 | +<type>[optional scope]: <description> |
| 108 | +
|
| 109 | +[optional body] |
| 110 | +
|
| 111 | +[optional footer(s)] |
| 112 | +``` |
| 113 | + |
| 114 | +Allowed `type` values: |
| 115 | + |
| 116 | +- `feat` — new feature |
| 117 | +- `fix` — bug fix |
| 118 | +- `refactor` — code improvement without behavior change |
| 119 | +- `docs` — documentation only |
| 120 | +- `test` — test additions or updates |
| 121 | + - Use `test(red)` when adding a failing test |
| 122 | +- `other` — if none apply |
| 123 | + |
| 124 | +Footer: |
| 125 | + |
| 126 | +- `JigDocument:<documentName>` — when a modified JigDocument is identifiable. |
| 127 | + |
| 128 | +### Commit Message Style |
| 129 | + |
| 130 | +Keep commit messages concise and factual. |
| 131 | + |
| 132 | +- Do not exaggerate impact or value. |
| 133 | +- Do not include promotional language. |
| 134 | +- Avoid unnecessary background or justification. |
| 135 | +- Describe what changed, not why it is great. |
| 136 | + |
| 137 | +Prefer short bodies. Omit the body if it is not necessary. |
| 138 | + |
| 139 | +#### JIG-DOCUMENT Rule |
| 140 | + |
| 141 | +If a change targets a specific JigDocument, add a footer: |
| 142 | +`JIG-DOCUMENT: <documentName>` |
| 143 | + |
| 144 | +Determine the document name from `JigDocument.java`: |
| 145 | + |
| 146 | +- If a modified file matches `jig-core/src/main/resources/templates/<documentFileName>.html`, |
| 147 | + add the corresponding `JigDocument`. |
| 148 | +- If a modified file matches `jig-core/src/main/resources/templates/assets/<documentFileName>.*`, |
| 149 | + add the corresponding `JigDocument`. |
| 150 | +- If multiple documents match, add all relevant `JIG-DOCUMENT` footers. |
| 151 | +- For shared assets (e.g., `assets/jig.js`) that affect multiple documents, add a footer |
| 152 | + **only when the task explicitly targets a document**. Otherwise omit to avoid false attribution. |
| 153 | + |
| 154 | +--- |
| 155 | + |
| 156 | +## Branch Strategy |
| 157 | + |
| 158 | +- Create a branch per request using: `agent/<topic>` |
| 159 | +- Branch from `main`. |
| 160 | +- Use short, lowercase, hyphenated names describing the work. |
| 161 | + |
| 162 | +Example: `agent/package-glossary-link` |
| 163 | + |
| 164 | +--- |
| 165 | + |
| 166 | +## Decision Rule |
| 167 | + |
| 168 | +When multiple approaches are possible: |
| 169 | + |
| 170 | +👉 **Choose the least invasive option.** |
| 171 | + |
| 172 | +Do exactly what was requested — nothing more. |
| 173 | +Do not proactively "improve" unrelated areas. |
0 commit comments