contextos-agents 2.2.0 → 2.3.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/.agents/AGENTS.md +53 -396
- package/.agents/adapters/aider/export.js +11 -16
- package/.agents/adapters/claude/export.js +13 -13
- package/.agents/adapters/copilot/export.js +29 -8
- package/.agents/adapters/cursor/export.js +9 -18
- package/.agents/adapters/gemini/export.js +11 -46
- package/.agents/adapters/pure-compiler.js +65 -42
- package/.agents/adapters/shared.js +35 -1
- package/.agents/adapters/zed/export.js +2 -2
- package/.agents/compiled/registry.v2.json +30 -18
- package/.agents/compiled/registry.v2.sha256 +1 -1
- package/.agents/compiler/manifest-compiler.js +5 -29
- package/.agents/core/skills/context-os/references/project-graph.md +3 -3
- package/.agents/core/skills/engineering-workflow/SKILL.md +11 -316
- package/.agents/core/skills/engineering-workflow/references/workflow.md +336 -0
- package/.agents/core/skills/engineering-workflow/skill.yaml +2 -4
- package/.agents/core/skills/gstack-roles/SKILL.md +11 -128
- package/.agents/core/skills/gstack-roles/references/roles.md +149 -0
- package/.agents/core/skills/gstack-roles/skill.yaml +2 -4
- package/.agents/core/skills/ponytail-mindset/SKILL.md +13 -165
- package/.agents/core/skills/ponytail-mindset/references/minimalism.md +186 -0
- package/.agents/core/skills/ponytail-mindset/skill.yaml +2 -5
- package/.agents/core/skills/security/skill.yaml +1 -0
- package/.agents/ctx.js +13 -13
- package/.agents/customization-dx.js +13 -9
- package/.agents/doctor.js +2 -2
- package/.agents/generated/claude/skills/context-manager/EXAMPLES.md +19 -0
- package/.agents/generated/claude/skills/context-manager/SKILL.md +0 -29
- package/.agents/generated/claude/skills/context-manager/TROUBLESHOOTING.md +7 -0
- package/.agents/generated/claude/skills/context-manager/VALIDATION.json +12 -0
- package/.agents/generated/claude/skills/context-manager/references/context-rules.md +59 -0
- package/.agents/generated/claude/skills/context-os/EXAMPLES.md +21 -0
- package/.agents/generated/claude/skills/context-os/SKILL.md +0 -31
- package/.agents/generated/claude/skills/context-os/TROUBLESHOOTING.md +7 -0
- package/.agents/generated/claude/skills/context-os/VALIDATION.json +12 -0
- package/.agents/generated/claude/skills/context-os/packs.yaml +59 -0
- package/.agents/generated/claude/skills/context-os/references/context-rules.md +68 -0
- package/.agents/generated/claude/skills/context-os/references/pipeline.md +119 -0
- package/.agents/generated/claude/skills/context-os/references/project-graph.md +103 -0
- package/.agents/generated/claude/skills/context-os/rules.yaml +135 -0
- package/.agents/generated/claude/skills/engineering-workflow/EXAMPLES.md +57 -0
- package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +10 -391
- package/.agents/generated/claude/skills/engineering-workflow/TROUBLESHOOTING.md +19 -0
- package/.agents/generated/claude/skills/engineering-workflow/VALIDATION.json +12 -0
- package/.agents/generated/claude/skills/engineering-workflow/references/workflow.md +336 -0
- package/.agents/generated/claude/skills/gemini-precision/EXAMPLES.md +72 -0
- package/.agents/generated/claude/skills/gemini-precision/SKILL.md +0 -100
- package/.agents/generated/claude/skills/gemini-precision/TROUBLESHOOTING.md +25 -0
- package/.agents/generated/claude/skills/gemini-precision/VALIDATION.json +12 -0
- package/.agents/generated/claude/skills/gstack-roles/EXAMPLES.md +23 -0
- package/.agents/generated/claude/skills/gstack-roles/SKILL.md +10 -164
- package/.agents/generated/claude/skills/gstack-roles/TROUBLESHOOTING.md +13 -0
- package/.agents/generated/claude/skills/gstack-roles/VALIDATION.json +12 -0
- package/.agents/generated/claude/skills/gstack-roles/references/roles.md +149 -0
- package/.agents/generated/claude/skills/ponytail-mindset/EXAMPLES.md +45 -0
- package/.agents/generated/claude/skills/ponytail-mindset/SKILL.md +12 -228
- package/.agents/generated/claude/skills/ponytail-mindset/TROUBLESHOOTING.md +19 -0
- package/.agents/generated/claude/skills/ponytail-mindset/VALIDATION.json +12 -0
- package/.agents/generated/claude/skills/ponytail-mindset/references/minimalism.md +186 -0
- package/.agents/generated/claude/skills/security/EXAMPLES.md +64 -0
- package/.agents/generated/claude/skills/security/SKILL.md +0 -86
- package/.agents/generated/claude/skills/security/TROUBLESHOOTING.md +19 -0
- package/.agents/generated/claude/skills/security/VALIDATION.json +12 -0
- package/.agents/generated/gemini/skills/context-manager/EXAMPLES.md +19 -0
- package/.agents/generated/gemini/skills/context-manager/SKILL.md +1 -33
- package/.agents/generated/gemini/skills/context-manager/TROUBLESHOOTING.md +7 -0
- package/.agents/generated/gemini/skills/context-manager/VALIDATION.json +12 -0
- package/.agents/generated/gemini/skills/context-manager/references/context-rules.md +59 -0
- package/.agents/generated/gemini/skills/context-os/EXAMPLES.md +21 -0
- package/.agents/generated/gemini/skills/context-os/SKILL.md +0 -35
- package/.agents/generated/gemini/skills/context-os/TROUBLESHOOTING.md +7 -0
- package/.agents/generated/gemini/skills/context-os/VALIDATION.json +12 -0
- package/.agents/generated/gemini/skills/context-os/packs.yaml +59 -0
- package/.agents/generated/gemini/skills/context-os/references/context-rules.md +68 -0
- package/.agents/generated/gemini/skills/context-os/references/pipeline.md +119 -0
- package/.agents/generated/gemini/skills/context-os/references/project-graph.md +103 -0
- package/.agents/generated/gemini/skills/context-os/rules.yaml +135 -0
- package/.agents/generated/gemini/skills/engineering-workflow/EXAMPLES.md +57 -0
- package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +11 -396
- package/.agents/generated/gemini/skills/engineering-workflow/TROUBLESHOOTING.md +19 -0
- package/.agents/generated/gemini/skills/engineering-workflow/VALIDATION.json +12 -0
- package/.agents/generated/gemini/skills/engineering-workflow/references/workflow.md +336 -0
- package/.agents/generated/gemini/skills/gemini-precision/EXAMPLES.md +72 -0
- package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +0 -104
- package/.agents/generated/gemini/skills/gemini-precision/TROUBLESHOOTING.md +25 -0
- package/.agents/generated/gemini/skills/gemini-precision/VALIDATION.json +12 -0
- package/.agents/generated/gemini/skills/gstack-roles/EXAMPLES.md +23 -0
- package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +11 -169
- package/.agents/generated/gemini/skills/gstack-roles/TROUBLESHOOTING.md +13 -0
- package/.agents/generated/gemini/skills/gstack-roles/VALIDATION.json +12 -0
- package/.agents/generated/gemini/skills/gstack-roles/references/roles.md +149 -0
- package/.agents/generated/gemini/skills/ponytail-mindset/EXAMPLES.md +45 -0
- package/.agents/generated/gemini/skills/ponytail-mindset/SKILL.md +13 -233
- package/.agents/generated/gemini/skills/ponytail-mindset/TROUBLESHOOTING.md +19 -0
- package/.agents/generated/gemini/skills/ponytail-mindset/VALIDATION.json +12 -0
- package/.agents/generated/gemini/skills/ponytail-mindset/references/minimalism.md +186 -0
- package/.agents/generated/gemini/skills/security/EXAMPLES.md +64 -0
- package/.agents/generated/gemini/skills/security/SKILL.md +2 -92
- package/.agents/generated/gemini/skills/security/TROUBLESHOOTING.md +19 -0
- package/.agents/generated/gemini/skills/security/VALIDATION.json +12 -0
- package/.agents/plugins.js +24 -5
- package/.agents/resolver/canonical-resolver.js +43 -7
- package/.agents/resolver/resolve-args.js +31 -0
- package/.agents/stats.js +8 -11
- package/.agents/workspace/workspace-graph.js +16 -6
- package/README.md +24 -4
- package/bin/lib/ui.js +2 -2
- package/package.json +5 -2
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
|
|
2
|
+
# engineering-workflow
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
Systematic 6-phase engineering pipeline (DEFINE → PLAN → BUILD → VERIFY → REVIEW → SHIP) enforcing role declarations, atomic task execution, quality gates, regression prevention, and structured requirements elicitation.
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
Activate on all project tasks to orchestrate structured development, spec definition, architectural planning, and verification gates.
|
|
11
|
+
|
|
12
|
+
## Rules & Patterns
|
|
13
|
+
|
|
14
|
+
Inspired by [addyosmani/agent-skills](https://github.com/addyosmani/agent-skills) by Addy Osmani (Google Chrome) and [obra/superpowers](https://github.com/obra/superpowers).
|
|
15
|
+
|
|
16
|
+
### Core Principle
|
|
17
|
+
|
|
18
|
+
> **A junior writes code immediately. A senior writes a spec first.**\
|
|
19
|
+
> Establish scope before substantial changes and carry existing authorization forward.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
### The 6-Phase Development Pipeline
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
DEFINE PLAN BUILD VERIFY REVIEW SHIP
|
|
27
|
+
┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐
|
|
28
|
+
│ Idea │ ───▶ │ Spec │ ───▶ │ Code │ ───▶ │ Test │ ───▶ │ QA │ ───▶ │ Go │
|
|
29
|
+
│Refine│ │ PRD │ │ Impl │ │Debug │ │ Gate │ │ Live │
|
|
30
|
+
└──────┘ └──────┘ └──────┘ └──────┘ └──────┘ └──────┘
|
|
31
|
+
/spec /plan /build /test /review /ship
|
|
32
|
+
|
|
33
|
+
[ROLE: Product Manager] [ROLE: Architect] [ROLE: Senior Dev] [ROLE: QA Lead] [ROLE: Staff Eng] [ROLE: Release Eng]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Workflow rule**: Scope substantial work before implementation. Existing authorization, standalone requests, and routine fast tracks permit proceeding directly.
|
|
37
|
+
**Direct Build & Fast-Track Exception**: When the prompt/caller explicitly requests a standalone implementation, declares `[PHASE: Build]`, or requests routine operational/maintenance tasks (git operations, version bumps, typo fixes, small config tweaks, diagnostic checks), proceed directly to execution without conversational approval pauses.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### Phase 1: DEFINE - /spec
|
|
42
|
+
|
|
43
|
+
**Auto-activates → `[ROLE: Product Manager]`**
|
|
44
|
+
|
|
45
|
+
Turn vague intent into a precise, executable specification.
|
|
46
|
+
|
|
47
|
+
#### Step 1.1: The Interview Protocol (`interview-me`)
|
|
48
|
+
|
|
49
|
+
Before writing the spec, if there is ambiguity, high blast radius, or multiple architectural paths, stop and ask the user **one question at a time** (or up to 2 tightly coupled questions):
|
|
50
|
+
|
|
51
|
+
1. **Clarify Business Intent**: What user problem are we solving? What is explicitly out of scope?
|
|
52
|
+
2. **Clarify Constraints**: Runtime versions, database engines, performance bounds.
|
|
53
|
+
3. **Clarify Edge Cases**: What happens on offline state, empty lists, unauthorized requests?
|
|
54
|
+
|
|
55
|
+
#### Step 1.2: Spec Template
|
|
56
|
+
|
|
57
|
+
```markdown
|
|
58
|
+
## Feature Spec: [Feature Name]
|
|
59
|
+
|
|
60
|
+
### Why (Problem)
|
|
61
|
+
[What pain does this solve? Who has it? How often?]
|
|
62
|
+
|
|
63
|
+
### Scope (What's In / Out)
|
|
64
|
+
|
|
65
|
+
**In-Scope**:
|
|
66
|
+
- [Specific item 1]
|
|
67
|
+
- [Specific item 2]
|
|
68
|
+
|
|
69
|
+
**Out-of-Scope**:
|
|
70
|
+
- [Thing we're NOT doing and why]
|
|
71
|
+
|
|
72
|
+
### Technical Approach
|
|
73
|
+
[Read the relevant code. Understand what changes where.]
|
|
74
|
+
Files affected:
|
|
75
|
+
- `src/X.js` - [what changes]
|
|
76
|
+
- `src/Y.js` - [what changes]
|
|
77
|
+
|
|
78
|
+
### Acceptance Criteria
|
|
79
|
+
- [ ] Given [context], when [action], then [result]
|
|
80
|
+
- [ ] Given [context], when [action], then [result]
|
|
81
|
+
|
|
82
|
+
### Open Questions
|
|
83
|
+
- [Unresolved decision 1]
|
|
84
|
+
- [Unresolved decision 2]
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
### Phase 2: PLAN - /plan
|
|
90
|
+
|
|
91
|
+
**Auto-activates → `[ROLE: Architect]`**
|
|
92
|
+
|
|
93
|
+
Break the spec into atomic, independently testable tasks.
|
|
94
|
+
|
|
95
|
+
#### Thin Vertical Slices (`incremental-implementation`)
|
|
96
|
+
|
|
97
|
+
Organize tasks as **Thin Vertical Slices** rather than horizontal layers:
|
|
98
|
+
|
|
99
|
+
- **Bad (Horizontal)**: Task 1: All DB migrations. Task 2: All API routes. Task 3: All UI components. (Nothing works until step 3).
|
|
100
|
+
- **Good (Vertical Slices)**: Slice 1: Minimal DB table + minimal API + minimal UI button end-to-end. Verify and commit. Slice 2: Add validation + edge cases. Slice 3: Polish UI & telemetry.
|
|
101
|
+
|
|
102
|
+
#### Plan Rules
|
|
103
|
+
|
|
104
|
+
- Each task must be **completable in < 2 hours** of focused work.
|
|
105
|
+
- Each task must be **independently testable**.
|
|
106
|
+
- Tasks must be **ordered by dependency** (blocking tasks first).
|
|
107
|
+
- Each task gets a **test requirement** - no task without a test.
|
|
108
|
+
|
|
109
|
+
#### Plan Template
|
|
110
|
+
|
|
111
|
+
```markdown
|
|
112
|
+
## Implementation Plan: [Feature Name]
|
|
113
|
+
|
|
114
|
+
### Tasks
|
|
115
|
+
|
|
116
|
+
**Task 1: [Slice 1 Name]** (est. 30min)
|
|
117
|
+
- What: [Specific implementation detail]
|
|
118
|
+
- Files: [file1.js, file2.js]\
|
|
119
|
+
- Test: [How will you verify this works?]
|
|
120
|
+
- Blocked by: [nothing / Task N]
|
|
121
|
+
|
|
122
|
+
**Task 2: [Slice 2 Name]** (est. 45min)
|
|
123
|
+
- What: [Specific implementation detail]
|
|
124
|
+
- Files: [file3.js]
|
|
125
|
+
- Test: [Test description]
|
|
126
|
+
- Blocked by: Task 1
|
|
127
|
+
|
|
128
|
+
### Risk Assessment
|
|
129
|
+
- [Risk 1]: [Mitigation]
|
|
130
|
+
- [Risk 2]: [Mitigation]
|
|
131
|
+
|
|
132
|
+
### STOP - Awaiting Approval
|
|
133
|
+
Proceed to BUILD when implementation is authorized; clarify missing scope decisions when needed.
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### Phase 3: BUILD - /build
|
|
139
|
+
|
|
140
|
+
**Auto-activates → `[ROLE: Senior Developer]`**
|
|
141
|
+
|
|
142
|
+
Implement one task at a time. Commit after each task.
|
|
143
|
+
|
|
144
|
+
#### Build Rules
|
|
145
|
+
|
|
146
|
+
1. **One task per commit** - atomic, descriptive commit messages.
|
|
147
|
+
2. **Write the test FIRST** (TDD - red-green-refactor).
|
|
148
|
+
3. **No dead code** - if it's not tested, it's not shipped.
|
|
149
|
+
4. **No TODOs in committed code** - resolve or create a tracked issue.
|
|
150
|
+
5. **Read before writing** - understand the surrounding code before changing it.
|
|
151
|
+
6. **Limit the blast radius** - modify ONLY the files explicitly listed in the current task's plan. Do NOT rewrite adjacent components, hooks, or utilities unless strictly required by the authorized outcome.
|
|
152
|
+
|
|
153
|
+
#### Commit Message Format
|
|
154
|
+
|
|
155
|
+
```text
|
|
156
|
+
type(scope): short description (max 72 chars)
|
|
157
|
+
|
|
158
|
+
- Detail 1
|
|
159
|
+
- Detail 2
|
|
160
|
+
|
|
161
|
+
Refs: #issue-number
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Types: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
### Phase 4: VERIFY - /test
|
|
169
|
+
|
|
170
|
+
**Auto-activates → `[ROLE: QA Lead]`**
|
|
171
|
+
|
|
172
|
+
Tests are proof, not an afterthought.
|
|
173
|
+
|
|
174
|
+
#### Test Strategy by Code Type
|
|
175
|
+
|
|
176
|
+
**Logic & Services (TDD)**:
|
|
177
|
+
|
|
178
|
+
```text
|
|
179
|
+
1. RED: Write a failing test for the next small behavior
|
|
180
|
+
2. GREEN: Write the minimum code to make it pass
|
|
181
|
+
3. REFACTOR: Clean up without breaking tests
|
|
182
|
+
4. REPEAT
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**UI Components & User Flows (BDD)**:
|
|
186
|
+
|
|
187
|
+
For complex React components, prioritize testing _user behavior_ over internal state:
|
|
188
|
+
|
|
189
|
+
- Use **React Testing Library** (`userEvent`, `screen.getByRole`) - test what the user sees.
|
|
190
|
+
- Use **Playwright** for critical user flows (login, checkout, form submit).
|
|
191
|
+
- Do NOT test implementation details (internal state, private methods, component structure).
|
|
192
|
+
- Focus on: "When user clicks X, does Y appear?" not "Does `useState` hold the right value?"
|
|
193
|
+
|
|
194
|
+
```tsx
|
|
195
|
+
// [GOOD] BDD: Test behavior
|
|
196
|
+
test("shows error when email is invalid", async () => {
|
|
197
|
+
render(<LoginForm />);
|
|
198
|
+
await userEvent.type(screen.getByLabelText("Email"), "not-an-email");
|
|
199
|
+
await userEvent.click(screen.getByRole("button", { name: /sign in/i }));
|
|
200
|
+
expect(screen.getByText(/invalid email/i)).toBeInTheDocument();
|
|
201
|
+
});
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
#### Test Quality Gates
|
|
205
|
+
|
|
206
|
+
Before moving to Review, verify:
|
|
207
|
+
|
|
208
|
+
- [ ] All new code has tests
|
|
209
|
+
- [ ] Tests are meaningful (not just coverage theater)
|
|
210
|
+
- [ ] Edge cases are covered (null, empty, overflow, unauthorized)
|
|
211
|
+
- [ ] Tests fail when the implementation is broken (anti-regression)
|
|
212
|
+
- [ ] Test names are readable: `it("returns 404 when user not found")`
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
### Phase 5: REVIEW - /review
|
|
217
|
+
|
|
218
|
+
**Auto-activates → `[ROLE: Staff Engineer]` + `[ROLE: Senior Designer]` for UI tasks**
|
|
219
|
+
|
|
220
|
+
Review before merging. Always.
|
|
221
|
+
|
|
222
|
+
#### Subagent / Peer Code Review Protocol
|
|
223
|
+
|
|
224
|
+
Inspired by [obra/superpowers](https://github.com/obra/superpowers):
|
|
225
|
+
|
|
226
|
+
1. **Self-Review First**: The implementer runs git diff and verifies against the original acceptance criteria.
|
|
227
|
+
2. **Review Checklist**:
|
|
228
|
+
- **Correctness**: Does it do what the spec says? Are all criteria met?
|
|
229
|
+
- **Architecture**: Single Responsibility, DRY without premature abstraction, no business logic in API routes.
|
|
230
|
+
- **Security**: No secrets hardcoded, inputs validated via Zod/schemas, auth checked before data access.
|
|
231
|
+
- **Performance**: No N+1 queries, expensive operations cached, sets paginated.
|
|
232
|
+
- **Design**: If UI, passes `impeccable-design` quick audit (typography, colors, spacing, animations).
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
### Phase 5.5: SIMPLIFY - /simplify
|
|
237
|
+
|
|
238
|
+
**Auto-activates → `[ROLE: Staff Engineer]` (Ponytail Mindset)**
|
|
239
|
+
|
|
240
|
+
Before merging, ruthlessly simplify:
|
|
241
|
+
|
|
242
|
+
1. Did we introduce abstractions that are only used once? (Inline them).
|
|
243
|
+
2. Can 3 lines of standard JavaScript replace a 50-line custom utility?
|
|
244
|
+
3. Is any configuration or generic handler premature? (YAGNI).
|
|
245
|
+
4. Is the code obvious to a mid-level engineer without reading a documentation manual?
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
### Phase 6: SHIP - /ship
|
|
250
|
+
|
|
251
|
+
**Auto-activates → `[ROLE: Release Engineer]`**
|
|
252
|
+
|
|
253
|
+
Only ship when all gates are green.
|
|
254
|
+
|
|
255
|
+
#### Pre-Ship Checklist
|
|
256
|
+
|
|
257
|
+
- [ ] All tests pass in CI
|
|
258
|
+
- [ ] No lint errors
|
|
259
|
+
- [ ] Feature works in staging environment
|
|
260
|
+
- [ ] Docs updated (README, API docs, changelogs)
|
|
261
|
+
- [ ] Breaking changes documented
|
|
262
|
+
- [ ] Rollback plan exists
|
|
263
|
+
- [ ] Preview / staging deployment verified (if applicable, e.g. Vercel Preview and Core Web Vitals for frontend deployments)
|
|
264
|
+
|
|
265
|
+
#### Operational Self-Improvement
|
|
266
|
+
|
|
267
|
+
Before completing a workflow, review the session for durable learnings. Write them to `.agents/learnings.md`. If no durable learning occurred, state "No durable learnings this session" in your final output.
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Code Examples
|
|
272
|
+
|
|
273
|
+
### Vertical Slice Example
|
|
274
|
+
|
|
275
|
+
```javascript
|
|
276
|
+
// Slice 1: Minimal functional endpoint
|
|
277
|
+
// POST /api/v1/projects -> creates project with basic validation
|
|
278
|
+
import { z } from 'zod';
|
|
279
|
+
import { projectService } from '@/services/project';
|
|
280
|
+
|
|
281
|
+
const CreateProjectSchema = z.object({
|
|
282
|
+
name: z.string().min(1).max(100),
|
|
283
|
+
description: z.string().optional()
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
export async function POST(req) {
|
|
287
|
+
const session = await auth();
|
|
288
|
+
if (!session?.userId) return Response.json({ error: 'Unauthorized' }, { status: 401 });
|
|
289
|
+
|
|
290
|
+
const body = await req.json();
|
|
291
|
+
const parsed = CreateProjectSchema.parse(body);
|
|
292
|
+
const project = await projectService.create({ ...parsed, userId: session.userId });
|
|
293
|
+
|
|
294
|
+
return Response.json(project, { status: 201 });
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Validation Checklist
|
|
301
|
+
|
|
302
|
+
- [ ] Specification exists with clear In-Scope and Out-of-Scope boundaries.
|
|
303
|
+
- [ ] Implementation plan broken down into vertical tasks < 2 hours each.
|
|
304
|
+
- [ ] Tests written before implementation (TDD/BDD).
|
|
305
|
+
- [ ] Code reviewed against correctness, security, performance, and design gates.
|
|
306
|
+
- [ ] Staged security and quality check passes (`contextos scan --staged --enforce`).
|
|
307
|
+
- [ ] Simplification ladder executed before shipping.
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Common Mistakes
|
|
312
|
+
|
|
313
|
+
- **Writing code before approval**: Skipping `/spec` or `/plan` in interactive sessions.
|
|
314
|
+
- **Horizontal task splitting**: Building all DB models first without verifying end-to-end integration.
|
|
315
|
+
- **Premature refactoring**: Changing unrelated adjacent code during a feature task.
|
|
316
|
+
- **Ignoring non-happy paths**: Testing only 200 OK responses while ignoring 400, 401, 404, 500 scenarios.
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## Integration Notes
|
|
321
|
+
|
|
322
|
+
- Integrates with `gstack-roles` for automated role switching across all 6 phases.
|
|
323
|
+
- Triggers `ponytail-mindset` during the BUILD and SIMPLIFY phases.
|
|
324
|
+
- Hands off to `impeccable-design` for UI quality review.
|
|
325
|
+
- Coordinates with `security` during Phase 5 for pre-merge compliance.
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## Completion Status Protocol
|
|
330
|
+
|
|
331
|
+
When completing a task or workflow, you must explicitly report your final status as the last part of your output:
|
|
332
|
+
|
|
333
|
+
- **DONE** - completed with evidence.
|
|
334
|
+
- **DONE_WITH_CONCERNS** - completed, but list concerns.
|
|
335
|
+
- **BLOCKED** - cannot proceed; state blocker and what was tried.
|
|
336
|
+
- **NEEDS_CONTEXT** - missing info; state exactly what is needed.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# gemini-precision Examples - Anti-patterns vs ContextOS Standard
|
|
2
|
+
|
|
3
|
+
## Example 1: Read-Before-Write Invariant (Zero Assumptions)
|
|
4
|
+
|
|
5
|
+
### Anti-pattern: Hallucinated Import and Signature
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
// BAD: Assuming the module exists and export is a default function
|
|
9
|
+
import hashPassword from 'src/utils/crypto';
|
|
10
|
+
const hash = hashPassword(password);
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Best practice: ContextOS Standard (Inspected Active Codebase First)
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
// GOOD: Inspected src/lib/auth.ts via view_file before writing code
|
|
17
|
+
import { hashSecret, ARGON2_CONFIG } from '../lib/auth.js';
|
|
18
|
+
const hash = await hashSecret(password, ARGON2_CONFIG);
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Example 2: Zero-Placeholder Invariant (Complete Code Only)
|
|
24
|
+
|
|
25
|
+
### Anti-pattern: Lazy Stubs and Ellipsis Comments
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
// BAD: Emitting incomplete code with TODOs and ellipsis
|
|
29
|
+
export function processTransaction(tx: Transaction) {
|
|
30
|
+
// TODO: validate transaction balance
|
|
31
|
+
// ... rest of implementation stays here ...
|
|
32
|
+
return { status: 'ok' };
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Best practice: ContextOS Standard (100% Drop-in Compilable)
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
// GOOD: Fully implemented logic with complete error handling
|
|
40
|
+
export function processTransaction(tx: Transaction): TransactionResult {
|
|
41
|
+
if (!tx.amount || tx.amount <= 0) {
|
|
42
|
+
throw new ValidationError('Transaction amount must be positive');
|
|
43
|
+
}
|
|
44
|
+
if (tx.senderBalance < tx.amount) {
|
|
45
|
+
throw new InsufficientFundsError(tx.senderId, tx.amount);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
status: 'ok',
|
|
49
|
+
transactionId: tx.id,
|
|
50
|
+
newBalance: tx.senderBalance - tx.amount,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Example 3: Mandatory Proof-of-Work Invariant
|
|
58
|
+
|
|
59
|
+
### Anti-pattern: Claiming Task Complete Without Evidence
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
BAD: "I have updated the authentication handler. The code looks correct and is ready to merge."
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Best practice: ContextOS Standard (Verified with Automated Gates)
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# GOOD: Run test suite, staged scanner, and consistency checks
|
|
69
|
+
npm test
|
|
70
|
+
contextos scan --staged --enforce
|
|
71
|
+
node .agents/ctx.js validate
|
|
72
|
+
```
|
|
@@ -164,103 +164,3 @@ export async function updateUser(id, data, session) {
|
|
|
164
164
|
- Pairs with `engineering-workflow` to enforce the 6-phase pipeline.
|
|
165
165
|
- Enforces the 7-rung ladder of `ponytail-mindset`.
|
|
166
166
|
- Acts as the baseline behavioral guardrail across all Gemini and Antigravity operations.
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
# gemini-precision Examples - Anti-patterns vs ContextOS Standard
|
|
170
|
-
|
|
171
|
-
## Example 1: Read-Before-Write Invariant (Zero Assumptions)
|
|
172
|
-
|
|
173
|
-
### Anti-pattern: Hallucinated Import and Signature
|
|
174
|
-
|
|
175
|
-
```typescript
|
|
176
|
-
// BAD: Assuming the module exists and export is a default function
|
|
177
|
-
import hashPassword from 'src/utils/crypto';
|
|
178
|
-
const hash = hashPassword(password);
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### Best practice: ContextOS Standard (Inspected Active Codebase First)
|
|
182
|
-
|
|
183
|
-
```typescript
|
|
184
|
-
// GOOD: Inspected src/lib/auth.ts via view_file before writing code
|
|
185
|
-
import { hashSecret, ARGON2_CONFIG } from '../lib/auth.js';
|
|
186
|
-
const hash = await hashSecret(password, ARGON2_CONFIG);
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
## Example 2: Zero-Placeholder Invariant (Complete Code Only)
|
|
192
|
-
|
|
193
|
-
### Anti-pattern: Lazy Stubs and Ellipsis Comments
|
|
194
|
-
|
|
195
|
-
```typescript
|
|
196
|
-
// BAD: Emitting incomplete code with TODOs and ellipsis
|
|
197
|
-
export function processTransaction(tx: Transaction) {
|
|
198
|
-
// TODO: validate transaction balance
|
|
199
|
-
// ... rest of implementation stays here ...
|
|
200
|
-
return { status: 'ok' };
|
|
201
|
-
}
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
### Best practice: ContextOS Standard (100% Drop-in Compilable)
|
|
205
|
-
|
|
206
|
-
```typescript
|
|
207
|
-
// GOOD: Fully implemented logic with complete error handling
|
|
208
|
-
export function processTransaction(tx: Transaction): TransactionResult {
|
|
209
|
-
if (!tx.amount || tx.amount <= 0) {
|
|
210
|
-
throw new ValidationError('Transaction amount must be positive');
|
|
211
|
-
}
|
|
212
|
-
if (tx.senderBalance < tx.amount) {
|
|
213
|
-
throw new InsufficientFundsError(tx.senderId, tx.amount);
|
|
214
|
-
}
|
|
215
|
-
return {
|
|
216
|
-
status: 'ok',
|
|
217
|
-
transactionId: tx.id,
|
|
218
|
-
newBalance: tx.senderBalance - tx.amount,
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
---
|
|
224
|
-
|
|
225
|
-
## Example 3: Mandatory Proof-of-Work Invariant
|
|
226
|
-
|
|
227
|
-
### Anti-pattern: Claiming Task Complete Without Evidence
|
|
228
|
-
|
|
229
|
-
```text
|
|
230
|
-
BAD: "I have updated the authentication handler. The code looks correct and is ready to merge."
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
### Best practice: ContextOS Standard (Verified with Automated Gates)
|
|
234
|
-
|
|
235
|
-
```bash
|
|
236
|
-
# GOOD: Run test suite, staged scanner, and consistency checks
|
|
237
|
-
npm test
|
|
238
|
-
contextos scan --staged --enforce
|
|
239
|
-
node .agents/ctx.js validate
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
# gemini-precision Troubleshooting & Common Failure Modes
|
|
243
|
-
|
|
244
|
-
## 1. Test Failure Investigation (No Guesswork)
|
|
245
|
-
|
|
246
|
-
- **Symptom**: Test fails during `npm test` after code modifications.
|
|
247
|
-
- **Root Cause**: Trying to patch the code without reading the exact assertion diff.
|
|
248
|
-
- **Fix**: Never guess the fix. View the test file line where assertion failed, inspect expected vs actual output, and resolve the root discrepancy.
|
|
249
|
-
|
|
250
|
-
## 2. Accidental Staged Secrets or Placeholders
|
|
251
|
-
|
|
252
|
-
- **Symptom**: `contextos scan --staged --enforce` fails with exit code 1.
|
|
253
|
-
- **Root Cause**: Committed temporary `.env` file or left an unfinished `// TODO: implement later` stub in added lines.
|
|
254
|
-
- **Fix**: Remove or redact the secret before committing. Fully implement the logic or replace the placeholder with an explicit tracked issue rather than committed code stubs.
|
|
255
|
-
|
|
256
|
-
## 3. Scope Creep and Excessive Blast Radius
|
|
257
|
-
|
|
258
|
-
- **Symptom**: Unrelated files reformatted or imports reordered across the repository.
|
|
259
|
-
- **Root Cause**: Full-file rewrite instead of targeted surgical replacement.
|
|
260
|
-
- **Fix**: Use targeted chunks that touch only the lines specified in the task plan. Avoid modifying unrelated styling or formatting.
|
|
261
|
-
|
|
262
|
-
## 4. Forbidden Long Dashes
|
|
263
|
-
|
|
264
|
-
- **Symptom**: Linter or compliance check flags unicode dashes in text.
|
|
265
|
-
- **Root Cause**: Using typography dashes (`\u2014` or `\u2013`) instead of standard ASCII hyphens.
|
|
266
|
-
- **Fix**: Replace all em-dashes and en-dashes with standard ASCII hyphens (` - `) or appropriate punctuation (parentheses, commas, colons).
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# gemini-precision Troubleshooting & Common Failure Modes
|
|
2
|
+
|
|
3
|
+
## 1. Test Failure Investigation (No Guesswork)
|
|
4
|
+
|
|
5
|
+
- **Symptom**: Test fails during `npm test` after code modifications.
|
|
6
|
+
- **Root Cause**: Trying to patch the code without reading the exact assertion diff.
|
|
7
|
+
- **Fix**: Never guess the fix. View the test file line where assertion failed, inspect expected vs actual output, and resolve the root discrepancy.
|
|
8
|
+
|
|
9
|
+
## 2. Accidental Staged Secrets or Placeholders
|
|
10
|
+
|
|
11
|
+
- **Symptom**: `contextos scan --staged --enforce` fails with exit code 1.
|
|
12
|
+
- **Root Cause**: Committed temporary `.env` file or left an unfinished `// TODO: implement later` stub in added lines.
|
|
13
|
+
- **Fix**: Remove or redact the secret before committing. Fully implement the logic or replace the placeholder with an explicit tracked issue rather than committed code stubs.
|
|
14
|
+
|
|
15
|
+
## 3. Scope Creep and Excessive Blast Radius
|
|
16
|
+
|
|
17
|
+
- **Symptom**: Unrelated files reformatted or imports reordered across the repository.
|
|
18
|
+
- **Root Cause**: Full-file rewrite instead of targeted surgical replacement.
|
|
19
|
+
- **Fix**: Use targeted chunks that touch only the lines specified in the task plan. Avoid modifying unrelated styling or formatting.
|
|
20
|
+
|
|
21
|
+
## 4. Forbidden Long Dashes
|
|
22
|
+
|
|
23
|
+
- **Symptom**: Linter or compliance check flags unicode dashes in text.
|
|
24
|
+
- **Root Cause**: Using typography dashes (`\u2014` or `\u2013`) instead of standard ASCII hyphens.
|
|
25
|
+
- **Fix**: Replace all em-dashes and en-dashes with standard ASCII hyphens (` - `) or appropriate punctuation (parentheses, commas, colons).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# gstack-roles Examples — Anti-patterns vs ContextOS Standard
|
|
2
|
+
|
|
3
|
+
## Example 1: Specialist Persona Activation
|
|
4
|
+
|
|
5
|
+
### Anti-pattern: Undifferentiated Generalist Response
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
User: "Should we migrate our monolithic PostgreSQL database to MongoDB?"
|
|
9
|
+
Agent: Gives a vague 5-paragraph summary listing pros and cons of both without making a recommendation.
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### Best practice: ContextOS Standard (Architect Role Declaration)
|
|
13
|
+
|
|
14
|
+
```markdown
|
|
15
|
+
[DOMAIN: Architecture] [PHASE: Plan] [ROLE: Database Architect]
|
|
16
|
+
Skills loaded: database, system-design, decisions
|
|
17
|
+
|
|
18
|
+
### Recommendation: Stay with PostgreSQL. Do NOT migrate to MongoDB.
|
|
19
|
+
1. Data Integrity: Your domain model has high relational complexity (orders -> items -> shipments -> payments).
|
|
20
|
+
2. Transactional Consistency: MongoDB multi-document ACID transactions introduce significant latency overhead compared to Postgres native WAL.
|
|
21
|
+
3. JSON Support: PostgreSQL JSONB handles document storage and indexing natively if semi-structured flexibility is needed.
|
|
22
|
+
Decision: Draft ADR 0004-retain-postgresql-with-jsonb.md.
|
|
23
|
+
```
|