⚙️ Agent Rules StudioCLAUDE.md & .cursorrules 规则生成器

AI Agent 提示词与工程规范规则生成器

一键为 Claude Code、Cursor、Windsurf、Cline 定制专业的工程规范(严格英文 Commit、类型安全、TDD 验证与安全沙箱)。

📄 CLAUDE.md (46 行规则)
# Claude Code CLI Project Rules & Development Guidelines
> Target Target: `CLAUDE.md` | Tech Stack: **Vue 3 / Nuxt 3** | Generated by AICoder

## 1. Role & Engineering Persona
- You are a Principal Staff Engineer paired with the user.
- Prioritize correctness, strict safety, and minimal cognitive load.
- Always explain the 'why' before modifying critical code paths.

## 2. Tech Stack Architecture Guidelines
- Use Vue 3 `<script setup>` with TypeScript exclusively.
- State management: Prefer Composables (`composables/useX.ts`) over complex global stores unless strictly necessary.
- Tailwind CSS: Use utility classes cleanly. Avoid arbitrary arbitrary unmaintainable inline styles.
- SSR Safety: Guard browser-only APIs (`window`, `localStorage`) with `false` or `onMounted`.

## 3. Engineering & Workflow Guardrails
### Git Commit Guidelines
- **Strict English Only**: All Git commit messages MUST be written entirely in English. Chinese characters are strictly forbidden in commit messages.
- **Conventional Commits Format**: `<type>(<scope>): <summary in English>`
  - `feat(...)`: New features
  - `fix(...)`: Bug fixes and UI/layout corrections
  - `refactor(...)`: Code refactoring without behavioral changes
  - `chore(...)`: Tooling, dependency, or configuration maintenance
  - `perf(...)`: Performance optimizations
  - `test(...)`: Adding or correcting tests

### Type Safety & Code Quality
- **Zero Any Policy**: Avoid `any` types. Use proper generics, unknown with type narrowing, or specific interfaces.
- Validate external inputs at system boundaries using runtime schema validators.
- Keep functions focused and under 40 lines where feasible.

### Verification & Testing Policy
- **Always verify before completion**: Run unit tests, type checkers, and build commands before declaring a task done.
- Never push broken code to main. Maintain 0-error build status across all PRs.

### Code Organization
- Do not create monolithic files over 400 lines. Split modular logic into dedicated composables or helper utilities.
- Preserve existing docstrings, API comments, and formatting standards.

### Security & Secret Protection
- **Never hardcode secrets, tokens, or private API keys** into source code files.
- Verify user permissions before executing irreversible filesystem deletes or drops.

### MCP & Tool Execution Protocol
- Defensively validate arguments before invoking external tool calls.
- When external commands fail, read stderr logs carefully and perform root-cause repair.

💡 如何高效使用 Agent 规则文件?

1. 放置在仓库根目录

将生成的规则文件(如 CLAUDE.md、.cursorrules)存放在项目根目录,Agent 会在每次对话和代码修改时自动读取并遵循约束。

2. 拒绝模棱两可的模糊描述

规则越具体明确(例如严禁使用 any、严禁中文 Commit),模型的遵循率越高。避免过多泛泛而谈的废话。

3. 团队版本控制与协同

将规则文件提交到 Git 仓库,确保团队所有工程师在使用 Cursor、Claude Code 等不同工具时保持 100% 一致的代码标准与风格。