@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.
- package/package.json +5 -2
- package/skills/api-designer/README.md +36 -0
- package/skills/api-designer/SKILL.md +232 -0
- package/skills/api-designer/references/graphql-patterns.md +12 -0
- package/skills/api-designer/references/rest-patterns.md +17 -0
- package/skills/api-designer/scripts/generate_api.py +87 -0
- package/skills/api-designer/scripts/validate_api.py +48 -0
- package/skills/api-documenter/README.md +41 -0
- package/skills/api-documenter/SKILL.md +209 -0
- package/skills/api-documenter/references/examples/README.md +3 -0
- package/skills/api-documenter/references/examples/openapi-example.yaml +10 -0
- package/skills/api-documenter/references/openapi-template.yaml +5 -0
- package/skills/api-documenter/scripts/generate_openapi.py +84 -0
- package/skills/api-documenter/scripts/validate_openapi.py +45 -0
- package/skills/architecting-solutions/README.md +22 -0
- package/skills/architecting-solutions/SKILL.md +459 -0
- package/skills/auto-trigger/README.md +23 -0
- package/skills/auto-trigger/SKILL.md +183 -0
- package/skills/code-reviewer/README.md +59 -0
- package/skills/code-reviewer/SKILL.md +220 -0
- package/skills/code-reviewer/references/checklist.md +80 -0
- package/skills/code-reviewer/references/patterns.md +226 -0
- package/skills/code-reviewer/references/security.md +88 -0
- package/skills/code-reviewer/scripts/review_checklist.py +191 -0
- package/skills/commit-helper/README.md +58 -0
- package/skills/commit-helper/SKILL.md +159 -0
- package/skills/commit-helper/references/conventional-commits.md +68 -0
- package/skills/commit-helper/references/examples.md +125 -0
- package/skills/commit-helper/references/scopes.md +49 -0
- package/skills/commit-helper/scripts/validate_commit.py +70 -0
- package/skills/create-pr/README.md +182 -0
- package/skills/create-pr/SKILL.md +340 -0
- package/skills/debugger/README.md +53 -0
- package/skills/debugger/SKILL.md +239 -0
- package/skills/debugger/references/checklist.md +7 -0
- package/skills/debugger/references/errors.md +6 -0
- package/skills/debugger/references/patterns.md +5 -0
- package/skills/debugger/scripts/debug_report.py +77 -0
- package/skills/deployment-engineer/README.md +40 -0
- package/skills/deployment-engineer/SKILL.md +242 -0
- package/skills/deployment-engineer/references/kubernetes.md +23 -0
- package/skills/deployment-engineer/references/monitoring.md +14 -0
- package/skills/deployment-engineer/references/pipelines.md +12 -0
- package/skills/deployment-engineer/scripts/generate_deploy.py +72 -0
- package/skills/deployment-engineer/scripts/validate_deploy.py +46 -0
- package/skills/documentation-engineer/README.md +41 -0
- package/skills/documentation-engineer/SKILL.md +164 -0
- package/skills/documentation-engineer/references/api-template.md +22 -0
- package/skills/documentation-engineer/references/readme-template.md +25 -0
- package/skills/documentation-engineer/references/style-guide.md +13 -0
- package/skills/documentation-engineer/scripts/generate_docs.py +68 -0
- package/skills/documentation-engineer/scripts/validate_docs.py +46 -0
- package/skills/figma-designer/README.md +222 -0
- package/skills/figma-designer/SKILL.md +407 -0
- package/skills/figma-designer/references/example-output.md +86 -0
- package/skills/performance-engineer/README.md +42 -0
- package/skills/performance-engineer/SKILL.md +236 -0
- package/skills/performance-engineer/references/checklist.md +6 -0
- package/skills/performance-engineer/references/monitoring.md +5 -0
- package/skills/performance-engineer/references/optimization.md +7 -0
- package/skills/performance-engineer/scripts/perf_report.py +64 -0
- package/skills/performance-engineer/scripts/profile.py +63 -0
- package/skills/planning-with-files/README.md +27 -0
- package/skills/planning-with-files/SKILL.md +103 -0
- package/skills/prd-implementation-precheck/README.md +97 -0
- package/skills/prd-implementation-precheck/SKILL.md +112 -0
- package/skills/prd-planner/README.md +102 -0
- package/skills/prd-planner/SKILL.md +449 -0
- package/skills/prd-planner/references/edge-case-analysis.md +111 -0
- package/skills/qa-expert/README.md +37 -0
- package/skills/qa-expert/SKILL.md +225 -0
- package/skills/qa-expert/references/gates.md +11 -0
- package/skills/qa-expert/references/metrics.md +6 -0
- package/skills/qa-expert/references/strategy.md +11 -0
- package/skills/qa-expert/scripts/coverage_analysis.py +61 -0
- package/skills/qa-expert/scripts/generate_test_plan.py +68 -0
- package/skills/refactoring-specialist/README.md +37 -0
- package/skills/refactoring-specialist/SKILL.md +283 -0
- package/skills/refactoring-specialist/references/checklist.md +6 -0
- package/skills/refactoring-specialist/references/smells.md +6 -0
- package/skills/refactoring-specialist/references/techniques.md +6 -0
- package/skills/security-auditor/README.md +48 -0
- package/skills/security-auditor/SKILL.md +256 -0
- package/skills/security-auditor/references/checklist.md +7 -0
- package/skills/security-auditor/references/owasp.md +12 -0
- package/skills/security-auditor/references/remediation.md +7 -0
- package/skills/security-auditor/scripts/find_secrets.py +58 -0
- package/skills/security-auditor/scripts/security_audit.py +64 -0
- package/skills/self-improving-agent/README.md +136 -0
- package/skills/self-improving-agent/SKILL.md +407 -0
- package/skills/self-improving-agent/hooks/post-bash.sh +10 -0
- package/skills/self-improving-agent/hooks/pre-tool.sh +10 -0
- package/skills/self-improving-agent/hooks/session-end.sh +4 -0
- package/skills/self-improving-agent/memory/semantic-patterns.json +288 -0
- package/skills/self-improving-agent/references/appendix.md +131 -0
- package/skills/self-improving-agent/templates/correction-template.md +11 -0
- package/skills/self-improving-agent/templates/pattern-template.md +15 -0
- package/skills/self-improving-agent/templates/validation-template.md +14 -0
- package/skills/session-logger/README.md +50 -0
- package/skills/session-logger/SKILL.md +156 -0
- package/skills/skill-router/README.md +155 -0
- package/skills/skill-router/SKILL.md +215 -0
- package/skills/test-automator/README.md +41 -0
- package/skills/test-automator/SKILL.md +202 -0
- package/skills/test-automator/references/best-practices.md +6 -0
- package/skills/test-automator/references/examples/README.md +3 -0
- package/skills/test-automator/references/examples/unit-test-example.md +8 -0
- package/skills/test-automator/references/mocking.md +5 -0
- package/skills/test-automator/scripts/coverage_report.py +59 -0
- package/skills/test-automator/scripts/generate_test.py +66 -0
- package/skills/workflow-orchestrator/README.md +20 -0
- package/skills/workflow-orchestrator/SKILL.md +342 -0
- package/src/cli.js +25 -10
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# Template generator for debug report.
|
|
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 debug report.")
|
|
20
|
+
parser.add_argument("--output", default="debug-report.md", help="Output file path")
|
|
21
|
+
parser.add_argument("--name", default="example", help="Issue summary")
|
|
22
|
+
parser.add_argument("--owner", default="team", help="Owning team")
|
|
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
|
+
# Debug Report
|
|
29
|
+
|
|
30
|
+
## Summary
|
|
31
|
+
{args.name}
|
|
32
|
+
|
|
33
|
+
## Ownership
|
|
34
|
+
- Owner: {args.owner}
|
|
35
|
+
- On-call: TBD
|
|
36
|
+
|
|
37
|
+
## Environment
|
|
38
|
+
- Service version:
|
|
39
|
+
- Region:
|
|
40
|
+
- Traffic level:
|
|
41
|
+
|
|
42
|
+
## Steps to Reproduce
|
|
43
|
+
1. Step one
|
|
44
|
+
2. Step two
|
|
45
|
+
|
|
46
|
+
## Expected vs Actual
|
|
47
|
+
- Expected:
|
|
48
|
+
- Actual:
|
|
49
|
+
|
|
50
|
+
## Logs and Evidence
|
|
51
|
+
- Attach logs, screenshots, traces
|
|
52
|
+
|
|
53
|
+
## Root Cause
|
|
54
|
+
TBD
|
|
55
|
+
|
|
56
|
+
## Fix
|
|
57
|
+
- Code changes
|
|
58
|
+
- Configuration changes
|
|
59
|
+
|
|
60
|
+
## Regression Tests
|
|
61
|
+
- Add or update tests
|
|
62
|
+
|
|
63
|
+
## Follow-ups
|
|
64
|
+
- Monitoring improvements
|
|
65
|
+
- Runbook updates
|
|
66
|
+
"""
|
|
67
|
+
).strip() + "\n"
|
|
68
|
+
|
|
69
|
+
output = Path(args.output)
|
|
70
|
+
if not write_output(output, content, args.force):
|
|
71
|
+
return 1
|
|
72
|
+
print(f"Wrote {output}")
|
|
73
|
+
return 0
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
if __name__ == "__main__":
|
|
77
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Deployment Engineer
|
|
2
|
+
|
|
3
|
+
> A Claude Code skill for CI/CD pipelines and deployment automation.
|
|
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: Set up CI/CD
|
|
13
|
+
You: Create deployment pipeline
|
|
14
|
+
You: Configure GitHub Actions
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Deployment Strategies
|
|
18
|
+
|
|
19
|
+
| Strategy | Description |
|
|
20
|
+
|----------|-------------|
|
|
21
|
+
| **Blue-Green** | Zero downtime, instant rollback |
|
|
22
|
+
| **Rolling** | Gradual replacement |
|
|
23
|
+
| **Canary** | Test with small traffic first |
|
|
24
|
+
|
|
25
|
+
## Scripts
|
|
26
|
+
|
|
27
|
+
Generate deployment config:
|
|
28
|
+
```bash
|
|
29
|
+
python scripts/generate_deploy.py <environment>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Validate deployment:
|
|
33
|
+
```bash
|
|
34
|
+
python scripts/validate_deploy.py
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Resources
|
|
38
|
+
|
|
39
|
+
- [GitHub Actions Docs](https://docs.github.com/en/actions)
|
|
40
|
+
- [CI/CD Best Practices](https://www.atlassian.com/continuous-delivery/principles/continuous-integration-vs-delivery-vs-deployment)
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deployment-engineer
|
|
3
|
+
description: Deployment automation specialist for CI/CD pipelines and infrastructure. Use when setting up deployment, configuring CI/CD, or managing releases.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Bash, Grep, Glob
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Deployment Engineer
|
|
8
|
+
|
|
9
|
+
Specialist in deployment automation, CI/CD pipelines, and infrastructure management.
|
|
10
|
+
|
|
11
|
+
## When This Skill Activates
|
|
12
|
+
|
|
13
|
+
Activates when you:
|
|
14
|
+
- Set up deployment pipeline
|
|
15
|
+
- Configure CI/CD
|
|
16
|
+
- Manage releases
|
|
17
|
+
- Automate infrastructure
|
|
18
|
+
|
|
19
|
+
## CI/CD Pipeline
|
|
20
|
+
|
|
21
|
+
### Pipeline Stages
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
stages:
|
|
25
|
+
- lint
|
|
26
|
+
- test
|
|
27
|
+
- build
|
|
28
|
+
- security
|
|
29
|
+
- deploy-dev
|
|
30
|
+
- deploy-staging
|
|
31
|
+
- deploy-production
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### GitHub Actions Example
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
name: CI/CD
|
|
38
|
+
|
|
39
|
+
on:
|
|
40
|
+
push:
|
|
41
|
+
branches: [main, develop]
|
|
42
|
+
pull_request:
|
|
43
|
+
branches: [main]
|
|
44
|
+
|
|
45
|
+
jobs:
|
|
46
|
+
lint:
|
|
47
|
+
runs-on: ubuntu-latest
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/checkout@v4
|
|
50
|
+
- uses: actions/setup-node@v4
|
|
51
|
+
with:
|
|
52
|
+
node-version: '20'
|
|
53
|
+
- run: npm ci
|
|
54
|
+
- run: npm run lint
|
|
55
|
+
|
|
56
|
+
test:
|
|
57
|
+
runs-on: ubuntu-latest
|
|
58
|
+
needs: lint
|
|
59
|
+
steps:
|
|
60
|
+
- uses: actions/checkout@v4
|
|
61
|
+
- uses: actions/setup-node@v4
|
|
62
|
+
- run: npm ci
|
|
63
|
+
- run: npm test
|
|
64
|
+
|
|
65
|
+
build:
|
|
66
|
+
runs-on: ubuntu-latest
|
|
67
|
+
needs: test
|
|
68
|
+
steps:
|
|
69
|
+
- uses: actions/checkout@v4
|
|
70
|
+
- uses: actions/setup-node@v4
|
|
71
|
+
- run: npm ci
|
|
72
|
+
- run: npm run build
|
|
73
|
+
- uses: actions/upload-artifact@v4
|
|
74
|
+
with:
|
|
75
|
+
name: build
|
|
76
|
+
path: dist/
|
|
77
|
+
|
|
78
|
+
deploy-production:
|
|
79
|
+
runs-on: ubuntu-latest
|
|
80
|
+
needs: build
|
|
81
|
+
if: github.ref == 'refs/heads/main'
|
|
82
|
+
environment: production
|
|
83
|
+
steps:
|
|
84
|
+
- uses: actions/checkout@v4
|
|
85
|
+
- uses: actions/download-artifact@v4
|
|
86
|
+
with:
|
|
87
|
+
name: build
|
|
88
|
+
path: dist/
|
|
89
|
+
- run: npm run deploy
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Deployment Strategies
|
|
93
|
+
|
|
94
|
+
### 1. Blue-Green Deployment
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
┌─────────┐
|
|
98
|
+
│ Load │
|
|
99
|
+
│ Balancer│
|
|
100
|
+
└────┬────┘
|
|
101
|
+
│
|
|
102
|
+
┌────────┴────────┐
|
|
103
|
+
│ Switch │
|
|
104
|
+
├────────┬────────┤
|
|
105
|
+
▼ ▼ ▼
|
|
106
|
+
┌─────┐ ┌─────┐ ┌─────┐
|
|
107
|
+
│Blue │ │Green│ │ │
|
|
108
|
+
└─────┘ └─────┘ └─────┘
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 2. Rolling Deployment
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
┌─────────────────────────────────────┐
|
|
115
|
+
│ v1 v1 v1 v1 v1 v1 v1 v1 v1 │ → Old
|
|
116
|
+
│ v2 v2 v2 v2 v2 v2 v2 v2 v2 │ → New
|
|
117
|
+
└─────────────────────────────────────┘
|
|
118
|
+
▲ ▲
|
|
119
|
+
│ │
|
|
120
|
+
Start End
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 3. Canary Deployment
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
┌──────────────────────────────────────┐
|
|
127
|
+
│ v1 v1 v1 v1 v1 v1 v1 v1 v1 v1 │ → Old
|
|
128
|
+
│ v2 v2 v2 v2 │ → Canary (5%)
|
|
129
|
+
└──────────────────────────────────────┘
|
|
130
|
+
|
|
131
|
+
Monitor metrics, then:
|
|
132
|
+
│ v1 v1 v1 v1 │ → Old (50%)
|
|
133
|
+
│ v2 v2 v2 v2 v2 v2 v2 v2 v2 v2 │ → New (50%)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Environment Configuration
|
|
137
|
+
|
|
138
|
+
### Environment Variables
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Production
|
|
142
|
+
NODE_ENV=production
|
|
143
|
+
DATABASE_URL=postgresql://...
|
|
144
|
+
API_KEY=sk-...
|
|
145
|
+
SENTRY_DSN=https://example.com/123
|
|
146
|
+
|
|
147
|
+
# Development
|
|
148
|
+
NODE_ENV=development
|
|
149
|
+
DATABASE_URL=postgresql://localhost:5432/dev
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Configuration Management
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
// config/production.ts
|
|
156
|
+
export default {
|
|
157
|
+
database: {
|
|
158
|
+
url: process.env.DATABASE_URL,
|
|
159
|
+
poolSize: 20,
|
|
160
|
+
},
|
|
161
|
+
redis: {
|
|
162
|
+
url: process.env.REDIS_URL,
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Health Checks
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
// GET /health
|
|
171
|
+
app.get('/health', (req, res) => {
|
|
172
|
+
const health = {
|
|
173
|
+
status: 'ok',
|
|
174
|
+
timestamp: new Date().toISOString(),
|
|
175
|
+
checks: {
|
|
176
|
+
database: 'ok',
|
|
177
|
+
redis: 'ok',
|
|
178
|
+
external_api: 'ok',
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
if (Object.values(health.checks).some(v => v !== 'ok')) {
|
|
183
|
+
health.status = 'degraded';
|
|
184
|
+
return res.status(503).json(health);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
res.json(health);
|
|
188
|
+
});
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Rollback Strategy
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
# Kubernetes
|
|
195
|
+
kubectl rollout undo deployment/app
|
|
196
|
+
|
|
197
|
+
# Docker
|
|
198
|
+
docker-compose down
|
|
199
|
+
docker-compose up -d --scale app=<previous-version>
|
|
200
|
+
|
|
201
|
+
# Git
|
|
202
|
+
git revert HEAD
|
|
203
|
+
git push
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Monitoring & Logging
|
|
207
|
+
|
|
208
|
+
### Metrics to Track
|
|
209
|
+
|
|
210
|
+
- Deployment frequency
|
|
211
|
+
- Lead time for changes
|
|
212
|
+
- Mean time to recovery (MTTR)
|
|
213
|
+
- Change failure rate
|
|
214
|
+
|
|
215
|
+
### Logging
|
|
216
|
+
|
|
217
|
+
```typescript
|
|
218
|
+
// Structured logging
|
|
219
|
+
logger.info('Deployment started', {
|
|
220
|
+
version: process.env.VERSION,
|
|
221
|
+
environment: process.env.NODE_ENV,
|
|
222
|
+
timestamp: new Date().toISOString(),
|
|
223
|
+
});
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Scripts
|
|
227
|
+
|
|
228
|
+
Generate deployment config:
|
|
229
|
+
```bash
|
|
230
|
+
python scripts/generate_deploy.py <environment>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Validate deployment:
|
|
234
|
+
```bash
|
|
235
|
+
python scripts/validate_deploy.py
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## References
|
|
239
|
+
|
|
240
|
+
- `references/pipelines.md` - CI/CD pipeline examples
|
|
241
|
+
- `references/kubernetes.md` - K8s deployment configs
|
|
242
|
+
- `references/monitoring.md` - Monitoring setup
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Kubernetes Deployment Skeleton
|
|
2
|
+
|
|
3
|
+
```yaml
|
|
4
|
+
apiVersion: apps/v1
|
|
5
|
+
kind: Deployment
|
|
6
|
+
metadata:
|
|
7
|
+
name: app
|
|
8
|
+
spec:
|
|
9
|
+
replicas: 2
|
|
10
|
+
selector:
|
|
11
|
+
matchLabels:
|
|
12
|
+
app: app
|
|
13
|
+
template:
|
|
14
|
+
metadata:
|
|
15
|
+
labels:
|
|
16
|
+
app: app
|
|
17
|
+
spec:
|
|
18
|
+
containers:
|
|
19
|
+
- name: app
|
|
20
|
+
image: example/app:latest
|
|
21
|
+
ports:
|
|
22
|
+
- containerPort: 8080
|
|
23
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Monitoring Checklist
|
|
2
|
+
|
|
3
|
+
## Metrics
|
|
4
|
+
- Request rate
|
|
5
|
+
- Error rate
|
|
6
|
+
- Latency (p50/p95/p99)
|
|
7
|
+
|
|
8
|
+
## Logs
|
|
9
|
+
- Structured logs with request IDs
|
|
10
|
+
- Include error context and stack traces
|
|
11
|
+
|
|
12
|
+
## Alerts
|
|
13
|
+
- Define SLO-based alerts
|
|
14
|
+
- Avoid noisy, low-signal alerts
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# Template generator for deployment plan.
|
|
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 deployment plan.")
|
|
20
|
+
parser.add_argument("--output", default="deploy-plan.md", help="Output file path")
|
|
21
|
+
parser.add_argument("--name", default="example", help="Service or app name")
|
|
22
|
+
parser.add_argument("--env", default="production", help="Target environment")
|
|
23
|
+
parser.add_argument("--owner", default="team", help="Owning team")
|
|
24
|
+
parser.add_argument("--force", action="store_true", help="Overwrite existing file")
|
|
25
|
+
args = parser.parse_args()
|
|
26
|
+
|
|
27
|
+
content = textwrap.dedent(
|
|
28
|
+
f"""\
|
|
29
|
+
# Deployment Plan
|
|
30
|
+
|
|
31
|
+
## Overview
|
|
32
|
+
- Service: {args.name}
|
|
33
|
+
- Environment: {args.env}
|
|
34
|
+
- Owner: {args.owner}
|
|
35
|
+
|
|
36
|
+
## Preconditions
|
|
37
|
+
- Release approved
|
|
38
|
+
- Change window confirmed
|
|
39
|
+
- Backups verified
|
|
40
|
+
|
|
41
|
+
## Steps
|
|
42
|
+
1. Build and publish artifacts
|
|
43
|
+
2. Deploy to staging and run smoke tests
|
|
44
|
+
3. Run migrations (if needed)
|
|
45
|
+
4. Deploy to {args.env}
|
|
46
|
+
5. Verify health checks and dashboards
|
|
47
|
+
|
|
48
|
+
## Verification
|
|
49
|
+
- Health endpoint returns 200
|
|
50
|
+
- Key metrics within baseline
|
|
51
|
+
- Error budget stable
|
|
52
|
+
|
|
53
|
+
## Rollback
|
|
54
|
+
- Revert to last known good release
|
|
55
|
+
- Disable feature flags
|
|
56
|
+
- Communicate rollback status
|
|
57
|
+
|
|
58
|
+
## Observability
|
|
59
|
+
- Dashboard links
|
|
60
|
+
- Alert channels
|
|
61
|
+
"""
|
|
62
|
+
).strip() + "\n"
|
|
63
|
+
|
|
64
|
+
output = Path(args.output)
|
|
65
|
+
if not write_output(output, content, args.force):
|
|
66
|
+
return 1
|
|
67
|
+
print(f"Wrote {output}")
|
|
68
|
+
return 0
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
if __name__ == "__main__":
|
|
72
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# Template validator for deployment plan.
|
|
3
|
+
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
import argparse
|
|
6
|
+
|
|
7
|
+
DEFAULT_REQUIRED = [
|
|
8
|
+
"## Overview",
|
|
9
|
+
"## Preconditions",
|
|
10
|
+
"## Steps",
|
|
11
|
+
"## Verification",
|
|
12
|
+
"## Rollback",
|
|
13
|
+
"## Observability",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def main() -> int:
|
|
18
|
+
parser = argparse.ArgumentParser(description="Validate a generated artifact.")
|
|
19
|
+
parser.add_argument("--input", default="deploy-plan.md", help="Input file path")
|
|
20
|
+
parser.add_argument(
|
|
21
|
+
"--require",
|
|
22
|
+
action="append",
|
|
23
|
+
default=[],
|
|
24
|
+
help="Additional required section heading",
|
|
25
|
+
)
|
|
26
|
+
args = parser.parse_args()
|
|
27
|
+
|
|
28
|
+
path = Path(args.input)
|
|
29
|
+
if not path.exists():
|
|
30
|
+
print(f"Missing file: {path}")
|
|
31
|
+
return 1
|
|
32
|
+
|
|
33
|
+
text = path.read_text(encoding="utf-8", errors="ignore")
|
|
34
|
+
text_lower = text.lower()
|
|
35
|
+
required = DEFAULT_REQUIRED + args.require
|
|
36
|
+
missing = [section for section in required if section.lower() not in text_lower]
|
|
37
|
+
if missing:
|
|
38
|
+
print("Missing required sections: " + ", ".join(missing))
|
|
39
|
+
return 1
|
|
40
|
+
|
|
41
|
+
print(f"Validated {path}")
|
|
42
|
+
return 0
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
if __name__ == "__main__":
|
|
46
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Documentation Engineer
|
|
2
|
+
|
|
3
|
+
> A Claude Code skill for creating clear, comprehensive 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: Write documentation for this API
|
|
13
|
+
You: Create a README
|
|
14
|
+
You: Document this code
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Documentation Types
|
|
18
|
+
|
|
19
|
+
| Type | Description |
|
|
20
|
+
|------|-------------|
|
|
21
|
+
| **README** | Project overview and quick start |
|
|
22
|
+
| **API Docs** | Endpoint/function documentation |
|
|
23
|
+
| **Code Comments** | Inline explanations |
|
|
24
|
+
| **Architecture** | System design documentation |
|
|
25
|
+
|
|
26
|
+
## Scripts
|
|
27
|
+
|
|
28
|
+
Generate documentation structure:
|
|
29
|
+
```bash
|
|
30
|
+
python scripts/generate_docs.py
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Validate documentation:
|
|
34
|
+
```bash
|
|
35
|
+
python scripts/validate_docs.py
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Resources
|
|
39
|
+
|
|
40
|
+
- [Google Developer Documentation Style Guide](https://developers.google.com/tech-writing/one)
|
|
41
|
+
- [Diátaxis Framework](https://diataxis.fr/)
|