bros-harness 0.1.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/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/README.md +183 -0
- package/SECURITY.md +16 -0
- package/assets/agents.manifest.json +55 -0
- package/assets/commands.manifest.json +35 -0
- package/assets/docs.manifest.json +20 -0
- package/assets/import-report.md +25 -0
- package/assets/manifest.json +799 -0
- package/assets/opencode/agents/README.md +3 -0
- package/assets/opencode/agents/bro-build.md +256 -0
- package/assets/opencode/agents/bro-design.md +77 -0
- package/assets/opencode/agents/bro-docs.md +72 -0
- package/assets/opencode/agents/bro-explore.md +143 -0
- package/assets/opencode/agents/bro-ops.md +195 -0
- package/assets/opencode/agents/bro-shield.md +77 -0
- package/assets/opencode/agents/bro-test.md +204 -0
- package/assets/opencode/agents/bro-ui.md +135 -0
- package/assets/opencode/agents/mighty-bro.md +252 -0
- package/assets/opencode/commands/README.md +3 -0
- package/assets/opencode/commands/bros-assemble.md +32 -0
- package/assets/opencode/commands/bros-build.md +58 -0
- package/assets/opencode/commands/bros-plan.md +83 -0
- package/assets/opencode/commands/bros-review.md +38 -0
- package/assets/opencode/commands/bros-status.md +26 -0
- package/assets/opencode/docs/README.md +3 -0
- package/assets/opencode/docs/bros-builtin-skills.md +63 -0
- package/assets/opencode/docs/bros-harness.md +194 -0
- package/assets/opencode/skills/README.md +3 -0
- package/assets/opencode/skills/agent-architecture-audit/SKILL.md +256 -0
- package/assets/opencode/skills/agent-harness-construction/.openskills.json +7 -0
- package/assets/opencode/skills/agent-harness-construction/SKILL.md +73 -0
- package/assets/opencode/skills/agent-introspection-debugging/.openskills.json +7 -0
- package/assets/opencode/skills/agent-introspection-debugging/SKILL.md +153 -0
- package/assets/opencode/skills/api-design/.openskills.json +7 -0
- package/assets/opencode/skills/api-design/agents/openai.yaml +7 -0
- package/assets/opencode/skills/architecture-decision-records/.openskills.json +7 -0
- package/assets/opencode/skills/architecture-decision-records/SKILL.md +179 -0
- package/assets/opencode/skills/article-writing/.openskills.json +7 -0
- package/assets/opencode/skills/article-writing/SKILL.md +79 -0
- package/assets/opencode/skills/article-writing/agents/openai.yaml +7 -0
- package/assets/opencode/skills/automation-audit-ops/.openskills.json +7 -0
- package/assets/opencode/skills/automation-audit-ops/SKILL.md +142 -0
- package/assets/opencode/skills/backend-patterns/.openskills.json +7 -0
- package/assets/opencode/skills/backend-patterns/SKILL.md +561 -0
- package/assets/opencode/skills/backend-patterns/agents/openai.yaml +7 -0
- package/assets/opencode/skills/benchmark/.openskills.json +7 -0
- package/assets/opencode/skills/benchmark/SKILL.md +93 -0
- package/assets/opencode/skills/bros-orchestrate/SKILL.md +455 -0
- package/assets/opencode/skills/browser-qa/.openskills.json +7 -0
- package/assets/opencode/skills/browser-qa/SKILL.md +87 -0
- package/assets/opencode/skills/canary-watch/.openskills.json +7 -0
- package/assets/opencode/skills/canary-watch/SKILL.md +107 -0
- package/assets/opencode/skills/code-review-expert/SKILL.md +155 -0
- package/assets/opencode/skills/code-review-expert/agents/agent.yaml +7 -0
- package/assets/opencode/skills/code-review-expert/references/code-quality-checklist.md +130 -0
- package/assets/opencode/skills/code-review-expert/references/removal-plan.md +52 -0
- package/assets/opencode/skills/code-review-expert/references/security-checklist.md +118 -0
- package/assets/opencode/skills/code-review-expert/references/solid-checklist.md +65 -0
- package/assets/opencode/skills/code-tour/.openskills.json +7 -0
- package/assets/opencode/skills/code-tour/SKILL.md +236 -0
- package/assets/opencode/skills/coding-standards/.openskills.json +7 -0
- package/assets/opencode/skills/coding-standards/SKILL.md +549 -0
- package/assets/opencode/skills/coding-standards/agents/openai.yaml +7 -0
- package/assets/opencode/skills/context-budget/.openskills.json +7 -0
- package/assets/opencode/skills/context-budget/SKILL.md +135 -0
- package/assets/opencode/skills/database-migrations/.openskills.json +7 -0
- package/assets/opencode/skills/database-migrations/SKILL.md +429 -0
- package/assets/opencode/skills/deployment-patterns/.openskills.json +7 -0
- package/assets/opencode/skills/deployment-patterns/SKILL.md +427 -0
- package/assets/opencode/skills/design-system/.openskills.json +7 -0
- package/assets/opencode/skills/design-system/SKILL.md +82 -0
- package/assets/opencode/skills/docker-patterns/.openskills.json +7 -0
- package/assets/opencode/skills/docker-patterns/SKILL.md +364 -0
- package/assets/opencode/skills/documentation-lookup/.openskills.json +7 -0
- package/assets/opencode/skills/documentation-lookup/SKILL.md +90 -0
- package/assets/opencode/skills/documentation-lookup/agents/openai.yaml +7 -0
- package/assets/opencode/skills/e2e-testing/.openskills.json +7 -0
- package/assets/opencode/skills/e2e-testing/SKILL.md +326 -0
- package/assets/opencode/skills/e2e-testing/agents/openai.yaml +7 -0
- package/assets/opencode/skills/error-handling/SKILL.md +376 -0
- package/assets/opencode/skills/frontend-design/.openskills.json +7 -0
- package/assets/opencode/skills/frontend-design/SKILL.md +145 -0
- package/assets/opencode/skills/frontend-design-direction/SKILL.md +92 -0
- package/assets/opencode/skills/frontend-patterns/.openskills.json +7 -0
- package/assets/opencode/skills/frontend-patterns/SKILL.md +642 -0
- package/assets/opencode/skills/frontend-patterns/agents/openai.yaml +7 -0
- package/assets/opencode/skills/gateguard/.openskills.json +7 -0
- package/assets/opencode/skills/gateguard/SKILL.md +125 -0
- package/assets/opencode/skills/git-master/SKILL.md +60 -0
- package/assets/opencode/skills/golang-patterns/.openskills.json +7 -0
- package/assets/opencode/skills/golang-patterns/SKILL.md +674 -0
- package/assets/opencode/skills/golang-testing/.openskills.json +7 -0
- package/assets/opencode/skills/golang-testing/SKILL.md +720 -0
- package/assets/opencode/skills/grafana-dashboard-design/SKILL.md +65 -0
- package/assets/opencode/skills/hexagonal-architecture/.openskills.json +7 -0
- package/assets/opencode/skills/hexagonal-architecture/SKILL.md +276 -0
- package/assets/opencode/skills/java-coding-standards/.openskills.json +7 -0
- package/assets/opencode/skills/java-coding-standards/SKILL.md +383 -0
- package/assets/opencode/skills/jpa-patterns/.openskills.json +7 -0
- package/assets/opencode/skills/jpa-patterns/SKILL.md +151 -0
- package/assets/opencode/skills/knowledge-ops/.openskills.json +7 -0
- package/assets/opencode/skills/knowledge-ops/SKILL.md +154 -0
- package/assets/opencode/skills/make-interfaces-feel-better/SKILL.md +151 -0
- package/assets/opencode/skills/mysql-patterns/SKILL.md +412 -0
- package/assets/opencode/skills/nestjs-patterns/.openskills.json +7 -0
- package/assets/opencode/skills/nestjs-patterns/SKILL.md +230 -0
- package/assets/opencode/skills/nextjs-turbopack/.openskills.json +7 -0
- package/assets/opencode/skills/nextjs-turbopack/SKILL.md +57 -0
- package/assets/opencode/skills/nextjs-turbopack/agents/openai.yaml +7 -0
- package/assets/opencode/skills/parallel-execution-optimizer/SKILL.md +72 -0
- package/assets/opencode/skills/postgres-patterns/.openskills.json +7 -0
- package/assets/opencode/skills/postgres-patterns/SKILL.md +147 -0
- package/assets/opencode/skills/prisma-patterns/SKILL.md +371 -0
- package/assets/opencode/skills/product-capability/.openskills.json +7 -0
- package/assets/opencode/skills/product-capability/SKILL.md +141 -0
- package/assets/opencode/skills/product-lens/.openskills.json +7 -0
- package/assets/opencode/skills/product-lens/SKILL.md +92 -0
- package/assets/opencode/skills/production-audit/SKILL.md +206 -0
- package/assets/opencode/skills/python-patterns/.openskills.json +7 -0
- package/assets/opencode/skills/python-patterns/SKILL.md +750 -0
- package/assets/opencode/skills/python-testing/.openskills.json +7 -0
- package/assets/opencode/skills/python-testing/SKILL.md +816 -0
- package/assets/opencode/skills/redis-patterns/SKILL.md +403 -0
- package/assets/opencode/skills/requirements-clarity/README.md +260 -0
- package/assets/opencode/skills/requirements-clarity/SKILL.md +324 -0
- package/assets/opencode/skills/rust-patterns/.openskills.json +7 -0
- package/assets/opencode/skills/rust-patterns/SKILL.md +499 -0
- package/assets/opencode/skills/rust-testing/.openskills.json +7 -0
- package/assets/opencode/skills/rust-testing/SKILL.md +500 -0
- package/assets/opencode/skills/safety-guard/.openskills.json +7 -0
- package/assets/opencode/skills/safety-guard/SKILL.md +75 -0
- package/assets/opencode/skills/search-first/.openskills.json +7 -0
- package/assets/opencode/skills/search-first/SKILL.md +181 -0
- package/assets/opencode/skills/security-review/.openskills.json +7 -0
- package/assets/opencode/skills/security-review/agents/openai.yaml +7 -0
- package/assets/opencode/skills/security-review/cloud-infrastructure-security.md +361 -0
- package/assets/opencode/skills/security-scan/.openskills.json +7 -0
- package/assets/opencode/skills/security-scan/SKILL.md +165 -0
- package/assets/opencode/skills/springboot-patterns/.openskills.json +7 -0
- package/assets/opencode/skills/springboot-patterns/SKILL.md +314 -0
- package/assets/opencode/skills/springboot-tdd/.openskills.json +7 -0
- package/assets/opencode/skills/springboot-tdd/SKILL.md +158 -0
- package/assets/opencode/skills/springboot-verification/.openskills.json +7 -0
- package/assets/opencode/skills/springboot-verification/SKILL.md +231 -0
- package/assets/opencode/skills/strategic-compact/.openskills.json +7 -0
- package/assets/opencode/skills/strategic-compact/SKILL.md +131 -0
- package/assets/opencode/skills/strategic-compact/agents/openai.yaml +7 -0
- package/assets/opencode/skills/strategic-compact/suggest-compact.sh +54 -0
- package/assets/opencode/skills/tdd-workflow/.openskills.json +7 -0
- package/assets/opencode/skills/tdd-workflow/SKILL.md +463 -0
- package/assets/opencode/skills/tdd-workflow/agents/openai.yaml +7 -0
- package/assets/opencode/skills/verification-loop/.openskills.json +7 -0
- package/assets/opencode/skills/verification-loop/SKILL.md +126 -0
- package/assets/opencode/skills/verification-loop/agents/openai.yaml +7 -0
- package/assets/opencode/skills/vite-patterns/SKILL.md +449 -0
- package/assets/opencode/skills/web-doc-search/SKILL.md +51 -0
- package/assets/opencode/templates/README.md +3 -0
- package/assets/opencode/templates/bros/adr.md +39 -0
- package/assets/opencode/templates/bros/delivery-report.md +71 -0
- package/assets/opencode/templates/bros/explorer-evidence-packet.md +51 -0
- package/assets/opencode/templates/bros/prd.md +72 -0
- package/assets/opencode/templates/bros/security-review.md +48 -0
- package/assets/opencode/templates/bros/status-board.md +33 -0
- package/assets/opencode/templates/bros/task-packet.md +94 -0
- package/assets/opencode/templates/bros/test-strategy.md +57 -0
- package/assets/opencode/templates/bros/ui-implementation-packet.md +64 -0
- package/assets/skills.manifest.json +650 -0
- package/assets/templates.manifest.json +55 -0
- package/bin/bros.mjs +122 -0
- package/docs/compatibility.md +9 -0
- package/docs/installation.md +66 -0
- package/docs/integrations/claude.md +5 -0
- package/docs/integrations/codex.md +5 -0
- package/docs/integrations/opencode.md +39 -0
- package/docs/migration/from-local-opencode-config.md +10 -0
- package/docs/release-process.md +11 -0
- package/docs/repository-structure.md +15 -0
- package/docs/roadmap.md +20 -0
- package/docs/security.md +18 -0
- package/docs/testing.md +9 -0
- package/examples/opencode/README.md +11 -0
- package/examples/opencode/opencode.example.jsonc +4 -0
- package/package.json +43 -0
- package/scripts/validate-assets.mjs +22 -0
- package/scripts/verify-no-secrets.mjs +38 -0
- package/src/plugin.mjs +98 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: search-first
|
|
3
|
+
description: Research-before-coding workflow. Search for existing tools, libraries, and patterns before writing custom code. Invokes the bro-explore agent.
|
|
4
|
+
origin: ECC
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /search-first — Research Before You Code
|
|
8
|
+
|
|
9
|
+
Systematizes the "search for existing solutions before implementing" workflow.
|
|
10
|
+
|
|
11
|
+
## Trigger
|
|
12
|
+
|
|
13
|
+
Use this skill when:
|
|
14
|
+
- Starting a new feature that likely has existing solutions
|
|
15
|
+
- Adding a dependency or integration
|
|
16
|
+
- The user asks "add X functionality" and you're about to write code
|
|
17
|
+
- Before creating a new utility, helper, or abstraction
|
|
18
|
+
|
|
19
|
+
## Workflow
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
┌─────────────────────────────────────────────┐
|
|
23
|
+
│ 0. TOOL AVAILABILITY PREFLIGHT │
|
|
24
|
+
│ Check search channels before relying on │
|
|
25
|
+
│ them; report skipped channels honestly │
|
|
26
|
+
├─────────────────────────────────────────────┤
|
|
27
|
+
│ 1. NEED ANALYSIS │
|
|
28
|
+
│ Define what functionality is needed │
|
|
29
|
+
│ Identify language/framework constraints │
|
|
30
|
+
├─────────────────────────────────────────────┤
|
|
31
|
+
│ 2. PARALLEL SEARCH (bro-explore agent) │
|
|
32
|
+
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
|
|
33
|
+
│ │ npm / │ │ MCP / │ │ GitHub / │ │
|
|
34
|
+
│ │ PyPI │ │ Skills │ │ Web │ │
|
|
35
|
+
│ └──────────┘ └──────────┘ └──────────┘ │
|
|
36
|
+
├─────────────────────────────────────────────┤
|
|
37
|
+
│ 3. EVALUATE │
|
|
38
|
+
│ Score candidates (functionality, maint, │
|
|
39
|
+
│ community, docs, license, deps) │
|
|
40
|
+
├─────────────────────────────────────────────┤
|
|
41
|
+
│ 4. DECIDE │
|
|
42
|
+
│ ┌─────────┐ ┌──────────┐ ┌─────────┐ │
|
|
43
|
+
│ │ Adopt │ │ Extend │ │ Build │ │
|
|
44
|
+
│ │ as-is │ │ /Wrap │ │ Custom │ │
|
|
45
|
+
│ └─────────┘ └──────────┘ └─────────┘ │
|
|
46
|
+
├─────────────────────────────────────────────┤
|
|
47
|
+
│ 5. IMPLEMENT │
|
|
48
|
+
│ Install package / Configure MCP / │
|
|
49
|
+
│ Write minimal custom code │
|
|
50
|
+
└─────────────────────────────────────────────┘
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Decision Matrix
|
|
54
|
+
|
|
55
|
+
| Signal | Action |
|
|
56
|
+
|--------|--------|
|
|
57
|
+
| Exact match, well-maintained, MIT/Apache | **Adopt** — install and use directly |
|
|
58
|
+
| Partial match, good foundation | **Extend** — install + write thin wrapper |
|
|
59
|
+
| Multiple weak matches | **Compose** — combine 2-3 small packages |
|
|
60
|
+
| Nothing suitable found | **Build** — write custom, but informed by research |
|
|
61
|
+
|
|
62
|
+
## How to Use
|
|
63
|
+
|
|
64
|
+
### Step 0: Tool Availability Preflight
|
|
65
|
+
|
|
66
|
+
This is agent guidance, not an executable setup script. Check only the channels
|
|
67
|
+
that are relevant to the task and project in front of you.
|
|
68
|
+
|
|
69
|
+
| Channel | Check | If missing |
|
|
70
|
+
|---------|-------|------------|
|
|
71
|
+
| Repository search | `rg --files` and targeted `rg` queries | State that only visible files were inspected |
|
|
72
|
+
| Package registry | `npm --version`, `python -m pip --version`, or project package manager | Use web/docs search and avoid claiming registry coverage |
|
|
73
|
+
| GitHub CLI | `gh auth status` | Use public web or local git history only |
|
|
74
|
+
| MCP/docs tools | Available tool list or local MCP config | Fall back to official docs/web search |
|
|
75
|
+
| Skills directory | Inspect `bundled BROS skill pack` and `user-added OpenCode skills directory` | Say no local OpenCode skill catalog was available |
|
|
76
|
+
|
|
77
|
+
### Quick Mode (inline)
|
|
78
|
+
|
|
79
|
+
Before writing a utility or adding functionality, mentally run through:
|
|
80
|
+
|
|
81
|
+
0. Does this already exist in the repo? → `rg` through relevant modules/tests first
|
|
82
|
+
1. Is this a common problem? → Search npm/PyPI
|
|
83
|
+
2. Is there an MCP for this? → Check active OpenCode tool availability and search
|
|
84
|
+
3. Is there a skill for this? → Check `bundled BROS skill pack` and `user-added OpenCode skills directory`
|
|
85
|
+
4. Is there a GitHub implementation/template? → Run GitHub code search for maintained OSS before writing net-new code
|
|
86
|
+
|
|
87
|
+
### Full Mode (agent)
|
|
88
|
+
|
|
89
|
+
For non-trivial functionality, launch the canonical BROS Explorer agent (`bro-explore`):
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
Agent(subagent_type="bro-explore", prompt="
|
|
93
|
+
Research existing tools for: [DESCRIPTION]
|
|
94
|
+
Language/framework: [LANG]
|
|
95
|
+
Constraints: [ANY]
|
|
96
|
+
|
|
97
|
+
Search: npm/PyPI, MCP servers, OpenCode skills, GitHub
|
|
98
|
+
Return: Evidence packet with citations, limitations, and options; do not decide or implement
|
|
99
|
+
")
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Use the current agent/subagent tool name exposed by the active harness.
|
|
103
|
+
|
|
104
|
+
## Search Shortcuts by Category
|
|
105
|
+
|
|
106
|
+
### Development Tooling
|
|
107
|
+
- Linting → `eslint`, `ruff`, `textlint`, `markdownlint`
|
|
108
|
+
- Formatting → `prettier`, `black`, `gofmt`
|
|
109
|
+
- Testing → `jest`, `pytest`, `go test`
|
|
110
|
+
- Pre-commit → `husky`, `lint-staged`, `pre-commit`
|
|
111
|
+
|
|
112
|
+
### AI/LLM Integration
|
|
113
|
+
- Claude SDK → Context7 for latest docs
|
|
114
|
+
- Prompt management → Check MCP servers
|
|
115
|
+
- Document processing → `unstructured`, `pdfplumber`, `mammoth`
|
|
116
|
+
|
|
117
|
+
### Data & APIs
|
|
118
|
+
- HTTP clients → `httpx` (Python), `ky`/`undici` (Node)
|
|
119
|
+
- Validation → `zod` (TS), `pydantic` (Python)
|
|
120
|
+
- Database → Check for MCP servers first
|
|
121
|
+
|
|
122
|
+
### Content & Publishing
|
|
123
|
+
- Markdown processing → `remark`, `unified`, `markdown-it`
|
|
124
|
+
- Image optimization → `sharp`, `imagemin`
|
|
125
|
+
|
|
126
|
+
## Integration Points
|
|
127
|
+
|
|
128
|
+
### With Orchestrator agent
|
|
129
|
+
The Orchestrator should invoke `bro-explore` before Phase 1 (Architecture Review):
|
|
130
|
+
- `bro-explore` identifies available tools
|
|
131
|
+
- Orchestrator incorporates them into the implementation plan
|
|
132
|
+
- Avoids "reinventing the wheel" in the plan
|
|
133
|
+
|
|
134
|
+
### With architect agent
|
|
135
|
+
The architect should consult `bro-explore` for:
|
|
136
|
+
- Technology stack decisions
|
|
137
|
+
- Integration pattern discovery
|
|
138
|
+
- Existing reference architectures
|
|
139
|
+
|
|
140
|
+
### With iterative-retrieval skill
|
|
141
|
+
Combine for progressive discovery:
|
|
142
|
+
- Cycle 1: Broad search (npm, PyPI, MCP)
|
|
143
|
+
- Cycle 2: Evaluate top candidates in detail
|
|
144
|
+
- Cycle 3: Test fit with project constraints
|
|
145
|
+
|
|
146
|
+
## Examples
|
|
147
|
+
|
|
148
|
+
### Example 1: "Add dead link checking"
|
|
149
|
+
```
|
|
150
|
+
Need: Check markdown files for broken links
|
|
151
|
+
Search: npm "markdown dead link checker"
|
|
152
|
+
Found: textlint-rule-no-dead-link (score: 9/10)
|
|
153
|
+
Action: ADOPT — npm install textlint-rule-no-dead-link
|
|
154
|
+
Result: Zero custom code, battle-tested solution
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Example 2: "Add HTTP client wrapper"
|
|
158
|
+
```
|
|
159
|
+
Need: Resilient HTTP client with retries and timeout handling
|
|
160
|
+
Search: npm "http client retry", PyPI "httpx retry"
|
|
161
|
+
Found: got (Node) with retry plugin, httpx (Python) with built-in retry
|
|
162
|
+
Action: ADOPT — use got/httpx directly with retry config
|
|
163
|
+
Result: Zero custom code, production-proven libraries
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Example 3: "Add config file linter"
|
|
167
|
+
```
|
|
168
|
+
Need: Validate project config files against a schema
|
|
169
|
+
Search: npm "config linter schema", "json schema validator cli"
|
|
170
|
+
Found: ajv-cli (score: 8/10)
|
|
171
|
+
Action: ADOPT + EXTEND — install ajv-cli, write project-specific schema
|
|
172
|
+
Result: 1 package + 1 schema file, no custom validation logic
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Anti-Patterns
|
|
176
|
+
|
|
177
|
+
- **Jumping to code**: Writing a utility without checking if one exists
|
|
178
|
+
- **Ignoring MCP**: Not checking if an MCP server already provides the capability
|
|
179
|
+
- **Silent skipping**: Reporting "nothing found" when a search channel was unavailable
|
|
180
|
+
- **Over-customizing**: Wrapping a library so heavily it loses its benefits
|
|
181
|
+
- **Dependency bloat**: Installing a massive package for one small feature
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Security Review"
|
|
3
|
+
short_description: "Comprehensive security checklist and vulnerability detection"
|
|
4
|
+
brand_color: "#EF4444"
|
|
5
|
+
default_prompt: "Run security checklist: secrets, input validation, injection prevention"
|
|
6
|
+
policy:
|
|
7
|
+
allow_implicit_invocation: true
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
| name | description |
|
|
2
|
+
|------|-------------|
|
|
3
|
+
| cloud-infrastructure-security | Use this skill when deploying to cloud platforms, configuring infrastructure, managing IAM policies, setting up logging/monitoring, or implementing CI/CD pipelines. Provides cloud security checklist aligned with best practices. |
|
|
4
|
+
|
|
5
|
+
# Cloud & Infrastructure Security Skill
|
|
6
|
+
|
|
7
|
+
This skill ensures cloud infrastructure, CI/CD pipelines, and deployment configurations follow security best practices and comply with industry standards.
|
|
8
|
+
|
|
9
|
+
## When to Activate
|
|
10
|
+
|
|
11
|
+
- Deploying applications to cloud platforms (AWS, Vercel, Railway, Cloudflare)
|
|
12
|
+
- Configuring IAM roles and permissions
|
|
13
|
+
- Setting up CI/CD pipelines
|
|
14
|
+
- Implementing infrastructure as code (Terraform, CloudFormation)
|
|
15
|
+
- Configuring logging and monitoring
|
|
16
|
+
- Managing secrets in cloud environments
|
|
17
|
+
- Setting up CDN and edge security
|
|
18
|
+
- Implementing disaster recovery and backup strategies
|
|
19
|
+
|
|
20
|
+
## Cloud Security Checklist
|
|
21
|
+
|
|
22
|
+
### 1. IAM & Access Control
|
|
23
|
+
|
|
24
|
+
#### Principle of Least Privilege
|
|
25
|
+
|
|
26
|
+
```yaml
|
|
27
|
+
# PASS: CORRECT: Minimal permissions
|
|
28
|
+
iam_role:
|
|
29
|
+
permissions:
|
|
30
|
+
- s3:GetObject # Only read access
|
|
31
|
+
- s3:ListBucket
|
|
32
|
+
resources:
|
|
33
|
+
- arn:aws:s3:::my-bucket/* # Specific bucket only
|
|
34
|
+
|
|
35
|
+
# FAIL: WRONG: Overly broad permissions
|
|
36
|
+
iam_role:
|
|
37
|
+
permissions:
|
|
38
|
+
- s3:* # All S3 actions
|
|
39
|
+
resources:
|
|
40
|
+
- "*" # All resources
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### Multi-Factor Authentication (MFA)
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# ALWAYS enable MFA for root/admin accounts
|
|
47
|
+
aws iam enable-mfa-device \
|
|
48
|
+
--user-name admin \
|
|
49
|
+
--serial-number arn:aws:iam::123456789:mfa/admin \
|
|
50
|
+
--authentication-code1 123456 \
|
|
51
|
+
--authentication-code2 789012
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### Verification Steps
|
|
55
|
+
|
|
56
|
+
- [ ] No root account usage in production
|
|
57
|
+
- [ ] MFA enabled for all privileged accounts
|
|
58
|
+
- [ ] Service accounts use roles, not long-lived credentials
|
|
59
|
+
- [ ] IAM policies follow least privilege
|
|
60
|
+
- [ ] Regular access reviews conducted
|
|
61
|
+
- [ ] Unused credentials rotated or removed
|
|
62
|
+
|
|
63
|
+
### 2. Secrets Management
|
|
64
|
+
|
|
65
|
+
#### Cloud Secrets Managers
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
// PASS: CORRECT: Use cloud secrets manager
|
|
69
|
+
import { SecretsManager } from '@aws-sdk/client-secrets-manager';
|
|
70
|
+
|
|
71
|
+
const client = new SecretsManager({ region: 'us-east-1' });
|
|
72
|
+
const secret = await client.getSecretValue({ SecretId: 'prod/api-key' });
|
|
73
|
+
const apiKey = JSON.parse(secret.SecretString).key;
|
|
74
|
+
|
|
75
|
+
// FAIL: WRONG: Hardcoded or in environment variables only
|
|
76
|
+
const apiKey = process.env.API_KEY; // Not rotated, not audited
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Secrets Rotation
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Set up automatic rotation for database credentials
|
|
83
|
+
aws secretsmanager rotate-secret \
|
|
84
|
+
--secret-id prod/db-password \
|
|
85
|
+
--rotation-lambda-arn arn:aws:lambda:region:account:function:rotate \
|
|
86
|
+
--rotation-rules AutomaticallyAfterDays=30
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
#### Verification Steps
|
|
90
|
+
|
|
91
|
+
- [ ] All secrets stored in cloud secrets manager (AWS Secrets Manager, Vercel Secrets)
|
|
92
|
+
- [ ] Automatic rotation enabled for database credentials
|
|
93
|
+
- [ ] API keys rotated at least quarterly
|
|
94
|
+
- [ ] No secrets in code, logs, or error messages
|
|
95
|
+
- [ ] Audit logging enabled for secret access
|
|
96
|
+
|
|
97
|
+
### 3. Network Security
|
|
98
|
+
|
|
99
|
+
#### VPC and Firewall Configuration
|
|
100
|
+
|
|
101
|
+
```terraform
|
|
102
|
+
# PASS: CORRECT: Restricted security group
|
|
103
|
+
resource "aws_security_group" "app" {
|
|
104
|
+
name = "app-sg"
|
|
105
|
+
|
|
106
|
+
ingress {
|
|
107
|
+
from_port = 443
|
|
108
|
+
to_port = 443
|
|
109
|
+
protocol = "tcp"
|
|
110
|
+
cidr_blocks = ["10.0.0.0/16"] # Internal VPC only
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
egress {
|
|
114
|
+
from_port = 443
|
|
115
|
+
to_port = 443
|
|
116
|
+
protocol = "tcp"
|
|
117
|
+
cidr_blocks = ["0.0.0.0/0"] # Only HTTPS outbound
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
# FAIL: WRONG: Open to the internet
|
|
122
|
+
resource "aws_security_group" "bad" {
|
|
123
|
+
ingress {
|
|
124
|
+
from_port = 0
|
|
125
|
+
to_port = 65535
|
|
126
|
+
protocol = "tcp"
|
|
127
|
+
cidr_blocks = ["0.0.0.0/0"] # All ports, all IPs!
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### Verification Steps
|
|
133
|
+
|
|
134
|
+
- [ ] Database not publicly accessible
|
|
135
|
+
- [ ] SSH/RDP ports restricted to VPN/bastion only
|
|
136
|
+
- [ ] Security groups follow least privilege
|
|
137
|
+
- [ ] Network ACLs configured
|
|
138
|
+
- [ ] VPC flow logs enabled
|
|
139
|
+
|
|
140
|
+
### 4. Logging & Monitoring
|
|
141
|
+
|
|
142
|
+
#### CloudWatch/Logging Configuration
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
// PASS: CORRECT: Comprehensive logging
|
|
146
|
+
import { CloudWatchLogsClient, CreateLogStreamCommand } from '@aws-sdk/client-cloudwatch-logs';
|
|
147
|
+
|
|
148
|
+
const logSecurityEvent = async (event: SecurityEvent) => {
|
|
149
|
+
await cloudwatch.putLogEvents({
|
|
150
|
+
logGroupName: '/aws/security/events',
|
|
151
|
+
logStreamName: 'authentication',
|
|
152
|
+
logEvents: [{
|
|
153
|
+
timestamp: Date.now(),
|
|
154
|
+
message: JSON.stringify({
|
|
155
|
+
type: event.type,
|
|
156
|
+
userId: event.userId,
|
|
157
|
+
ip: event.ip,
|
|
158
|
+
result: event.result,
|
|
159
|
+
// Never log sensitive data
|
|
160
|
+
})
|
|
161
|
+
}]
|
|
162
|
+
});
|
|
163
|
+
};
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
#### Verification Steps
|
|
167
|
+
|
|
168
|
+
- [ ] CloudWatch/logging enabled for all services
|
|
169
|
+
- [ ] Failed authentication attempts logged
|
|
170
|
+
- [ ] Admin actions audited
|
|
171
|
+
- [ ] Log retention configured (90+ days for compliance)
|
|
172
|
+
- [ ] Alerts configured for suspicious activity
|
|
173
|
+
- [ ] Logs centralized and tamper-proof
|
|
174
|
+
|
|
175
|
+
### 5. CI/CD Pipeline Security
|
|
176
|
+
|
|
177
|
+
#### Secure Pipeline Configuration
|
|
178
|
+
|
|
179
|
+
```yaml
|
|
180
|
+
# PASS: CORRECT: Secure GitHub Actions workflow
|
|
181
|
+
name: Deploy
|
|
182
|
+
|
|
183
|
+
on:
|
|
184
|
+
push:
|
|
185
|
+
branches: [main]
|
|
186
|
+
|
|
187
|
+
jobs:
|
|
188
|
+
deploy:
|
|
189
|
+
runs-on: ubuntu-latest
|
|
190
|
+
permissions:
|
|
191
|
+
contents: read # Minimal permissions
|
|
192
|
+
|
|
193
|
+
steps:
|
|
194
|
+
- uses: actions/checkout@v4
|
|
195
|
+
|
|
196
|
+
# Scan for secrets
|
|
197
|
+
- name: Secret scanning
|
|
198
|
+
uses: trufflesecurity/trufflehog@main
|
|
199
|
+
|
|
200
|
+
# Dependency audit
|
|
201
|
+
- name: Audit dependencies
|
|
202
|
+
run: npm audit --audit-level=high
|
|
203
|
+
|
|
204
|
+
# Use OIDC, not long-lived tokens
|
|
205
|
+
- name: Configure AWS credentials
|
|
206
|
+
uses: aws-actions/configure-aws-credentials@v4
|
|
207
|
+
with:
|
|
208
|
+
role-to-assume: arn:aws:iam::123456789:role/GitHubActionsRole
|
|
209
|
+
aws-region: us-east-1
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
#### Supply Chain Security
|
|
213
|
+
|
|
214
|
+
```json
|
|
215
|
+
// package.json - Use lock files and integrity checks
|
|
216
|
+
{
|
|
217
|
+
"scripts": {
|
|
218
|
+
"install": "npm ci", // Use ci for reproducible builds
|
|
219
|
+
"audit": "npm audit --audit-level=moderate",
|
|
220
|
+
"check": "npm outdated"
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
#### Verification Steps
|
|
226
|
+
|
|
227
|
+
- [ ] OIDC used instead of long-lived credentials
|
|
228
|
+
- [ ] Secrets scanning in pipeline
|
|
229
|
+
- [ ] Dependency vulnerability scanning
|
|
230
|
+
- [ ] Container image scanning (if applicable)
|
|
231
|
+
- [ ] Branch protection rules enforced
|
|
232
|
+
- [ ] Code review required before merge
|
|
233
|
+
- [ ] Signed commits enforced
|
|
234
|
+
|
|
235
|
+
### 6. Cloudflare & CDN Security
|
|
236
|
+
|
|
237
|
+
#### Cloudflare Security Configuration
|
|
238
|
+
|
|
239
|
+
```typescript
|
|
240
|
+
// PASS: CORRECT: Cloudflare Workers with security headers
|
|
241
|
+
export default {
|
|
242
|
+
async fetch(request: Request): Promise<Response> {
|
|
243
|
+
const response = await fetch(request);
|
|
244
|
+
|
|
245
|
+
// Add security headers
|
|
246
|
+
const headers = new Headers(response.headers);
|
|
247
|
+
headers.set('X-Frame-Options', 'DENY');
|
|
248
|
+
headers.set('X-Content-Type-Options', 'nosniff');
|
|
249
|
+
headers.set('Referrer-Policy', 'strict-origin-when-cross-origin');
|
|
250
|
+
headers.set('Permissions-Policy', 'geolocation=(), microphone=()');
|
|
251
|
+
|
|
252
|
+
return new Response(response.body, {
|
|
253
|
+
status: response.status,
|
|
254
|
+
headers
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
#### WAF Rules
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# Enable Cloudflare WAF managed rules
|
|
264
|
+
# - OWASP Core Ruleset
|
|
265
|
+
# - Cloudflare Managed Ruleset
|
|
266
|
+
# - Rate limiting rules
|
|
267
|
+
# - Bot protection
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
#### Verification Steps
|
|
271
|
+
|
|
272
|
+
- [ ] WAF enabled with OWASP rules
|
|
273
|
+
- [ ] Rate limiting configured
|
|
274
|
+
- [ ] Bot protection active
|
|
275
|
+
- [ ] DDoS protection enabled
|
|
276
|
+
- [ ] Security headers configured
|
|
277
|
+
- [ ] SSL/TLS strict mode enabled
|
|
278
|
+
|
|
279
|
+
### 7. Backup & Disaster Recovery
|
|
280
|
+
|
|
281
|
+
#### Automated Backups
|
|
282
|
+
|
|
283
|
+
```terraform
|
|
284
|
+
# PASS: CORRECT: Automated RDS backups
|
|
285
|
+
resource "aws_db_instance" "main" {
|
|
286
|
+
allocated_storage = 20
|
|
287
|
+
engine = "postgres"
|
|
288
|
+
|
|
289
|
+
backup_retention_period = 30 # 30 days retention
|
|
290
|
+
backup_window = "03:00-04:00"
|
|
291
|
+
maintenance_window = "mon:04:00-mon:05:00"
|
|
292
|
+
|
|
293
|
+
enabled_cloudwatch_logs_exports = ["postgresql"]
|
|
294
|
+
|
|
295
|
+
deletion_protection = true # Prevent accidental deletion
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
#### Verification Steps
|
|
300
|
+
|
|
301
|
+
- [ ] Automated daily backups configured
|
|
302
|
+
- [ ] Backup retention meets compliance requirements
|
|
303
|
+
- [ ] Point-in-time recovery enabled
|
|
304
|
+
- [ ] Backup testing performed quarterly
|
|
305
|
+
- [ ] Disaster recovery plan documented
|
|
306
|
+
- [ ] RPO and RTO defined and tested
|
|
307
|
+
|
|
308
|
+
## Pre-Deployment Cloud Security Checklist
|
|
309
|
+
|
|
310
|
+
Before ANY production cloud deployment:
|
|
311
|
+
|
|
312
|
+
- [ ] **IAM**: Root account not used, MFA enabled, least privilege policies
|
|
313
|
+
- [ ] **Secrets**: All secrets in cloud secrets manager with rotation
|
|
314
|
+
- [ ] **Network**: Security groups restricted, no public databases
|
|
315
|
+
- [ ] **Logging**: CloudWatch/logging enabled with retention
|
|
316
|
+
- [ ] **Monitoring**: Alerts configured for anomalies
|
|
317
|
+
- [ ] **CI/CD**: OIDC auth, secrets scanning, dependency audits
|
|
318
|
+
- [ ] **CDN/WAF**: Cloudflare WAF enabled with OWASP rules
|
|
319
|
+
- [ ] **Encryption**: Data encrypted at rest and in transit
|
|
320
|
+
- [ ] **Backups**: Automated backups with tested recovery
|
|
321
|
+
- [ ] **Compliance**: GDPR/HIPAA requirements met (if applicable)
|
|
322
|
+
- [ ] **Documentation**: Infrastructure documented, runbooks created
|
|
323
|
+
- [ ] **Incident Response**: Security incident plan in place
|
|
324
|
+
|
|
325
|
+
## Common Cloud Security Misconfigurations
|
|
326
|
+
|
|
327
|
+
### S3 Bucket Exposure
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
# FAIL: WRONG: Public bucket
|
|
331
|
+
aws s3api put-bucket-acl --bucket my-bucket --acl public-read
|
|
332
|
+
|
|
333
|
+
# PASS: CORRECT: Private bucket with specific access
|
|
334
|
+
aws s3api put-bucket-acl --bucket my-bucket --acl private
|
|
335
|
+
aws s3api put-bucket-policy --bucket my-bucket --policy file://policy.json
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### RDS Public Access
|
|
339
|
+
|
|
340
|
+
```terraform
|
|
341
|
+
# FAIL: WRONG
|
|
342
|
+
resource "aws_db_instance" "bad" {
|
|
343
|
+
publicly_accessible = true # NEVER do this!
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
# PASS: CORRECT
|
|
347
|
+
resource "aws_db_instance" "good" {
|
|
348
|
+
publicly_accessible = false
|
|
349
|
+
vpc_security_group_ids = [aws_security_group.db.id]
|
|
350
|
+
}
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
## Resources
|
|
354
|
+
|
|
355
|
+
- [AWS Security Best Practices](https://aws.amazon.com/security/best-practices/)
|
|
356
|
+
- [CIS AWS Foundations Benchmark](https://www.cisecurity.org/benchmark/amazon_web_services)
|
|
357
|
+
- [Cloudflare Security Documentation](https://developers.cloudflare.com/security/)
|
|
358
|
+
- [OWASP Cloud Security](https://owasp.org/www-project-cloud-security/)
|
|
359
|
+
- [Terraform Security Best Practices](https://www.terraform.io/docs/cloud/guides/recommended-practices/)
|
|
360
|
+
|
|
361
|
+
**Remember**: Cloud misconfigurations are the leading cause of data breaches. A single exposed S3 bucket or overly permissive IAM policy can compromise your entire infrastructure. Always follow the principle of least privilege and defense in depth.
|