Communitygithub.com

SamuelChien/mega-skills-collection

自动检测并加载项目中 agents.md 文件,实现主动式上下文加载。在检测到适当上下文时使用,根据技能目的触发相关短语。

mega-skills-collection 是什么?

Agent Context Loader 技能用于在 AI 编码代理(如 Claude Code、Cursor、Codex 等)中自动发现并加载项目层次结构中的 `AGENTS.md` 文件。它扫描当前工作目录及其父目录,定位代理指令文件,并将其内容整合呈递给当前代理会话,从而提供完整操作上下文。该技能支持多级加载(根目录先加载作为全局上下文,子目录后加载作为补充或覆盖),并会检测冲突(如子目录代理指令与根层级规则矛盾)。输出包括有序的文件路径列表、合并后的指令集、冲突报告以及会话缓存状态。对于 monorepo 或嵌套工作区尤其有用,能够高效管理不同层级(全局、模块、子包)的代理指令配置。支持的平台包括 Claude Code 等,通过自动发现减少手动配置工作量。

兼容平台✓Claude Code✓Codex CLI~Cursor
npx skills add https://github.com/SamuelChien/mega-skills-collection/tree/HEAD/agent-context-loader

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Agent 上下文加载器

概述

自动发现并加载 AI 编码代理在项目层次结构中的 AGENTS.md 文件。此技能扫描当前工作空间及其父目录,定位代理指令文件,并将其内容呈递给当前代理会话,从而提供完整的操作上下文。

前提条件

  • 项目工作空间中包含一个或多个位于任意目录深度的 AGENTS.md 文件
  • 具有遍历目录树的读取和 Glob 权限
  • 当存在多个候选文件时,需具备用于搜索文件内容的 Grep 访问权限

指令

  1. 扫描当前工作目录及其所有祖先目录(直到文件系统根或仓库根),查找名为 AGENTS.md 或 agents.md 的文件。
  2. 搜索当前工作空间的子目录,查找可能适用于子项目或模块的其他 AGENTS.md 文件。
  3. 确定加载顺序:距离仓库根目录较近的文件先加载(全局上下文),位于更深层目录的文件后加载(覆盖或补充)。
  4. 读取每个发现的 AGENTS.md 文件,提取其中的指令块、工作流定义和约束声明。
  5. 将指令合并为统一的上下文,注意各个层级之间的冲突(例如,子目录代理覆盖了根层级的规则)。
  6. 将加载的上下文呈现为结构化摘要:源文件路径、指令数量和检测到的冲突。
  7. 缓存当前会话的发现结果,以避免在后续激活时重复进行文件系统扫描。

输出

  • 已发现的 AGENTS.md 文件路径的有序列表及其目录深度
  • 合并所有已发现代理上下文的指令集
  • 冲突报告,突出显示各层级之间存在的矛盾指令
  • 会话缓存状态,指示结果是新获取的还是复用的

错误处理

错误原因解决方案
未找到 AGENTS.md工作空间没有代理指令文件确认正确的工作目录;必要时在项目根目录创建 AGENTS.md
遍历目录时权限被拒绝工作空间上方的父目录受限将扫描深度限制为仓库根目录(通过检测 .git/ 是否存在)
检测到循环符号链接符号链接目录创建了无限遍历循环扫描时跳过符号链接目录;记录包含符号链接路径的警告
跨层级指令冲突子目录的 AGENTS.md 与根层级文件矛盾在输出中标记冲突;默认应用更具体的(更深层)指令
文件编码错误AGENTS.md 使用了非 UTF-8 编码尝试 latin-1 回退;报告文件路径和编码问题

示例

示例 1:包含每个包代理指令的 Monorepo

  • 结构:根目录的 AGENTS.md 设置全局约定;packages/api/AGENTS.md 添加 API 特定的工具规则。
  • 结果:按顺序加载两个文件。API 特定的规则补充全局上下文,没有冲突。

示例 2:包含冲突提交策略的嵌套工作空间

  • 结构:根目录的 AGENTS.md 规定“始终签名提交”;services/legacy/AGENTS.md 规定“跳过提交签名”。
  • 结果:检测到并报告冲突。应用更深层(旧版)指令,并附带覆盖警告。

示例 3:首次设置,无代理文件

  • 结构:一个刚克隆的仓库,没有任何 AGENTS.md。
  • 结果:扫描完成,找到零个文件。输出包含建议,在仓库根目录创建一个含有最小模板的 AGENTS.md。

资源

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

SamuelChien/mega-skills-collection

Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

SamuelChien/mega-skills-collection

Arquitecto de Soluciones Principal y Consultor Tecnológico de Andru.ia. Diagnostica y traza la hoja de ruta óptima para proyectos de IA en español.

SamuelChien/mega-skills-collection

Ingeniero de Sistemas de Andru.ia. Diseña, redacta y despliega nuevas habilidades (skills) dentro del repositorio siguiendo el Estándar de Diamante.

SamuelChien/mega-skills-collection

Estratega de Inteligencia de Dominio de Andru.ia. Analiza el nicho específico de un proyecto para inyectar conocimientos, regulaciones y estándares únicos del sector. Actívalo tras definir el nicho.

SamuelChien/mega-skills-collection

2D game development principles. Sprites, tilemaps, physics, camera.

SamuelChien/mega-skills-collection

3D game development principles. Rendering, shaders, physics, cameras.

SamuelChien/mega-skills-collection

Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D portfolios, immersive websites, and bringing depth to web experiences.

SamuelChien/mega-skills-collection

Accessibility audit skill for scanning, fixing, and verifying WCAG 2.2 Level A and AA compliance across React, Next.js, Vue, Angular, Svelte, and plain HTML codebases. Use when auditing accessibility, fixing a11y violations, checking color contrast, generating compliance reports, or integrating accessibility checks into CI/CD pipelines.

SamuelChien/mega-skills-collection

Ab Test Analyzer - Auto-activating skill for Data Analytics. Triggers on: ab test analyzer, ab test analyzer Part of the Data Analytics skill category.

SamuelChien/mega-skills-collection

A B Test Config Creator - Auto-activating skill for ML Deployment. Triggers on: a b test config creator, a b test config creator Part of the ML Deployment skill category.

SamuelChien/mega-skills-collection

When the user wants to plan, design, or implement an A/B test or experiment. Also use when the user mentions "A/B test," "split test," "experiment," "test this change," "variant copy," "multivariate test," "hypothesis," "conversion experiment," "statistical significance," or "test this." For tracking implementation, see analytics-tracking.

SamuelChien/mega-skills-collection

Acceptance Criteria Creator - Auto-activating skill for Enterprise Workflows. Triggers on: acceptance criteria creator, acceptance criteria creator Part of the Enterprise Workflows skill category.

SamuelChien/mega-skills-collection

Use when a coding task should be driven end-to-end from issue intake through implementation, review, deployment, and acceptance verification with minimal human re-intervention.

SamuelChien/mega-skills-collection

Accessibility Audit Runner - Auto-activating skill for Frontend Development. Triggers on: accessibility audit runner, accessibility audit runner Part of the Frontend Development skill category.

SamuelChien/mega-skills-collection

You are an accessibility expert specializing in WCAG compliance, inclusive design, and assistive technology compatibility. Conduct audits, identify barriers, and provide remediation guidance.

SamuelChien/mega-skills-collection

Web accessibility patterns for WCAG 2.2 compliance including ARIA, keyboard navigation, screen readers, and testing

SamuelChien/mega-skills-collection

Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the Discord channel.

SamuelChien/mega-skills-collection

Create unified specification packages across Business, Development, and Design teams. Staged elaboration (L0 Vision → L1 Requirements → L2 Team Detail → L3 Acceptance Criteria) to build shared understanding. Does not write code.

SamuelChien/mega-skills-collection

Research a company or person and get actionable sales intel. Works standalone with web search, supercharged when you connect enrichment tools or your CRM. Trigger with "research [company]", "look up [person]", "intel on [prospect]", "who is [name] at [company]", or "tell me about [company]".

SamuelChien/mega-skills-collection

Validate messaging consistency across website, GitHub repos, and local documentation generating read-only discrepancy reports. Use when checking content alignment or finding mixed messaging. Trigger with phrases like "check consistency", "validate documentation", or "audit messaging".

相关技能