Skip to content

Commit 8287501

Browse files
authored
GH#943: docs(agents): expand guidance for 4 recurring error patterns from superdav42 (#944)
- read:file_not_found: add includes/, src/, lib/, languages/, .env to non-existent paths table - edit:not_read_first: add explicit per-file read-then-edit workflow with numbered steps - webfetch:other: add Stripe and PayPal gateway file pointers as webfetch alternatives - bash:other: add PHPCS --standard= flag warning (config is in .phpcs.xml.dist)
1 parent e4ecc70 commit 8287501

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@ read them will produce `read:file_not_found`:
224224
| `phpstan.neon` | Gitignored override; use `phpstan.neon.dist` |
225225
| `vendor/**` | Gitignored; run `composer install` first |
226226
| `node_modules/**` | Gitignored; run `npm install` first |
227+
| `includes/` | Does not exist; this repo uses `inc/` (not `includes/`) |
228+
| `src/` | Does not exist; PHP classes live in `inc/` |
229+
| `lib/` | Does not exist; use `inc/` for PHP code, `assets/` for frontend |
230+
| `languages/` | Does not exist; i18n files are in `lang/` |
231+
| `.env`, `.env.example` | Does not exist; no local env config stored in this repo |
227232

228233
Always verify a file is tracked before reading it with `git ls-files '<path>'`. An empty result means the file does not exist in the repo.
229234

@@ -251,6 +256,8 @@ Use the codebase itself for API/hook research:
251256

252257
- WordPress functions and hooks → `rg 'function_name'` across `inc/`
253258
- Existing gateway patterns → read `inc/gateways/` directly
259+
- Stripe integration details → read `inc/gateways/class-base-stripe-gateway.php`
260+
- PayPal integration details → read `inc/gateways/class-base-paypal-gateway.php`
254261
- REST API shape → read `inc/apis/` trait files
255262
- Hook reference → `rg 'do_action\|apply_filters'` across `inc/`
256263
- BerlinDB schema → read `inc/database/` directly
@@ -259,6 +266,14 @@ Use the codebase itself for API/hook research:
259266

260267
The Edit tool **requires** a prior Read call on the same file in the **current conversation session**. A prior read from a previous conversation does not count — if the session restarts or the context is cleared, re-read every file before editing it. If you attempt to edit without reading first, the tool will fail. Always read the complete target file before editing — even for small changes.
261268

269+
**Required per-file workflow — follow this every time:**
270+
271+
1. Call `Read` on the target file.
272+
2. Immediately call `Edit` on that same file.
273+
3. If you need to edit another file, call `Read` on that next file first.
274+
275+
Do **not** read all files at session start and edit them later. The pattern `Read(A) → Read(B) → Edit(A)` is correct only if A's content has not changed; in practice, read immediately before each edit to stay safe.
276+
262277
When working on multiple files in the same session: read each file immediately before editing it, not at the start of the session. Reading file A, then file B, then editing file A will fail if A's content changed between your read and your edit.
263278

264279
### WP-CLI and Bash Prerequisites
@@ -345,3 +360,12 @@ bootstrapped. Use WP-CLI for WordPress-context commands instead:
345360
wp eval 'echo get_option("blogname");' # correct — WP context available
346361
php -r 'echo get_option("blogname");' # wrong — fatal: Call to undefined function
347362
```
363+
364+
**Do not pass `--standard=` to PHPCS** — the coding standard is already declared in
365+
`.phpcs.xml.dist` (and `.phpcs.xml` if present). Passing `--standard=WordPress` manually
366+
overrides the project config and ignores custom rules. Run PHPCS without a `--standard=` flag:
367+
368+
```bash
369+
vendor/bin/phpcs inc/path/to/file.php # correct — uses .phpcs.xml.dist
370+
vendor/bin/phpcs --standard=WordPress inc/path/to/file.php # wrong — bypasses project config
371+
```

0 commit comments

Comments
 (0)