Skill 寫法圖鑑

ecc-conventions

affaan-m | 設定與維護 | 原文 | MIT

ECC repo 的 commit、命名、測試與常見工作流慣例

中文翻譯

---
name: ecc-conventions
description: ECC 的開發慣例與模式。JavaScript 專案,採用 conventional commits。
license: MIT
---

# ECC Conventions

> 由 [affaan-m/ECC](https://github.com/affaan-m/ECC) 於 2026-03-20 產生

## 概覽

這個 skill 教 Claude ECC 所採用的開發模式與慣例。

## 技術棧

- **主要語言**:JavaScript
- **架構**:混合式模組組織
- **測試位置**:獨立存放

## 何時使用這個 Skill

在下列情況啟用這個 skill:
- 修改這個 repo
- 依既有模式新增功能
- 撰寫符合專案慣例的測試
- 用正確的訊息格式建立 commit

## Commit 慣例

依據分析過的 500 個 commit,遵循以下 commit 訊息慣例。

### Commit 風格:Conventional Commits

### 使用的前綴

- `fix`
- `test`
- `feat`
- `docs`

### 訊息準則

- 訊息平均長度:約 65 個字元
- 第一行要精簡又有描述性
- 用祈使語氣("Add feature" 而不是 "Added feature")


*Commit 訊息範例*

```text
feat(rules): add C# language support
```

*Commit 訊息範例*

```text
chore(deps-dev): bump flatted (#675)
```

*Commit 訊息範例*

```text
fix: auto-detect ECC root from plugin cache when CLAUDE_PLUGIN_ROOT is unset (#547) (#691)
```

*Commit 訊息範例*

```text
docs: add Antigravity setup and usage guide (#552)
```

*Commit 訊息範例*

```text
merge: PR #529 — feat(skills): add documentation-lookup, bun-runtime, nextjs-turbopack; feat(agents): add rust-reviewer
```

*Commit 訊息範例*

```text
Revert "Add Kiro IDE support (.kiro/) (#548)"
```

*Commit 訊息範例*

```text
Add Kiro IDE support (.kiro/) (#548)
```

*Commit 訊息範例*

```text
feat: add block-no-verify hook for Claude Code and Cursor (#649)
```

## 架構

### 專案結構:單一套件

這個專案採用**混合式**模組組織。

### 設定檔

- `.github/workflows/ci.yml`
- `.github/workflows/maintenance.yml`
- `.github/workflows/monthly-metrics.yml`
- `.github/workflows/release.yml`
- `.github/workflows/reusable-release.yml`
- `.github/workflows/reusable-test.yml`
- `.github/workflows/reusable-validate.yml`
- `.opencode/package.json`
- `.opencode/tsconfig.json`
- `.prettierrc`
- `eslint.config.js`
- `package.json`

### 準則

- 這個專案採用混合式組織
- 新增程式碼時,依循既有模式

## 程式碼風格

### 語言:JavaScript

### 命名慣例

| 元素 | 慣例 |
|---------|------------|
| 檔案 | camelCase |
| 函式 | camelCase |
| 類別 | PascalCase |
| 常數 | SCREAMING_SNAKE_CASE |

### Import 風格:相對路徑 Import

### Export 風格:混合風格


*偏好的 import 風格*

```typescript
// Use relative imports
import { Button } from '../components/Button'
import { useAuth } from './hooks/useAuth'
```

## 測試

### 測試框架

沒有偵測到特定的測試框架,沿用這個 repo 既有的測試模式。

### 檔案模式:`*.test.js`

### 測試類型

- **單元測試**:隔離測試個別的函式與元件
- **整合測試**:測試多個元件/服務之間的互動

### Coverage

這個專案已設定 coverage 報告。目標是 80% 以上的 coverage。


## 錯誤處理

### 錯誤處理風格:Try-Catch 區塊


*標準的錯誤處理模式*

```typescript
try {
  const result = await riskyOperation()
  return result
} catch (error) {
  console.error('Operation failed:', error)
  throw new Error('User-friendly message')
}
```

## 常見工作流

這些工作流是分析 commit 模式後偵測出來的。

### 資料庫 Migration

用 migration 檔案做資料庫 schema 變更

**頻率**:每月約 2 次

**步驟**:
1. 建立 migration 檔案
2. 更新 schema 定義
3. 產生/更新型別

**通常會牽涉的檔案**:
- `**/schema.*`
- `migrations/*`

**Commit 序列範例**:
```
feat: implement --with/--without selective install flags (#679)
fix: sync catalog counts with filesystem (27 agents, 113 skills, 58 commands) (#693)
feat(rules): add Rust language rules (rebased #660) (#686)
```

### 功能開發

標準的功能實作流程

**頻率**:每月約 22 次

**步驟**:
1. 新增功能實作
2. 為功能新增測試
3. 更新文件

**通常會牽涉的檔案**:
- `manifests/*`
- `schemas/*`
- `**/*.test.*`
- `**/api/**`

**Commit 序列範例**:
```
feat(skills): add documentation-lookup, bun-runtime, nextjs-turbopack; feat(agents): add rust-reviewer
docs(skills): align documentation-lookup with CONTRIBUTING template; add cross-harness (Codex/Cursor) skill copies
fix: address PR review — skill template (When to use, How it works, Examples), bun.lock, next build note, rust-reviewer CI note, doc-lookup privacy/uncertainty
```

### 新增語言規則

在規則系統中新增一個程式語言,包含 coding style、hook、模式、安全與測試準則。

**頻率**:每月約 2 次

**步驟**:
1. 在 rules/{language}/ 底下建立新目錄
2. 新增 coding-style.md、hooks.md、patterns.md、security.md 和 testing.md,內容針對該語言
3. 視需要引用或連結相關的 skill

**通常會牽涉的檔案**:
- `rules/*/coding-style.md`
- `rules/*/hooks.md`
- `rules/*/patterns.md`
- `rules/*/security.md`
- `rules/*/testing.md`

**Commit 序列範例**:
```
Create a new directory under rules/{language}/
Add coding-style.md, hooks.md, patterns.md, security.md, and testing.md files with language-specific content
Optionally reference or link to related skills
```

### 新增 Skill

在系統中新增一個 skill,記錄它的工作流、觸發條件與用法,通常還附輔助 script。

**頻率**:每月約 4 次

**步驟**:
1. 在 skills/{skill-name}/ 底下建立新目錄
2. 新增 SKILL.md 並寫好文件(何時使用、運作方式、範例等)
3. 視需要在 skills/{skill-name}/scripts/ 底下新增 script 或輔助檔案
4. 處理 review 回饋並反覆修訂文件

**通常會牽涉的檔案**:
- `skills/*/SKILL.md`
- `skills/*/scripts/*.sh`
- `skills/*/scripts/*.js`

**Commit 序列範例**:
```
Create a new directory under skills/{skill-name}/
Add SKILL.md with documentation (When to Use, How It Works, Examples, etc.)
Optionally add scripts or supporting files under skills/{skill-name}/scripts/
Address review feedback and iterate on documentation
```

### 新增 Agent

在系統中新增一個 agent,用於 code review、解決 build 問題或其他自動化任務。

**頻率**:每月約 2 次

**步驟**:
1. 在 agents/{agent-name}.md 建立新的 agent markdown 檔
2. 在 AGENTS.md 註冊這個 agent
3. 視需要更新 README.md 和 docs/COMMAND-AGENT-MAP.md

**通常會牽涉的檔案**:
- `agents/*.md`
- `AGENTS.md`
- `README.md`
- `docs/COMMAND-AGENT-MAP.md`

**Commit 序列範例**:
```
Create a new agent markdown file under agents/{agent-name}.md
Register the agent in AGENTS.md
Optionally update README.md and docs/COMMAND-AGENT-MAP.md
```

### 新增 Workflow 入口

新增或更新工作流入口。預設以 skill 優先;只有在仍需要舊式 slash 相容性時才加 command shim。

**頻率**:每月約 1 次

**步驟**:
1. 在 skills/{skill-name}/SKILL.md 建立或更新正式的工作流
2. 只在需要時,才新增或更新 commands/{command-name}.md 當作相容性 shim

**通常會牽涉的檔案**:
- `skills/*/SKILL.md`
- `commands/*.md`(只有在刻意保留舊式 shim 時)

**Commit 序列範例**:
```
Create or update the canonical skill under skills/{skill-name}/SKILL.md
Only if needed, add or update commands/{command-name}.md as a compatibility shim
```

### 同步目錄數量

讓 AGENTS.md 和 README.md 裡記載的 agent、skill、command 數量,跟 repo 實際狀態一致。

**頻率**:每月約 3 次

**步驟**:
1. 更新 AGENTS.md 裡的 agent、skill、command 數量
2. 更新 README.md 裡同樣的數量(quick-start、比較表等)
3. 視需要更新其他文件檔案

**通常會牽涉的檔案**:
- `AGENTS.md`
- `README.md`

**Commit 序列範例**:
```
Update agent, skill, and command counts in AGENTS.md
Update the same counts in README.md (quick-start, comparison table, etc.)
Optionally update other documentation files
```

### 新增跨 Harness 的 Skill 副本

為不同的 agent harness(例如 Codex、Cursor、Antigravity)新增 skill 副本,確保跨平台相容。

**頻率**:每月約 2 次

**步驟**:
1. 把 SKILL.md 複製或改編到 .agents/skills/{skill}/SKILL.md 和/或 .cursor/skills/{skill}/SKILL.md
2. 視需要新增各 harness 專屬的 openai.yaml 或設定檔
3. 處理 review 回饋,對齊 CONTRIBUTING 範本

**通常會牽涉的檔案**:
- `.agents/skills/*/SKILL.md`
- `.cursor/skills/*/SKILL.md`
- `.agents/skills/*/agents/openai.yaml`

**Commit 序列範例**:
```
Copy or adapt SKILL.md to .agents/skills/{skill}/SKILL.md and/or .cursor/skills/{skill}/SKILL.md
Optionally add harness-specific openai.yaml or config files
Address review feedback to align with CONTRIBUTING template
```

### 新增或更新 Hook

新增或更新 git 或 bash hook,用來落實工作流、品質或安全政策。

**頻率**:每月約 1 次

**步驟**:
1. 在 hooks/ 或 scripts/hooks/ 新增或更新 hook script
2. 在 hooks/hooks.json 或類似的設定檔註冊 hook
3. 視需要在 tests/hooks/ 新增或更新測試

**通常會牽涉的檔案**:
- `hooks/*.hook`
- `hooks/hooks.json`
- `scripts/hooks/*.js`
- `tests/hooks/*.test.js`
- `.cursor/hooks.json`

**Commit 序列範例**:
```
Add or update hook scripts in hooks/ or scripts/hooks/
Register the hook in hooks/hooks.json or similar config
Optionally add or update tests in tests/hooks/
```

### 處理 Review 回饋

依 code review 的回饋更新文件、script 或設定,讓它更清楚、更正確或更符合慣例。

**頻率**:每月約 4 次

**步驟**:
1. 編輯 SKILL.md、agent 或 command 檔案,回應 reviewer 的意見
2. 依要求更新範例、標題或設定
3. 反覆修改直到所有 review 回饋都解決

**通常會牽涉的檔案**:
- `skills/*/SKILL.md`
- `agents/*.md`
- `commands/*.md`
- `.agents/skills/*/SKILL.md`
- `.cursor/skills/*/SKILL.md`

**Commit 序列範例**:
```
Edit SKILL.md, agent, or command files to address reviewer comments
Update examples, headings, or configuration as requested
Iterate until all review feedback is resolved
```


## 最佳實務

依據對 codebase 的分析,遵循這些做法:

### 該做

- 用 conventional commit 格式(feat:、fix: 等)
- 遵循 *.test.js 的命名模式
- 檔名用 camelCase
- 偏好混合式 export

### 不該做

- 不要寫含糊的 commit 訊息
- 新功能不要跳過測試
- 沒討論過就不要偏離既有模式

---

*這個 skill 由 [ECC Tools](https://ecc.tools) 自動產生。請依團隊需求自行檢視並客製化。*

英文原文

---
name: ecc-conventions
description: Development conventions and patterns for ECC. JavaScript project with conventional commits.
license: MIT
---

# ECC Conventions

> Generated from [affaan-m/ECC](https://github.com/affaan-m/ECC) on 2026-03-20

## Overview

This skill teaches Claude the development patterns and conventions used in ECC.

## Tech Stack

- **Primary Language**: JavaScript
- **Architecture**: hybrid module organization
- **Test Location**: separate

## When to Use This Skill

Activate this skill when:
- Making changes to this repository
- Adding new features following established patterns
- Writing tests that match project conventions
- Creating commits with proper message format

## Commit Conventions

Follow these commit message conventions based on 500 analyzed commits.

### Commit Style: Conventional Commits

### Prefixes Used

- `fix`
- `test`
- `feat`
- `docs`

### Message Guidelines

- Average message length: ~65 characters
- Keep first line concise and descriptive
- Use imperative mood ("Add feature" not "Added feature")


*Commit message example*

```text
feat(rules): add C# language support
```

*Commit message example*

```text
chore(deps-dev): bump flatted (#675)
```

*Commit message example*

```text
fix: auto-detect ECC root from plugin cache when CLAUDE_PLUGIN_ROOT is unset (#547) (#691)
```

*Commit message example*

```text
docs: add Antigravity setup and usage guide (#552)
```

*Commit message example*

```text
merge: PR #529 — feat(skills): add documentation-lookup, bun-runtime, nextjs-turbopack; feat(agents): add rust-reviewer
```

*Commit message example*

```text
Revert "Add Kiro IDE support (.kiro/) (#548)"
```

*Commit message example*

```text
Add Kiro IDE support (.kiro/) (#548)
```

*Commit message example*

```text
feat: add block-no-verify hook for Claude Code and Cursor (#649)
```

## Architecture

### Project Structure: Single Package

This project uses **hybrid** module organization.

### Configuration Files

- `.github/workflows/ci.yml`
- `.github/workflows/maintenance.yml`
- `.github/workflows/monthly-metrics.yml`
- `.github/workflows/release.yml`
- `.github/workflows/reusable-release.yml`
- `.github/workflows/reusable-test.yml`
- `.github/workflows/reusable-validate.yml`
- `.opencode/package.json`
- `.opencode/tsconfig.json`
- `.prettierrc`
- `eslint.config.js`
- `package.json`

### Guidelines

- This project uses a hybrid organization
- Follow existing patterns when adding new code

## Code Style

### Language: JavaScript

### Naming Conventions

| Element | Convention |
|---------|------------|
| Files | camelCase |
| Functions | camelCase |
| Classes | PascalCase |
| Constants | SCREAMING_SNAKE_CASE |

### Import Style: Relative Imports

### Export Style: Mixed Style


*Preferred import style*

```typescript
// Use relative imports
import { Button } from '../components/Button'
import { useAuth } from './hooks/useAuth'
```

## Testing

### Test Framework

No specific test framework detected — use the repository's existing test patterns.

### File Pattern: `*.test.js`

### Test Types

- **Unit tests**: Test individual functions and components in isolation
- **Integration tests**: Test interactions between multiple components/services

### Coverage

This project has coverage reporting configured. Aim for 80%+ coverage.


## Error Handling

### Error Handling Style: Try-Catch Blocks


*Standard error handling pattern*

```typescript
try {
  const result = await riskyOperation()
  return result
} catch (error) {
  console.error('Operation failed:', error)
  throw new Error('User-friendly message')
}
```

## Common Workflows

These workflows were detected from analyzing commit patterns.

### Database Migration

Database schema changes with migration files

**Frequency**: ~2 times per month

**Steps**:
1. Create migration file
2. Update schema definitions
3. Generate/update types

**Files typically involved**:
- `**/schema.*`
- `migrations/*`

**Example commit sequence**:
```
feat: implement --with/--without selective install flags (#679)
fix: sync catalog counts with filesystem (27 agents, 113 skills, 58 commands) (#693)
feat(rules): add Rust language rules (rebased #660) (#686)
```

### Feature Development

Standard feature implementation workflow

**Frequency**: ~22 times per month

**Steps**:
1. Add feature implementation
2. Add tests for feature
3. Update documentation

**Files typically involved**:
- `manifests/*`
- `schemas/*`
- `**/*.test.*`
- `**/api/**`

**Example commit sequence**:
```
feat(skills): add documentation-lookup, bun-runtime, nextjs-turbopack; feat(agents): add rust-reviewer
docs(skills): align documentation-lookup with CONTRIBUTING template; add cross-harness (Codex/Cursor) skill copies
fix: address PR review — skill template (When to use, How it works, Examples), bun.lock, next build note, rust-reviewer CI note, doc-lookup privacy/uncertainty
```

### Add Language Rules

Adds a new programming language to the rules system, including coding style, hooks, patterns, security, and testing guidelines.

**Frequency**: ~2 times per month

**Steps**:
1. Create a new directory under rules/{language}/
2. Add coding-style.md, hooks.md, patterns.md, security.md, and testing.md files with language-specific content
3. Optionally reference or link to related skills

**Files typically involved**:
- `rules/*/coding-style.md`
- `rules/*/hooks.md`
- `rules/*/patterns.md`
- `rules/*/security.md`
- `rules/*/testing.md`

**Example commit sequence**:
```
Create a new directory under rules/{language}/
Add coding-style.md, hooks.md, patterns.md, security.md, and testing.md files with language-specific content
Optionally reference or link to related skills
```

### Add New Skill

Adds a new skill to the system, documenting its workflow, triggers, and usage, often with supporting scripts.

**Frequency**: ~4 times per month

**Steps**:
1. Create a new directory under skills/{skill-name}/
2. Add SKILL.md with documentation (When to Use, How It Works, Examples, etc.)
3. Optionally add scripts or supporting files under skills/{skill-name}/scripts/
4. Address review feedback and iterate on documentation

**Files typically involved**:
- `skills/*/SKILL.md`
- `skills/*/scripts/*.sh`
- `skills/*/scripts/*.js`

**Example commit sequence**:
```
Create a new directory under skills/{skill-name}/
Add SKILL.md with documentation (When to Use, How It Works, Examples, etc.)
Optionally add scripts or supporting files under skills/{skill-name}/scripts/
Address review feedback and iterate on documentation
```

### Add New Agent

Adds a new agent to the system for code review, build resolution, or other automated tasks.

**Frequency**: ~2 times per month

**Steps**:
1. Create a new agent markdown file under agents/{agent-name}.md
2. Register the agent in AGENTS.md
3. Optionally update README.md and docs/COMMAND-AGENT-MAP.md

**Files typically involved**:
- `agents/*.md`
- `AGENTS.md`
- `README.md`
- `docs/COMMAND-AGENT-MAP.md`

**Example commit sequence**:
```
Create a new agent markdown file under agents/{agent-name}.md
Register the agent in AGENTS.md
Optionally update README.md and docs/COMMAND-AGENT-MAP.md
```

### Add New Workflow Surface

Adds or updates a workflow entrypoint. Default to skills-first; only add a command shim when legacy slash compatibility is still required.

**Frequency**: ~1 times per month

**Steps**:
1. Create or update the canonical workflow under skills/{skill-name}/SKILL.md
2. Only if needed, add or update commands/{command-name}.md as a compatibility shim

**Files typically involved**:
- `skills/*/SKILL.md`
- `commands/*.md` (only when a legacy shim is intentionally retained)

**Example commit sequence**:
```
Create or update the canonical skill under skills/{skill-name}/SKILL.md
Only if needed, add or update commands/{command-name}.md as a compatibility shim
```

### Sync Catalog Counts

Synchronizes the documented counts of agents, skills, and commands in AGENTS.md and README.md with the actual repository state.

**Frequency**: ~3 times per month

**Steps**:
1. Update agent, skill, and command counts in AGENTS.md
2. Update the same counts in README.md (quick-start, comparison table, etc.)
3. Optionally update other documentation files

**Files typically involved**:
- `AGENTS.md`
- `README.md`

**Example commit sequence**:
```
Update agent, skill, and command counts in AGENTS.md
Update the same counts in README.md (quick-start, comparison table, etc.)
Optionally update other documentation files
```

### Add Cross Harness Skill Copies

Adds skill copies for different agent harnesses (e.g., Codex, Cursor, Antigravity) to ensure compatibility across platforms.

**Frequency**: ~2 times per month

**Steps**:
1. Copy or adapt SKILL.md to .agents/skills/{skill}/SKILL.md and/or .cursor/skills/{skill}/SKILL.md
2. Optionally add harness-specific openai.yaml or config files
3. Address review feedback to align with CONTRIBUTING template

**Files typically involved**:
- `.agents/skills/*/SKILL.md`
- `.cursor/skills/*/SKILL.md`
- `.agents/skills/*/agents/openai.yaml`

**Example commit sequence**:
```
Copy or adapt SKILL.md to .agents/skills/{skill}/SKILL.md and/or .cursor/skills/{skill}/SKILL.md
Optionally add harness-specific openai.yaml or config files
Address review feedback to align with CONTRIBUTING template
```

### Add Or Update Hook

Adds or updates git or bash hooks to enforce workflow, quality, or security policies.

**Frequency**: ~1 times per month

**Steps**:
1. Add or update hook scripts in hooks/ or scripts/hooks/
2. Register the hook in hooks/hooks.json or similar config
3. Optionally add or update tests in tests/hooks/

**Files typically involved**:
- `hooks/*.hook`
- `hooks/hooks.json`
- `scripts/hooks/*.js`
- `tests/hooks/*.test.js`
- `.cursor/hooks.json`

**Example commit sequence**:
```
Add or update hook scripts in hooks/ or scripts/hooks/
Register the hook in hooks/hooks.json or similar config
Optionally add or update tests in tests/hooks/
```

### Address Review Feedback

Addresses code review feedback by updating documentation, scripts, or configuration for clarity, correctness, or convention alignment.

**Frequency**: ~4 times per month

**Steps**:
1. Edit SKILL.md, agent, or command files to address reviewer comments
2. Update examples, headings, or configuration as requested
3. Iterate until all review feedback is resolved

**Files typically involved**:
- `skills/*/SKILL.md`
- `agents/*.md`
- `commands/*.md`
- `.agents/skills/*/SKILL.md`
- `.cursor/skills/*/SKILL.md`

**Example commit sequence**:
```
Edit SKILL.md, agent, or command files to address reviewer comments
Update examples, headings, or configuration as requested
Iterate until all review feedback is resolved
```


## Best Practices

Based on analysis of the codebase, follow these practices:

### Do

- Use conventional commit format (feat:, fix:, etc.)
- Follow *.test.js naming pattern
- Use camelCase for file names
- Prefer mixed exports

### Don't

- Don't write vague commit messages
- Don't skip tests for new features
- Don't deviate from established patterns without discussion

---

*This skill was auto-generated by [ECC Tools](https://ecc.tools). Review and customize as needed for your team.*