/ 目录 / 演练场 / agent-rules-skill
● 社区 netresearch ⚡ 即开即用

agent-rules-skill

作者 netresearch · netresearch/agent-rules-skill

Generates AGENTS.md files following the agents.md convention — tells any coding agent (Claude Code, Cursor, Codex) how your repo works.

A small, focused Claude Code skill by Netresearch. It inspects a repository and drafts an AGENTS.md file following the agents.md convention — a growing standard for telling AI agents project conventions, build commands, testing approach, and contribution rules in one place.

为什么要用

核心特性

实时演示

实际使用效果

agent-rules-skill.replay ▶ 就绪
0/0

安装

选择你的客户端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "agent-rules-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/netresearch/agent-rules-skill",
        "~/.claude/skills/agent-rules-skill"
      ],
      "_inferred": true
    }
  }
}

打开 Claude Desktop → Settings → Developer → Edit Config。保存后重启应用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "agent-rules-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/netresearch/agent-rules-skill",
        "~/.claude/skills/agent-rules-skill"
      ],
      "_inferred": true
    }
  }
}

Cursor 使用与 Claude Desktop 相同的 mcpServers 格式。项目级配置优先于全局。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "agent-rules-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/netresearch/agent-rules-skill",
        "~/.claude/skills/agent-rules-skill"
      ],
      "_inferred": true
    }
  }
}

点击 Cline 侧栏中的 MCP Servers 图标,然后选 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "agent-rules-skill": {
      "command": "git",
      "args": [
        "clone",
        "https://github.com/netresearch/agent-rules-skill",
        "~/.claude/skills/agent-rules-skill"
      ],
      "_inferred": true
    }
  }
}

格式与 Claude Desktop 相同。重启 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "agent-rules-skill",
      "command": "git",
      "args": [
        "clone",
        "https://github.com/netresearch/agent-rules-skill",
        "~/.claude/skills/agent-rules-skill"
      ]
    }
  ]
}

Continue 使用服务器对象数组,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "agent-rules-skill": {
      "command": {
        "path": "git",
        "args": [
          "clone",
          "https://github.com/netresearch/agent-rules-skill",
          "~/.claude/skills/agent-rules-skill"
        ]
      }
    }
  }
}

加入 context_servers。Zed 保存后热重载。

claude mcp add agent-rules-skill -- git clone https://github.com/netresearch/agent-rules-skill ~/.claude/skills/agent-rules-skill

一行命令搞定。用 claude mcp list 验证,claude mcp remove 卸载。

使用场景

实战用法: agent-rules-skill

Generate an AGENTS.md for a repo that doesn't have one

👤 Teams introducing AI coding agents to an existing codebase ⏱ ~15 min beginner

何时使用: Your team just started using Claude Code / Cursor and nobody's written the orientation doc.

前置条件
  • Skill installed — git clone https://github.com/netresearch/agent-rules-skill ~/.claude/skills/agent-rules-skill
步骤
  1. Run it on your repo
    Use agent-rules-skill. Analyze this repo and draft an AGENTS.md following the convention.✓ 已复制
    → Draft with build/test commands, lint config, style notes, gotchas
  2. Refine
    Add a section on where not to edit (generated files, vendor/).✓ 已复制
    → Section added with explicit paths
  3. Commit
    Commit as docs/AGENTS.md.✓ 已复制
    → File committed at repo root or in docs/

结果: A living AGENTS.md that makes future agent sessions start with context.

注意事项
  • AGENTS.md balloons into an everything-doc — Keep it focused on what an agent needs. Link to README for humans.
搭配使用: filesystem · git

Generate per-package AGENTS.md files in a monorepo

👤 Monorepo maintainers ⏱ ~30 min intermediate

何时使用: Different packages have different conventions; a single root AGENTS.md isn't enough.

步骤
  1. Scan packages
    Use agent-rules-skill. For each package in packages/, generate a tailored AGENTS.md capturing its specifics.✓ 已复制
    → One AGENTS.md per package
  2. Root summary
    Generate a root AGENTS.md that links to per-package files and lists shared rules.✓ 已复制
    → Root file with pointers

结果: Agents pick up the right context based on which package they're working in.

搭配使用: filesystem

Keep AGENTS.md in sync with an evolving repo

👤 Repos where AGENTS.md goes stale fast ⏱ ~10 min beginner

何时使用: You added new build commands or changed conventions and AGENTS.md lies about them.

步骤
  1. Diff
    Use agent-rules-skill. Compare current AGENTS.md to what the repo actually has now. What's stale?✓ 已复制
    → List of drift items
  2. Update
    Update only the stale parts; leave human-written sections alone.✓ 已复制
    → Minimal diff preserving human commentary

结果: AGENTS.md stays trustworthy.

搭配使用: git

组合

与其他 MCP 搭配,撬动十倍杠杆

agent-rules-skill + filesystem

Apply generated files directly

Write the draft to AGENTS.md at repo root.✓ 已复制
agent-rules-skill + git

Commit as a focused change

Commit the new AGENTS.md with a message describing what it covers.✓ 已复制

工具

此 MCP 暴露的能力

工具输入参数何时调用成本
scan_repo repo path First step on any repo 0
draft_agents_md scan output Drafting new file 0
diff_check existing AGENTS.md + current repo Staleness check 0

成本与限制

运行它的成本

API 配额
None
每次调用 Token 数
Modest — repo scan + short output
费用
Free
提示
Run on focused directories in huge monorepos; whole-repo scans are token-heavy.

安全

权限、密钥、影响范围

凭据存储: None
数据出站: Repo contents go through Claude API during scan

故障排查

常见错误与修复

Generated commands don't match CI

Verify against actual CI config; skill infers from common files but not always correct

File is too long

Prompt for conciseness; agents.md is meant to be short

替代方案

agent-rules-skill 对比其他方案

替代方案何时用它替代权衡
Manually writing AGENTS.mdSmall repo with clear conventionsWorks but drifts; need discipline to keep fresh
Cursor-specific .cursorrulesYou only use CursorNon-portable; AGENTS.md works across agents

更多

资源

📖 阅读 GitHub 上的官方 README

🐙 查看未解决的 issue

🔍 浏览全部 400+ MCP 服务器和 Skills