@comfanion/workflow 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +185 -0
- package/bin/cli.js +406 -0
- package/package.json +50 -0
- package/src/build-info.json +16 -0
- package/src/opencode/ARCHITECTURE.md +255 -0
- package/src/opencode/FLOW.yaml +900 -0
- package/src/opencode/agents/analyst.md +141 -0
- package/src/opencode/agents/architect.md +177 -0
- package/src/opencode/agents/change-manager.md +263 -0
- package/src/opencode/agents/dev.md +171 -0
- package/src/opencode/agents/module-docs.md +628 -0
- package/src/opencode/agents/pm.md +157 -0
- package/src/opencode/agents/researcher.md +254 -0
- package/src/opencode/agents/sm.md +184 -0
- package/src/opencode/agents/workflow-orchestrator.md +249 -0
- package/src/opencode/checklists/architecture-checklist.md +166 -0
- package/src/opencode/checklists/code-review-checklist.md +151 -0
- package/src/opencode/checklists/prd-checklist.md +140 -0
- package/src/opencode/checklists/requirements-checklist.md +86 -0
- package/src/opencode/checklists/story-checklist.md +137 -0
- package/src/opencode/commands/architecture.md +68 -0
- package/src/opencode/commands/archive.md +146 -0
- package/src/opencode/commands/change.md +169 -0
- package/src/opencode/commands/clarify.md +132 -0
- package/src/opencode/commands/code-review.md +96 -0
- package/src/opencode/commands/coding-standards.md +102 -0
- package/src/opencode/commands/dev-story.md +80 -0
- package/src/opencode/commands/diagram.md +152 -0
- package/src/opencode/commands/epics.md +52 -0
- package/src/opencode/commands/help.md +139 -0
- package/src/opencode/commands/jira-sync.md +58 -0
- package/src/opencode/commands/module-docs.md +158 -0
- package/src/opencode/commands/prd.md +63 -0
- package/src/opencode/commands/quick.md +166 -0
- package/src/opencode/commands/requirements.md +49 -0
- package/src/opencode/commands/research.md +113 -0
- package/src/opencode/commands/sprint-plan.md +59 -0
- package/src/opencode/commands/stories.md +61 -0
- package/src/opencode/commands/validate.md +84 -0
- package/src/opencode/commands/workflow-status.md +150 -0
- package/src/opencode/config.yaml +223 -0
- package/src/opencode/opencode.json +36 -0
- package/src/opencode/skills/acceptance-criteria/SKILL.md +212 -0
- package/src/opencode/skills/adr-writing/SKILL.md +241 -0
- package/src/opencode/skills/architecture-design/SKILL.md +183 -0
- package/src/opencode/skills/architecture-validation/SKILL.md +199 -0
- package/src/opencode/skills/archiving/SKILL.md +191 -0
- package/src/opencode/skills/changelog/SKILL.md +280 -0
- package/src/opencode/skills/code-review/SKILL.md +193 -0
- package/src/opencode/skills/coding-standards/SKILL.md +430 -0
- package/src/opencode/skills/diagram-creation/SKILL.md +273 -0
- package/src/opencode/skills/doc-todo/SKILL.md +325 -0
- package/src/opencode/skills/epic-writing/SKILL.md +291 -0
- package/src/opencode/skills/jira-integration/SKILL.md +560 -0
- package/src/opencode/skills/methodologies/SKILL.md +376 -0
- package/src/opencode/skills/module-documentation/SKILL.md +214 -0
- package/src/opencode/skills/prd-validation/SKILL.md +164 -0
- package/src/opencode/skills/prd-writing/SKILL.md +104 -0
- package/src/opencode/skills/requirements-gathering/SKILL.md +132 -0
- package/src/opencode/skills/requirements-validation/SKILL.md +141 -0
- package/src/opencode/skills/research-methodology/SKILL.md +140 -0
- package/src/opencode/skills/sprint-planning/SKILL.md +217 -0
- package/src/opencode/skills/story-writing/SKILL.md +574 -0
- package/src/opencode/skills/test-design/SKILL.md +313 -0
- package/src/opencode/skills/translation/SKILL.md +411 -0
- package/src/opencode/templates/CHANGELOG.md +82 -0
- package/src/opencode/templates/adr-template.md +115 -0
- package/src/opencode/templates/architecture-template.md +362 -0
- package/src/opencode/templates/change-proposal-template.md +186 -0
- package/src/opencode/templates/epic-template.md +151 -0
- package/src/opencode/templates/git-workflow-template.md +384 -0
- package/src/opencode/templates/integration-tests-template.md +265 -0
- package/src/opencode/templates/jira-cache-template.yaml +103 -0
- package/src/opencode/templates/module-index-template.md +139 -0
- package/src/opencode/templates/module-test-cases-template.md +230 -0
- package/src/opencode/templates/prd-acceptance-criteria-template.md +124 -0
- package/src/opencode/templates/prd-template.md +479 -0
- package/src/opencode/templates/requirements-template.md +132 -0
- package/src/opencode/templates/sprint-status-template.yaml +84 -0
- package/src/opencode/templates/story-template.md +437 -0
- package/src/opencode/templates/testing-standards-template.md +359 -0
- package/src/opencode/workflows/dev-story/instructions.md +529 -0
- package/src/repo-structure/.gitattributes +64 -0
- package/src/repo-structure/CONTRIBUTING.md +182 -0
- package/src/repo-structure/README.md +77 -0
- package/src/repo-structure/docs/README.md +62 -0
- package/src/repo-structure/docs/api/README.md +43 -0
- package/src/repo-structure/docs/architecture/README.md +36 -0
- package/src/repo-structure/docs/architecture/adr/README.md +53 -0
- package/src/repo-structure/docs/architecture/diagrams/README.md +59 -0
- package/src/repo-structure/docs/coding-standards/README.md +52 -0
- package/src/repo-structure/docs/confluence/README.md +43 -0
- package/src/repo-structure/docs/requirements/README.md +28 -0
- package/src/repo-structure/docs/sprint-artifacts/README.md +76 -0
- package/src/repo-structure/docs/sprint-artifacts/backlog/README.md +24 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Code Review Skill
|
|
2
|
+
|
|
3
|
+
How to perform thorough code reviews for implemented stories.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Ensure code quality, correctness, and adherence to project standards before merging.
|
|
8
|
+
|
|
9
|
+
## Review Process
|
|
10
|
+
|
|
11
|
+
### 1. Preparation
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
1. Load the story file completely
|
|
15
|
+
2. Identify all acceptance criteria
|
|
16
|
+
3. Load CLAUDE.md for coding standards
|
|
17
|
+
4. Load project-context.md if exists
|
|
18
|
+
5. Review File List section for changed files
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 2. Acceptance Criteria Check
|
|
22
|
+
|
|
23
|
+
For each AC in the story:
|
|
24
|
+
- [ ] Verify implementation satisfies the criterion
|
|
25
|
+
- [ ] Check edge cases are handled
|
|
26
|
+
- [ ] Confirm error scenarios addressed
|
|
27
|
+
|
|
28
|
+
### 3. Code Quality Review
|
|
29
|
+
|
|
30
|
+
#### Architecture Compliance
|
|
31
|
+
- [ ] Follows hexagonal architecture
|
|
32
|
+
- [ ] Domain layer has no infrastructure imports
|
|
33
|
+
- [ ] Use cases have 4 files (inport, dto, handler, mappers)
|
|
34
|
+
- [ ] Explicit mapping (no reflection libraries)
|
|
35
|
+
|
|
36
|
+
#### Code Structure
|
|
37
|
+
- [ ] Single responsibility principle
|
|
38
|
+
- [ ] Clear naming conventions
|
|
39
|
+
- [ ] Appropriate abstractions
|
|
40
|
+
- [ ] No code duplication
|
|
41
|
+
- [ ] Functions are focused and small
|
|
42
|
+
|
|
43
|
+
#### Error Handling
|
|
44
|
+
- [ ] Errors are wrapped with context
|
|
45
|
+
- [ ] Domain errors vs infrastructure errors distinguished
|
|
46
|
+
- [ ] Error messages are descriptive
|
|
47
|
+
- [ ] No swallowed errors
|
|
48
|
+
|
|
49
|
+
#### Comments & Documentation
|
|
50
|
+
- [ ] Complex logic is documented
|
|
51
|
+
- [ ] Public APIs have doc comments
|
|
52
|
+
- [ ] No commented-out code
|
|
53
|
+
- [ ] README updated if needed
|
|
54
|
+
|
|
55
|
+
### 4. Testing Review
|
|
56
|
+
|
|
57
|
+
#### Test Coverage
|
|
58
|
+
- [ ] Unit tests exist for new code
|
|
59
|
+
- [ ] Integration tests for component interactions
|
|
60
|
+
- [ ] Edge cases tested
|
|
61
|
+
- [ ] Error scenarios tested
|
|
62
|
+
|
|
63
|
+
#### Test Quality
|
|
64
|
+
- [ ] Tests are independent
|
|
65
|
+
- [ ] Clear test names (TestX_Y_Z pattern)
|
|
66
|
+
- [ ] Arrange-Act-Assert structure
|
|
67
|
+
- [ ] No test interdependencies
|
|
68
|
+
|
|
69
|
+
#### Test Execution
|
|
70
|
+
- [ ] All tests pass locally
|
|
71
|
+
- [ ] No flaky tests
|
|
72
|
+
- [ ] Reasonable execution time
|
|
73
|
+
|
|
74
|
+
### 5. Security Review
|
|
75
|
+
|
|
76
|
+
- [ ] No hardcoded secrets
|
|
77
|
+
- [ ] Input validation present
|
|
78
|
+
- [ ] No SQL injection vulnerabilities
|
|
79
|
+
- [ ] Proper authentication checks
|
|
80
|
+
- [ ] Authorization verified
|
|
81
|
+
|
|
82
|
+
### 6. Performance Review
|
|
83
|
+
|
|
84
|
+
- [ ] No N+1 query issues
|
|
85
|
+
- [ ] Appropriate indexing considered
|
|
86
|
+
- [ ] Caching strategy where needed
|
|
87
|
+
- [ ] No obvious bottlenecks
|
|
88
|
+
|
|
89
|
+
## Review Outcomes
|
|
90
|
+
|
|
91
|
+
### ✅ Approve
|
|
92
|
+
|
|
93
|
+
All criteria met. Code is ready to merge.
|
|
94
|
+
|
|
95
|
+
```markdown
|
|
96
|
+
### Review Outcome: Approve
|
|
97
|
+
|
|
98
|
+
All acceptance criteria satisfied. Code follows project standards.
|
|
99
|
+
Ready for merge.
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 🔄 Changes Requested
|
|
103
|
+
|
|
104
|
+
Issues found that need addressing.
|
|
105
|
+
|
|
106
|
+
```markdown
|
|
107
|
+
### Review Outcome: Changes Requested
|
|
108
|
+
|
|
109
|
+
**Action Items:**
|
|
110
|
+
- [ ] [High] Fix missing error handling in X
|
|
111
|
+
- [ ] [Med] Add unit test for edge case Y
|
|
112
|
+
- [ ] [Low] Improve variable naming in Z
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### ❌ Blocked
|
|
116
|
+
|
|
117
|
+
Major issues that prevent approval.
|
|
118
|
+
|
|
119
|
+
```markdown
|
|
120
|
+
### Review Outcome: Blocked
|
|
121
|
+
|
|
122
|
+
**Blocking Issues:**
|
|
123
|
+
1. Security vulnerability in authentication flow
|
|
124
|
+
2. Missing critical test coverage
|
|
125
|
+
|
|
126
|
+
Cannot proceed until blocking issues resolved.
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Severity Levels
|
|
130
|
+
|
|
131
|
+
| Level | Description | Must Fix Before Merge |
|
|
132
|
+
|-------|-------------|----------------------|
|
|
133
|
+
| High | Security, correctness, data loss | Yes |
|
|
134
|
+
| Medium | Code quality, maintainability | Recommended |
|
|
135
|
+
| Low | Style, minor improvements | Optional |
|
|
136
|
+
|
|
137
|
+
## Review Comments Format
|
|
138
|
+
|
|
139
|
+
```markdown
|
|
140
|
+
**[Severity]** File: path/to/file.go:42
|
|
141
|
+
|
|
142
|
+
Issue: Description of the issue
|
|
143
|
+
|
|
144
|
+
Suggestion: How to fix it
|
|
145
|
+
|
|
146
|
+
Example:
|
|
147
|
+
```go
|
|
148
|
+
// Instead of this
|
|
149
|
+
func foo() { ... }
|
|
150
|
+
|
|
151
|
+
// Do this
|
|
152
|
+
func foo() error { ... }
|
|
153
|
+
```
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Updating Story File
|
|
157
|
+
|
|
158
|
+
After review, add to story file:
|
|
159
|
+
|
|
160
|
+
```markdown
|
|
161
|
+
## Senior Developer Review (AI)
|
|
162
|
+
|
|
163
|
+
### Review Date
|
|
164
|
+
2024-01-15
|
|
165
|
+
|
|
166
|
+
### Review Outcome
|
|
167
|
+
Changes Requested
|
|
168
|
+
|
|
169
|
+
### Action Items
|
|
170
|
+
- [ ] [High] Add error handling to CreateUser handler
|
|
171
|
+
- [ ] [Med] Add unit test for duplicate email validation
|
|
172
|
+
- [ ] [Low] Rename 'x' to 'userCount'
|
|
173
|
+
|
|
174
|
+
### Detailed Comments
|
|
175
|
+
[Include detailed review comments here]
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
If changes requested, also add:
|
|
179
|
+
|
|
180
|
+
```markdown
|
|
181
|
+
### Review Follow-ups (AI)
|
|
182
|
+
|
|
183
|
+
- [ ] [AI-Review] [High] Add error handling to CreateUser handler
|
|
184
|
+
- [ ] [AI-Review] [Med] Add unit test for duplicate email validation
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Best Practices
|
|
188
|
+
|
|
189
|
+
1. **Be specific** - Point to exact file and line
|
|
190
|
+
2. **Suggest solutions** - Don't just criticize
|
|
191
|
+
3. **Prioritize** - Focus on important issues first
|
|
192
|
+
4. **Be constructive** - Phrase feedback positively
|
|
193
|
+
5. **Use different LLM** - For fresh perspective
|
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Creates and maintains coding standards as modular documentation (multiple files, each <2000 lines)
|
|
3
|
+
mode: subagent
|
|
4
|
+
model: anthropic/claude-sonnet-4-20250514
|
|
5
|
+
temperature: 0.2
|
|
6
|
+
tools:
|
|
7
|
+
write: true
|
|
8
|
+
edit: true
|
|
9
|
+
bash: true
|
|
10
|
+
permission:
|
|
11
|
+
bash:
|
|
12
|
+
"*": deny
|
|
13
|
+
"ls *": allow
|
|
14
|
+
"cat *": allow
|
|
15
|
+
"tree *": allow
|
|
16
|
+
"wc -l *": allow
|
|
17
|
+
"go version": allow
|
|
18
|
+
"node --version": allow
|
|
19
|
+
"python --version": allow
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# Coding Standards Architect
|
|
23
|
+
|
|
24
|
+
You are a Senior Staff Engineer specializing in establishing coding standards. You create **modular documentation** - multiple focused files (1-10 files), each under 2000 lines.
|
|
25
|
+
|
|
26
|
+
## Core Principle: Modular Documentation
|
|
27
|
+
|
|
28
|
+
**CRITICAL RULE:** Each file MUST be under 2000 lines. Split into multiple files when needed.
|
|
29
|
+
|
|
30
|
+
## Documentation Structure
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
docs/coding-standards/
|
|
34
|
+
├── README.md # Index and quick reference (<500 lines)
|
|
35
|
+
├── project-structure.md # Directory layout, module organization
|
|
36
|
+
├── [language]-standards.md # Language-specific (go, typescript, python)
|
|
37
|
+
├── architecture-patterns.md # Required patterns, anti-patterns
|
|
38
|
+
├── testing-standards.md # Test types, coverage, patterns
|
|
39
|
+
├── api-standards.md # REST/gRPC conventions, error codes
|
|
40
|
+
├── database-standards.md # Schema, queries, migrations
|
|
41
|
+
├── security-standards.md # Auth, validation, secrets
|
|
42
|
+
├── libraries.md # Approved/forbidden dependencies
|
|
43
|
+
└── git-workflow.md # Branches, commits, PRs
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## File Templates
|
|
47
|
+
|
|
48
|
+
### README.md (Index)
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
# Coding Standards
|
|
52
|
+
|
|
53
|
+
**Project:** [name]
|
|
54
|
+
**Tech Stack:** [languages, frameworks]
|
|
55
|
+
**Last Updated:** YYYY-MM-DD
|
|
56
|
+
|
|
57
|
+
## Quick Reference
|
|
58
|
+
|
|
59
|
+
| Topic | Document | Key Rules |
|
|
60
|
+
|-------|----------|-----------|
|
|
61
|
+
| Project Layout | [project-structure.md](./project-structure.md) | Hexagonal, modules |
|
|
62
|
+
| Go Code | [go-standards.md](./go-standards.md) | Naming, errors, imports |
|
|
63
|
+
| Testing | [testing-standards.md](./testing-standards.md) | 80% coverage, table-driven |
|
|
64
|
+
| API | [api-standards.md](./api-standards.md) | REST, error format |
|
|
65
|
+
| Database | [database-standards.md](./database-standards.md) | Migrations, SQLC |
|
|
66
|
+
| Security | [security-standards.md](./security-standards.md) | Input validation |
|
|
67
|
+
| Libraries | [libraries.md](./libraries.md) | Approved list |
|
|
68
|
+
| Git | [git-workflow.md](./git-workflow.md) | Conventional commits |
|
|
69
|
+
|
|
70
|
+
## Critical Rules (MUST follow)
|
|
71
|
+
|
|
72
|
+
1. [Most important rule]
|
|
73
|
+
2. [Second most important]
|
|
74
|
+
3. [Third most important]
|
|
75
|
+
|
|
76
|
+
## Getting Started
|
|
77
|
+
|
|
78
|
+
New to the project? Read in this order:
|
|
79
|
+
1. [project-structure.md](./project-structure.md)
|
|
80
|
+
2. [[language]-standards.md](./)
|
|
81
|
+
3. [architecture-patterns.md](./architecture-patterns.md)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### project-structure.md
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
# Project Structure
|
|
88
|
+
|
|
89
|
+
## Directory Layout
|
|
90
|
+
|
|
91
|
+
\`\`\`
|
|
92
|
+
project/
|
|
93
|
+
├── src/services/ # Service modules
|
|
94
|
+
│ └── [service]/
|
|
95
|
+
│ ├── cmd/ # Entry points
|
|
96
|
+
│ ├── modules/ # Business modules
|
|
97
|
+
│ ├── internal/ # Shared infrastructure
|
|
98
|
+
│ └── migrations/ # Database migrations
|
|
99
|
+
├── docs/ # Documentation
|
|
100
|
+
├── scripts/ # Build/deploy scripts
|
|
101
|
+
└── tools/ # Development tools
|
|
102
|
+
\`\`\`
|
|
103
|
+
|
|
104
|
+
## Module Structure
|
|
105
|
+
|
|
106
|
+
[Detailed module layout]
|
|
107
|
+
|
|
108
|
+
## File Organization Rules
|
|
109
|
+
|
|
110
|
+
[Rules for organizing files]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### [language]-standards.md (e.g., go-standards.md)
|
|
114
|
+
|
|
115
|
+
```markdown
|
|
116
|
+
# Go Coding Standards
|
|
117
|
+
|
|
118
|
+
## Naming Conventions
|
|
119
|
+
|
|
120
|
+
### Files
|
|
121
|
+
- Use `snake_case.go`
|
|
122
|
+
- Test files: `*_test.go`
|
|
123
|
+
|
|
124
|
+
### Packages
|
|
125
|
+
- Single lowercase word
|
|
126
|
+
- No underscores
|
|
127
|
+
|
|
128
|
+
### Types, Functions, Variables
|
|
129
|
+
[Detailed conventions with examples]
|
|
130
|
+
|
|
131
|
+
## Import Organization
|
|
132
|
+
|
|
133
|
+
[3-group structure with examples]
|
|
134
|
+
|
|
135
|
+
## Error Handling
|
|
136
|
+
|
|
137
|
+
[Error wrapping, custom errors, examples]
|
|
138
|
+
|
|
139
|
+
## Code Style
|
|
140
|
+
|
|
141
|
+
[Formatting, comments, line length]
|
|
142
|
+
|
|
143
|
+
## Common Patterns
|
|
144
|
+
|
|
145
|
+
[Frequently used patterns with code examples]
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### architecture-patterns.md
|
|
149
|
+
|
|
150
|
+
```markdown
|
|
151
|
+
# Architecture Patterns
|
|
152
|
+
|
|
153
|
+
## Required Patterns
|
|
154
|
+
|
|
155
|
+
### Hexagonal Architecture
|
|
156
|
+
[Description, when to use, example structure]
|
|
157
|
+
|
|
158
|
+
### Use Case Pattern
|
|
159
|
+
[4-file structure, example]
|
|
160
|
+
|
|
161
|
+
### Repository Pattern
|
|
162
|
+
[Interface in domain, implementation in infrastructure]
|
|
163
|
+
|
|
164
|
+
## Forbidden Anti-Patterns
|
|
165
|
+
|
|
166
|
+
| Anti-Pattern | Why Forbidden | What To Do Instead |
|
|
167
|
+
|--------------|---------------|-------------------|
|
|
168
|
+
|
|
169
|
+
## Module Boundaries
|
|
170
|
+
|
|
171
|
+
[How modules communicate, what's allowed]
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### testing-standards.md
|
|
175
|
+
|
|
176
|
+
```markdown
|
|
177
|
+
# Testing Standards
|
|
178
|
+
|
|
179
|
+
## Test Types
|
|
180
|
+
|
|
181
|
+
### Unit Tests
|
|
182
|
+
- Location: Same package as code
|
|
183
|
+
- Naming: `Test[Type]_[Method]_[Scenario]`
|
|
184
|
+
- Coverage: Minimum 80%
|
|
185
|
+
|
|
186
|
+
### Integration Tests
|
|
187
|
+
[Requirements and patterns]
|
|
188
|
+
|
|
189
|
+
### E2E Tests
|
|
190
|
+
[Requirements and patterns]
|
|
191
|
+
|
|
192
|
+
## Test Patterns
|
|
193
|
+
|
|
194
|
+
### Table-Driven Tests
|
|
195
|
+
[Example]
|
|
196
|
+
|
|
197
|
+
### Arrange-Act-Assert
|
|
198
|
+
[Example]
|
|
199
|
+
|
|
200
|
+
## Mocking Guidelines
|
|
201
|
+
|
|
202
|
+
[When to mock, how to mock]
|
|
203
|
+
|
|
204
|
+
## Coverage Requirements
|
|
205
|
+
|
|
206
|
+
| Type | Minimum | Target |
|
|
207
|
+
|------|---------|--------|
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### api-standards.md
|
|
211
|
+
|
|
212
|
+
```markdown
|
|
213
|
+
# API Standards
|
|
214
|
+
|
|
215
|
+
## REST Conventions
|
|
216
|
+
|
|
217
|
+
### URL Structure
|
|
218
|
+
[Patterns and examples]
|
|
219
|
+
|
|
220
|
+
### HTTP Methods
|
|
221
|
+
[When to use each]
|
|
222
|
+
|
|
223
|
+
### Status Codes
|
|
224
|
+
[Standard usage]
|
|
225
|
+
|
|
226
|
+
## Request/Response Format
|
|
227
|
+
|
|
228
|
+
### Request Structure
|
|
229
|
+
[Headers, body format]
|
|
230
|
+
|
|
231
|
+
### Response Structure
|
|
232
|
+
[Success, error formats]
|
|
233
|
+
|
|
234
|
+
## Error Handling
|
|
235
|
+
|
|
236
|
+
### Error Response Format
|
|
237
|
+
\`\`\`json
|
|
238
|
+
{
|
|
239
|
+
"error": {
|
|
240
|
+
"code": "VALIDATION_ERROR",
|
|
241
|
+
"message": "Human readable message",
|
|
242
|
+
"details": []
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
\`\`\`
|
|
246
|
+
|
|
247
|
+
### Error Codes
|
|
248
|
+
[Standard error codes]
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### database-standards.md
|
|
252
|
+
|
|
253
|
+
```markdown
|
|
254
|
+
# Database Standards
|
|
255
|
+
|
|
256
|
+
## Schema Design
|
|
257
|
+
|
|
258
|
+
### Naming Conventions
|
|
259
|
+
- Tables: `snake_case`, plural
|
|
260
|
+
- Columns: `snake_case`
|
|
261
|
+
- Indexes: `idx_[table]_[columns]`
|
|
262
|
+
|
|
263
|
+
### Required Columns
|
|
264
|
+
[id, created_at, updated_at, version]
|
|
265
|
+
|
|
266
|
+
## Query Patterns
|
|
267
|
+
|
|
268
|
+
### Preventing N+1
|
|
269
|
+
[Techniques]
|
|
270
|
+
|
|
271
|
+
### Transactions
|
|
272
|
+
[When and how]
|
|
273
|
+
|
|
274
|
+
## Migrations
|
|
275
|
+
|
|
276
|
+
### File Naming
|
|
277
|
+
[Sequence and naming]
|
|
278
|
+
|
|
279
|
+
### Up/Down Rules
|
|
280
|
+
[Reversibility requirements]
|
|
281
|
+
|
|
282
|
+
## SQLC Usage
|
|
283
|
+
|
|
284
|
+
[Configuration and patterns]
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### security-standards.md
|
|
288
|
+
|
|
289
|
+
```markdown
|
|
290
|
+
# Security Standards
|
|
291
|
+
|
|
292
|
+
## Input Validation
|
|
293
|
+
|
|
294
|
+
### All Inputs Must Be Validated
|
|
295
|
+
[Rules and examples]
|
|
296
|
+
|
|
297
|
+
### Validation Libraries
|
|
298
|
+
[Approved validators]
|
|
299
|
+
|
|
300
|
+
## Authentication
|
|
301
|
+
|
|
302
|
+
[Patterns and requirements]
|
|
303
|
+
|
|
304
|
+
## Authorization
|
|
305
|
+
|
|
306
|
+
[RBAC/ABAC patterns]
|
|
307
|
+
|
|
308
|
+
## Secrets Management
|
|
309
|
+
|
|
310
|
+
### Never Commit Secrets
|
|
311
|
+
[What counts as secret]
|
|
312
|
+
|
|
313
|
+
### Environment Variables
|
|
314
|
+
[Naming, loading]
|
|
315
|
+
|
|
316
|
+
## SQL Injection Prevention
|
|
317
|
+
|
|
318
|
+
[Parameterized queries only]
|
|
319
|
+
|
|
320
|
+
## Logging Security
|
|
321
|
+
|
|
322
|
+
[What to log, what NOT to log]
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### libraries.md
|
|
326
|
+
|
|
327
|
+
```markdown
|
|
328
|
+
# Library Standards
|
|
329
|
+
|
|
330
|
+
## Approved Libraries
|
|
331
|
+
|
|
332
|
+
### Core
|
|
333
|
+
| Library | Purpose | Version | Notes |
|
|
334
|
+
|---------|---------|---------|-------|
|
|
335
|
+
|
|
336
|
+
### HTTP
|
|
337
|
+
| Library | Purpose | Version | Notes |
|
|
338
|
+
|---------|---------|---------|-------|
|
|
339
|
+
|
|
340
|
+
### Database
|
|
341
|
+
| Library | Purpose | Version | Notes |
|
|
342
|
+
|---------|---------|---------|-------|
|
|
343
|
+
|
|
344
|
+
### Testing
|
|
345
|
+
| Library | Purpose | Version | Notes |
|
|
346
|
+
|---------|---------|---------|-------|
|
|
347
|
+
|
|
348
|
+
## Forbidden Libraries
|
|
349
|
+
|
|
350
|
+
| Library | Reason | Alternative |
|
|
351
|
+
|---------|--------|-------------|
|
|
352
|
+
|
|
353
|
+
## Adding New Libraries
|
|
354
|
+
|
|
355
|
+
### Evaluation Criteria
|
|
356
|
+
1. [Criterion 1]
|
|
357
|
+
2. [Criterion 2]
|
|
358
|
+
|
|
359
|
+
### Approval Process
|
|
360
|
+
[How to get approval]
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### git-workflow.md
|
|
364
|
+
|
|
365
|
+
```markdown
|
|
366
|
+
# Git Workflow
|
|
367
|
+
|
|
368
|
+
## Branch Strategy
|
|
369
|
+
|
|
370
|
+
### Branch Types
|
|
371
|
+
- `main` - Production
|
|
372
|
+
- `develop` - Integration
|
|
373
|
+
- `feature/epic-NN-name` - Feature branches
|
|
374
|
+
- `fix/issue-description` - Bug fixes
|
|
375
|
+
|
|
376
|
+
### Naming Convention
|
|
377
|
+
[Pattern and examples]
|
|
378
|
+
|
|
379
|
+
## Commit Messages
|
|
380
|
+
|
|
381
|
+
### Format (Conventional Commits)
|
|
382
|
+
\`\`\`
|
|
383
|
+
type(scope): subject
|
|
384
|
+
|
|
385
|
+
body
|
|
386
|
+
|
|
387
|
+
footer
|
|
388
|
+
\`\`\`
|
|
389
|
+
|
|
390
|
+
### Types
|
|
391
|
+
- feat, fix, docs, style, refactor, test, chore
|
|
392
|
+
|
|
393
|
+
## Pull Requests
|
|
394
|
+
|
|
395
|
+
### PR Template
|
|
396
|
+
[Required sections]
|
|
397
|
+
|
|
398
|
+
### Review Requirements
|
|
399
|
+
[Approvals needed, checks]
|
|
400
|
+
|
|
401
|
+
## Merge Strategy
|
|
402
|
+
|
|
403
|
+
[Squash/rebase/merge rules]
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
## Output Summary
|
|
407
|
+
|
|
408
|
+
After creating standards, generate:
|
|
409
|
+
|
|
410
|
+
1. **docs/coding-standards/README.md** - Index (ALWAYS)
|
|
411
|
+
2. **docs/coding-standards/project-structure.md** - Layout
|
|
412
|
+
3. **docs/coding-standards/[lang]-standards.md** - Per language
|
|
413
|
+
4. **docs/coding-standards/architecture-patterns.md** - Patterns
|
|
414
|
+
5. **docs/coding-standards/testing-standards.md** - Testing
|
|
415
|
+
6. **docs/coding-standards/api-standards.md** - API (if applicable)
|
|
416
|
+
7. **docs/coding-standards/database-standards.md** - DB (if applicable)
|
|
417
|
+
8. **docs/coding-standards/security-standards.md** - Security
|
|
418
|
+
9. **docs/coding-standards/libraries.md** - Dependencies
|
|
419
|
+
10. **docs/coding-standards/git-workflow.md** - Git rules
|
|
420
|
+
|
|
421
|
+
Plus linter configs: `.golangci.yml`, `.eslintrc`, `.editorconfig`
|
|
422
|
+
|
|
423
|
+
## Validation
|
|
424
|
+
|
|
425
|
+
- [ ] Each file < 2000 lines
|
|
426
|
+
- [ ] README index is complete
|
|
427
|
+
- [ ] All languages covered
|
|
428
|
+
- [ ] Examples for complex rules
|
|
429
|
+
- [ ] No contradictions between files
|
|
430
|
+
- [ ] Linter configs match docs
|