跳到主内容
智客 ZICQ

技能库 智客分类:安全测试 bagisto-coding-standards

Bagisto Coding Standards

在写、修改或审查任何 Bagisto PHP 或 Blade 时使用——这个代码库所持有的公约,包括Laravel idom、代码样式、评论和docblocks、数据库访问、Blade、安全和本地化。 触发短语包括"标准","公约","代码风格","docblock","评论","存储图案","Blade","组件","绑定","事件","移民","安全","XSS","授权","逃脱","这是安全的","最佳做法"等.

69 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

在写、修改或审查任何 Bagisto PHP 或 Blade 时使用——这个代码库所持有的公约,包括Laravel idom、代码样式、评论和docblocks、数据库访问、Blade、安全和本地化。 触发短语包括"标准","公约","代码风格","docblock","评论","存储图案","Blade","组件","绑定","事件","移民","安全","XSS","授权","逃脱","这是安全的","最佳做法"等.

何时用

编写、修改或审查任何 Bagisto PHP 或 Blade —— 这个代码库所持有的公约,包括Laravel idom、代码样式、评论和docblocks、数据库访问、Blade、安全和本地化。 触发短语包括"标准","公约","代码风格","docb"

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Coding Standards、Reference files、The rules in one screen、Where the code and these files disagree、Related。

文件分析

文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。

官方 description(原文)

Use when writing, changing or reviewing any Bagisto PHP or Blade — the conventions this codebase holds to, covering Laravel idiom, code style, comments and docblocks, database access, Blade, security and localization. Trigger phrases include "standards", "conventions", "code style", "docblock", "comments", "repository pattern", "blade", "component", "binding", "event", "migration", "security", "XSS", "authorization", "escaping", "is this safe", "best practice".

Coding StandardsReference filesThe rules in one screenWhere the code and these files disagreeRelated

· 许可:MIT

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
bagisto-coding-standards
description
Use when writing, changing or reviewing any Bagisto PHP or Blade — the conventions this codebase holds to, covering Laravel idiom, code style, comments and docblocks, database access, Blade, security and localization. Trigger phrases include "standards", "conventions", "code style", "docblock", "comments", "repository pattern", "blade", "component", "binding", "event", "migration", "security", "XSS", "authorization", "escaping", "is this safe", "best practice".
许可
MIT
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「bagisto-coding-standards」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-46fcb928b3b82013-%E5%B7%B4%E5%90%89%E6%96%AF%E6%89%98%E7%BC%96%E7%A0%81%E6%A0%87%E5%87%86.html
请存为 .cursor/skills/bagisto-coding-standards/SKILL.md 或 .claude/skills/bagisto-coding-standards/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/bagisto/agent-skills' --list

npx skills add 'https://github.com/bagisto/agent-skills' --skill 'bagisto-coding-standards'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版

name: bagisto-coding-standards description: Use when writing, changing or reviewing any Bagisto PHP or Blade — the conventions this codebase holds to, covering Laravel idiom, code style, comments and docblocks, database access, Blade, security and localization. Trigger phrases include "standards", "conventions", "code style", "docblock", "comments", "repository pattern", "blade", "component", "binding", "event", "migration", "security", "XSS", "authorization", "escaping", "is this safe", "best practice". license: MIT

Coding Standards

The canonical rules for all Bagisto code, in one place, so a change to a DataGrid, a payment class or a theme is held to the same bar as a change to a package.

Pint decides the mechanical questions. Run vendor/bin/pint and trust it for spacing, import order, trailing commas and the rest. What follows is what Pint cannot see — and what a reviewer will otherwise send back.

Reference files

| File | Load when | |---|---| | code-style.md | Writing any PHP — multi-clause conditions, class member order | | comments.md | Any comment or docblock, in any language | | laravel.md | Framework idiom — events, migrations, config, helpers, validation, queues | | data-access.md | Reading or writing the database — the repository rule and its one exception | | security.md | Output, input, uploads, SQL, secrets, payments | | security-authorization.md | Routes, permissions, guards, one user's access to another's data | | blade.md | Any .blade.php — namespaces, : versus ::, components, page skeleton | | blade-formatting.md | Indentation, attribute layout, @props alignment, recipes | | localization.md | Any user-facing string, or a Resources/lang/ change |

The PHP rules apply inside an @php block too, which Pint cannot reach.

The rules in one screen

  • Every method and property carries a docblock, whatever its visibility. The description is a capitalised sentence ending in a full stop, and it is at most two lines. Type information belongs in the signature; add @param/@return only for what a native type cannot express.
  • Class members run constants → properties → constructor → public → protected → private, each visibility one contiguous block. A helper called by a public method still lives in the protected block at the bottom.
  • A condition with more than one clause goes multiline, the boolean operator leading each line. Single-clause conditions stay inline. The rule keys off the number of clauses, not the line length.
  • No comments inside method bodies, object literals or markup — not even a one-line "why". A non-obvious reason belongs in the method's docblock or the commit message. If a line needs prose to be understood, extract a named method instead. See comments.md.
  • No docblock above the class, ever — 98.7% of core classes have none. The docblock belongs on the method, property or constant, never on the class, interface, trait or enum.
  • A docblock is at most two lines. One is the norm. If it does not fit in two, it is not docblock material — cut it or move it to the commit message.
  • All database access goes through a repository. No DB:: and no model queries in controllers, listeners, jobs or services. The single sanctioned exception is a DataGrid's prepareQueryBuilder().
  • Events are dot-delimited strings, not classes — catalog.product.update.after — and fire in before/after pairs. See laravel.md.
  • : binds a PHP value, :: passes a literal : through to Vue, and :: only works on a Blade component tag. Getting this wrong fails silently. See blade.md.
  • Authorize on the server and escape at the point of interpolation. Hiding a control is presentation; the route and the controller decide what is allowed, and a value is safe in element text yet dangerous inside an attribute. See security.md.
  • Scope every storefront query to its owner. An id from the request never selects a row on its own — that is the easiest real vulnerability to introduce here. See security-authorization.md.
  • Every user-facing string goes through trans(), with the key added to all 22 locales and verified by php artisan bagisto:translations:check.
  • Fix what you touch. A pre-existing violation in a file you edit is yours — scan the whole class's member order and docblocks, not just your own lines.

Where the code and these files disagree

The checkout wins. Follow the surrounding code, say so in your summary, and raise the drift — these files are a snapshot, not the source of truth.

That is different from a file that is simply wrong: a missing docblock in an untouched class is debt, not a convention. Match the rule, not the worst example of it.

Related

  • bagisto-code-review — applying all of this to someone else's change.
  • bagisto-package-development — the structure these rules are written inside.

相关技能

安全测试

Skill Vetter

人工智能特工的安全第一技能审查。 在安装来自 ClawdHub, GitHub 或其他来源的任何技能之前使用 。 检查红旗,许可范围,可疑图案.

安全测试

Moltguard

MoltGuard——由OpenGuardrails担任OpenClaw保安. 安装 MoltGuard 以保护你和你的人类免受迅速注射、数据过滤和恶意命令的影响。 资料来源:https://github.com/openguardrails/openguardrails/tre…

安全测试

Security Auditor

用于审查安全漏洞代码,实施认证流,审计OWASP Top 10,配置CORS/CSP头,处理秘密,输入验证,SQL注射预防,XSS保护,或任何与安全相关的代码审查.

安全测试

Skill Vetter

安装任何AI代理技能前的安全审查协议. 红旗侦取入证盗取,疏通密码,放出. 风险分类:低/中/高/高。 编制结构化审查报告。 不先运行此功能, 绝不安装不信任的技能 .