AI News AI资讯 10h ago Updated 6h ago 更新于 6小时前 42

Show HN: Manage coding norms across your AI agents 展示 HN:跨 AI 代理管理编码规范

Norms is a CLI tool that centralizes coding rules as Markdown files in `.norms/` and auto-generates agent-specific rule files for Cursor, Claude, GitHub Copilot, and other coding agents Each norm has a stable ID, optional path scopes, and a single clear instruction, enabling granular, reusable, and version-controlled coding standards Norms can be managed through coding agents interactively or via CLI commands (`norms propose`, `norms sync`, `norms lint`, etc.), with full support for images, diag Norms是一个开源工具,用于将仓库级AI编程规则存储为Markdown,并自动生成各编码代理(Claude、Cursor、GitHub Copilot等)的规则文件 核心设计理念:一次定义规则,所有AI代理统一遵循,通过`.norms/`目录管理,支持路径作用域和冲突检测 支持多种指令格式:集成测试要求、依赖管理、代码规范、MR描述等,可包含图片、图表、代码片段等多媒体内容 提供完整CLI工具链:init、list、sync、propose、lint、check、review等命令,支持JSON输出和VS Code扩展 技术栈为TypeScript/Bun,开源协议为Public,提供mac

58
Hot 热度
62
Quality 质量
60
Impact 影响力

Analysis 深度分析

TL;DR

  • Norms is a CLI tool that centralizes coding rules as Markdown files in .norms/ and auto-generates agent-specific rule files for Cursor, Claude, GitHub Copilot, and other coding agents
  • Each norm has a stable ID, optional path scopes, and a single clear instruction, enabling granular, reusable, and version-controlled coding standards
  • Norms can be managed through coding agents interactively or via CLI commands (norms propose, norms sync, norms lint, etc.), with full support for images, diagrams, code snippets, and tables
  • The tool resolves norm conflicts, explains scope matches, and generates deterministic context for agent evaluation, ensuring consistent rule enforcement across teams

Why It Matters

Norms addresses a critical pain point in AI-assisted development: the fragmentation of coding standards across different agent platforms. By treating repo-level instructions as first-class Git-tracked artifacts, it enables teams to define rules once and have them consistently enforced across Cursor, Claude Code, GitHub Copilot, and other agents—eliminating the need to duplicate guidelines in multiple .mdc or instruction files.

Technical Details

  • Repository structure: Norms live as Markdown files under .norms/norms/ with frontmatter containing id and applies_to path scopes; supporting assets (images, diagrams) are stored in .norms/assets/stores/
  • Generated adapters: norms sync produces AGENTS.md, CLAUDE.md, .cursor/rules/norms.mdc, and .github/copilot-instructions.md from a single source of truth
  • CLI commands: Key commands include norms init (initialize repo), norms propose (create/update norms interactively), norms sync (generate adapters), norms lint (emit deterministic context), norms explain (resolve scope matches and conflicts), and norms review (commit, push, and open PR reviews)
  • Installation: Supports shell script (curl | sh) on macOS/Linux, PowerShell (irm | iex) on Windows, and source installation via bun install && bun run build
  • Extensibility: Norms support rich Markdown content including code snippets, tables, images, and links, enabling complex instructions beyond simple text rules

Industry Insight

  • The rise of multi-agent development workflows makes tools like Norms essential—teams using multiple coding agents will benefit from centralized rule management rather than maintaining parallel instruction files per platform
  • The "define once, sync everywhere" paradigm could become a standard pattern for AI-native repositories, similar to how .editorconfig or .prettierrc standardized formatting across tooling ecosystems
  • The norms review command's integration with GitHub/GitLab PR workflows suggests a future where norm changes themselves are subject to code review, bringing the same governance rigor to agent instructions as to application code

TL;DR

  • Norms是一个开源工具,用于将仓库级AI编程规则存储为Markdown,并自动生成各编码代理(Claude、Cursor、GitHub Copilot等)的规则文件
  • 核心设计理念:一次定义规则,所有AI代理统一遵循,通过.norms/目录管理,支持路径作用域和冲突检测
  • 支持多种指令格式:集成测试要求、依赖管理、代码规范、MR描述等,可包含图片、图表、代码片段等多媒体内容
  • 提供完整CLI工具链:init、list、sync、propose、lint、check、review等命令,支持JSON输出和VS Code扩展
  • 技术栈为TypeScript/Bun,开源协议为Public,提供macOS/Linux和Windows双平台安装脚本

为什么值得看

Norms解决了AI编程代理规则管理碎片化的痛点,为团队级AI编码规范提供了标准化方案。对于正在探索AI代理协同开发的工程团队,这种"规则即代码"的管理思路具有重要参考价值。

技术解析

架构设计:采用"单一数据源"模式,所有norms存储在.norms/norms/目录下的Markdown文件中,通过norms sync命令生成各代理适配文件(AGENTS.md、CLAUDE.md、.cursor/rules/norms.mdc、.github/copilot-instructions.md)。编辑时只修改源Markdown,不触碰生成的适配器文件。

规则格式:每个norm包含YAML frontmatter(id、applies_to路径作用域)和Markdown正文。支持路径过滤(如packages/**)、冲突声明、多媒体嵌入(图片、图表、代码片段、表格)。示例规则包括"所有新API端点必须包含集成测试"、"React组件不超过300行"等。

CLI工具链:提供10+命令,核心流程为norms init初始化→norms propose创建/更新规则→norms sync生成适配器→norms check验证配置。支持norms context [path]返回路径适用规则、norms explain <path>解释作用域匹配和冲突、norms lint输出确定性上下文供代理评估。

安装与开发:支持一键安装脚本(curl/PowerShell),自动验证校验和并可选安装VS Code扩展。开发模式使用Bun,源码在GitHub(gsttm/norms),构建产物为./dist/norms.js。仓库结构包含packages、scripts、docs、.cursor/rules等标准TS项目布局。

行业启示

AI代理生态标准化趋势:Norms的出现反映了AI编程代理从"单点工具"向"团队协作平台"演进的必然需求。随着Claude、Cursor、Copilot等代理并行使用,规则管理的标准化将成为工程效能的关键基础设施。

规则工程化机遇:将编码规范从"文档"升级为"可执行、可版本控制、可作用域过滤"的规则集,为AI时代的软件工程方法论提供了新范式。团队可借此建立"规范即代码"的实践,实现AI代理行为的可预测性和一致性。

工具链整合方向:Norms与Git工作流深度集成(commit、push、review),并支持VS Code扩展,体现了AI工具从"孤立助手"向"开发环境原生组件"转变的趋势。未来类似工具可能成为CI/CD管道和代码审查流程的标准组件。

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Open Source 开源 Agent Agent Code Generation 代码生成 Programming 编程