@codeharbor/agent-playbook 0.1.0 → 0.1.1

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.
Files changed (113) hide show
  1. package/package.json +5 -2
  2. package/skills/api-designer/README.md +36 -0
  3. package/skills/api-designer/SKILL.md +232 -0
  4. package/skills/api-designer/references/graphql-patterns.md +12 -0
  5. package/skills/api-designer/references/rest-patterns.md +17 -0
  6. package/skills/api-designer/scripts/generate_api.py +87 -0
  7. package/skills/api-designer/scripts/validate_api.py +48 -0
  8. package/skills/api-documenter/README.md +41 -0
  9. package/skills/api-documenter/SKILL.md +209 -0
  10. package/skills/api-documenter/references/examples/README.md +3 -0
  11. package/skills/api-documenter/references/examples/openapi-example.yaml +10 -0
  12. package/skills/api-documenter/references/openapi-template.yaml +5 -0
  13. package/skills/api-documenter/scripts/generate_openapi.py +84 -0
  14. package/skills/api-documenter/scripts/validate_openapi.py +45 -0
  15. package/skills/architecting-solutions/README.md +22 -0
  16. package/skills/architecting-solutions/SKILL.md +459 -0
  17. package/skills/auto-trigger/README.md +23 -0
  18. package/skills/auto-trigger/SKILL.md +183 -0
  19. package/skills/code-reviewer/README.md +59 -0
  20. package/skills/code-reviewer/SKILL.md +220 -0
  21. package/skills/code-reviewer/references/checklist.md +80 -0
  22. package/skills/code-reviewer/references/patterns.md +226 -0
  23. package/skills/code-reviewer/references/security.md +88 -0
  24. package/skills/code-reviewer/scripts/review_checklist.py +191 -0
  25. package/skills/commit-helper/README.md +58 -0
  26. package/skills/commit-helper/SKILL.md +159 -0
  27. package/skills/commit-helper/references/conventional-commits.md +68 -0
  28. package/skills/commit-helper/references/examples.md +125 -0
  29. package/skills/commit-helper/references/scopes.md +49 -0
  30. package/skills/commit-helper/scripts/validate_commit.py +70 -0
  31. package/skills/create-pr/README.md +182 -0
  32. package/skills/create-pr/SKILL.md +340 -0
  33. package/skills/debugger/README.md +53 -0
  34. package/skills/debugger/SKILL.md +239 -0
  35. package/skills/debugger/references/checklist.md +7 -0
  36. package/skills/debugger/references/errors.md +6 -0
  37. package/skills/debugger/references/patterns.md +5 -0
  38. package/skills/debugger/scripts/debug_report.py +77 -0
  39. package/skills/deployment-engineer/README.md +40 -0
  40. package/skills/deployment-engineer/SKILL.md +242 -0
  41. package/skills/deployment-engineer/references/kubernetes.md +23 -0
  42. package/skills/deployment-engineer/references/monitoring.md +14 -0
  43. package/skills/deployment-engineer/references/pipelines.md +12 -0
  44. package/skills/deployment-engineer/scripts/generate_deploy.py +72 -0
  45. package/skills/deployment-engineer/scripts/validate_deploy.py +46 -0
  46. package/skills/documentation-engineer/README.md +41 -0
  47. package/skills/documentation-engineer/SKILL.md +164 -0
  48. package/skills/documentation-engineer/references/api-template.md +22 -0
  49. package/skills/documentation-engineer/references/readme-template.md +25 -0
  50. package/skills/documentation-engineer/references/style-guide.md +13 -0
  51. package/skills/documentation-engineer/scripts/generate_docs.py +68 -0
  52. package/skills/documentation-engineer/scripts/validate_docs.py +46 -0
  53. package/skills/figma-designer/README.md +222 -0
  54. package/skills/figma-designer/SKILL.md +407 -0
  55. package/skills/figma-designer/references/example-output.md +86 -0
  56. package/skills/performance-engineer/README.md +42 -0
  57. package/skills/performance-engineer/SKILL.md +236 -0
  58. package/skills/performance-engineer/references/checklist.md +6 -0
  59. package/skills/performance-engineer/references/monitoring.md +5 -0
  60. package/skills/performance-engineer/references/optimization.md +7 -0
  61. package/skills/performance-engineer/scripts/perf_report.py +64 -0
  62. package/skills/performance-engineer/scripts/profile.py +63 -0
  63. package/skills/planning-with-files/README.md +27 -0
  64. package/skills/planning-with-files/SKILL.md +103 -0
  65. package/skills/prd-implementation-precheck/README.md +97 -0
  66. package/skills/prd-implementation-precheck/SKILL.md +112 -0
  67. package/skills/prd-planner/README.md +102 -0
  68. package/skills/prd-planner/SKILL.md +449 -0
  69. package/skills/prd-planner/references/edge-case-analysis.md +111 -0
  70. package/skills/qa-expert/README.md +37 -0
  71. package/skills/qa-expert/SKILL.md +225 -0
  72. package/skills/qa-expert/references/gates.md +11 -0
  73. package/skills/qa-expert/references/metrics.md +6 -0
  74. package/skills/qa-expert/references/strategy.md +11 -0
  75. package/skills/qa-expert/scripts/coverage_analysis.py +61 -0
  76. package/skills/qa-expert/scripts/generate_test_plan.py +68 -0
  77. package/skills/refactoring-specialist/README.md +37 -0
  78. package/skills/refactoring-specialist/SKILL.md +283 -0
  79. package/skills/refactoring-specialist/references/checklist.md +6 -0
  80. package/skills/refactoring-specialist/references/smells.md +6 -0
  81. package/skills/refactoring-specialist/references/techniques.md +6 -0
  82. package/skills/security-auditor/README.md +48 -0
  83. package/skills/security-auditor/SKILL.md +256 -0
  84. package/skills/security-auditor/references/checklist.md +7 -0
  85. package/skills/security-auditor/references/owasp.md +12 -0
  86. package/skills/security-auditor/references/remediation.md +7 -0
  87. package/skills/security-auditor/scripts/find_secrets.py +58 -0
  88. package/skills/security-auditor/scripts/security_audit.py +64 -0
  89. package/skills/self-improving-agent/README.md +136 -0
  90. package/skills/self-improving-agent/SKILL.md +407 -0
  91. package/skills/self-improving-agent/hooks/post-bash.sh +10 -0
  92. package/skills/self-improving-agent/hooks/pre-tool.sh +10 -0
  93. package/skills/self-improving-agent/hooks/session-end.sh +4 -0
  94. package/skills/self-improving-agent/memory/semantic-patterns.json +288 -0
  95. package/skills/self-improving-agent/references/appendix.md +131 -0
  96. package/skills/self-improving-agent/templates/correction-template.md +11 -0
  97. package/skills/self-improving-agent/templates/pattern-template.md +15 -0
  98. package/skills/self-improving-agent/templates/validation-template.md +14 -0
  99. package/skills/session-logger/README.md +50 -0
  100. package/skills/session-logger/SKILL.md +156 -0
  101. package/skills/skill-router/README.md +155 -0
  102. package/skills/skill-router/SKILL.md +215 -0
  103. package/skills/test-automator/README.md +41 -0
  104. package/skills/test-automator/SKILL.md +202 -0
  105. package/skills/test-automator/references/best-practices.md +6 -0
  106. package/skills/test-automator/references/examples/README.md +3 -0
  107. package/skills/test-automator/references/examples/unit-test-example.md +8 -0
  108. package/skills/test-automator/references/mocking.md +5 -0
  109. package/skills/test-automator/scripts/coverage_report.py +59 -0
  110. package/skills/test-automator/scripts/generate_test.py +66 -0
  111. package/skills/workflow-orchestrator/README.md +20 -0
  112. package/skills/workflow-orchestrator/SKILL.md +342 -0
  113. package/src/cli.js +25 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeharbor/agent-playbook",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "One-click installer and workflow fixer for agent-playbook across Claude Code and Codex.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -9,11 +9,14 @@
9
9
  },
10
10
  "scripts": {
11
11
  "test": "node --test test/*.test.js",
12
- "lint": "node -c src/cli.js"
12
+ "lint": "node -c src/cli.js",
13
+ "prepack": "node scripts/sync-skills.js copy",
14
+ "postpack": "node scripts/sync-skills.js clean"
13
15
  },
14
16
  "files": [
15
17
  "bin",
16
18
  "src",
19
+ "skills",
17
20
  "templates",
18
21
  "README.md",
19
22
  "LICENSE"
@@ -0,0 +1,36 @@
1
+ # API Designer
2
+
3
+ > A Claude Code skill for REST and GraphQL API design.
4
+
5
+ ## Installation
6
+
7
+ This skill is part of the [agent-playbook](https://github.com/Charon-Fan/agent-playbook) collection.
8
+
9
+ ## Usage
10
+
11
+ ```
12
+ You: Design an API for user management
13
+ You: Create API specification
14
+ You: Review this API design
15
+ ```
16
+
17
+ ## API Design Principles
18
+
19
+ 1. **Resource-Oriented**: Nouns, not verbs
20
+ 2. **Consistent Naming**: kebab-case for URLs
21
+ 3. **Proper HTTP Methods**: GET, POST, PUT, DELETE
22
+ 4. **Status Codes**: Correct HTTP status codes
23
+ 5. **Versioning**: Plan for API evolution
24
+
25
+ ## Scripts
26
+
27
+ Generate API scaffold:
28
+ ```bash
29
+ python scripts/generate_api.py <resource-name>
30
+ ```
31
+
32
+ ## Resources
33
+
34
+ - [REST API Tutorial](https://restfulapi.net/)
35
+ - [GraphQL Best Practices](https://graphql.org/learn/best-practices/)
36
+ - [API Design Guidelines](https://github.com/microsoft/api-guidelines)
@@ -0,0 +1,232 @@
1
+ ---
2
+ name: api-designer
3
+ description: REST and GraphQL API architect for designing robust, scalable APIs. Use when designing new APIs or improving existing ones.
4
+ allowed-tools: Read, Write, Edit, Bash, Grep, Glob, WebFetch, WebSearch
5
+ ---
6
+
7
+ # API Designer
8
+
9
+ Expert in designing REST and GraphQL APIs that are robust, scalable, and maintainable.
10
+
11
+ ## When This Skill Activates
12
+
13
+ Activates when you:
14
+ - Design a new API
15
+ - Review API design
16
+ - Improve existing API
17
+ - Create API specifications
18
+
19
+ ## REST API Design Principles
20
+
21
+ ### 1. Resource-Oriented Design
22
+
23
+ **Good:**
24
+ ```
25
+ GET /users # List users
26
+ POST /users # Create user
27
+ GET /users/{id} # Get specific user
28
+ PATCH /users/{id} # Update user
29
+ DELETE /users/{id} # Delete user
30
+ ```
31
+
32
+ **Avoid:**
33
+ ```
34
+ POST /getUsers # Should be GET
35
+ POST /users/create # Redundant
36
+ GET /users/get/{id} # Redundant
37
+ ```
38
+
39
+ ### 2. HTTP Methods
40
+
41
+ | Method | Safe | Idempotent | Purpose |
42
+ |--------|------|------------|---------|
43
+ | GET | ✓ | ✓ | Read resource |
44
+ | POST | ✗ | ✗ | Create resource |
45
+ | PUT | ✗ | ✓ | Replace resource |
46
+ | PATCH | ✗ | ✗ | Update resource |
47
+ | DELETE | ✗ | ✓ | Delete resource |
48
+
49
+ ### 3. Status Codes
50
+
51
+ | Code | Meaning | Usage |
52
+ |------|---------|-------|
53
+ | 200 | OK | Successful GET, PATCH, DELETE |
54
+ | 201 | Created | Successful POST |
55
+ | 204 | No Content | Successful DELETE with no body |
56
+ | 400 | Bad Request | Invalid input |
57
+ | 401 | Unauthorized | Missing or invalid auth |
58
+ | 403 | Forbidden | Authenticated but not authorized |
59
+ | 404 | Not Found | Resource doesn't exist |
60
+ | 409 | Conflict | Resource already exists |
61
+ | 422 | Unprocessable | Valid syntax but semantic errors |
62
+ | 429 | Too Many Requests | Rate limit exceeded |
63
+ | 500 | Internal Server Error | Server error |
64
+
65
+ ### 4. Naming Conventions
66
+
67
+ - **URLs**: kebab-case (`/user-preferences`)
68
+ - **JSON**: camelCase (`{"userId": "123"}`)
69
+ - **Query params**: snake_case or camelCase (`?page_size=10`)
70
+
71
+ ### 5. Pagination
72
+
73
+ ```http
74
+ GET /users?page=1&page_size=20
75
+
76
+ Response:
77
+ {
78
+ "data": [...],
79
+ "pagination": {
80
+ "page": 1,
81
+ "page_size": 20,
82
+ "total": 100,
83
+ "total_pages": 5
84
+ }
85
+ }
86
+ ```
87
+
88
+ ### 6. Filtering and Sorting
89
+
90
+ ```http
91
+ GET /users?status=active&sort=-created_at,name
92
+
93
+ # -created_at = descending
94
+ # name = ascending
95
+ ```
96
+
97
+ ## GraphQL API Design
98
+
99
+ ### Schema Design
100
+
101
+ ```graphql
102
+ type Query {
103
+ user(id: ID!): User
104
+ users(limit: Int, offset: Int): UserConnection!
105
+ }
106
+
107
+ type Mutation {
108
+ createUser(input: CreateUserInput!): CreateUserPayload!
109
+ updateUser(id: ID!, input: UpdateUserInput!): UpdateUserPayload!
110
+ }
111
+
112
+ type User {
113
+ id: ID!
114
+ email: String!
115
+ profile: Profile
116
+ posts(first: Int, after: String): PostConnection!
117
+ }
118
+
119
+ type UserConnection {
120
+ edges: [UserEdge!]!
121
+ pageInfo: PageInfo!
122
+ }
123
+
124
+ type UserEdge {
125
+ node: User!
126
+ cursor: String!
127
+ }
128
+
129
+ type PageInfo {
130
+ hasNextPage: Boolean!
131
+ hasPreviousPage: Boolean!
132
+ startCursor: String
133
+ endCursor: String
134
+ }
135
+ ```
136
+
137
+ ### Best Practices
138
+
139
+ - **Nullability**: Default to non-null, nullable only when appropriate
140
+ - **Connections**: Use cursor-based pagination for lists
141
+ - **Payloads**: Use mutation payloads for consistent error handling
142
+ - **Descriptions**: Document all types and fields
143
+
144
+ ## API Versioning
145
+
146
+ ### Approaches
147
+
148
+ **URL Versioning** (Recommended):
149
+ ```
150
+ /api/v1/users
151
+ /api/v2/users
152
+ ```
153
+
154
+ **Header Versioning**:
155
+ ```
156
+ GET /users
157
+ Accept: application/vnd.myapi.v2+json
158
+ ```
159
+
160
+ ### Versioning Guidelines
161
+
162
+ - Start with v1
163
+ - Maintain backwards compatibility when possible
164
+ - Deprecate old versions with notice
165
+ - Document breaking changes
166
+
167
+ ## Authentication & Authorization
168
+
169
+ ### Authentication Methods
170
+
171
+ 1. **JWT Bearer Token**
172
+ ```http
173
+ Authorization: Bearer <token>
174
+ ```
175
+
176
+ 2. **API Key**
177
+ ```http
178
+ X-API-Key: <key>
179
+ ```
180
+
181
+ 3. **OAuth 2.0**
182
+ ```http
183
+ Authorization: Bearer <access_token>
184
+ ```
185
+
186
+ ### Authorization
187
+
188
+ - Use roles/permissions
189
+ - Document required permissions per endpoint
190
+ - Return 403 for authorization failures
191
+
192
+ ## Rate Limiting
193
+
194
+ ```http
195
+ HTTP/1.1 200 OK
196
+ X-RateLimit-Limit: 1000
197
+ X-RateLimit-Remaining: 999
198
+ X-RateLimit-Reset: 1631234567
199
+ ```
200
+
201
+ **Recommended limits:**
202
+ - Public APIs: 100-1000 requests/hour
203
+ - Authenticated APIs: 1000-10000 requests/hour
204
+ - Webhooks: 10-100 requests/minute
205
+
206
+ ## Documentation Requirements
207
+
208
+ - All endpoints documented
209
+ - Request/response examples
210
+ - Authentication requirements
211
+ - Error response formats
212
+ - Rate limits
213
+ - SDK examples (if available)
214
+
215
+ ## Scripts
216
+
217
+ Generate API scaffold:
218
+ ```bash
219
+ python scripts/generate_api.py <resource-name>
220
+ ```
221
+
222
+ Validate API design:
223
+ ```bash
224
+ python scripts/validate_api.py openapi.yaml
225
+ ```
226
+
227
+ ## References
228
+
229
+ - `references/rest-patterns.md` - REST design patterns
230
+ - `references/graphql-patterns.md` - GraphQL design patterns
231
+ - [REST API Tutorial](https://restfulapi.net/)
232
+ - [GraphQL Best Practices](https://graphql.org/learn/best-practices/)
@@ -0,0 +1,12 @@
1
+ # GraphQL Patterns
2
+
3
+ ## Schema Design
4
+ - Use clear type names
5
+ - Avoid overly generic fields
6
+
7
+ ## Pagination
8
+ - Prefer cursor-based pagination
9
+
10
+ ## Mutations
11
+ - Use input objects for complex mutations
12
+ - Return updated entities and errors
@@ -0,0 +1,17 @@
1
+ # REST Patterns
2
+
3
+ ## Resource Naming
4
+ - Use nouns (e.g., /users)
5
+ - Use plural for collections
6
+
7
+ ## Methods
8
+ - GET for retrieval
9
+ - POST for creation
10
+ - PUT/PATCH for updates
11
+ - DELETE for removal
12
+
13
+ ## Status Codes
14
+ - 200 OK
15
+ - 201 Created
16
+ - 204 No Content
17
+ - 400/401/403/404 for errors
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env python3
2
+ # Template generator for API design.
3
+
4
+ from pathlib import Path
5
+ import argparse
6
+ import textwrap
7
+
8
+
9
+ def write_output(path: Path, content: str, force: bool) -> bool:
10
+ if path.exists() and not force:
11
+ print(f"{path} already exists (use --force to overwrite)")
12
+ return False
13
+ path.parent.mkdir(parents=True, exist_ok=True)
14
+ path.write_text(content, encoding="utf-8")
15
+ return True
16
+
17
+
18
+ def main() -> int:
19
+ parser = argparse.ArgumentParser(description="Generate a starter API design.")
20
+ parser.add_argument("--output", default="api-design.md", help="Output file path")
21
+ parser.add_argument("--name", default="example", help="Primary resource name")
22
+ parser.add_argument("--owner", default="team", help="Owning team or service")
23
+ parser.add_argument("--force", action="store_true", help="Overwrite existing file")
24
+ args = parser.parse_args()
25
+
26
+ content = textwrap.dedent(
27
+ f"""\
28
+ # API Design
29
+
30
+ ## Overview
31
+ Describe the API for {args.name}.
32
+
33
+ ## Ownership
34
+ - Owner: {args.owner}
35
+ - Stakeholders: TBD
36
+
37
+ ## Goals
38
+ - Provide CRUD for {args.name}
39
+ - Maintain backward compatibility
40
+
41
+ ## Non-Goals
42
+ - Bulk export
43
+ - Cross-service transactions
44
+
45
+ ## Resources
46
+ - {args.name}
47
+ - {args.name}-metadata
48
+
49
+ ## Endpoints
50
+ | Method | Path | Description | Auth |
51
+ | --- | --- | --- | --- |
52
+ | GET | /{args.name} | List {args.name} | Required |
53
+ | POST | /{args.name} | Create {args.name} | Required |
54
+
55
+ ## Authentication
56
+ - OAuth2 bearer tokens
57
+ - Service-to-service mTLS
58
+
59
+ ## Error Model
60
+ - Use RFC7807 problem details
61
+ - Standard error codes and retry hints
62
+
63
+ ## Pagination and Filtering
64
+ - Cursor-based pagination
65
+ - Filter by status, owner, and created_at
66
+
67
+ ## Rate Limits
68
+ - 100 rps per token, burst 200
69
+
70
+ ## Observability
71
+ - Structured logs with request_id
72
+ - Metrics: latency, error rate, saturation
73
+
74
+ ## Open Questions
75
+ - Define data retention policy
76
+ """
77
+ ).strip() + "\n"
78
+
79
+ output = Path(args.output)
80
+ if not write_output(output, content, args.force):
81
+ return 1
82
+ print(f"Wrote {output}")
83
+ return 0
84
+
85
+
86
+ if __name__ == "__main__":
87
+ raise SystemExit(main())
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env python3
2
+ # Template validator for API design.
3
+
4
+ from pathlib import Path
5
+ import argparse
6
+
7
+ DEFAULT_REQUIRED = [
8
+ "## Overview",
9
+ "## Ownership",
10
+ "## Resources",
11
+ "## Endpoints",
12
+ "## Authentication",
13
+ "## Error Model",
14
+ "## Pagination",
15
+ "## Rate Limits",
16
+ ]
17
+
18
+
19
+ def main() -> int:
20
+ parser = argparse.ArgumentParser(description="Validate a generated artifact.")
21
+ parser.add_argument("--input", default="api-design.md", help="Input file path")
22
+ parser.add_argument(
23
+ "--require",
24
+ action="append",
25
+ default=[],
26
+ help="Additional required section heading",
27
+ )
28
+ args = parser.parse_args()
29
+
30
+ path = Path(args.input)
31
+ if not path.exists():
32
+ print(f"Missing file: {path}")
33
+ return 1
34
+
35
+ text = path.read_text(encoding="utf-8", errors="ignore")
36
+ text_lower = text.lower()
37
+ required = DEFAULT_REQUIRED + args.require
38
+ missing = [section for section in required if section.lower() not in text_lower]
39
+ if missing:
40
+ print("Missing required sections: " + ", ".join(missing))
41
+ return 1
42
+
43
+ print(f"Validated {path}")
44
+ return 0
45
+
46
+
47
+ if __name__ == "__main__":
48
+ raise SystemExit(main())
@@ -0,0 +1,41 @@
1
+ # API Documenter
2
+
3
+ > A Claude Code skill for OpenAPI/Swagger API documentation.
4
+
5
+ ## Installation
6
+
7
+ This skill is part of the [agent-playbook](https://github.com/Charon-Fan/agent-playbook) collection.
8
+
9
+ ## Usage
10
+
11
+ ```
12
+ You: Document this API
13
+ You: Create OpenAPI spec
14
+ You: Generate API documentation
15
+ ```
16
+
17
+ ## OpenAPI Specification
18
+
19
+ The skill generates OpenAPI 3.0 specifications following:
20
+ - RESTful conventions
21
+ - Clear resource naming
22
+ - Complete request/response documentation
23
+ - Authentication requirements
24
+ - Error response formats
25
+
26
+ ## Scripts
27
+
28
+ Generate OpenAPI spec:
29
+ ```bash
30
+ python scripts/generate_openapi.py
31
+ ```
32
+
33
+ Validate OpenAPI spec:
34
+ ```bash
35
+ python scripts/validate_openapi.py openapi.yaml
36
+ ```
37
+
38
+ ## Resources
39
+
40
+ - [OpenAPI Specification](https://swagger.io/specification/)
41
+ - [Swagger Tools](https://swagger.io/tools/)
@@ -0,0 +1,209 @@
1
+ ---
2
+ name: api-documenter
3
+ description: API documentation specialist for OpenAPI/Swagger specifications. Use when documenting REST or GraphQL APIs.
4
+ allowed-tools: Read, Write, Edit, Bash, Grep, Glob
5
+ ---
6
+
7
+ # API Documenter
8
+
9
+ Specialist in creating comprehensive API documentation using OpenAPI/Swagger specifications.
10
+
11
+ ## When This Skill Activates
12
+
13
+ Activates when you:
14
+ - Ask to document an API
15
+ - Create OpenAPI/Swagger specs
16
+ - Need API reference documentation
17
+ - Mention "API docs"
18
+
19
+ ## OpenAPI Specification Structure
20
+
21
+ ```yaml
22
+ openapi: 3.0.3
23
+ info:
24
+ title: API Title
25
+ version: 1.0.0
26
+ description: API description
27
+ servers:
28
+ - url: https://example.com/api/v1
29
+ paths:
30
+ /users:
31
+ get:
32
+ summary: List users
33
+ operationId: listUsers
34
+ tags:
35
+ - users
36
+ parameters: []
37
+ responses:
38
+ '200':
39
+ description: Successful response
40
+ content:
41
+ application/json:
42
+ schema:
43
+ type: array
44
+ items:
45
+ $ref: '#/components/schemas/User'
46
+ components:
47
+ schemas:
48
+ User:
49
+ type: object
50
+ properties:
51
+ id:
52
+ type: string
53
+ name:
54
+ type: string
55
+ ```
56
+
57
+ ## Endpoint Documentation
58
+
59
+ For each endpoint, document:
60
+
61
+ ### Required Fields
62
+ - **summary**: Brief description
63
+ - **operationId**: Unique identifier
64
+ - **description**: Detailed explanation
65
+ - **tags**: For grouping
66
+ - **responses**: All possible responses
67
+
68
+ ### Recommended Fields
69
+ - **parameters**: All parameters with details
70
+ - **requestBody**: For POST/PUT/PATCH
71
+ - **security**: Authentication requirements
72
+ - **deprecated**: If applicable
73
+
74
+ ### Example
75
+
76
+ ```yaml
77
+ /users/{id}:
78
+ get:
79
+ summary: Get a user by ID
80
+ operationId: getUserById
81
+ description: Retrieves a single user by their unique identifier
82
+ tags:
83
+ - users
84
+ parameters:
85
+ - name: id
86
+ in: path
87
+ required: true
88
+ schema:
89
+ type: string
90
+ description: The user ID
91
+ responses:
92
+ '200':
93
+ description: User found
94
+ content:
95
+ application/json:
96
+ schema:
97
+ $ref: '#/components/schemas/User'
98
+ '404':
99
+ description: User not found
100
+ content:
101
+ application/json:
102
+ schema:
103
+ $ref: '#/components/schemas/Error'
104
+ ```
105
+
106
+ ## Schema Documentation
107
+
108
+ ### Best Practices
109
+
110
+ 1. **Use references** for shared schemas
111
+ 2. **Add descriptions** to all properties
112
+ 3. **Specify format** for strings (email, uuid, date-time)
113
+ 4. **Add examples** for complex schemas
114
+ 5. **Mark required fields**
115
+
116
+ ### Example
117
+
118
+ ```yaml
119
+ components:
120
+ schemas:
121
+ User:
122
+ type: object
123
+ required:
124
+ - id
125
+ - email
126
+ properties:
127
+ id:
128
+ type: string
129
+ format: uuid
130
+ description: Unique user identifier
131
+ example: "550e8400-e29b-41d4-a716-446655440000"
132
+ email:
133
+ type: string
134
+ format: email
135
+ description: User's email address
136
+ example: "user@example.com"
137
+ createdAt:
138
+ type: string
139
+ format: date-time
140
+ description: Account creation timestamp
141
+ ```
142
+
143
+ ## Authentication Documentation
144
+
145
+ Document auth requirements:
146
+
147
+ ```yaml
148
+ security:
149
+ - bearerAuth: []
150
+
151
+ components:
152
+ securitySchemes:
153
+ bearerAuth:
154
+ type: http
155
+ scheme: bearer
156
+ bearerFormat: JWT
157
+ description: Use your JWT token from /auth/login
158
+ ```
159
+
160
+ ## Error Responses
161
+
162
+ Standard error format:
163
+
164
+ ```yaml
165
+ components:
166
+ schemas:
167
+ Error:
168
+ type: object
169
+ properties:
170
+ error:
171
+ type: string
172
+ description: Error message
173
+ code:
174
+ type: string
175
+ description: Application-specific error code
176
+ details:
177
+ type: object
178
+ description: Additional error details
179
+ ```
180
+
181
+ Common HTTP status codes:
182
+ - **200**: Success
183
+ - **201**: Created
184
+ - **204**: No Content
185
+ - **400**: Bad Request
186
+ - **401**: Unauthorized
187
+ - **403**: Forbidden
188
+ - **404**: Not Found
189
+ - **409**: Conflict
190
+ - **422**: Unprocessable Entity
191
+ - **500**: Internal Server Error
192
+
193
+ ## Scripts
194
+
195
+ Generate OpenAPI spec from code:
196
+ ```bash
197
+ python scripts/generate_openapi.py
198
+ ```
199
+
200
+ Validate OpenAPI spec:
201
+ ```bash
202
+ python scripts/validate_openapi.py openapi.yaml
203
+ ```
204
+
205
+ ## References
206
+
207
+ - `references/openapi-template.yaml` - OpenAPI template
208
+ - `references/examples/` - API documentation examples
209
+ - [OpenAPI Specification](https://swagger.io/specification/)
@@ -0,0 +1,3 @@
1
+ # OpenAPI Examples
2
+
3
+ This directory contains small OpenAPI examples for reference.