cortex-agents 1.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.
Files changed (40) hide show
  1. package/.opencode/agents/build.md +160 -0
  2. package/.opencode/agents/debug.md +141 -0
  3. package/.opencode/agents/devops.md +109 -0
  4. package/.opencode/agents/fullstack.md +84 -0
  5. package/.opencode/agents/plan.md +188 -0
  6. package/.opencode/agents/security.md +90 -0
  7. package/.opencode/agents/testing.md +89 -0
  8. package/.opencode/skills/code-quality/SKILL.md +251 -0
  9. package/.opencode/skills/deployment-automation/SKILL.md +258 -0
  10. package/.opencode/skills/git-workflow/SKILL.md +281 -0
  11. package/.opencode/skills/security-hardening/SKILL.md +209 -0
  12. package/.opencode/skills/testing-strategies/SKILL.md +159 -0
  13. package/.opencode/skills/web-development/SKILL.md +122 -0
  14. package/LICENSE +17 -0
  15. package/README.md +172 -0
  16. package/dist/cli.d.ts +3 -0
  17. package/dist/cli.d.ts.map +1 -0
  18. package/dist/cli.js +174 -0
  19. package/dist/index.d.ts +4 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +42 -0
  22. package/dist/plugin.d.ts +1 -0
  23. package/dist/plugin.d.ts.map +1 -0
  24. package/dist/plugin.js +3 -0
  25. package/dist/tools/branch.d.ts +35 -0
  26. package/dist/tools/branch.d.ts.map +1 -0
  27. package/dist/tools/branch.js +176 -0
  28. package/dist/tools/cortex.d.ts +11 -0
  29. package/dist/tools/cortex.d.ts.map +1 -0
  30. package/dist/tools/cortex.js +149 -0
  31. package/dist/tools/plan.d.ts +59 -0
  32. package/dist/tools/plan.d.ts.map +1 -0
  33. package/dist/tools/plan.js +177 -0
  34. package/dist/tools/session.d.ts +36 -0
  35. package/dist/tools/session.d.ts.map +1 -0
  36. package/dist/tools/session.js +175 -0
  37. package/dist/tools/worktree.d.ts +45 -0
  38. package/dist/tools/worktree.d.ts.map +1 -0
  39. package/dist/tools/worktree.js +198 -0
  40. package/package.json +55 -0
@@ -0,0 +1,281 @@
1
+ ---
2
+ name: git-workflow
3
+ description: Git branching strategies, worktree management, and collaborative development workflows
4
+ license: Apache-2.0
5
+ compatibility: opencode
6
+ ---
7
+
8
+ # Git Workflow Skill
9
+
10
+ This skill provides patterns for git branching, worktree management, and collaborative workflows.
11
+
12
+ ## When to Use
13
+
14
+ Use this skill when:
15
+ - Setting up branch strategy for new work
16
+ - Managing parallel development with worktrees
17
+ - Handling production hotfixes
18
+ - Coordinating team workflows
19
+ - Understanding git best practices
20
+
21
+ ## Branch Naming Conventions
22
+
23
+ | Type | Prefix | Example | Use Case |
24
+ |------|--------|---------|----------|
25
+ | Feature | `feature/` | `feature/user-authentication` | New functionality |
26
+ | Bugfix | `bugfix/` | `bugfix/login-validation` | Non-critical bug fixes |
27
+ | Hotfix | `hotfix/` | `hotfix/security-patch` | Critical production fixes |
28
+ | Refactor | `refactor/` | `refactor/api-cleanup` | Code restructuring |
29
+ | Docs | `docs/` | `docs/api-reference` | Documentation only |
30
+ | Test | `test/` | `test/e2e-coverage` | Test additions |
31
+ | Spike | `spike/` | `spike/graphql-poc` | Research/proof of concept |
32
+ | Chore | `chore/` | `chore/update-deps` | Maintenance tasks |
33
+
34
+ ## Protected Branches
35
+
36
+ These branches should never be committed to directly:
37
+ - `main` / `master` - Production code
38
+ - `develop` - Integration branch
39
+ - `staging` - Pre-production testing
40
+ - `production` - Live deployment
41
+
42
+ Always create a feature/bugfix branch and merge via Pull Request.
43
+
44
+ ## Worktree Workflow
45
+
46
+ ### When to Use Worktrees
47
+
48
+ Worktrees are ideal for:
49
+ - Parallel feature development
50
+ - Urgent hotfix while mid-feature
51
+ - Testing different approaches simultaneously
52
+ - Code review while continuing work
53
+ - Running different versions side-by-side
54
+
55
+ ### Worktree Structure
56
+
57
+ ```
58
+ project/ # Main worktree (main branch)
59
+ ../.worktrees/
60
+ ├── feature-auth/ # feature/auth worktree
61
+ ├── hotfix-security/ # hotfix/security worktree
62
+ └── spike-graphql/ # spike/graphql worktree
63
+ ```
64
+
65
+ ### Worktree Commands
66
+
67
+ ```bash
68
+ # Create worktree with new branch
69
+ git worktree add -b feature/auth ../.worktrees/feature-auth
70
+
71
+ # List all worktrees
72
+ git worktree list
73
+
74
+ # Remove worktree (after merge)
75
+ git worktree remove ../.worktrees/feature-auth
76
+
77
+ # Prune stale worktree references
78
+ git worktree prune
79
+ ```
80
+
81
+ ### Worktree Best Practices
82
+
83
+ 1. **Keep worktrees short-lived** - Merge and clean up promptly
84
+ 2. **Name descriptively** - Match branch name for clarity
85
+ 3. **Share dependencies** - Use same node_modules when possible
86
+ 4. **Clean up after merge** - Remove worktree and optionally delete branch
87
+ 5. **Don't nest worktrees** - Keep them as siblings
88
+
89
+ ## Workflow Patterns
90
+
91
+ ### Feature Development Flow
92
+
93
+ ```mermaid
94
+ graph LR
95
+ A[main] -->|branch| B[feature/x]
96
+ B -->|develop| C[commits]
97
+ C -->|PR| D[review]
98
+ D -->|merge| A
99
+ ```
100
+
101
+ Steps:
102
+ 1. Create feature branch from main
103
+ 2. Develop and commit regularly
104
+ 3. Push and create Pull Request
105
+ 4. Address review feedback
106
+ 5. Merge after approval
107
+ 6. Delete feature branch
108
+
109
+ ### Hotfix Flow (with Worktree)
110
+
111
+ ```mermaid
112
+ graph LR
113
+ A[main] -->|worktree| B[hotfix/x]
114
+ B -->|fix| C[test]
115
+ C -->|deploy| D[production]
116
+ D -->|merge| A
117
+ ```
118
+
119
+ Steps:
120
+ 1. Create worktree from main: `worktree_create hotfix critical-bug`
121
+ 2. Open new terminal: `worktree_open critical-bug`
122
+ 3. Fix issue in new terminal
123
+ 4. Test and deploy
124
+ 5. Merge back to main
125
+ 6. Remove worktree
126
+
127
+ ### Parallel Development
128
+
129
+ ```mermaid
130
+ graph TD
131
+ A[main] -->|worktree 1| B[feature/a]
132
+ A -->|worktree 2| C[feature/b]
133
+ B -->|merge| A
134
+ C -->|merge| A
135
+ ```
136
+
137
+ Use when:
138
+ - Multiple features needed simultaneously
139
+ - Don't want to stash/switch constantly
140
+ - Need to compare implementations
141
+
142
+ ## Commit Message Convention
143
+
144
+ ### Format
145
+
146
+ ```
147
+ <type>(<scope>): <subject>
148
+
149
+ <body>
150
+
151
+ <footer>
152
+ ```
153
+
154
+ ### Types
155
+
156
+ | Type | Description |
157
+ |------|-------------|
158
+ | `feat` | New feature |
159
+ | `fix` | Bug fix |
160
+ | `docs` | Documentation only |
161
+ | `style` | Formatting, no code change |
162
+ | `refactor` | Code change, no feature/fix |
163
+ | `test` | Adding tests |
164
+ | `chore` | Maintenance |
165
+ | `perf` | Performance improvement |
166
+ | `ci` | CI/CD changes |
167
+
168
+ ### Examples
169
+
170
+ ```
171
+ feat(auth): add OAuth2 login flow
172
+
173
+ Implement Google and GitHub OAuth providers.
174
+ Includes token refresh and session management.
175
+
176
+ Closes #123
177
+ ```
178
+
179
+ ```
180
+ fix(api): handle null response in user endpoint
181
+
182
+ The /users/:id endpoint was crashing when user
183
+ not found. Now returns proper 404 response.
184
+
185
+ Fixes #456
186
+ ```
187
+
188
+ ## Pull Request Best Practices
189
+
190
+ ### PR Title
191
+ - Use same format as commits: `type(scope): description`
192
+ - Keep under 72 characters
193
+ - Be specific about the change
194
+
195
+ ### PR Description Template
196
+
197
+ ```markdown
198
+ ## Summary
199
+ Brief description of changes
200
+
201
+ ## Changes
202
+ - Change 1
203
+ - Change 2
204
+
205
+ ## Testing
206
+ How was this tested?
207
+
208
+ ## Screenshots (if applicable)
209
+
210
+ ## Checklist
211
+ - [ ] Tests added/updated
212
+ - [ ] Documentation updated
213
+ - [ ] No breaking changes
214
+ ```
215
+
216
+ ### Review Guidelines
217
+
218
+ 1. **Keep PRs small** - Under 400 lines ideally
219
+ 2. **One concern per PR** - Don't mix features
220
+ 3. **Self-review first** - Check your own diff
221
+ 4. **Respond to feedback** - Address or discuss all comments
222
+ 5. **Squash if needed** - Clean up messy history before merge
223
+
224
+ ## Git Configuration
225
+
226
+ ### Recommended Global Config
227
+
228
+ ```bash
229
+ # Use rebase by default when pulling
230
+ git config --global pull.rebase true
231
+
232
+ # Prune deleted remote branches
233
+ git config --global fetch.prune true
234
+
235
+ # Sign commits (optional)
236
+ git config --global commit.gpgsign true
237
+
238
+ # Default branch name
239
+ git config --global init.defaultBranch main
240
+ ```
241
+
242
+ ### Useful Aliases
243
+
244
+ ```bash
245
+ git config --global alias.co checkout
246
+ git config --global alias.br branch
247
+ git config --global alias.st status
248
+ git config --global alias.last 'log -1 HEAD'
249
+ git config --global alias.unstage 'reset HEAD --'
250
+ git config --global alias.visual '!gitk'
251
+ ```
252
+
253
+ ## Troubleshooting
254
+
255
+ ### Undo Last Commit (keep changes)
256
+ ```bash
257
+ git reset --soft HEAD~1
258
+ ```
259
+
260
+ ### Discard Local Changes
261
+ ```bash
262
+ git checkout -- <file> # Single file
263
+ git checkout -- . # All files
264
+ ```
265
+
266
+ ### Fix Commit Message
267
+ ```bash
268
+ git commit --amend -m "New message"
269
+ ```
270
+
271
+ ### Recover Deleted Branch
272
+ ```bash
273
+ git reflog # Find commit hash
274
+ git checkout -b branch-name <hash>
275
+ ```
276
+
277
+ ### Clean Untracked Files
278
+ ```bash
279
+ git clean -n # Dry run
280
+ git clean -f # Actually delete
281
+ ```
@@ -0,0 +1,209 @@
1
+ ---
2
+ name: security-hardening
3
+ description: Security best practices, vulnerability detection, and secure coding patterns
4
+ license: Apache-2.0
5
+ compatibility: opencode
6
+ ---
7
+
8
+ # Security Hardening Skill
9
+
10
+ This skill provides guidance for writing secure code and identifying vulnerabilities.
11
+
12
+ ## When to Use
13
+
14
+ Use this skill when:
15
+ - Reviewing code for security issues
16
+ - Implementing authentication/authorization
17
+ - Handling sensitive data
18
+ - Setting up security headers
19
+ - Auditing dependencies
20
+
21
+ ## Security Principles
22
+
23
+ ### Core Concepts
24
+ - Defense in depth
25
+ - Principle of least privilege
26
+ - Fail securely
27
+ - Keep it simple
28
+ - Don't trust user input
29
+ - Security through obscurity is not security
30
+
31
+ ### Threat Model
32
+ - Identify assets
33
+ - Identify threats
34
+ - Identify vulnerabilities
35
+ - Assess risk
36
+ - Mitigate threats
37
+
38
+ ## Common Vulnerabilities
39
+
40
+ ### OWASP Top 10 (2021)
41
+ 1. Broken Access Control
42
+ 2. Cryptographic Failures
43
+ 3. Injection
44
+ 4. Insecure Design
45
+ 5. Security Misconfiguration
46
+ 6. Vulnerable Components
47
+ 7. ID and Auth Failures
48
+ 8. Software Integrity Failures
49
+ 9. Logging Failures
50
+ 10. SSRF
51
+
52
+ ### Injection Attacks
53
+ - SQL Injection
54
+ - NoSQL Injection
55
+ - Command Injection
56
+ - LDAP Injection
57
+ - XPath Injection
58
+
59
+ Prevention:
60
+ - Use parameterized queries
61
+ - Input validation
62
+ - ORM/ODM libraries
63
+ - WAF rules
64
+
65
+ ### XSS (Cross-Site Scripting)
66
+ - Stored XSS
67
+ - Reflected XSS
68
+ - DOM-based XSS
69
+
70
+ Prevention:
71
+ - Output encoding
72
+ - Content Security Policy
73
+ - HttpOnly cookies
74
+ - Input sanitization
75
+
76
+ ### CSRF (Cross-Site Request Forgery)
77
+ Prevention:
78
+ - CSRF tokens
79
+ - SameSite cookies
80
+ - Double-submit cookies
81
+ - Custom headers
82
+
83
+ ## Authentication & Authorization
84
+
85
+ ### Password Security
86
+ - Strong hashing (bcrypt, Argon2)
87
+ - Salt generation
88
+ - Password complexity rules
89
+ - Rate limiting on auth endpoints
90
+ - Account lockout policies
91
+
92
+ ### Session Management
93
+ - Secure session IDs
94
+ - Session timeout
95
+ - Secure cookie attributes
96
+ - Session invalidation on logout
97
+ - Concurrent session handling
98
+
99
+ ### JWT Security
100
+ - Strong signing algorithms (RS256, ES256)
101
+ - Short expiration times
102
+ - Refresh token rotation
103
+ - Secure token storage
104
+ - Token revocation
105
+
106
+ ### Authorization Patterns
107
+ - RBAC (Role-Based Access Control)
108
+ - ABAC (Attribute-Based Access Control)
109
+ - OAuth 2.0 scopes
110
+ - API key management
111
+ - Claims-based authorization
112
+
113
+ ## Data Protection
114
+
115
+ ### Encryption
116
+ - Encryption at rest (AES-256)
117
+ - Encryption in transit (TLS 1.3)
118
+ - Key management (KMS, Vault)
119
+ - Database encryption (TDE)
120
+ - Field-level encryption
121
+
122
+ ### Secrets Management
123
+ - Never commit secrets to code
124
+ - Use environment variables
125
+ - Secrets management tools (Vault, AWS Secrets Manager)
126
+ - Regular rotation
127
+ - Least privilege access
128
+
129
+ ### PII Handling
130
+ - Data minimization
131
+ - Anonymization/pseudonymization
132
+ - Consent management
133
+ - Right to erasure
134
+ - Audit logging
135
+
136
+ ## Secure Coding Practices
137
+
138
+ ### Input Validation
139
+ - Whitelist validation
140
+ - Type checking
141
+ - Length limits
142
+ - Format validation (regex)
143
+ - Sanitization
144
+
145
+ ### Output Encoding
146
+ - HTML encoding
147
+ - JavaScript encoding
148
+ - URL encoding
149
+ - CSS encoding
150
+ - JSON encoding
151
+
152
+ ### Error Handling
153
+ - Don't leak sensitive info
154
+ - Generic error messages
155
+ - Log detailed errors securely
156
+ - Fail securely
157
+ - Stack trace exposure
158
+
159
+ ## Security Headers
160
+
161
+ Essential headers:
162
+ - Content-Security-Policy
163
+ - X-Content-Type-Options
164
+ - X-Frame-Options
165
+ - X-XSS-Protection
166
+ - Strict-Transport-Security
167
+ - Referrer-Policy
168
+ - Permissions-Policy
169
+
170
+ ## Dependency Security
171
+
172
+ ### Vulnerability Management
173
+ - Regular dependency audits
174
+ - Automated scanning (Snyk, Dependabot)
175
+ - SBOM generation
176
+ - License compliance
177
+ - Version pinning
178
+
179
+ ### Supply Chain Security
180
+ - Verify package signatures
181
+ - Use lock files
182
+ - Private registries
183
+ - Provenance attestation
184
+ - Reproducible builds
185
+
186
+ ## Security Testing
187
+
188
+ ### Static Analysis (SAST)
189
+ - Semgrep
190
+ - SonarQube
191
+ - Bandit (Python)
192
+ - ESLint security plugin
193
+
194
+ ### Dynamic Analysis (DAST)
195
+ - OWASP ZAP
196
+ - Burp Suite
197
+ - Nikto
198
+
199
+ ### Dependency Scanning
200
+ - npm audit
201
+ - Snyk
202
+ - OWASP Dependency-Check
203
+
204
+ ### Penetration Testing
205
+ - Reconnaissance
206
+ - Vulnerability scanning
207
+ - Exploitation
208
+ - Post-exploitation
209
+ - Reporting
@@ -0,0 +1,159 @@
1
+ ---
2
+ name: testing-strategies
3
+ description: Comprehensive testing approaches including unit, integration, and end-to-end testing patterns
4
+ license: Apache-2.0
5
+ compatibility: opencode
6
+ ---
7
+
8
+ # Testing Strategies Skill
9
+
10
+ This skill provides patterns and best practices for writing effective tests.
11
+
12
+ ## When to Use
13
+
14
+ Use this skill when:
15
+ - Setting up testing infrastructure
16
+ - Writing new tests
17
+ - Improving test coverage
18
+ - Debugging test failures
19
+ - Choosing testing tools
20
+
21
+ ## Testing Fundamentals
22
+
23
+ ### The Testing Pyramid
24
+ - Unit tests (70%) - Fast, isolated, cheap
25
+ - Integration tests (20%) - Medium speed, test interactions
26
+ - E2E tests (10%) - Slow, realistic, expensive
27
+
28
+ ### Test Quality Attributes
29
+ - Fast (< 100ms per test ideally)
30
+ - Independent (no shared state)
31
+ - Repeatable (same results every time)
32
+ - Self-validating (pass/fail clearly)
33
+ - Timely (written with or before code)
34
+
35
+ ## Unit Testing
36
+
37
+ ### Best Practices
38
+ - Test one concept per test
39
+ - Use descriptive test names
40
+ - Follow AAA pattern (Arrange, Act, Assert)
41
+ - Mock external dependencies
42
+ - Test edge cases and errors
43
+
44
+ ### Test Structure
45
+ ```typescript
46
+ describe('Calculator', () => {
47
+ describe('add', () => {
48
+ it('should return sum of two positive numbers', () => {
49
+ // Arrange
50
+ const calc = new Calculator();
51
+
52
+ // Act
53
+ const result = calc.add(2, 3);
54
+
55
+ // Assert
56
+ expect(result).toBe(5);
57
+ });
58
+
59
+ it('should handle negative numbers', () => {
60
+ const calc = new Calculator();
61
+ const result = calc.add(-2, -3);
62
+ expect(result).toBe(-5);
63
+ });
64
+ });
65
+ });
66
+ ```
67
+
68
+ ### Mocking Strategies
69
+ - Mock external APIs
70
+ - Mock database calls
71
+ - Mock file system operations
72
+ - Mock time (Date.now)
73
+ - Mock randomness
74
+
75
+ ## Integration Testing
76
+
77
+ ### Database Testing
78
+ - Use test database (in-memory or dedicated)
79
+ - Reset state between tests
80
+ - Test transactions
81
+ - Verify data integrity
82
+ - Test migrations
83
+
84
+ ### API Testing
85
+ - Test all endpoints
86
+ - Verify status codes
87
+ - Check response schemas
88
+ - Test authentication
89
+ - Test error scenarios
90
+
91
+ ### Component Testing
92
+ - Render components in isolation
93
+ - Test user interactions
94
+ - Verify state changes
95
+ - Check accessibility
96
+ - Test responsive behavior
97
+
98
+ ## End-to-End Testing
99
+
100
+ ### Best Practices
101
+ - Test critical user journeys
102
+ - Avoid testing implementation details
103
+ - Use data-testid attributes
104
+ - Handle async operations
105
+ - Clean up test data
106
+
107
+ ### Test Scenarios
108
+ - User registration/login
109
+ - Complete purchase flow
110
+ - CRUD operations
111
+ - Search functionality
112
+ - File uploads
113
+
114
+ ### Tools
115
+ - Playwright (recommended)
116
+ - Cypress
117
+ - Selenium
118
+ - Puppeteer
119
+
120
+ ## Test Coverage
121
+
122
+ ### Goals by Layer
123
+ - Business logic: >90%
124
+ - Utilities: >80%
125
+ - Components: >70%
126
+ - API routes: >80%
127
+ - Integration points: >75%
128
+
129
+ ### Coverage Reports
130
+ - Use coverage tools (Istanbul, c8)
131
+ - Track trends over time
132
+ - Focus on meaningful coverage
133
+ - Don't chase 100% blindly
134
+ - Identify untested critical paths
135
+
136
+ ## Testing Tools by Language
137
+
138
+ ### JavaScript/TypeScript
139
+ - Jest or Vitest (unit)
140
+ - React Testing Library (components)
141
+ - Playwright (e2e)
142
+ - MSW (API mocking)
143
+
144
+ ### Python
145
+ - pytest (unit/integration)
146
+ - pytest-asyncio (async)
147
+ - factory-boy (fixtures)
148
+ - Playwright (e2e)
149
+
150
+ ### Go
151
+ - Testing package (built-in)
152
+ - Testify (assertions)
153
+ - GoMock (mocking)
154
+ - Playwright (e2e)
155
+
156
+ ### Rust
157
+ - Built-in test framework
158
+ - Mockall (mocking)
159
+ - Playwright (e2e)