バックエンドピース追加とアーキテクチャナレッジ改善
- backend / backend-cqrs ピースを en/ja で追加 - ピースカテゴリにバックエンドピースを登録 - アーキテクチャナレッジに「操作の一覧性」「パブリック API の公開範囲」を追加 - DRY 基準を回数ベースから本質的重複ベースに改善
This commit is contained in:
parent
b54fbe32b2
commit
be0f299727
@ -18,6 +18,26 @@
|
|||||||
- No circular dependencies
|
- No circular dependencies
|
||||||
- Appropriate directory hierarchy
|
- Appropriate directory hierarchy
|
||||||
|
|
||||||
|
**Operation Discoverability:**
|
||||||
|
|
||||||
|
When calls to the same generic function are scattered across the codebase with different purposes, it becomes impossible to understand what the system does without grepping every call site. Group related operations into purpose-named functions within a single module. Reading that module should reveal the complete list of operations the system performs.
|
||||||
|
|
||||||
|
| Judgment | Criteria |
|
||||||
|
|----------|----------|
|
||||||
|
| REJECT | Same generic function called directly from 3+ places with different purposes |
|
||||||
|
| REJECT | Understanding all system operations requires grepping every call site |
|
||||||
|
| OK | Purpose-named functions defined and collected in a single module |
|
||||||
|
|
||||||
|
**Public API Surface:**
|
||||||
|
|
||||||
|
Public APIs should expose only domain-level functions and types. Do not export infrastructure internals (provider-specific functions, internal parsers, etc.).
|
||||||
|
|
||||||
|
| Judgment | Criteria |
|
||||||
|
|----------|----------|
|
||||||
|
| REJECT | Infrastructure-layer functions exported from public API |
|
||||||
|
| REJECT | Internal implementation functions callable from outside |
|
||||||
|
| OK | External consumers interact only through domain-level abstractions |
|
||||||
|
|
||||||
**Function Design:**
|
**Function Design:**
|
||||||
|
|
||||||
- One responsibility per function
|
- One responsibility per function
|
||||||
@ -299,19 +319,18 @@ Correct handling:
|
|||||||
|
|
||||||
## DRY Violation Detection
|
## DRY Violation Detection
|
||||||
|
|
||||||
Detect duplicate code.
|
Eliminate duplication by default. When logic is essentially the same and should be unified, apply DRY. Do not judge mechanically by count.
|
||||||
|
|
||||||
| Pattern | Judgment |
|
| Pattern | Judgment |
|
||||||
|---------|----------|
|
|---------|----------|
|
||||||
| Same logic in 3+ places | Immediate REJECT - Extract to function/method |
|
| Essentially identical logic duplicated | REJECT - Extract to function/method |
|
||||||
| Same validation in 2+ places | Immediate REJECT - Extract to validator function |
|
| Same validation duplicated | REJECT - Extract to validator function |
|
||||||
| Similar components 3+ | Immediate REJECT - Create shared component |
|
| Essentially identical component structure | REJECT - Create shared component |
|
||||||
| Copy-paste derived code | Immediate REJECT - Parameterize or abstract |
|
| Copy-paste derived code | REJECT - Parameterize or abstract |
|
||||||
|
|
||||||
AHA principle (Avoid Hasty Abstractions) balance:
|
When NOT to apply DRY:
|
||||||
- 2 duplications → Wait and see
|
- Different domains: Don't abstract (e.g., customer validation vs admin validation are different things)
|
||||||
- 3 duplications → Extract immediately
|
- Superficially similar but different reasons to change: Treat as separate code
|
||||||
- Different domain duplications → Don't abstract (e.g., customer validation vs admin validation are different)
|
|
||||||
|
|
||||||
## Spec Compliance Verification
|
## Spec Compliance Verification
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,10 @@ piece_categories:
|
|||||||
🎨 Frontend:
|
🎨 Frontend:
|
||||||
pieces:
|
pieces:
|
||||||
- frontend
|
- frontend
|
||||||
⚙️ Backend: {}
|
⚙️ Backend:
|
||||||
|
pieces:
|
||||||
|
- backend
|
||||||
|
- backend-cqrs
|
||||||
🔧 Expert:
|
🔧 Expert:
|
||||||
Full Stack:
|
Full Stack:
|
||||||
pieces:
|
pieces:
|
||||||
|
|||||||
267
builtins/en/pieces/backend-cqrs.yaml
Normal file
267
builtins/en/pieces/backend-cqrs.yaml
Normal file
@ -0,0 +1,267 @@
|
|||||||
|
name: backend-cqrs
|
||||||
|
description: CQRS+ES, Security, QA Expert Review
|
||||||
|
max_movements: 30
|
||||||
|
initial_movement: plan
|
||||||
|
movements:
|
||||||
|
- name: plan
|
||||||
|
edit: false
|
||||||
|
persona: planner
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: plan
|
||||||
|
rules:
|
||||||
|
- condition: Task analysis and planning is complete
|
||||||
|
next: implement
|
||||||
|
- condition: Requirements are unclear and planning cannot proceed
|
||||||
|
next: ABORT
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 00-plan.md
|
||||||
|
format: plan
|
||||||
|
- name: implement
|
||||||
|
edit: true
|
||||||
|
persona: coder
|
||||||
|
policy:
|
||||||
|
- coding
|
||||||
|
- testing
|
||||||
|
session: refresh
|
||||||
|
knowledge:
|
||||||
|
- backend
|
||||||
|
- cqrs-es
|
||||||
|
- security
|
||||||
|
- architecture
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Edit
|
||||||
|
- Write
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: implement
|
||||||
|
rules:
|
||||||
|
- condition: Implementation is complete
|
||||||
|
next: ai_review
|
||||||
|
- condition: No implementation (report only)
|
||||||
|
next: ai_review
|
||||||
|
- condition: Cannot proceed with implementation
|
||||||
|
next: ai_review
|
||||||
|
- condition: User input required
|
||||||
|
next: implement
|
||||||
|
requires_user_input: true
|
||||||
|
interactive_only: true
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- Scope: 01-coder-scope.md
|
||||||
|
- Decisions: 02-coder-decisions.md
|
||||||
|
- name: ai_review
|
||||||
|
edit: false
|
||||||
|
persona: ai-antipattern-reviewer
|
||||||
|
policy:
|
||||||
|
- review
|
||||||
|
- ai-antipattern
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: ai-review
|
||||||
|
rules:
|
||||||
|
- condition: No AI-specific issues found
|
||||||
|
next: reviewers
|
||||||
|
- condition: AI-specific issues detected
|
||||||
|
next: ai_fix
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 03-ai-review.md
|
||||||
|
format: ai-review
|
||||||
|
- name: ai_fix
|
||||||
|
edit: true
|
||||||
|
persona: coder
|
||||||
|
policy:
|
||||||
|
- coding
|
||||||
|
- testing
|
||||||
|
session: refresh
|
||||||
|
knowledge:
|
||||||
|
- backend
|
||||||
|
- cqrs-es
|
||||||
|
- security
|
||||||
|
- architecture
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Edit
|
||||||
|
- Write
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: ai-fix
|
||||||
|
rules:
|
||||||
|
- condition: AI Reviewer's issues have been fixed
|
||||||
|
next: ai_review
|
||||||
|
- condition: No fix needed (verified target files/spec)
|
||||||
|
next: ai_no_fix
|
||||||
|
- condition: Unable to proceed with fixes
|
||||||
|
next: ai_no_fix
|
||||||
|
- name: ai_no_fix
|
||||||
|
edit: false
|
||||||
|
persona: architecture-reviewer
|
||||||
|
policy: review
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
rules:
|
||||||
|
- condition: ai_review's findings are valid (fix required)
|
||||||
|
next: ai_fix
|
||||||
|
- condition: ai_fix's judgment is valid (no fix needed)
|
||||||
|
next: reviewers
|
||||||
|
instruction: arbitrate
|
||||||
|
- name: reviewers
|
||||||
|
parallel:
|
||||||
|
- name: cqrs-es-review
|
||||||
|
edit: false
|
||||||
|
persona: cqrs-es-reviewer
|
||||||
|
policy: review
|
||||||
|
knowledge:
|
||||||
|
- cqrs-es
|
||||||
|
- backend
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
rules:
|
||||||
|
- condition: approved
|
||||||
|
- condition: needs_fix
|
||||||
|
instruction: review-cqrs-es
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 04-cqrs-es-review.md
|
||||||
|
format: cqrs-es-review
|
||||||
|
- name: security-review
|
||||||
|
edit: false
|
||||||
|
persona: security-reviewer
|
||||||
|
policy: review
|
||||||
|
knowledge: security
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
rules:
|
||||||
|
- condition: approved
|
||||||
|
- condition: needs_fix
|
||||||
|
instruction: review-security
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 05-security-review.md
|
||||||
|
format: security-review
|
||||||
|
- name: qa-review
|
||||||
|
edit: false
|
||||||
|
persona: qa-reviewer
|
||||||
|
policy:
|
||||||
|
- review
|
||||||
|
- qa
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
rules:
|
||||||
|
- condition: approved
|
||||||
|
- condition: needs_fix
|
||||||
|
instruction: review-qa
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 06-qa-review.md
|
||||||
|
format: qa-review
|
||||||
|
rules:
|
||||||
|
- condition: all("approved")
|
||||||
|
next: supervise
|
||||||
|
- condition: any("needs_fix")
|
||||||
|
next: fix
|
||||||
|
- name: fix
|
||||||
|
edit: true
|
||||||
|
persona: coder
|
||||||
|
policy:
|
||||||
|
- coding
|
||||||
|
- testing
|
||||||
|
knowledge:
|
||||||
|
- backend
|
||||||
|
- cqrs-es
|
||||||
|
- security
|
||||||
|
- architecture
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Edit
|
||||||
|
- Write
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
permission_mode: edit
|
||||||
|
rules:
|
||||||
|
- condition: Fix complete
|
||||||
|
next: reviewers
|
||||||
|
- condition: Cannot proceed, insufficient info
|
||||||
|
next: plan
|
||||||
|
instruction: fix
|
||||||
|
- name: supervise
|
||||||
|
edit: false
|
||||||
|
persona: expert-supervisor
|
||||||
|
policy: review
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: supervise
|
||||||
|
rules:
|
||||||
|
- condition: All validations pass and ready to merge
|
||||||
|
next: COMPLETE
|
||||||
|
- condition: Issues detected during final review
|
||||||
|
next: fix_supervisor
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- Validation: 07-supervisor-validation.md
|
||||||
|
- Summary: summary.md
|
||||||
|
- name: fix_supervisor
|
||||||
|
edit: true
|
||||||
|
persona: coder
|
||||||
|
policy:
|
||||||
|
- coding
|
||||||
|
- testing
|
||||||
|
knowledge:
|
||||||
|
- backend
|
||||||
|
- cqrs-es
|
||||||
|
- security
|
||||||
|
- architecture
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Edit
|
||||||
|
- Write
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: fix-supervisor
|
||||||
|
rules:
|
||||||
|
- condition: Supervisor's issues have been fixed
|
||||||
|
next: supervise
|
||||||
|
- condition: Unable to proceed with fixes
|
||||||
|
next: plan
|
||||||
263
builtins/en/pieces/backend.yaml
Normal file
263
builtins/en/pieces/backend.yaml
Normal file
@ -0,0 +1,263 @@
|
|||||||
|
name: backend
|
||||||
|
description: Backend, Security, QA Expert Review
|
||||||
|
max_movements: 30
|
||||||
|
initial_movement: plan
|
||||||
|
movements:
|
||||||
|
- name: plan
|
||||||
|
edit: false
|
||||||
|
persona: planner
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: plan
|
||||||
|
rules:
|
||||||
|
- condition: Task analysis and planning is complete
|
||||||
|
next: implement
|
||||||
|
- condition: Requirements are unclear and planning cannot proceed
|
||||||
|
next: ABORT
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 00-plan.md
|
||||||
|
format: plan
|
||||||
|
- name: implement
|
||||||
|
edit: true
|
||||||
|
persona: coder
|
||||||
|
policy:
|
||||||
|
- coding
|
||||||
|
- testing
|
||||||
|
session: refresh
|
||||||
|
knowledge:
|
||||||
|
- backend
|
||||||
|
- security
|
||||||
|
- architecture
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Edit
|
||||||
|
- Write
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: implement
|
||||||
|
rules:
|
||||||
|
- condition: Implementation is complete
|
||||||
|
next: ai_review
|
||||||
|
- condition: No implementation (report only)
|
||||||
|
next: ai_review
|
||||||
|
- condition: Cannot proceed with implementation
|
||||||
|
next: ai_review
|
||||||
|
- condition: User input required
|
||||||
|
next: implement
|
||||||
|
requires_user_input: true
|
||||||
|
interactive_only: true
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- Scope: 01-coder-scope.md
|
||||||
|
- Decisions: 02-coder-decisions.md
|
||||||
|
- name: ai_review
|
||||||
|
edit: false
|
||||||
|
persona: ai-antipattern-reviewer
|
||||||
|
policy:
|
||||||
|
- review
|
||||||
|
- ai-antipattern
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: ai-review
|
||||||
|
rules:
|
||||||
|
- condition: No AI-specific issues found
|
||||||
|
next: reviewers
|
||||||
|
- condition: AI-specific issues detected
|
||||||
|
next: ai_fix
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 03-ai-review.md
|
||||||
|
format: ai-review
|
||||||
|
- name: ai_fix
|
||||||
|
edit: true
|
||||||
|
persona: coder
|
||||||
|
policy:
|
||||||
|
- coding
|
||||||
|
- testing
|
||||||
|
session: refresh
|
||||||
|
knowledge:
|
||||||
|
- backend
|
||||||
|
- security
|
||||||
|
- architecture
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Edit
|
||||||
|
- Write
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: ai-fix
|
||||||
|
rules:
|
||||||
|
- condition: AI Reviewer's issues have been fixed
|
||||||
|
next: ai_review
|
||||||
|
- condition: No fix needed (verified target files/spec)
|
||||||
|
next: ai_no_fix
|
||||||
|
- condition: Unable to proceed with fixes
|
||||||
|
next: ai_no_fix
|
||||||
|
- name: ai_no_fix
|
||||||
|
edit: false
|
||||||
|
persona: architecture-reviewer
|
||||||
|
policy: review
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
rules:
|
||||||
|
- condition: ai_review's findings are valid (fix required)
|
||||||
|
next: ai_fix
|
||||||
|
- condition: ai_fix's judgment is valid (no fix needed)
|
||||||
|
next: reviewers
|
||||||
|
instruction: arbitrate
|
||||||
|
- name: reviewers
|
||||||
|
parallel:
|
||||||
|
- name: arch-review
|
||||||
|
edit: false
|
||||||
|
persona: architecture-reviewer
|
||||||
|
policy: review
|
||||||
|
knowledge:
|
||||||
|
- architecture
|
||||||
|
- backend
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
rules:
|
||||||
|
- condition: approved
|
||||||
|
- condition: needs_fix
|
||||||
|
instruction: review-arch
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 04-architect-review.md
|
||||||
|
format: architecture-review
|
||||||
|
- name: security-review
|
||||||
|
edit: false
|
||||||
|
persona: security-reviewer
|
||||||
|
policy: review
|
||||||
|
knowledge: security
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
rules:
|
||||||
|
- condition: approved
|
||||||
|
- condition: needs_fix
|
||||||
|
instruction: review-security
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 05-security-review.md
|
||||||
|
format: security-review
|
||||||
|
- name: qa-review
|
||||||
|
edit: false
|
||||||
|
persona: qa-reviewer
|
||||||
|
policy:
|
||||||
|
- review
|
||||||
|
- qa
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
rules:
|
||||||
|
- condition: approved
|
||||||
|
- condition: needs_fix
|
||||||
|
instruction: review-qa
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 06-qa-review.md
|
||||||
|
format: qa-review
|
||||||
|
rules:
|
||||||
|
- condition: all("approved")
|
||||||
|
next: supervise
|
||||||
|
- condition: any("needs_fix")
|
||||||
|
next: fix
|
||||||
|
- name: fix
|
||||||
|
edit: true
|
||||||
|
persona: coder
|
||||||
|
policy:
|
||||||
|
- coding
|
||||||
|
- testing
|
||||||
|
knowledge:
|
||||||
|
- backend
|
||||||
|
- security
|
||||||
|
- architecture
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Edit
|
||||||
|
- Write
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
permission_mode: edit
|
||||||
|
rules:
|
||||||
|
- condition: Fix complete
|
||||||
|
next: reviewers
|
||||||
|
- condition: Cannot proceed, insufficient info
|
||||||
|
next: plan
|
||||||
|
instruction: fix
|
||||||
|
- name: supervise
|
||||||
|
edit: false
|
||||||
|
persona: expert-supervisor
|
||||||
|
policy: review
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: supervise
|
||||||
|
rules:
|
||||||
|
- condition: All validations pass and ready to merge
|
||||||
|
next: COMPLETE
|
||||||
|
- condition: Issues detected during final review
|
||||||
|
next: fix_supervisor
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- Validation: 07-supervisor-validation.md
|
||||||
|
- Summary: summary.md
|
||||||
|
- name: fix_supervisor
|
||||||
|
edit: true
|
||||||
|
persona: coder
|
||||||
|
policy:
|
||||||
|
- coding
|
||||||
|
- testing
|
||||||
|
knowledge:
|
||||||
|
- backend
|
||||||
|
- security
|
||||||
|
- architecture
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Edit
|
||||||
|
- Write
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: fix-supervisor
|
||||||
|
rules:
|
||||||
|
- condition: Supervisor's issues have been fixed
|
||||||
|
next: supervise
|
||||||
|
- condition: Unable to proceed with fixes
|
||||||
|
next: plan
|
||||||
@ -18,6 +18,26 @@
|
|||||||
- 循環依存がないか
|
- 循環依存がないか
|
||||||
- 適切なディレクトリ階層か
|
- 適切なディレクトリ階層か
|
||||||
|
|
||||||
|
**操作の一覧性**
|
||||||
|
|
||||||
|
同じ汎用関数への呼び出しがコードベースに散在すると、システムが何をしているか把握できなくなる。操作には目的に応じた名前を付けて関数化し、関連する操作を1つのモジュールにまとめる。そのモジュールを読めば「このシステムが行う操作の全体像」がわかる状態にする。
|
||||||
|
|
||||||
|
| 判定 | 基準 |
|
||||||
|
|------|------|
|
||||||
|
| REJECT | 同じ汎用関数が目的の異なる3箇所以上から直接呼ばれている |
|
||||||
|
| REJECT | 呼び出し元を全件 grep しないとシステムの操作一覧がわからない |
|
||||||
|
| OK | 目的ごとに名前付き関数が定義され、1モジュールに集約されている |
|
||||||
|
|
||||||
|
**パブリック API の公開範囲**
|
||||||
|
|
||||||
|
パブリック API が公開するのは、ドメインの操作に対応する関数・型のみ。インフラの実装詳細(特定プロバイダーの関数、内部パーサー等)を公開しない。
|
||||||
|
|
||||||
|
| 判定 | 基準 |
|
||||||
|
|------|------|
|
||||||
|
| REJECT | インフラ層の関数がパブリック API からエクスポートされている |
|
||||||
|
| REJECT | 内部実装の関数が外部から直接呼び出し可能になっている |
|
||||||
|
| OK | 外部消費者がドメインレベルの抽象のみを通じて対話する |
|
||||||
|
|
||||||
**関数設計**
|
**関数設計**
|
||||||
|
|
||||||
- 1関数1責務になっているか
|
- 1関数1責務になっているか
|
||||||
@ -299,19 +319,18 @@ TODOが許容される唯一のケース:
|
|||||||
|
|
||||||
## DRY違反の検出
|
## DRY違反の検出
|
||||||
|
|
||||||
重複コードを検出する。
|
基本的に重複は排除する。本質的に同じロジックであり、まとめるべきと判断したら DRY にする。回数で機械的に判断しない。
|
||||||
|
|
||||||
| パターン | 判定 |
|
| パターン | 判定 |
|
||||||
|---------|------|
|
|---------|------|
|
||||||
| 同じロジックが3箇所以上 | 即REJECT - 関数/メソッドに抽出 |
|
| 本質的に同じロジックの重複 | REJECT - 関数/メソッドに抽出 |
|
||||||
| 同じバリデーションが2箇所以上 | 即REJECT - バリデーター関数に抽出 |
|
| 同じバリデーションの重複 | REJECT - バリデーター関数に抽出 |
|
||||||
| 似たようなコンポーネントが3個以上 | 即REJECT - 共通コンポーネント化 |
|
| 本質的に同じ構造のコンポーネント | REJECT - 共通コンポーネント化 |
|
||||||
| コピペで派生したコード | 即REJECT - パラメータ化または抽象化 |
|
| コピペで派生したコード | REJECT - パラメータ化または抽象化 |
|
||||||
|
|
||||||
AHA原則(Avoid Hasty Abstractions)とのバランス:
|
DRY にしないケース:
|
||||||
- 2回の重複 → 様子見
|
- ドメインが異なる重複は抽象化しない(例: 顧客用バリデーションと管理者用バリデーションは別物)
|
||||||
- 3回の重複 → 即抽出
|
- 表面的に似ているが、変更理由が異なるコードは別物として扱う
|
||||||
- ドメインが異なる重複 → 抽象化しない(例: 顧客用バリデーションと管理者用バリデーションは別物)
|
|
||||||
|
|
||||||
## 仕様準拠の検証
|
## 仕様準拠の検証
|
||||||
|
|
||||||
|
|||||||
@ -9,7 +9,10 @@ piece_categories:
|
|||||||
🎨 フロントエンド:
|
🎨 フロントエンド:
|
||||||
pieces:
|
pieces:
|
||||||
- frontend
|
- frontend
|
||||||
⚙️ バックエンド: {}
|
⚙️ バックエンド:
|
||||||
|
pieces:
|
||||||
|
- backend
|
||||||
|
- backend-cqrs
|
||||||
🔧 エキスパート:
|
🔧 エキスパート:
|
||||||
フルスタック:
|
フルスタック:
|
||||||
pieces:
|
pieces:
|
||||||
|
|||||||
267
builtins/ja/pieces/backend-cqrs.yaml
Normal file
267
builtins/ja/pieces/backend-cqrs.yaml
Normal file
@ -0,0 +1,267 @@
|
|||||||
|
name: backend-cqrs
|
||||||
|
description: CQRS+ES・セキュリティ・QA専門家レビュー
|
||||||
|
max_movements: 30
|
||||||
|
initial_movement: plan
|
||||||
|
movements:
|
||||||
|
- name: plan
|
||||||
|
edit: false
|
||||||
|
persona: planner
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: plan
|
||||||
|
rules:
|
||||||
|
- condition: タスク分析と計画が完了した
|
||||||
|
next: implement
|
||||||
|
- condition: 要件が不明確で計画を立てられない
|
||||||
|
next: ABORT
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 00-plan.md
|
||||||
|
format: plan
|
||||||
|
- name: implement
|
||||||
|
edit: true
|
||||||
|
persona: coder
|
||||||
|
policy:
|
||||||
|
- coding
|
||||||
|
- testing
|
||||||
|
session: refresh
|
||||||
|
knowledge:
|
||||||
|
- backend
|
||||||
|
- cqrs-es
|
||||||
|
- security
|
||||||
|
- architecture
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Edit
|
||||||
|
- Write
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: implement
|
||||||
|
rules:
|
||||||
|
- condition: 実装が完了した
|
||||||
|
next: ai_review
|
||||||
|
- condition: 実装未着手(レポートのみ)
|
||||||
|
next: ai_review
|
||||||
|
- condition: 実装を進行できない
|
||||||
|
next: ai_review
|
||||||
|
- condition: ユーザー入力が必要
|
||||||
|
next: implement
|
||||||
|
requires_user_input: true
|
||||||
|
interactive_only: true
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- Scope: 01-coder-scope.md
|
||||||
|
- Decisions: 02-coder-decisions.md
|
||||||
|
- name: ai_review
|
||||||
|
edit: false
|
||||||
|
persona: ai-antipattern-reviewer
|
||||||
|
policy:
|
||||||
|
- review
|
||||||
|
- ai-antipattern
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: ai-review
|
||||||
|
rules:
|
||||||
|
- condition: AI特有の問題が見つからない
|
||||||
|
next: reviewers
|
||||||
|
- condition: AI特有の問題が検出された
|
||||||
|
next: ai_fix
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 03-ai-review.md
|
||||||
|
format: ai-review
|
||||||
|
- name: ai_fix
|
||||||
|
edit: true
|
||||||
|
persona: coder
|
||||||
|
policy:
|
||||||
|
- coding
|
||||||
|
- testing
|
||||||
|
session: refresh
|
||||||
|
knowledge:
|
||||||
|
- backend
|
||||||
|
- cqrs-es
|
||||||
|
- security
|
||||||
|
- architecture
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Edit
|
||||||
|
- Write
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: ai-fix
|
||||||
|
rules:
|
||||||
|
- condition: AI Reviewerの指摘に対する修正が完了した
|
||||||
|
next: ai_review
|
||||||
|
- condition: 修正不要(指摘対象ファイル/仕様の確認済み)
|
||||||
|
next: ai_no_fix
|
||||||
|
- condition: 修正を進行できない
|
||||||
|
next: ai_no_fix
|
||||||
|
- name: ai_no_fix
|
||||||
|
edit: false
|
||||||
|
persona: architecture-reviewer
|
||||||
|
policy: review
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
rules:
|
||||||
|
- condition: ai_reviewの指摘が妥当(修正すべき)
|
||||||
|
next: ai_fix
|
||||||
|
- condition: ai_fixの判断が妥当(修正不要)
|
||||||
|
next: reviewers
|
||||||
|
instruction: arbitrate
|
||||||
|
- name: reviewers
|
||||||
|
parallel:
|
||||||
|
- name: cqrs-es-review
|
||||||
|
edit: false
|
||||||
|
persona: cqrs-es-reviewer
|
||||||
|
policy: review
|
||||||
|
knowledge:
|
||||||
|
- cqrs-es
|
||||||
|
- backend
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
rules:
|
||||||
|
- condition: approved
|
||||||
|
- condition: needs_fix
|
||||||
|
instruction: review-cqrs-es
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 04-cqrs-es-review.md
|
||||||
|
format: cqrs-es-review
|
||||||
|
- name: security-review
|
||||||
|
edit: false
|
||||||
|
persona: security-reviewer
|
||||||
|
policy: review
|
||||||
|
knowledge: security
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
rules:
|
||||||
|
- condition: approved
|
||||||
|
- condition: needs_fix
|
||||||
|
instruction: review-security
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 05-security-review.md
|
||||||
|
format: security-review
|
||||||
|
- name: qa-review
|
||||||
|
edit: false
|
||||||
|
persona: qa-reviewer
|
||||||
|
policy:
|
||||||
|
- review
|
||||||
|
- qa
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
rules:
|
||||||
|
- condition: approved
|
||||||
|
- condition: needs_fix
|
||||||
|
instruction: review-qa
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 06-qa-review.md
|
||||||
|
format: qa-review
|
||||||
|
rules:
|
||||||
|
- condition: all("approved")
|
||||||
|
next: supervise
|
||||||
|
- condition: any("needs_fix")
|
||||||
|
next: fix
|
||||||
|
- name: fix
|
||||||
|
edit: true
|
||||||
|
persona: coder
|
||||||
|
policy:
|
||||||
|
- coding
|
||||||
|
- testing
|
||||||
|
knowledge:
|
||||||
|
- backend
|
||||||
|
- cqrs-es
|
||||||
|
- security
|
||||||
|
- architecture
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Edit
|
||||||
|
- Write
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
permission_mode: edit
|
||||||
|
rules:
|
||||||
|
- condition: 修正が完了した
|
||||||
|
next: reviewers
|
||||||
|
- condition: 修正を進行できない
|
||||||
|
next: plan
|
||||||
|
instruction: fix
|
||||||
|
- name: supervise
|
||||||
|
edit: false
|
||||||
|
persona: expert-supervisor
|
||||||
|
policy: review
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: supervise
|
||||||
|
rules:
|
||||||
|
- condition: すべての検証が完了し、マージ可能な状態である
|
||||||
|
next: COMPLETE
|
||||||
|
- condition: 問題が検出された
|
||||||
|
next: fix_supervisor
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- Validation: 07-supervisor-validation.md
|
||||||
|
- Summary: summary.md
|
||||||
|
- name: fix_supervisor
|
||||||
|
edit: true
|
||||||
|
persona: coder
|
||||||
|
policy:
|
||||||
|
- coding
|
||||||
|
- testing
|
||||||
|
knowledge:
|
||||||
|
- backend
|
||||||
|
- cqrs-es
|
||||||
|
- security
|
||||||
|
- architecture
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Edit
|
||||||
|
- Write
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: fix-supervisor
|
||||||
|
rules:
|
||||||
|
- condition: 監督者の指摘に対する修正が完了した
|
||||||
|
next: supervise
|
||||||
|
- condition: 修正を進行できない
|
||||||
|
next: plan
|
||||||
263
builtins/ja/pieces/backend.yaml
Normal file
263
builtins/ja/pieces/backend.yaml
Normal file
@ -0,0 +1,263 @@
|
|||||||
|
name: backend
|
||||||
|
description: バックエンド・セキュリティ・QA専門家レビュー
|
||||||
|
max_movements: 30
|
||||||
|
initial_movement: plan
|
||||||
|
movements:
|
||||||
|
- name: plan
|
||||||
|
edit: false
|
||||||
|
persona: planner
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: plan
|
||||||
|
rules:
|
||||||
|
- condition: タスク分析と計画が完了した
|
||||||
|
next: implement
|
||||||
|
- condition: 要件が不明確で計画を立てられない
|
||||||
|
next: ABORT
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 00-plan.md
|
||||||
|
format: plan
|
||||||
|
- name: implement
|
||||||
|
edit: true
|
||||||
|
persona: coder
|
||||||
|
policy:
|
||||||
|
- coding
|
||||||
|
- testing
|
||||||
|
session: refresh
|
||||||
|
knowledge:
|
||||||
|
- backend
|
||||||
|
- security
|
||||||
|
- architecture
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Edit
|
||||||
|
- Write
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: implement
|
||||||
|
rules:
|
||||||
|
- condition: 実装が完了した
|
||||||
|
next: ai_review
|
||||||
|
- condition: 実装未着手(レポートのみ)
|
||||||
|
next: ai_review
|
||||||
|
- condition: 実装を進行できない
|
||||||
|
next: ai_review
|
||||||
|
- condition: ユーザー入力が必要
|
||||||
|
next: implement
|
||||||
|
requires_user_input: true
|
||||||
|
interactive_only: true
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- Scope: 01-coder-scope.md
|
||||||
|
- Decisions: 02-coder-decisions.md
|
||||||
|
- name: ai_review
|
||||||
|
edit: false
|
||||||
|
persona: ai-antipattern-reviewer
|
||||||
|
policy:
|
||||||
|
- review
|
||||||
|
- ai-antipattern
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: ai-review
|
||||||
|
rules:
|
||||||
|
- condition: AI特有の問題が見つからない
|
||||||
|
next: reviewers
|
||||||
|
- condition: AI特有の問題が検出された
|
||||||
|
next: ai_fix
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 03-ai-review.md
|
||||||
|
format: ai-review
|
||||||
|
- name: ai_fix
|
||||||
|
edit: true
|
||||||
|
persona: coder
|
||||||
|
policy:
|
||||||
|
- coding
|
||||||
|
- testing
|
||||||
|
session: refresh
|
||||||
|
knowledge:
|
||||||
|
- backend
|
||||||
|
- security
|
||||||
|
- architecture
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Edit
|
||||||
|
- Write
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: ai-fix
|
||||||
|
rules:
|
||||||
|
- condition: AI Reviewerの指摘に対する修正が完了した
|
||||||
|
next: ai_review
|
||||||
|
- condition: 修正不要(指摘対象ファイル/仕様の確認済み)
|
||||||
|
next: ai_no_fix
|
||||||
|
- condition: 修正を進行できない
|
||||||
|
next: ai_no_fix
|
||||||
|
- name: ai_no_fix
|
||||||
|
edit: false
|
||||||
|
persona: architecture-reviewer
|
||||||
|
policy: review
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
rules:
|
||||||
|
- condition: ai_reviewの指摘が妥当(修正すべき)
|
||||||
|
next: ai_fix
|
||||||
|
- condition: ai_fixの判断が妥当(修正不要)
|
||||||
|
next: reviewers
|
||||||
|
instruction: arbitrate
|
||||||
|
- name: reviewers
|
||||||
|
parallel:
|
||||||
|
- name: arch-review
|
||||||
|
edit: false
|
||||||
|
persona: architecture-reviewer
|
||||||
|
policy: review
|
||||||
|
knowledge:
|
||||||
|
- architecture
|
||||||
|
- backend
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
rules:
|
||||||
|
- condition: approved
|
||||||
|
- condition: needs_fix
|
||||||
|
instruction: review-arch
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 04-architect-review.md
|
||||||
|
format: architecture-review
|
||||||
|
- name: security-review
|
||||||
|
edit: false
|
||||||
|
persona: security-reviewer
|
||||||
|
policy: review
|
||||||
|
knowledge: security
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
rules:
|
||||||
|
- condition: approved
|
||||||
|
- condition: needs_fix
|
||||||
|
instruction: review-security
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 05-security-review.md
|
||||||
|
format: security-review
|
||||||
|
- name: qa-review
|
||||||
|
edit: false
|
||||||
|
persona: qa-reviewer
|
||||||
|
policy:
|
||||||
|
- review
|
||||||
|
- qa
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
rules:
|
||||||
|
- condition: approved
|
||||||
|
- condition: needs_fix
|
||||||
|
instruction: review-qa
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- name: 06-qa-review.md
|
||||||
|
format: qa-review
|
||||||
|
rules:
|
||||||
|
- condition: all("approved")
|
||||||
|
next: supervise
|
||||||
|
- condition: any("needs_fix")
|
||||||
|
next: fix
|
||||||
|
- name: fix
|
||||||
|
edit: true
|
||||||
|
persona: coder
|
||||||
|
policy:
|
||||||
|
- coding
|
||||||
|
- testing
|
||||||
|
knowledge:
|
||||||
|
- backend
|
||||||
|
- security
|
||||||
|
- architecture
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Edit
|
||||||
|
- Write
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
permission_mode: edit
|
||||||
|
rules:
|
||||||
|
- condition: 修正が完了した
|
||||||
|
next: reviewers
|
||||||
|
- condition: 修正を進行できない
|
||||||
|
next: plan
|
||||||
|
instruction: fix
|
||||||
|
- name: supervise
|
||||||
|
edit: false
|
||||||
|
persona: expert-supervisor
|
||||||
|
policy: review
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: supervise
|
||||||
|
rules:
|
||||||
|
- condition: すべての検証が完了し、マージ可能な状態である
|
||||||
|
next: COMPLETE
|
||||||
|
- condition: 問題が検出された
|
||||||
|
next: fix_supervisor
|
||||||
|
output_contracts:
|
||||||
|
report:
|
||||||
|
- Validation: 07-supervisor-validation.md
|
||||||
|
- Summary: summary.md
|
||||||
|
- name: fix_supervisor
|
||||||
|
edit: true
|
||||||
|
persona: coder
|
||||||
|
policy:
|
||||||
|
- coding
|
||||||
|
- testing
|
||||||
|
knowledge:
|
||||||
|
- backend
|
||||||
|
- security
|
||||||
|
- architecture
|
||||||
|
allowed_tools:
|
||||||
|
- Read
|
||||||
|
- Glob
|
||||||
|
- Grep
|
||||||
|
- Edit
|
||||||
|
- Write
|
||||||
|
- Bash
|
||||||
|
- WebSearch
|
||||||
|
- WebFetch
|
||||||
|
instruction: fix-supervisor
|
||||||
|
rules:
|
||||||
|
- condition: 監督者の指摘に対する修正が完了した
|
||||||
|
next: supervise
|
||||||
|
- condition: 修正を進行できない
|
||||||
|
next: plan
|
||||||
Loading…
x
Reference in New Issue
Block a user