|
| 1 | +## Purpose |
| 2 | + |
| 3 | +This document defines baseline conventions and expectations for all agents |
| 4 | +contributing to any project. Treat this as a living document -- expect things |
| 5 | +to change with time. Use this doc as a starting point, but do not treat it as |
| 6 | +the single source of truth. |
| 7 | + |
| 8 | +## General guidelines |
| 9 | + |
| 10 | +- **Complexity is your arch-nemesis**. Write clear, maintainable, and minimal |
| 11 | + code. Avoid unnecessary abstractions. You’re writing code for humans first, |
| 12 | + computers second. |
| 13 | +- Saying no (to a feature or abstraction or rewrite) is OK. |
| 14 | +- Sometimes you have no choice but to say OK because otherwise it halts all |
| 15 | + progress. |
| 16 | +- **Easier to ask for permission than to repair the damage**. Unless you are |
| 17 | + explicitly given permission, always ask before committing to something. |
| 18 | +- **Always favor being explicit over implicit**. |
| 19 | +- **Follow the principle of least surprise** -- your code should behave in a |
| 20 | + way that most users will expect it to behave, and therefore not astonish or |
| 21 | + surprise users. |
| 22 | +- Default to idempotent operations and stateless design when possible. |
| 23 | +- **Avoid premature optimization**. |
| 24 | +- Always program defensively (more under #security-considerations). |
| 25 | +- **Treat warnings and errors as bugs to fix, not noise to ignore.** |
| 26 | +- Always use `context7` tools when you need code generation, setup or |
| 27 | + configuration steps, or documentation. Automatically use the Context7 MCP |
| 28 | + tools to resolve the `libraryId` and get library docs without me having to |
| 29 | + explicitly ask. |
| 30 | +- If you are unsure how to do something, use `gh_grep` to search code examples |
| 31 | + from GitHub. |
| 32 | + |
| 33 | +## Writing good commit messages |
| 34 | + |
| 35 | +Follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/#specification) |
| 36 | +spec when writing commit messages, unless a project defines its own guidelines. |
| 37 | + |
| 38 | +Additionally: |
| 39 | + |
| 40 | +- Description should be concise and in the imperative mood (e.g. “add”, not |
| 41 | + “adds” or “added”). |
| 42 | +- Only use lowercase for the commit summary. |
| 43 | +- No period at the end of the commit summary. |
| 44 | +- The commit summary should not exceed 75 characters (if at all possible). |
| 45 | +- You can write a longer commit body in addition to the |
| 46 | + |
| 47 | +### Examples |
| 48 | + |
| 49 | +#### Commit message with no body |
| 50 | + |
| 51 | +``` |
| 52 | +docs: correct spelling of CHANGELOG |
| 53 | +``` |
| 54 | + |
| 55 | +#### Commit message with scope |
| 56 | + |
| 57 | +``` |
| 58 | +feat(lang): add Polish language |
| 59 | +``` |
| 60 | + |
| 61 | +#### Commit message with multi-paragraph body and multiple footers |
| 62 | + |
| 63 | +``` |
| 64 | +fix: prevent racing of requests |
| 65 | +
|
| 66 | +Introduce a request id and a reference to latest request. Dismiss |
| 67 | +incoming responses other than from latest request. |
| 68 | +
|
| 69 | +Remove timeouts which were used to mitigate the racing issue but are |
| 70 | +obsolete now. |
| 71 | +
|
| 72 | +Reviewed-by: Z |
| 73 | +Refs: #123 |
| 74 | +``` |
| 75 | + |
| 76 | +## Security considerations |
| 77 | + |
| 78 | +- **Never** log sensitive data (credentials, PII, secrets). |
| 79 | +- Do **not** install any new dependencies if the task can be achieved using |
| 80 | + existing libraries (standard lib or existing dependencies). |
| 81 | +- You must assume that your code might be misused actively to reveal bugs, |
| 82 | + and that bugs could be exploited maliciously. |
| 83 | +- If data is to be checked for correctness, verify that it is correct, not that |
| 84 | + it is incorrect. |
| 85 | +- Use assertions if the programming language (or runtime) supports them. |
| 86 | +- **All data is important until proven otherwise** -- all data must be verified |
| 87 | + as garbage before being destroyed. |
| 88 | +- **All data is tainted until proven otherwise** -- all data must be handled in |
| 89 | + a way that does not expose the rest of the runtime environment without |
| 90 | + verifying integrity. |
| 91 | +- **All code is insecure until proven otherwise** -- never assume your code is |
| 92 | + secure as bugs or undefined behavior may expose the project or system to |
| 93 | + attacks such as common SQL injection attacks. |
0 commit comments