Borrowing it
Nothing to install: this file belongs to sybrew/troy. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/sybrew/troy/main/.github/instructions/php.instructions.mdgit clone --depth 1 https://github.com/sybrew/troyWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/sybrew/troy/php)<a href="https://agentmods.dev/instructions/sybrew/troy/php"><img src="https://agentmods.dev/badge/instructions/sybrew/troy/php/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/sybrew/troy/php"><img src="https://agentmods.dev/badge/instructions/sybrew/troy/php.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.02476 | $0.02476 |
| Opus 5.5 | $0.00990 | $0.00990 |
| Sonnet 5.5 | $0.00495 | $0.00495 |
| Haiku 4.5 | $0.00248 | $0.00248 |
Grade A, and why
troy php.instructions.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 63 lines — stays where its author put it; the contents beside it link to each section on GitHub.
PHP and WordPress Rules
- Use PHP 8.4+ for
src/troy-server/**. Use PHP 7.4+ for PHP files elsewhere in the repository. - Use WordPress coding standards, except where this file narrows them.
- Write PHP attributes inline on the symbol they annotate, for example
function foo( #[\SensitiveParameter] $x ). If the attribute plus that symbol would exceed 80 visual columns (tab = 4), put the attribute on the line above. If the attribute itself exceeds 80, wrap its arguments like a function call. - Never add phpcs comments. That includes
phpcs:disable,phpcs:enable,phpcs:ignore,phpcs:set, and any-- phpcs:annotation. Do not copy them from existing files into new or edited code. Existing comments in unmodified files stay. - Avoid functions
wp_sprintf, except with%llists,wp_json_encode, andstatus_header. - Never add hooks in class constructs.
- In
add_filter()andadd_action(), write each argument on a new line when implementing anonymous functions. - Do not mark anonymous functions or arrow functions
staticexcept in instance methods.staticonly prevents binding$this. - Do not create
validate_callbacksfor REST routes. Validate and sanitize parameters directly in the route callback. - Use short array syntax.
- Always delimit regular expressions with
/. Escape slashes in the pattern. Do not use#or other preg delimiters. - Add trailing commas on multiline array items and function calls. Do not add them on function, method, closure, or
fn()parameter lists, closureuse (lists, or control-structure conditions in PHP 7.4 packages (PHP 8.0 syntax).src/troy-server/**(PHP 8.4+) may use trailing commas on multiline parameter lists. - A one-line list of plain strings longer than 120 visual columns (tab = 4) requires one string per line. Sort that list by byte order unless position changes behavior, such as the search array of
str_replace. A one-line list of at most 120 visual columns stays as written. - Never use strict typing unless required.
- Short Echo Tags, HereDoc, and NowDoc are permitted.
- Use
(s|v)printffor complex strings when variables still need to be escaped. - Align array key/value separators with spaces before the separator.
- Do not pad array access strings with spaces.
- Avoid output buffering.
- You may use
str_starts_with,str_ends_with, andstr_contains; WordPress provides these. - Refrain from colon syntax for conditionals and loops.
- You may use logical operators like
and,or, andxor, but not in conditional expressions. - Use
??(or??=) when the coalesced value is assigned or returned. The miss value must benull. - Use
?:when any empty value is a miss and a string of0is not a valid keep. - Use
or/andfor statement-level short-circuit, for exampleisset( $x ) or $x = ...orget_cache() or set_cache(). Do not use??as a statement. - Pass-through wrappers stay on the opener line; the inner call whose arguments exceed 30 characters starts on the next line. After the coalesce or ternary break, a remaining single nested call may stay compact, for example
?? Query\Cache::memo( self::is_menu_page( Admin\Menu::get_page_hook_name() ) ). - Keep a coalesce of two wrappers on one line when the right-hand call is a single-argument pass-through, for example
memo() ?? memo( array_values(. - When a
?:expression wraps, treat it like??: break after=, break at?:first, and pad the first operand by 3 spaces. When that first operand is a call with multiple parameters, put each parameter on its own line, indent the call one tab, and put?:or??at the same indent as that call. Do not pad that call by 3 spaces. Keep each later operand on one line. - A single-property array that is the only argument stays on the opener, for example
get_post_types( [ 'public' => true ] ). That is not the multi-argument wrap trigger. If the only argument is a multi-property array, keepfn( [and wrap the properties. - Wrap a Boolean
&&/||function argument so phpcs treats it as one argument. - Compact
if/elseif: keep a voidreturn;,continue;, orbreak;on the same line when that line is at most 80 columns (tab = 4). Put areturnwith a value on the next line, unbraced. If that compact void line exceeds 80, put the terminator on the next line, unbraced. Do not wrap a single expression (no&&/||) just to make room for the terminator. If an&&/||condition line exceeds 80, wrap at those operators (first operand padded by 3 spaces) and use braces. Do not wrap only thereturn. - After a function opening
{, insert a blank line when the body has two or more statements. A single-statement body stays tight. A leading comment is not a statement: comment plus a singlereturnoryieldstays tight, comment on the first interior line. With two or more statements, the blank line comes first so that comment sits on the next interior line. Do not insert that blank afterif,elseif,else, loop,try, or labeled{(label: {) braces. - A
returnoryieldthat ends that interior always has a blank line before it if that interior has two or more statements. Earlyreturn/yieldinsideif/elsecount: the blank is a visual split that this path ends there. A single-statement interior that is only areturnoryieldstays tight. Own-line comments immediately above thatreturnoryieldstay attached to it; the blank line goes before that comment group. Do not insert that blank beforecontinueorbreak. After an earlyreturn,continue, orbreakguard, insert a blank line before the next sibling statement, including another guard. - Inside a function, isolate a required in-body docblock from sibling statements: a blank line before the docblock and a blank line after the statement it documents. Keep the docblock glued to that expression. Consecutive documented units share one blank between them. The function-opening blank already counts as the before-blank. Do not add a blank before
}. This is for WordPress hook documentation on siblingdo_action,apply_filters,do_action_ref_array,apply_filters_ref_array,do_action_deprecated, andapply_filters_deprecated. Glue the docblock to that call. Aniforreturnmay carry the doc when that hook is the entire condition or the returned expression. If the hook is an operand of a compoundif, keep that oneif(cheap tests first so the hook still short-circuits). Put the doc immediately above the call, grouping the call in parentheses when!or a line-start&&/||would otherwise sit between the doc and the call. Do not split theifinto extra guards to isolate the doc. It is not for undocumented hook calls. It is not for a hook doc that annotates a function argument: glue that docblock to that argument; argument wrap already isolates it. It is not for/* translators: */, which stays immediately above the gettext call, including when that string is an argument. It is not for other interior/**(closure parameter docs, explanatory comments). - When outside global namespace:
- Namespace-escape only these native PHP functions:
strlen,is_null,is_bool,is_long,is_int,is_integer,is_float,is_double,is_string,is_array,is_object,is_resource,is_scalar,boolval,intval,floatval,doubleval,strval,defined,chr,ord,call_user_func_array,call_user_func,in_array,count,sizeof,get_class,get_called_class,gettype,func_num_args,func_get_args,array_slice,array_key_exists,sprintf,constant,function_exists,is_callable,extension_loaded,dirname,define. - Do not namespace-escape any other native PHP functions.
- Put imported non-native PHP symbols above the copyright header, below the direct-access guard, in this order: constants, functions, classes.
- Namespace-escape imported non-native PHP function calls that resolve outside the current namespace.
- Namespace-escape constants that are not imported.
- When importing multiple symbols from the same namespace, use a single import statement with a comma-separated list and each item on a new line. A single symbol stays on one line:
use Troy\Server\API;Do not wrap a lone name in{ }. - Import only first-order
Troy\Serversymbols: primary branches (Admin,API,Endpoints,Integrations,Packages,Plugins,Settings,Stats,Themes) and first-order classes (Admin_Menu,Admin_Scripts,Cron,File_Utils,Markdown,Plugin_Table,Template,Zip_Extractor). Do not import nested classes. Write those at the call site (Plugins\Files::,Settings\Data::,Admin\Notice\Persistent::,Endpoints\Base_Endpoint,Integrations\Plugins\Store::). - Within each group (constants, functions, classes), sort imported identifiers alphabetically (case-sensitive
strcmp).APIbeforeAdmin. - Same-namespace siblings and nested children of the current namespace stay unqualified (
new DataandCPT\Store::inTroy\Server\Plugins). Do not import a branch that shadows a sibling of the current namespace (Endpoints\Routermust not importPluginsorPackages). - Do not namespace-escape calls to functions defined in the current namespace unless phpcs.xml already requires an exception.
- Namespace-escape only these native PHP functions:
- For SQL queries over 80 characters:
- Put every clause on a new line.
- If a clause exceeds 60 characters, put each logical operator on a new line, put each predicate on a new line, keep aliases on the same line as the column unless they contain an operator or exceed 60 characters, put expressions on new lines, and indent every new line by one tab.
- Put operators at the start of new lines.
- When mixing PHP and HTML, indent HTML to match the PHP block scope.
- Close PHP tags on a new line after an opening brace.
- Reopen PHP tags on their own line before the closing brace.
- Use double quotes for HTML attribute values.
- Do not self-close void elements.
- Do not use quote marks on literal string attribute values unless necessary.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 63 lines · 2,476 tokens per session scan A 0a332328cb42
troy php.instructions.md is an instructions file published in the GitHub repository sybrew/troy (55 stars, last pushed 14d ago), licensed MIT. It adds 2,476 tokens to every session, about $0.0099 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-26.
Other instructions, from other repositories
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, cache eligibility and rollout and applying the notice (cutover).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
vscode copilot-instructions.md
Copilot instructions for microsoft/vscode, covering vs code copilot instructions, project overview, root folders, core architecture (src/ folder) and built-in extensions (extensions/ folder).
vscode model-prompts.instructions.md
Model-specific prompt authoring and registry guidelines.