security-architecture

security-architecture is a skill for Claude Code, Codex from garrettw/php-arch-skills. It costs 44 tokens per session (1,253 once invoked), scanned A, original, MPL-2.0.

A guide to planning security architecture in PHP applications. It covers authentication, permissions, tenant separation, sensitive data, and trust boundaries between parts of a system.

In plain words
What is it for?
Use it to design identity and permission checks, validate untrusted inputs, separate tenants, protect sensitive data, and review trust boundaries.
Why use it?
It helps place security checks where they protect business rules, rather than relying only on framework middleware or a single boundary.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to design identity and permission checks, validate untrusted inputs, separate tenants, protect sensitive data, and review trust boundaries.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/garrettw/php-arch-skills/security-architecture
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add garrettw/php-arch-skills --skill security-architecture
Clone the repo
git clone --depth 1 https://github.com/garrettw/php-arch-skills

Made for: Claude Code, Codex.

Wrote 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.

agentmods badge for security-architecture

README.md
[![agentmods](https://agentmods.dev/badge/skills/garrettw/php-arch-skills/security-architecture/github.svg)](https://agentmods.dev/skills/garrettw/php-arch-skills/security-architecture)
Your own site
<a href="https://agentmods.dev/skills/garrettw/php-arch-skills/security-architecture"><img src="https://agentmods.dev/badge/skills/garrettw/php-arch-skills/security-architecture/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.

agentmods 80×15 button for security-architecture

Your own site · 80×15
<a href="https://agentmods.dev/skills/garrettw/php-arch-skills/security-architecture"><img src="https://agentmods.dev/badge/skills/garrettw/php-arch-skills/security-architecture.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,253 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00044 $0.01253
Opus 5.5 $0.00018 $0.00501
Sonnet 5.5 $0.00009 $0.00251
Haiku 4.5 $0.00004 $0.00125

Measured 18d ago against content hash 88a90cc4cf96, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

security-architecture 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 18d 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.

skills/security-architecture/SKILL.md · 78 lines

How it starts

The opening of the file, as written. The whole thing — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Security Architecture for PHP Applications

Security Starts at Trust Boundaries

Treat every value from a browser, API client, queue, webhook, file, or third-party system as untrusted until validated for its specific use. Identify the assets, actors, trust boundaries, and high-impact abuse cases before choosing controls. Security checks belong at boundaries and in the layer that owns the policy; framework middleware alone cannot protect business invariants.

This skill addresses architectural placement and decisions, not a complete secure-coding checklist or substitute for threat modeling, dependency scanning, penetration testing, or specialist review.

Numbered Workflows

1. Separating Identity from Permission

When a use case needs access control:

  1. Authenticate at the delivery boundary. Establish the caller's identity using the project's chosen mechanism. Public operations can intentionally allow anonymous callers.
  2. Authorize the operation. Check whether that identity may perform this action on this specific resource, not merely whether the caller is signed in.
  3. Enforce business invariants in the core. If a rule must hold regardless of entry point (HTTP, CLI, queue), enforce it in the application/domain use case, not only in a controller or route middleware.
  4. Fail closed. Missing, malformed, expired, or unverifiable identity/permission data must not grant access. Return a safe denial without disclosing whether protected resources exist when that distinction is sensitive.

Prefer explicit policies or narrow authorization ports over passing a framework user/session object deep into the application. Keep authentication protocol details in the delivery adapter; pass only the identity and relevant authorization context needed by the use case.

2. Enforcing Tenant and Resource Ownership

For multi-tenant or user-owned data:

  1. Derive the tenant and subject from verified server-side identity/context, never from an untrusted request field alone.
  2. Scope reads and writes by tenant/owner at the data-access boundary, and authorize the requested action at the use-case boundary.
  3. Apply the same rule to background jobs, exports, caches, search indexes, and administrative paths; these often bypass HTTP middleware.
  4. Test that a caller from tenant A cannot read, mutate, infer, or receive tenant B's data, including by guessing identifiers or replaying a queued message.

Read the full file on GitHub · 78 lines

Changes

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.

  1. 18d ago First seen · 78 lines · 44 tokens per session scan A 88a90cc4cf96

Subscribe to this mod's changes

security-architecture is a skill published in the GitHub repository garrettw/php-arch-skills (17 stars, last pushed 13d ago), licensed MPL-2.0. It adds 44 tokens to every session and 1,253 once invoked, about $0.0002 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-11-13.

Related

security-architecture compared with skills from other repositories

security-architecture next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
security-architecturegarrettw/php-arch-skillsSkill1713d agoMPL-2.0A44Claude Code, Codex
php-rulessoftspark/ai-toolkitSkill18013d agoApache-2.0A38Claude Code
bitrix-console-commandsbxmaximum/bitrix-framework-skillsSkill7513d agoMITA55Claude Code, Codex
daily-workflowdev-toolings/superpowers-symfonySkill23520d agoMITA19Claude Code
bitrix-componentsbxmaximum/bitrix-framework-skillsSkill7513d agoMITA58Claude Code, Codex
bitrix-http-clientbxmaximum/bitrix-framework-skillsSkill7513d agoMITA59Claude Code, Codex
bitrix-request-responsebxmaximum/bitrix-framework-skillsSkill7513d agoMITA57Claude Code, Codex