opencastle 1.6.2 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/bin/cli.mjs +19 -12
- package/dist/cli/adapters/adapter-contract.test.js +1 -1
- package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
- package/dist/cli/adapters/single-file-base.js +2 -12
- package/dist/cli/adapters/single-file-base.js.map +1 -1
- package/dist/cli/add.js +7 -7
- package/dist/cli/add.js.map +1 -1
- package/dist/cli/baseline.js +6 -6
- package/dist/cli/baseline.js.map +1 -1
- package/dist/cli/bootstrap.d.ts.map +1 -1
- package/dist/cli/bootstrap.js +15 -6
- package/dist/cli/bootstrap.js.map +1 -1
- package/dist/cli/bootstrap.test.js +8 -0
- package/dist/cli/bootstrap.test.js.map +1 -1
- package/dist/cli/ci.d.ts.map +1 -1
- package/dist/cli/ci.js +19 -9
- package/dist/cli/ci.js.map +1 -1
- package/dist/cli/command-namespace.test.js +4 -21
- package/dist/cli/command-namespace.test.js.map +1 -1
- package/dist/cli/convoy/engine.js +3 -3
- package/dist/cli/convoy/engine.js.map +1 -1
- package/dist/cli/convoy/engine.test.js +1 -1
- package/dist/cli/convoy/engine.test.js.map +1 -1
- package/dist/cli/convoy/read-model.d.ts +8 -15
- package/dist/cli/convoy/read-model.d.ts.map +1 -1
- package/dist/cli/convoy/read-model.js +9 -68
- package/dist/cli/convoy/read-model.js.map +1 -1
- package/dist/cli/convoy/read-model.test.js +6 -25
- package/dist/cli/convoy/read-model.test.js.map +1 -1
- package/dist/cli/convoy/spec-builder.d.ts +2 -2
- package/dist/cli/convoy/spec-builder.d.ts.map +1 -1
- package/dist/cli/convoy/spec-builder.js +3 -3
- package/dist/cli/convoy/spec-builder.js.map +1 -1
- package/dist/cli/convoy/spec-builder.test.js +2 -2
- package/dist/cli/convoy/spec-builder.test.js.map +1 -1
- package/dist/cli/convoy-cmd.js +16 -16
- package/dist/cli/convoy-cmd.js.map +1 -1
- package/dist/cli/convoy-cmd.test.js +11 -11
- package/dist/cli/convoy-cmd.test.js.map +1 -1
- package/dist/cli/dashboard.js +3 -3
- package/dist/cli/dashboard.js.map +1 -1
- package/dist/cli/dashboard.test.js +10 -2
- package/dist/cli/dashboard.test.js.map +1 -1
- package/dist/cli/dispatcher.test.js +7 -4
- package/dist/cli/dispatcher.test.js.map +1 -1
- package/dist/cli/docs-accuracy.test.js +5 -1
- package/dist/cli/docs-accuracy.test.js.map +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +17 -42
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/explain.js +2 -2
- package/dist/cli/explain.js.map +1 -1
- package/dist/cli/fleet.js +1 -1
- package/dist/cli/github-report.js +5 -5
- package/dist/cli/github-report.js.map +1 -1
- package/dist/cli/gitignore.js +1 -1
- package/dist/cli/gitignore.js.map +1 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +27 -10
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/layers.js +4 -4
- package/dist/cli/layers.js.map +1 -1
- package/dist/cli/lesson.js +12 -12
- package/dist/cli/lesson.js.map +1 -1
- package/dist/cli/lessons.d.ts.map +1 -1
- package/dist/cli/lessons.js +11 -7
- package/dist/cli/lessons.js.map +1 -1
- package/dist/cli/managed-block.js +1 -1
- package/dist/cli/managed-block.js.map +1 -1
- package/dist/cli/mcp-audit.js +6 -6
- package/dist/cli/mcp-audit.js.map +1 -1
- package/dist/cli/mcp-audit.test.js +5 -5
- package/dist/cli/mcp-audit.test.js.map +1 -1
- package/dist/cli/pipeline.d.ts +1 -1
- package/dist/cli/pipeline.flow.test.js +77 -77
- package/dist/cli/pipeline.flow.test.js.map +1 -1
- package/dist/cli/pipeline.js +30 -30
- package/dist/cli/pipeline.js.map +1 -1
- package/dist/cli/plan.d.ts +8 -2
- package/dist/cli/plan.d.ts.map +1 -1
- package/dist/cli/plan.js +18 -12
- package/dist/cli/plan.js.map +1 -1
- package/dist/cli/plan.test.js +17 -19
- package/dist/cli/plan.test.js.map +1 -1
- package/dist/cli/plugin.js +8 -8
- package/dist/cli/plugin.js.map +1 -1
- package/dist/cli/promote.js +5 -5
- package/dist/cli/promote.js.map +1 -1
- package/dist/cli/prompt.d.ts.map +1 -1
- package/dist/cli/prompt.js +15 -2
- package/dist/cli/prompt.js.map +1 -1
- package/dist/cli/prompt.test.js +33 -8
- package/dist/cli/prompt.test.js.map +1 -1
- package/dist/cli/remove.js +1 -1
- package/dist/cli/review.js +3 -3
- package/dist/cli/review.js.map +1 -1
- package/dist/cli/run/adapters/index.js +3 -3
- package/dist/cli/run/adapters/index.js.map +1 -1
- package/dist/cli/run/adapters/index.test.js +3 -3
- package/dist/cli/run/adapters/index.test.js.map +1 -1
- package/dist/cli/run/schema.js +3 -3
- package/dist/cli/run/schema.js.map +1 -1
- package/dist/cli/run.js +21 -21
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/run.test.js +3 -3
- package/dist/cli/run.test.js.map +1 -1
- package/dist/cli/stack-config-update.test.js +18 -1
- package/dist/cli/stack-config-update.test.js.map +1 -1
- package/dist/cli/stack-config.d.ts.map +1 -1
- package/dist/cli/stack-config.js +10 -1
- package/dist/cli/stack-config.js.map +1 -1
- package/dist/cli/status.js +9 -9
- package/dist/cli/status.js.map +1 -1
- package/dist/cli/status.test.js +3 -3
- package/dist/cli/status.test.js.map +1 -1
- package/dist/cli/sync-check.js +16 -16
- package/dist/cli/sync-check.js.map +1 -1
- package/dist/cli/sync.js +1 -1
- package/dist/cli/team-ci.test.js +3 -3
- package/dist/cli/team-ci.test.js.map +1 -1
- package/dist/cli/team-commands.test.js +30 -1
- package/dist/cli/team-commands.test.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +34 -66
- package/dist/cli/update.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/adapters/adapter-contract.test.ts +1 -1
- package/src/cli/adapters/single-file-base.ts +2 -11
- package/src/cli/add.ts +7 -7
- package/src/cli/baseline.ts +6 -6
- package/src/cli/bootstrap.test.ts +9 -0
- package/src/cli/bootstrap.ts +16 -6
- package/src/cli/ci.ts +17 -9
- package/src/cli/command-namespace.test.ts +5 -22
- package/src/cli/convoy/engine.test.ts +1 -1
- package/src/cli/convoy/engine.ts +3 -3
- package/src/{orchestrator/prompts/assess-complexity.prompt.md → cli/convoy/prompts/convoy-assess.prompt.md} +0 -3
- package/src/{orchestrator/prompts/fix-convoy.prompt.md → cli/convoy/prompts/convoy-plan-fix.prompt.md} +0 -3
- package/src/{orchestrator/prompts/validate-convoy.prompt.md → cli/convoy/prompts/convoy-plan-review.prompt.md} +0 -3
- package/src/{orchestrator/prompts/generate-convoy.prompt.md → cli/convoy/prompts/convoy-plan.prompt.md} +0 -2
- package/src/{orchestrator/prompts/fix-prd.prompt.md → cli/convoy/prompts/convoy-prd-fix.prompt.md} +0 -3
- package/src/{orchestrator/prompts/validate-prd.prompt.md → cli/convoy/prompts/convoy-prd-review.prompt.md} +0 -3
- package/src/{orchestrator/prompts/generate-prd.prompt.md → cli/convoy/prompts/convoy-prd.prompt.md} +0 -3
- package/src/cli/convoy/read-model.test.ts +5 -29
- package/src/cli/convoy/read-model.ts +11 -71
- package/src/cli/convoy/spec-builder.test.ts +2 -2
- package/src/cli/convoy/spec-builder.ts +4 -4
- package/src/cli/convoy-cmd.test.ts +11 -11
- package/src/cli/convoy-cmd.ts +18 -18
- package/src/cli/dashboard/dashboard.js +2 -4
- package/src/cli/dashboard.test.ts +10 -2
- package/src/cli/dashboard.ts +3 -3
- package/src/cli/dispatcher.test.ts +8 -4
- package/src/cli/docs-accuracy.test.ts +5 -1
- package/src/cli/doctor.ts +17 -43
- package/src/cli/explain.ts +2 -2
- package/src/cli/fleet.ts +1 -1
- package/src/cli/github-report.ts +5 -5
- package/src/cli/gitignore.ts +1 -1
- package/src/cli/init.ts +26 -10
- package/src/cli/layers.ts +4 -4
- package/src/cli/lesson.ts +12 -12
- package/src/cli/lessons.ts +11 -7
- package/src/cli/managed-block.ts +1 -1
- package/src/cli/mcp-audit.test.ts +5 -5
- package/src/cli/mcp-audit.ts +6 -6
- package/src/cli/pipeline.flow.test.ts +78 -78
- package/src/cli/pipeline.ts +31 -31
- package/src/cli/plan.test.ts +18 -20
- package/src/cli/plan.ts +18 -12
- package/src/cli/plugin.ts +8 -8
- package/src/cli/promote.ts +5 -5
- package/src/cli/prompt.test.ts +41 -13
- package/src/cli/prompt.ts +14 -2
- package/src/cli/remove.ts +1 -1
- package/src/cli/review.ts +3 -3
- package/src/cli/run/adapters/index.test.ts +3 -3
- package/src/cli/run/adapters/index.ts +3 -3
- package/src/cli/run/schema.ts +3 -3
- package/src/cli/run.test.ts +3 -3
- package/src/cli/run.ts +21 -21
- package/src/cli/stack-config-update.test.ts +22 -1
- package/src/cli/stack-config.ts +9 -1
- package/src/cli/status.test.ts +3 -3
- package/src/cli/status.ts +9 -9
- package/src/cli/sync-check.ts +16 -16
- package/src/cli/sync.ts +1 -1
- package/src/cli/team-ci.test.ts +3 -3
- package/src/cli/team-commands.test.ts +32 -1
- package/src/cli/update.ts +32 -74
- package/src/orchestrator/agent-workflows/README.md +10 -18
- package/src/orchestrator/agent-workflows/data-pipeline.md +7 -140
- package/src/orchestrator/agent-workflows/database-migration.md +7 -153
- package/src/orchestrator/agent-workflows/performance-optimization.md +6 -119
- package/src/orchestrator/agent-workflows/refactoring.md +8 -137
- package/src/orchestrator/agent-workflows/schema-changes.md +8 -159
- package/src/orchestrator/agent-workflows/security-audit.md +7 -142
- package/src/orchestrator/agent-workflows/shared-delivery-phase.md +8 -25
- package/src/orchestrator/agents/architect.agent.md +2 -14
- package/src/orchestrator/agents/content-engineer.agent.md +8 -10
- package/src/orchestrator/agents/data-engineer.agent.md +8 -8
- package/src/orchestrator/agents/developer.agent.md +3 -10
- package/src/orchestrator/agents/devops-expert.agent.md +0 -3
- package/src/orchestrator/agents/performance-expert.agent.md +2 -3
- package/src/orchestrator/agents/security-expert.agent.md +10 -12
- package/src/orchestrator/agents/team-lead.agent.md +31 -75
- package/src/orchestrator/agents/testing-expert.agent.md +3 -6
- package/src/orchestrator/agents/ui-ux-expert.agent.md +1 -4
- package/src/orchestrator/agents/writer.agent.md +0 -3
- package/src/orchestrator/customizations/LESSONS-LEARNED.md +5 -3
- package/src/orchestrator/customizations/README.md +3 -4
- package/src/orchestrator/customizations/agents/agent-registry.md +3 -3
- package/src/orchestrator/customizations/agents/skill-matrix.json +6 -42
- package/src/orchestrator/instructions/general.instructions.md +10 -37
- package/src/orchestrator/prompts/bootstrap-customizations.prompt.md +4 -6
- package/src/orchestrator/prompts/brainstorm.prompt.md +7 -12
- package/src/orchestrator/prompts/bug-fix.prompt.md +19 -100
- package/src/orchestrator/prompts/convoy.prompt.md +20 -0
- package/src/orchestrator/prompts/create-skill.prompt.md +1 -5
- package/src/orchestrator/prompts/implement-feature.prompt.md +22 -93
- package/src/orchestrator/prompts/resolve-pr-comments.prompt.md +1 -5
- package/src/orchestrator/skills/api-patterns/SKILL.md +21 -18
- package/src/orchestrator/skills/deployment-infrastructure/SKILL.md +1 -1
- package/src/orchestrator/skills/fast-review/SKILL.md +28 -65
- package/src/orchestrator/skills/frontend-design/REFERENCE.md +0 -1
- package/src/orchestrator/skills/frontend-design/SKILL.md +3 -1
- package/src/orchestrator/skills/git-workflow/SKILL.md +18 -34
- package/src/orchestrator/skills/panel-majority-vote/SKILL.md +16 -46
- package/src/orchestrator/skills/security-hardening/SKILL.md +20 -19
- package/src/orchestrator/skills/self-improvement/LESSON-CATEGORIES.md +2 -2
- package/src/orchestrator/skills/self-improvement/SKILL.md +21 -46
- package/src/orchestrator/skills/technical-writing/SKILL.md +3 -1
- package/src/orchestrator/skills/technical-writing/TEMPLATES.md +23 -0
- package/src/orchestrator/skills/testing-workflow/SKILL.md +21 -23
- package/src/orchestrator/skills/validation-gates/REFERENCE.md +2 -14
- package/src/orchestrator/skills/validation-gates/SKILL.md +10 -88
- package/dist/cli/log.d.ts +0 -44
- package/dist/cli/log.d.ts.map +0 -1
- package/dist/cli/log.js +0 -336
- package/dist/cli/log.js.map +0 -1
- package/dist/cli/log.test.d.ts +0 -2
- package/dist/cli/log.test.d.ts.map +0 -1
- package/dist/cli/log.test.js +0 -208
- package/dist/cli/log.test.js.map +0 -1
- package/src/cli/log.test.ts +0 -228
- package/src/cli/log.ts +0 -374
- package/src/orchestrator/agent-workflows/bug-fix.md +0 -130
- package/src/orchestrator/agent-workflows/feature-implementation.md +0 -232
- package/src/orchestrator/instructions/ai-optimization.instructions.md +0 -17
- package/src/orchestrator/prompts/quick-refinement.prompt.md +0 -110
- package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +0 -44
- package/src/orchestrator/skills/agent-hooks/SKILL.md +0 -80
- package/src/orchestrator/skills/agent-memory/KNOWLEDGE-GRAPH.md +0 -49
- package/src/orchestrator/skills/agent-memory/SKILL.md +0 -50
- package/src/orchestrator/skills/code-commenting/SKILL.md +0 -18
- package/src/orchestrator/skills/context-map/REFERENCE.md +0 -67
- package/src/orchestrator/skills/context-map/SKILL.md +0 -71
- package/src/orchestrator/skills/decomposition/SKILL.md +0 -103
- package/src/orchestrator/skills/documentation-standards/SKILL.md +0 -33
- package/src/orchestrator/skills/fast-review/REFERENCE.md +0 -28
- package/src/orchestrator/skills/memory-merger/SKILL.md +0 -77
- package/src/orchestrator/skills/observability-logging/LOG-SCHEMA.md +0 -238
- package/src/orchestrator/skills/observability-logging/SKILL.md +0 -73
- package/src/orchestrator/skills/orchestration-protocols/REFERENCE.md +0 -38
- package/src/orchestrator/skills/orchestration-protocols/SKILL.md +0 -120
- package/src/orchestrator/skills/panel-majority-vote/REFERENCE.md +0 -49
- package/src/orchestrator/skills/panel-majority-vote/panel-report.template.md +0 -38
- package/src/orchestrator/skills/performance-optimization/SKILL.md +0 -23
- package/src/orchestrator/skills/project-consistency/SKILL.md +0 -80
- package/src/orchestrator/skills/project-consistency/TEMPLATES.md +0 -35
- package/src/orchestrator/skills/react-development/SKILL.md +0 -24
- package/src/orchestrator/skills/session-checkpoints/CHECKPOINT-TEMPLATE.md +0 -56
- package/src/orchestrator/skills/session-checkpoints/SKILL.md +0 -40
- package/src/orchestrator/skills/team-lead-reference/SKILL.md +0 -126
|
@@ -1,166 +1,15 @@
|
|
|
1
1
|
<!-- ⚠️ This file is managed by OpenCastle. Edits will be overwritten on update. Customize in the .opencastle/ directory instead. -->
|
|
2
2
|
|
|
3
|
-
# Workflow: Schema
|
|
3
|
+
# Workflow: CMS Schema Changes
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
For a change to the content model: new types or fields, renames, and the queries and pages that use them. The CMS's own syntax and tools are in its skill and in `.opencastle/stack/<cms>-config.md`.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
1. **Analyse** (Content Engineer). Read the current schema and the queries the change affects, and check the content already in the CMS: what does a new required field mean for existing documents? Write down the field mapping, new against existing.
|
|
8
|
+
2. **Change the schema** (Content Engineer). Add the types and fields with their validation rules, register them, and run the CMS's own schema check. A rename or a removal ships with a migration — or keeps serving the old field under the new name until one does.
|
|
9
|
+
3. **Update the queries** (Content Engineer or Developer). Every query that reads the changed fields, and the types of their results; test them against real content.
|
|
10
|
+
4. **Integrate** (Developer). Update the pages and components, handling content that lacks the new field; run the tests, lint and build; check the pages in a browser.
|
|
11
|
+
5. **Verify** (Team Lead). The content model behaves in the CMS's editor, old content still renders, and the pages show the new fields.
|
|
8
12
|
|
|
9
|
-
##
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
Phase 1: Schema Analysis (sub-agent, inline)
|
|
13
|
-
Phase 2: Schema Implementation (sub-agent or background)
|
|
14
|
-
Phase 3: Query Updates (sub-agent, sequential)
|
|
15
|
-
Phase 4: Page Integration (sub-agent, sequential)
|
|
16
|
-
Phase 5: Verification (sub-agent, inline)
|
|
17
|
-
Phase 6: Delivery (direct, Team Lead)
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Branch & Delivery Strategy
|
|
23
|
-
|
|
24
|
-
The Team Lead creates the branch before any delegation and delivers it as the Delivery phase below describes. Branch naming: `feat/<ticket-id>-<short-description>` or `chore/<ticket-id>-<short-description>`.
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## Phase 1: Schema Analysis
|
|
29
|
-
|
|
30
|
-
**Agent:** Content Engineer (via sub-agent)
|
|
31
|
-
**Type:** Sub-agent (inline)
|
|
32
|
-
|
|
33
|
-
### Steps
|
|
34
|
-
|
|
35
|
-
1. Read current CMS schema to understand existing types
|
|
36
|
-
2. Check the data model documentation (Key Documentation in `.opencastle/project.instructions.md`) for field documentation
|
|
37
|
-
3. Check the query library (see CMS customization) for queries that will be affected
|
|
38
|
-
4. Verify schema changes don't conflict with existing content in the CMS
|
|
39
|
-
5. Document field mapping (new vs existing fields)
|
|
40
|
-
6. Create tracker issue with schema change details
|
|
41
|
-
|
|
42
|
-
### Exit Criteria
|
|
43
|
-
|
|
44
|
-
- [ ] Existing schema understood
|
|
45
|
-
- [ ] Impact on data queries assessed
|
|
46
|
-
- [ ] Impact on existing content assessed
|
|
47
|
-
- [ ] Tracker issue created
|
|
48
|
-
- [ ] Approach decided (new type vs modify existing)
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## Phase 2: Schema Implementation
|
|
53
|
-
|
|
54
|
-
**Agent:** Content Engineer
|
|
55
|
-
**Type:** Sub-agent (simple changes) or Background (complex schema additions)
|
|
56
|
-
|
|
57
|
-
### File Partition
|
|
58
|
-
|
|
59
|
-
> See the CMS customization file for project-specific paths.
|
|
60
|
-
|
|
61
|
-
- CMS schema directory — schema type files
|
|
62
|
-
- CMS config file — schema registry
|
|
63
|
-
|
|
64
|
-
### Steps
|
|
65
|
-
|
|
66
|
-
1. Create or modify schema type files using `defineType` / `defineField`
|
|
67
|
-
2. Add validation rules where appropriate
|
|
68
|
-
3. Update the schema index to register new types
|
|
69
|
-
4. Deploy schema (see CMS customization for deploy command)
|
|
70
|
-
5. Verify in CMS studio that the schema renders correctly
|
|
71
|
-
6. Create any necessary content for new types
|
|
72
|
-
|
|
73
|
-
### Exit Criteria
|
|
74
|
-
|
|
75
|
-
- [ ] Schema files created/modified
|
|
76
|
-
- [ ] Schema deployed successfully
|
|
77
|
-
- [ ] Schema renders correctly in CMS Studio
|
|
78
|
-
- [ ] Existing content not broken by changes
|
|
79
|
-
- [ ] Output contract returned
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## Phase 3: Query Updates
|
|
84
|
-
|
|
85
|
-
**Agent:** Content Engineer or Developer (via sub-agent)
|
|
86
|
-
**Type:** Sub-agent (sequential — depends on Phase 2)
|
|
87
|
-
|
|
88
|
-
### File Partition
|
|
89
|
-
|
|
90
|
-
> See the CMS customization file for project-specific query library paths.
|
|
91
|
-
|
|
92
|
-
- Query library — data query files
|
|
93
|
-
|
|
94
|
-
### Steps
|
|
95
|
-
|
|
96
|
-
1. Update data queries to include new/modified fields
|
|
97
|
-
2. Update TypeScript types for query results
|
|
98
|
-
3. Test queries in the CMS query tool
|
|
99
|
-
4. Run query library tests
|
|
100
|
-
|
|
101
|
-
### Exit Criteria
|
|
102
|
-
|
|
103
|
-
- [ ] Data queries updated
|
|
104
|
-
- [ ] TypeScript types match schema
|
|
105
|
-
- [ ] Queries tested in CMS query tool
|
|
106
|
-
- [ ] Query tests pass
|
|
107
|
-
- [ ] Output contract returned
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
## Phase 4: Page Integration
|
|
112
|
-
|
|
113
|
-
**Agent:** Developer (via sub-agent)
|
|
114
|
-
**Type:** Sub-agent (sequential — depends on Phase 3)
|
|
115
|
-
|
|
116
|
-
### File Partition
|
|
117
|
-
|
|
118
|
-
- Varies by feature — typically app page routes and shared UI components
|
|
119
|
-
|
|
120
|
-
### Steps
|
|
121
|
-
|
|
122
|
-
1. Update components to use new/modified fields
|
|
123
|
-
2. Handle missing data gracefully (backwards compatibility)
|
|
124
|
-
3. Run lint + test + build for affected projects
|
|
125
|
-
4. Start dev server and verify in browser
|
|
126
|
-
|
|
127
|
-
### Exit Criteria
|
|
128
|
-
|
|
129
|
-
- [ ] Components updated
|
|
130
|
-
- [ ] Missing data handled gracefully
|
|
131
|
-
- [ ] Lint + test + build pass
|
|
132
|
-
- [ ] Visual verification in browser
|
|
133
|
-
- [ ] Output contract returned
|
|
134
|
-
|
|
135
|
-
---
|
|
136
|
-
|
|
137
|
-
## Phase 5: Verification
|
|
138
|
-
|
|
139
|
-
**Agent:** Team Lead (self)
|
|
140
|
-
**Type:** Direct verification
|
|
141
|
-
|
|
142
|
-
### Steps
|
|
143
|
-
|
|
144
|
-
1. Review all output contracts
|
|
145
|
-
2. Verify in CMS that content can be created/edited
|
|
146
|
-
3. Start dev server and verify pages render correctly
|
|
147
|
-
4. Check both apps if shared schema/queries changed
|
|
148
|
-
5. Verify data model documentation is updated
|
|
149
|
-
6. Move tracker issue to Done
|
|
150
|
-
|
|
151
|
-
### Exit Criteria
|
|
152
|
-
|
|
153
|
-
- [ ] Schema works in CMS
|
|
154
|
-
- [ ] Pages render correctly in browser
|
|
155
|
-
- [ ] Both apps verified (if shared code changed)
|
|
156
|
-
- [ ] Data model documentation updated (if applicable)
|
|
157
|
-
- [ ] Tracker issue moved to Done
|
|
158
|
-
- [ ] Delivery phase completed — branch pushed, PR opened (not merged), tracker linked
|
|
159
|
-
|
|
160
|
-
---
|
|
161
|
-
|
|
162
|
-
### Phase 6: Delivery
|
|
13
|
+
## Delivery
|
|
163
14
|
|
|
164
15
|
> **See [shared-delivery-phase.md](shared-delivery-phase.md) for the standard delivery steps.**
|
|
165
|
-
>
|
|
166
|
-
> Commit → Push → PR → tracker linkage. Team Lead owns delivery.
|
|
@@ -2,149 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
# Workflow: Security Audit
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
For a security review of the whole application or one area of it, and fixing what it finds. The rules it checks against: **security-hardening**, and the skills of the stack's database and framework.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
1. **Scope** (Team Lead). The whole application or one area; the known issues; the auth flow; every endpoint and server action.
|
|
8
|
+
2. **Automated checks** (Security Expert). Lint with security rules, a secret scan (**validation-gates**), the dependency audit, the security headers and CSP of a running build, access control enabled on every table, and every place that renders raw HTML.
|
|
9
|
+
3. **Manual review** (Security Expert). Authentication and sessions; authorization and route protection; access policies; input validation on every endpoint; CSRF; rate limiting; error responses; OAuth callbacks, state and PKCE; headers; cookie flags. Each finding rated Critical, High, Medium or Low.
|
|
10
|
+
4. **Panel** — **panel-majority-vote** on the findings and the files they name, asking "Are there unmitigated vulnerabilities in this code?"
|
|
11
|
+
5. **Fix** (Security Expert, or the Developer for application code). Critical and High first; an issue in the tracker for each Medium or Low left for later; the panel again if it blocked. A risk accepted on purpose goes in `.opencastle/KNOWN-ISSUES.md`.
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
Phase 1: Scope & Context (sub-agent, inline)
|
|
11
|
-
Phase 2: Automated Checks (sub-agent, inline)
|
|
12
|
-
Phase 3: Manual Review (background agent)
|
|
13
|
-
Phase 4: Panel Review (sub-agent, inline)
|
|
14
|
-
Phase 5: Remediation (sub-agent or background)
|
|
15
|
-
Phase 6: Delivery (direct, Team Lead)
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## Branch & Delivery Strategy
|
|
21
|
-
|
|
22
|
-
The Team Lead creates the branch before any delegation and delivers it as the Delivery phase below describes. Branch naming: `fix/<ticket-id>-<short-description>` for remediations.
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## Phase 1: Scope & Context
|
|
27
|
-
|
|
28
|
-
**Agent:** Team Lead (self)
|
|
29
|
-
**Type:** Direct research
|
|
30
|
-
|
|
31
|
-
### Steps
|
|
32
|
-
|
|
33
|
-
1. Define audit scope (full audit vs. targeted area)
|
|
34
|
-
2. Read `.opencastle/project.instructions.md` security sections
|
|
35
|
-
3. Read `.opencastle/KNOWN-ISSUES.md` for existing security items
|
|
36
|
-
4. Check current CSP configuration in `next.config.js`
|
|
37
|
-
5. Review auth flow (see database/auth customization for library paths)
|
|
38
|
-
6. Map all API routes and Server Actions
|
|
39
|
-
7. Create tracker issue for the audit
|
|
40
|
-
|
|
41
|
-
### Exit Criteria
|
|
42
|
-
|
|
43
|
-
- [ ] Scope defined (which apps, libs, routes)
|
|
44
|
-
- [ ] Existing security docs reviewed
|
|
45
|
-
- [ ] Attack surface mapped
|
|
46
|
-
- [ ] Tracker issue created
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## Phase 2: Automated Checks
|
|
51
|
-
|
|
52
|
-
**Agent:** Security Expert (via sub-agent)
|
|
53
|
-
**Type:** Sub-agent (inline)
|
|
54
|
-
|
|
55
|
-
### Steps
|
|
56
|
-
|
|
57
|
-
1. Run lint with security rules
|
|
58
|
-
2. Check for hardcoded secrets (`grep -r "password\|secret\|api_key"`)
|
|
59
|
-
3. Validate CSP headers
|
|
60
|
-
4. Check dependency vulnerabilities (`yarn audit`)
|
|
61
|
-
5. Verify RLS is enabled on all database tables
|
|
62
|
-
6. Check for `dangerouslySetInnerHTML` usage
|
|
63
|
-
|
|
64
|
-
### Exit Criteria
|
|
65
|
-
|
|
66
|
-
- [ ] No hardcoded secrets found
|
|
67
|
-
- [ ] CSP headers valid
|
|
68
|
-
- [ ] Dependency audit clean (or known issues documented)
|
|
69
|
-
- [ ] RLS enabled on all tables
|
|
70
|
-
- [ ] No unsafe HTML injection points
|
|
71
|
-
- [ ] Findings documented
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
## Phase 3: Manual Review
|
|
76
|
-
|
|
77
|
-
**Agent:** Security Expert
|
|
78
|
-
**Type:** Background agent
|
|
79
|
-
|
|
80
|
-
### Checklist
|
|
81
|
-
|
|
82
|
-
- [ ] **Authentication:** Session handling, token refresh, logout flow
|
|
83
|
-
- [ ] **Authorization:** Role checks, route protection, middleware
|
|
84
|
-
- [ ] **RLS Policies:** Default-deny, explicit-allow, policy correctness
|
|
85
|
-
- [ ] **Input Validation:** Zod schemas on all API routes and Server Actions
|
|
86
|
-
- [ ] **CSRF Protection:** Server Actions use form tokens
|
|
87
|
-
- [ ] **Rate Limiting:** Proxy layer, per-IP limits, fingerprinting
|
|
88
|
-
- [ ] **Error Handling:** No sensitive data in error responses
|
|
89
|
-
- [ ] **OAuth:** Callback URLs, state parameter, PKCE
|
|
90
|
-
- [ ] **Headers:** HSTS, X-Content-Type-Options, X-Frame-Options
|
|
91
|
-
- [ ] **Cookies:** HttpOnly, Secure, SameSite flags
|
|
92
|
-
|
|
93
|
-
### Exit Criteria
|
|
94
|
-
|
|
95
|
-
- [ ] All checklist items reviewed
|
|
96
|
-
- [ ] Findings categorized by severity
|
|
97
|
-
- [ ] Output contract returned with findings list
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
## Phase 4: Panel Review
|
|
102
|
-
|
|
103
|
-
**Agent:** Team Lead (orchestrates panel)
|
|
104
|
-
**Type:** Sub-agent (inline)
|
|
105
|
-
|
|
106
|
-
### Steps
|
|
107
|
-
|
|
108
|
-
1. Load **panel-majority-vote** skill
|
|
109
|
-
2. Provide Phase 3 findings and affected files as in-scope artifacts
|
|
110
|
-
3. Panel question: "Are there any unmitigated security vulnerabilities in the reviewed code?"
|
|
111
|
-
4. Run 3 reviewer sub-agents
|
|
112
|
-
5. Consolidate results
|
|
113
|
-
|
|
114
|
-
### Exit Criteria
|
|
115
|
-
|
|
116
|
-
- [ ] Panel completed (PASS or BLOCK)
|
|
117
|
-
- [ ] Panel report linked to tracker issue
|
|
118
|
-
- [ ] If BLOCK: MUST-FIX items extracted
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## Phase 5: Remediation
|
|
123
|
-
|
|
124
|
-
**Agent:** Security Expert or Developer (depends on finding)
|
|
125
|
-
**Type:** Sub-agent (critical fixes) or Background (non-critical)
|
|
126
|
-
|
|
127
|
-
### Steps
|
|
128
|
-
|
|
129
|
-
1. Fix Critical and High severity findings first
|
|
130
|
-
2. Create separate tracker issues for Medium/Low findings if not fixing now
|
|
131
|
-
3. Run verification after each fix
|
|
132
|
-
4. Re-run panel review if initial panel BLOCKed
|
|
133
|
-
5. Update `.opencastle/KNOWN-ISSUES.md` for any accepted risks
|
|
134
|
-
|
|
135
|
-
### Exit Criteria
|
|
136
|
-
|
|
137
|
-
- [ ] Critical/High findings remediated
|
|
138
|
-
- [ ] Medium/Low findings tracked in tracker
|
|
139
|
-
- [ ] Panel review passed (if applicable)
|
|
140
|
-
- [ ] Known issues updated for accepted risks
|
|
141
|
-
- [ ] All tracker issues updated
|
|
142
|
-
- [ ] Delivery phase completed — branch pushed, PR opened (not merged), tracker linked
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
### Phase 6: Delivery
|
|
13
|
+
## Delivery
|
|
147
14
|
|
|
148
15
|
> **See [shared-delivery-phase.md](shared-delivery-phase.md) for the standard delivery steps.**
|
|
149
|
-
>
|
|
150
|
-
> Commit → Push → PR → tracker linkage. Team Lead owns delivery.
|
|
@@ -2,34 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
# Shared Delivery Phase
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The last phase of every workflow template, once the work is implemented and verified.
|
|
6
6
|
|
|
7
7
|
## Steps
|
|
8
8
|
|
|
9
|
-
1. **Commit
|
|
10
|
-
2. **Push
|
|
11
|
-
3. **Open a
|
|
9
|
+
1. **Commit** to the feature branch, with the tracker issue ID in the messages when there is one.
|
|
10
|
+
2. **Push** it: `git push -u origin <branch>`.
|
|
11
|
+
3. **Open a pull request**, with the body written to a file first so the shell cannot mangle it:
|
|
12
12
|
```bash
|
|
13
|
-
GH_PAGER=cat gh pr create --base main --title "
|
|
13
|
+
GH_PAGER=cat gh pr create --base main --title "<title>" --body-file /tmp/pr-body.md
|
|
14
14
|
```
|
|
15
|
-
4. **Do NOT merge** —
|
|
16
|
-
5. **
|
|
17
|
-
6. **Clean up session checkpoint** if one exists
|
|
15
|
+
4. **Do NOT merge** — a person reviews and merges it.
|
|
16
|
+
5. **Link it** from the tracker issue, when there is one.
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
The **Team Lead owns delivery**, not individual specialist agents:
|
|
22
|
-
|
|
23
|
-
- **Team Lead creates the branch** in Phase 1 before any delegation
|
|
24
|
-
- **Sub-agents** work directly on the Team Lead's branch (shared working tree)
|
|
25
|
-
- **Background agents** work in isolated worktrees branched from the feature branch
|
|
26
|
-
- **Team Lead merges worktrees back** during verification
|
|
27
|
-
- **Only the Team Lead pushes** to the branch and opens the PR
|
|
28
|
-
|
|
29
|
-
## Exit Criteria
|
|
30
|
-
|
|
31
|
-
- [ ] All changes committed with tracker issue IDs in messages
|
|
32
|
-
- [ ] Branch pushed to origin
|
|
33
|
-
- [ ] PR opened on GitHub (NOT merged)
|
|
34
|
-
- [ ] Tracker issues updated with PR URL
|
|
35
|
-
- [ ] All project issues marked Done or Cancelled
|
|
18
|
+
Whoever coordinates the work owns delivery: the Team Lead creates the branch before delegating, sub-agents work on that branch, and only the Team Lead pushes and opens the pull request.
|
|
@@ -9,8 +9,7 @@ user-invocable: false
|
|
|
9
9
|
# Software Architect
|
|
10
10
|
|
|
11
11
|
Strategic decisions, system design, ADRs, technology evaluation, roadmap. Advises;
|
|
12
|
-
never implements.
|
|
13
|
-
architecture, performance at scale, i18n, monetization.
|
|
12
|
+
never implements.
|
|
14
13
|
|
|
15
14
|
## Skills
|
|
16
15
|
|
|
@@ -19,7 +18,7 @@ Resolve skills (slots, direct) via `.opencastle/agents/skill-matrix.json`.
|
|
|
19
18
|
## Rules
|
|
20
19
|
|
|
21
20
|
1. **Never propose a big-bang rewrite** — find the incremental path, or defer the decision
|
|
22
|
-
2. **Every architectural decision gets an ADR
|
|
21
|
+
2. **Every architectural decision gets an ADR**, where the project keeps them — or `.opencastle/project/decisions.md`, created with the first one (the ADR template is in **technical-writing**)
|
|
23
22
|
3. **Check shared vs. app-specific boundaries** before recommending anything multi-app; map the dependency graph first
|
|
24
23
|
4. **No clear winner → document the trade-offs and let the team decide.** Do not force a call
|
|
25
24
|
|
|
@@ -27,14 +26,6 @@ Resolve skills (slots, direct) via `.opencastle/agents/skill-matrix.json`.
|
|
|
27
26
|
|
|
28
27
|
Apps → libs (never reverse) · UI never fetches data · no barrel files · co-locate code changing together
|
|
29
28
|
|
|
30
|
-
## ADR Template
|
|
31
|
-
|
|
32
|
-
```markdown
|
|
33
|
-
## ADR-XXX: [Title]
|
|
34
|
-
**Date:** YYYY-MM-DD **Status:** Proposed | Accepted | Deprecated | Superseded
|
|
35
|
-
**Context:** … **Decision:** … **Consequences:** … **Alternatives Considered:** …
|
|
36
|
-
```
|
|
37
|
-
|
|
38
29
|
## Agent-Native Review
|
|
39
30
|
|
|
40
31
|
For new features and APIs, assess whether an AI agent can consume them:
|
|
@@ -56,6 +47,3 @@ Implementing changes · writing tests · DB/schema changes · deploying infrastr
|
|
|
56
47
|
|
|
57
48
|
1. **Assessment** — APPROVE / CONCERNS / RETHINK + rationale
|
|
58
49
|
2. **Strengths** · **Risks** (likelihood + impact) · **Alternatives** · **Action Items**
|
|
59
|
-
|
|
60
|
-
End with the standard closing items from the project instructions: observability
|
|
61
|
-
logged, discovered issues, lessons applied.
|
|
@@ -16,14 +16,15 @@ Resolve skills (slots, direct) via `.opencastle/agents/skill-matrix.json`.
|
|
|
16
16
|
|
|
17
17
|
## Rules
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
The CMS's own syntax, tools and gotchas are in the skill bound to the **cms** slot.
|
|
20
|
+
|
|
21
|
+
1. **Read the schema before writing a query** — the schema files in the repository, or the CMS's schema tool; trust the local files over the remote.
|
|
22
|
+
2. **Check whether a field is a list** before projecting it.
|
|
21
23
|
3. **Queries live in the shared query library**, never inline in components. Document non-obvious filters inline.
|
|
22
|
-
4. **
|
|
23
|
-
5. **Validate
|
|
24
|
-
6. **Renaming or removing a field breaks backward
|
|
25
|
-
7. **New API endpoints belong to Developer** — hand off rather than adding routes.
|
|
26
|
-
8. `defineType` / `defineField` for schema; `references()` for relational fields.
|
|
24
|
+
4. **Never mix draft and published content** in one result. A query that returns nothing for content you know exists is usually missing the draft filter.
|
|
25
|
+
5. **Validate a query against real content, and a schema change with the CMS's own check, before deploying.**
|
|
26
|
+
6. **Renaming or removing a field breaks backward compatibility** unless a migration ships with it. During a rename, serve the old field under the new name.
|
|
27
|
+
7. **New API endpoints belong to the Developer** — hand off rather than adding routes.
|
|
27
28
|
|
|
28
29
|
## Verification
|
|
29
30
|
|
|
@@ -39,6 +40,3 @@ UI components · DB migrations mirroring CMS data · E2E tests for CMS pages ·
|
|
|
39
40
|
2. **Queries** — new/modified queries with purpose
|
|
40
41
|
3. **Verification** — schema deploy result, query test results
|
|
41
42
|
4. **Migration Notes** — any data migration needed
|
|
42
|
-
|
|
43
|
-
End with the standard closing items from the project instructions: observability
|
|
44
|
-
logged, discovered issues, lessons applied.
|
|
@@ -18,13 +18,16 @@ Resolve skills (slots, direct) via `.opencastle/agents/skill-matrix.json`.
|
|
|
18
18
|
## Rules — schema and migrations
|
|
19
19
|
|
|
20
20
|
1. **Always write a migration.** Never modify a schema directly.
|
|
21
|
-
2. **
|
|
22
|
-
|
|
21
|
+
2. **Guard every table** with the access control the database offers —
|
|
22
|
+
row-level security, rules, or checks in the one data layer every query goes
|
|
23
|
+
through. Derive identity from the verified session, never from a
|
|
24
|
+
client-supplied user id. The database's own syntax is in its skill.
|
|
23
25
|
3. **Test policies from every relevant role** — anonymous, authenticated, and any
|
|
24
26
|
custom role. A policy that was never exercised from an anonymous session is
|
|
25
27
|
untested.
|
|
26
|
-
4. **Migrations must be re-runnable** — guard with `IF NOT EXISTS` and `IF EXISTS
|
|
27
|
-
|
|
28
|
+
4. **Migrations must be re-runnable** — guard with `IF NOT EXISTS` and `IF EXISTS`,
|
|
29
|
+
or the migration tool's own checks.
|
|
30
|
+
5. **Document the rollback** — the reverse migration — in the same change.
|
|
28
31
|
6. **Index what you query.** `EXPLAIN ANALYZE` a slow query; a sequential scan on
|
|
29
32
|
a large table is a missing index.
|
|
30
33
|
|
|
@@ -57,9 +60,6 @@ production deployment
|
|
|
57
60
|
|
|
58
61
|
1. **Migrations** — files and what each changes
|
|
59
62
|
2. **Policies** — the access intent, and which roles were tested
|
|
60
|
-
3. **Rollback** — the reverse
|
|
63
|
+
3. **Rollback** — the reverse migration
|
|
61
64
|
4. **Data impact** — rows affected, records skipped and why
|
|
62
65
|
5. **Verification** — apply results, test queries, pipeline counts
|
|
63
|
-
|
|
64
|
-
End with the standard closing items from the project instructions: observability
|
|
65
|
-
logged, discovered issues, lessons applied.
|
|
@@ -23,19 +23,15 @@ Resolve skills (slots, direct) via `.opencastle/agents/skill-matrix.json`.
|
|
|
23
23
|
4. **Co-locate** component, styles, and tests in one directory. Shared components → UI library; queries → data layer.
|
|
24
24
|
5. **Never invent a design value.** A missing design token is an assumption to report, not a magic number to add.
|
|
25
25
|
6. **Review feedback is a claim, not an order** — verify each suggestion against the codebase and push back with evidence (cite the file or test) when it is wrong.
|
|
26
|
-
7.
|
|
26
|
+
7. Several agents building UI at once: the foundation comes first (**frontend-design**).
|
|
27
27
|
|
|
28
28
|
## File Size Limits
|
|
29
29
|
|
|
30
30
|
Target ≤ 500 lines/file. 500–800: use line-range reads. **>800 → propose a split before editing.**
|
|
31
31
|
|
|
32
|
-
## API
|
|
32
|
+
## API work
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
2. **Validate every input with a schema.** Client input is never trusted.
|
|
36
|
-
3. **Return typed error codes**, not a generic 500: 422 for validation failures, 409 for conflicts.
|
|
37
|
-
4. **Keep conventions uniform** across endpoints — naming, error shape, pagination. If existing routes already disagree, document the variance and propose one way forward rather than adding a third.
|
|
38
|
-
5. **Version from the start.** Removing a version later is easier than adding one retroactively.
|
|
34
|
+
Endpoints, server actions and external APIs follow **api-patterns**: the contract before the handler, a schema on every input.
|
|
39
35
|
|
|
40
36
|
## Verification
|
|
41
37
|
|
|
@@ -51,6 +47,3 @@ Database migrations · security policy changes · CMS schema changes · E2E/brow
|
|
|
51
47
|
2. **Verification Results** — lint/test/build pass/fail + error count
|
|
52
48
|
3. **Acceptance Criteria Status** — checklist, each item ✅ or ❌
|
|
53
49
|
4. **Assumptions Made** — decisions not explicitly specified
|
|
54
|
-
|
|
55
|
-
End with the standard closing items from the project instructions: observability
|
|
56
|
-
logged, discovered issues, lessons applied.
|
|
@@ -49,6 +49,3 @@ Application code · business logic · DB migrations · RLS policies · CMS schem
|
|
|
49
49
|
3. **Verification** — build result, deployment status, health check
|
|
50
50
|
4. **Rollback Plan** — how to revert if the deployment causes issues
|
|
51
51
|
5. **Monitoring** — what to watch after deployment
|
|
52
|
-
|
|
53
|
-
End with the standard closing items from the project instructions: observability
|
|
54
|
-
logged, discovered issues, lessons applied.
|
|
@@ -25,6 +25,8 @@ Resolve skills (slots, direct) via `.opencastle/agents/skill-matrix.json`.
|
|
|
25
25
|
7. **Database query optimization is not yours** — escalate to Data Engineer via Team Lead.
|
|
26
26
|
8. Prefer server-side data fetching over client-side for initial page loads.
|
|
27
27
|
9. Bundle size high with no obvious offender → `vite-bundle-analyzer` or Next.js `--analyze`.
|
|
28
|
+
10. **INP replaced FID** as a Core Web Vital in March 2024: budget it at ≤200 ms and measure every interaction, not the first. Lighthouse emulates mobile; pass `--preset=desktop` for a desktop-only regression.
|
|
29
|
+
11. **Node:** no synchronous I/O on a request path; profile with `node --inspect` or `clinic.js`. React: the DevTools Profiler or `<Profiler onRender>`.
|
|
28
30
|
|
|
29
31
|
## Verification
|
|
30
32
|
|
|
@@ -41,6 +43,3 @@ Architecture rewrites · database query optimization · infrastructure and CDN c
|
|
|
41
43
|
3. **Verification** — profiling results, Lighthouse scores, build analysis
|
|
42
44
|
4. **Trade-offs** — DX or functionality costs
|
|
43
45
|
5. **Further Opportunities** — optimizations identified but not implemented
|
|
44
|
-
|
|
45
|
-
End with the standard closing items from the project instructions: observability
|
|
46
|
-
logged, discovered issues, lessons applied.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Security expert: authentication, authorization,
|
|
2
|
+
description: "Security expert: authentication, authorization, data access policies, security headers, input validation, API security, vulnerability management."
|
|
3
3
|
name: "Security Expert"
|
|
4
4
|
tier: premium
|
|
5
5
|
tools: ["search/changes", "search/codebase", "edit/editFiles", "web/fetch", "vscode/getProjectSetupInfo", "vscode/installExtension", "vscode/newWorkspace", "vscode/runCommand", "read/problems", "execute/getTerminalOutput", "execute/runInTerminal", "read/terminalLastCommand", "read/terminalSelection", "search", "execute/testFailure", "search/usages"]
|
|
@@ -8,8 +8,9 @@ user-invocable: false
|
|
|
8
8
|
|
|
9
9
|
# Security Expert
|
|
10
10
|
|
|
11
|
-
Authentication, authorization,
|
|
12
|
-
API security, vulnerability management.
|
|
11
|
+
Authentication, authorization, data access policies, security headers, input
|
|
12
|
+
validation, API security, vulnerability management. The stack's specifics are in
|
|
13
|
+
the skills of the **database** and **framework** slots.
|
|
13
14
|
|
|
14
15
|
## Skills
|
|
15
16
|
|
|
@@ -18,10 +19,10 @@ Resolve skills (slots, direct) via `.opencastle/agents/skill-matrix.json`.
|
|
|
18
19
|
## Rules
|
|
19
20
|
|
|
20
21
|
1. **Never commit a secret.** Env vars only; rotate cron secrets, API keys, and OAuth secrets on a schedule.
|
|
21
|
-
2. **
|
|
22
|
-
3. **Validate server-side with a
|
|
22
|
+
2. **Access policies at the data layer** where it has them (row-level security, rules): on every table, default-deny, explicit-allow. Test each policy from every relevant role, including one that must read nothing.
|
|
23
|
+
3. **Validate server-side with a schema before any database operation.** Client-side validation is not validation.
|
|
23
24
|
4. **Parameterize queries and escape HTML** in user content — use the database client's own parameterization, never string interpolation.
|
|
24
|
-
5. **Never roll your own auth or crypto** — established
|
|
25
|
+
5. **Never roll your own auth or crypto** — the project's auth library and established primitives (bcrypt, argon2) only. Auth operations run on the server.
|
|
25
26
|
6. **Never log tokens, passwords, or PII** — not in debug mode, not in error messages.
|
|
26
27
|
7. **Never disable a security feature "temporarily" in production.** Defense in depth, not obscurity.
|
|
27
28
|
8. **CSP: add the specific source.** Never `*`, never `unsafe-inline`.
|
|
@@ -29,19 +30,16 @@ Resolve skills (slots, direct) via `.opencastle/agents/skill-matrix.json`.
|
|
|
29
30
|
|
|
30
31
|
## Verification
|
|
31
32
|
|
|
32
|
-
Every finding rated Critical / High / Medium / Low · fixes given as concrete code or config changes ·
|
|
33
|
+
Every finding rated Critical / High / Medium / Low · fixes given as concrete code or config changes · access policies exercised from multiple roles · security headers verified · residual risk stated explicitly
|
|
33
34
|
|
|
34
35
|
## Out of Scope
|
|
35
36
|
|
|
36
|
-
Feature code beyond security-specific changes · comprehensive test suites · schema design beyond
|
|
37
|
+
Feature code beyond security-specific changes · comprehensive test suites · schema design beyond access policies · UI/UX
|
|
37
38
|
|
|
38
39
|
## Output Contract
|
|
39
40
|
|
|
40
41
|
1. **Findings** — severity (Critical/High/Medium/Low) per finding
|
|
41
42
|
2. **Changes Made** — files modified with security-relevant details
|
|
42
|
-
3. **Verification** — tests run,
|
|
43
|
+
3. **Verification** — tests run, access-policy checks, header validation
|
|
43
44
|
4. **Residual Risk** — known risks remaining after the fix
|
|
44
45
|
5. **Recommendations** — follow-up improvements to consider
|
|
45
|
-
|
|
46
|
-
End with the standard closing items from the project instructions: observability
|
|
47
|
-
logged, discovered issues, lessons applied.
|