Skip to content

Commit b639ed4

Browse files
committed
chore: add agent guidelines, editorconfig, and symlink CLAUDE.md
Add AGENTS.md with guidelines for AI coding agents covering lint requirements, performance expectations, commit conventions, and changelog practices. Symlink CLAUDE.md to AGENTS.md so Claude Code picks up the same rules. Add .editorconfig enforcing LF line endings, final newlines, 4-space indentation for Rust, and 2-space for config/doc files.
1 parent eb6090d commit b639ed4

4 files changed

Lines changed: 67 additions & 1 deletion

File tree

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
trim_trailing_whitespace = true
7+
charset = utf-8
8+
indent_style = space
9+
indent_size = 4
10+
11+
[*.{toml,yml,yaml,json,md}]
12+
indent_size = 2

AGENTS.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# AI Agent Guidelines for PHPantom
2+
3+
This is a Rust-based PHP language server. Performance and memory
4+
efficiency are critical -- PHPantom is one of the fastest language
5+
servers available and it must stay that way.
6+
7+
## Before Committing
8+
9+
Always run these checks before considering any change complete:
10+
11+
```bash
12+
cargo clippy -- -D warnings
13+
cargo clippy --tests -- -D warnings
14+
cargo fmt
15+
```
16+
17+
Clippy runs twice: once for library code, once including tests. Run
18+
`cargo fmt` after clippy, not before -- clippy fixes can affect
19+
formatting.
20+
21+
## Contributing Guidelines
22+
23+
Read and follow [docs/CONTRIBUTING.md](docs/CONTRIBUTING.md) for the
24+
full set of CI checks, testing conventions, and code style rules.
25+
26+
## Key Rules
27+
28+
- **Performance is critical.** Every allocation, clone, and lock
29+
matters. Avoid unnecessary heap allocations, prefer `&str` over
30+
`String` where possible, and be mindful of hot paths. Do not
31+
introduce regressions in startup time or memory usage.
32+
- **Run the full lint pipeline.** `cargo clippy` and `cargo fmt` must
33+
pass with zero warnings before every commit. Do not skip this.
34+
- **Update the changelog.** When a change affects user-visible
35+
behaviour, add an entry under `## [Unreleased]` in
36+
`docs/CHANGELOG.md`. Write for end users, not developers. Include
37+
`Contributed by @username` with the GitHub username of the author.
38+
- **Reference issues in commits.** When fixing a GitHub issue, include
39+
`Closes #123` in the commit message body.
40+
- **Prefer single tests.** Run individual tests (`cargo test test_name`)
41+
rather than the full suite during development for faster feedback.
42+
- **Debug root causes.** When investigating a bug, determine the root
43+
cause rather than patching symptoms.
44+
- **Clean commit history.** Use atomic commits, each representing one
45+
logical change. No fixup or WIP commits. Use
46+
[conventional commits](https://www.conventionalcommits.org/) for the
47+
subject line (`feat:`, `fix:`, `docs:`, `refactor:`, `chore:`, etc.).
48+
The commit body should explain *why* the change was made, not just
49+
what changed. Wrap the body at 80 characters.
50+
- **Comments only where they add value.** Don't add obvious or
51+
boilerplate comments. Do comment tricky logic, non-obvious design
52+
decisions, and workarounds. Follow existing conventions.
53+
All files must end with a newline.

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PHPantom -- a PHP language server
1+
# PHPantom: a PHP language server
22

33
<p align="center">
44
<img src="assets/spookaphant.svg" alt="PHPantom" width="200" />

0 commit comments

Comments
 (0)