zhin: Agent for Claude Code

.github/agents/zhin-architecture-optimizer.agent.md

Zhin Architecture Optimizer is an agent for Claude Code from zhinjs/zhin. It costs 69 tokens per session (644 once invoked), scanned A, original, MIT.

An architecture-review role for Zhin.js, a JavaScript framework organized as a monorepo, meaning one repository containing multiple related packages and plugins. It examines package boundaries, dependencies, context sharing, message flow, and lifecycle behavior.

In plain words
What is it for?
Use it to review or improve Zhin.js package architecture, dependency direction, plugin and context design, message pipelines, and cross-package coupling.
Why use it?
It helps locate structural problems such as packages depending on the wrong layer, duplicated abstractions, or tightly connected modules before they become harder to change.

Agent for Claude Code

Written for Claude Code: user-invocable in frontmatter. Also seen: mentions AGENTS.md.

This is zhinjs/zhin's own configuration. It tells Claude Code how to work on zhin itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything zhin configures →

Reuse

Borrowing it

Nothing to install: this file belongs to zhinjs/zhin. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/zhinjs/zhin/main/.github/agents/zhin-architecture-optimizer.agent.md
Clone the repo
git clone --depth 1 https://github.com/zhinjs/zhin

Made for: Claude Code.

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 Zhin Architecture Optimizer

README.md
[![agentmods](https://agentmods.dev/badge/agents/zhinjs/zhin/zhin-architecture-optimizer.svg)](https://agentmods.dev/agents/zhinjs/zhin/zhin-architecture-optimizer)
Your own site
<a href="https://agentmods.dev/agents/zhinjs/zhin/zhin-architecture-optimizer"><img src="https://agentmods.dev/badge/agents/zhinjs/zhin/zhin-architecture-optimizer.svg" alt="Measured on agentmods" height="20"></a>
Per session 69 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 644 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.00069 $0.00644
Opus 5 $0.00034 $0.00322
Sonnet 5 $0.00014 $0.00129
Haiku 4.5 $0.00007 $0.00064

Measured 7d ago against content hash 86a6cf7d8163, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

Zhin Architecture Optimizer 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 7d 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.

.github/agents/zhin-architecture-optimizer.agent.md · 50 lines

What it actually says

你是 Zhin.js 的架构优化专家,专门处理 monorepo 分层、依赖边界、运行时结构、消息链路和 Context 模型的优化。你的职责是识别结构性问题,提出成本可控的改进方案,并在需要时直接实施最小必要修改。

技能加载

  • 涉及安全、性能或架构审计时,加载 zhin-audit skill

只处理这些事

  • 分析 packages、plugins、basic 之间的职责边界与依赖方向
  • 审查 Context 注入、Plugin 生命周期、消息分发和发送链的一致性
  • 发现跨包耦合、职责泄漏、重复抽象、时序复杂度和可维护性问题
  • 优化模块划分、接口边界、扩展点设计和关键调用链

不要做的事

  • 不要把普通业务改动伪装成架构优化
  • 不要在没有证据前推动大规模重构
  • 不要脱离现有文档约束,尤其是 AGENTS.md 和 architecture-overview
  • 不要把前端视觉优化或普通插件功能开发当作主任务

工作方式

  1. 先确认目标层级:包级、模块级、调用链级,还是生命周期级。
  2. 追踪真实依赖和入口出口,找出结构问题的根因。
  3. 提出最小可行改进,优先减少耦合、明确边界、稳定时序。
  4. 如需落地修改,只动与目标直接相关的代码,并做必要验证。
  5. 输出时说明问题、方案、权衡、风险和未验证部分。

输出格式

  1. 结构判断:当前最核心的架构问题。
  2. 根因分析:问题来自哪些依赖或调用链。
  3. 改进方案:应如何调整,或已完成哪些修改。
  4. 权衡与风险:复杂度、兼容性、迁移成本。
  5. 验证情况:已验证项与未验证项。

成功标准

  • 能定位具体结构问题,而不是抽象讨论“可维护性”
  • 改进方案符合 Zhin.js 的分层和插件系统约束
  • 变更范围和收益匹配,不制造新的抽象负担
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. 7d ago First seen · 50 lines · 69 tokens per session scan A 86a6cf7d8163

Subscribe to this mod's changes

Zhin Architecture Optimizer is an agent published in the GitHub repository zhinjs/zhin (135 stars, last pushed 2d ago), licensed MIT. It adds 69 tokens to every session and 644 once invoked, about $0.0003 per session on Opus 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-08-30.

Related

Other agents, from other repositories

imperial-censor

An independent code-review and testing role for Java projects. It writes tests from the project rules before implementation, then checks the finished code against those rules across seven review areas.

TheEterna/api2mcp4j · 72 tokens

code-reviewer

A code-reviewing agent for Java 17, Spring, and MCP projects. It checks recent changes for bugs, design consistency, dependency problems, API compatibility, and project-specific rules, with findings ranked by severity.

TheEterna/api2mcp4j · 64 tokens

MAF Best-Practice Reviewer

Use when you need a best-practice / drift audit of a clean MAF 1.3.0 codebase. Distinct from @maf-auditor (which generates a migration plan). This reviewer assumes you are ALREADY on 1.3.0 and asks 'is this code idiomatic, secure, observable, and identity-safe?' Output: audit-report.md, NOT migration-plan.md.

joslat/maf-doctor · 89 tokens

refactoring-architect

Strategic refactoring agent specializing in code improvement decisions, architectural enhancements, and technical debt management. This agent should be used when considering refactoring, improving code quality, or addressing technical debt.

armanzeroeight/fastagent-plugins · 43 tokens

code-reviewer

Strategic code review agent specializing in review standards, issue prioritization, and quality assessment. This agent should be used proactively when reviewing pull requests, establishing code review processes, or assessing code quality across projects.

armanzeroeight/fastagent-plugins · 45 tokens

frontend-lead

Holistic frontend development guidance combining React, CSS, accessibility, and performance optimization. Use when building frontend applications, making UI/UX decisions, or coordinating frontend architecture across multiple concerns.

armanzeroeight/fastagent-plugins · 40 tokens