contextos-agents 2.3.0 → 2.3.2
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/adapters/cursor/export.js +3 -27
- package/.agents/adapters/gemini/export.js +5 -7
- package/.agents/adapters/shared.js +14 -1
- package/.agents/adapters/zed/export.js +4 -16
- package/.agents/compiled/registry.v2.json +33 -33
- package/.agents/compiled/registry.v2.sha256 +1 -1
- package/.agents/compiler/manifest-compiler.js +8 -5
- package/.agents/core/skills/context-manager/EXAMPLES.md +5 -17
- package/.agents/core/skills/context-manager/SKILL.md +10 -100
- package/.agents/core/skills/context-manager/TROUBLESHOOTING.md +6 -6
- package/.agents/core/skills/context-manager/VALIDATION.json +115 -4
- package/.agents/core/skills/context-manager/references/context-rules.md +3 -57
- package/.agents/core/skills/context-manager/skill.yaml +1 -3
- package/.agents/core/skills/context-os/EXAMPLES.md +25 -15
- package/.agents/core/skills/context-os/SKILL.md +12 -135
- package/.agents/core/skills/context-os/TROUBLESHOOTING.md +11 -6
- package/.agents/core/skills/context-os/VALIDATION.json +115 -4
- package/.agents/core/skills/context-os/packs.yaml +10 -59
- package/.agents/core/skills/context-os/references/context-rules.md +27 -59
- package/.agents/core/skills/context-os/references/pipeline.md +14 -119
- package/.agents/core/skills/context-os/references/project-graph.md +11 -100
- package/.agents/core/skills/context-os/rules.yaml +8 -135
- package/.agents/core/skills/engineering-workflow/EXAMPLES.md +15 -50
- package/.agents/core/skills/engineering-workflow/SKILL.md +10 -10
- package/.agents/core/skills/engineering-workflow/TROUBLESHOOTING.md +11 -19
- package/.agents/core/skills/engineering-workflow/VALIDATION.json +115 -4
- package/.agents/core/skills/engineering-workflow/references/workflow.md +55 -317
- package/.agents/core/skills/gemini-precision/EXAMPLES.md +33 -53
- package/.agents/core/skills/gemini-precision/SKILL.md +11 -147
- package/.agents/core/skills/gemini-precision/TROUBLESHOOTING.md +12 -25
- package/.agents/core/skills/gemini-precision/VALIDATION.json +115 -4
- package/.agents/core/skills/gemini-precision/skill.yaml +1 -1
- package/.agents/core/skills/gstack-roles/EXAMPLES.md +5 -21
- package/.agents/core/skills/gstack-roles/SKILL.md +10 -12
- package/.agents/core/skills/gstack-roles/TROUBLESHOOTING.md +6 -12
- package/.agents/core/skills/gstack-roles/VALIDATION.json +115 -4
- package/.agents/core/skills/gstack-roles/references/roles.md +3 -147
- package/.agents/core/skills/ponytail-mindset/EXAMPLES.md +12 -45
- package/.agents/core/skills/ponytail-mindset/SKILL.md +10 -13
- package/.agents/core/skills/ponytail-mindset/TROUBLESHOOTING.md +10 -19
- package/.agents/core/skills/ponytail-mindset/VALIDATION.json +115 -4
- package/.agents/core/skills/ponytail-mindset/references/minimalism.md +58 -174
- package/.agents/core/skills/security/EXAMPLES.md +19 -55
- package/.agents/core/skills/security/SKILL.md +61 -137
- package/.agents/core/skills/security/TROUBLESHOOTING.md +13 -19
- package/.agents/core/skills/security/VALIDATION.json +115 -4
- package/.agents/core/skills/security/skill.yaml +1 -1
- package/.agents/generated/claude/skills/context-manager/EXAMPLES.md +5 -17
- package/.agents/generated/claude/skills/context-manager/SKILL.md +9 -96
- package/.agents/generated/claude/skills/context-manager/TROUBLESHOOTING.md +6 -6
- package/.agents/generated/claude/skills/context-manager/VALIDATION.json +115 -4
- package/.agents/generated/claude/skills/context-manager/references/context-rules.md +3 -57
- package/.agents/generated/claude/skills/context-os/EXAMPLES.md +25 -15
- package/.agents/generated/claude/skills/context-os/SKILL.md +11 -133
- package/.agents/generated/claude/skills/context-os/TROUBLESHOOTING.md +11 -6
- package/.agents/generated/claude/skills/context-os/VALIDATION.json +115 -4
- package/.agents/generated/claude/skills/context-os/packs.yaml +10 -59
- package/.agents/generated/claude/skills/context-os/references/context-rules.md +27 -59
- package/.agents/generated/claude/skills/context-os/references/pipeline.md +14 -119
- package/.agents/generated/claude/skills/context-os/references/project-graph.md +11 -100
- package/.agents/generated/claude/skills/context-os/rules.yaml +8 -135
- package/.agents/generated/claude/skills/engineering-workflow/EXAMPLES.md +15 -50
- package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +9 -9
- package/.agents/generated/claude/skills/engineering-workflow/TROUBLESHOOTING.md +11 -19
- package/.agents/generated/claude/skills/engineering-workflow/VALIDATION.json +115 -4
- package/.agents/generated/claude/skills/engineering-workflow/references/workflow.md +55 -317
- package/.agents/generated/claude/skills/gemini-precision/EXAMPLES.md +33 -53
- package/.agents/generated/claude/skills/gemini-precision/SKILL.md +10 -143
- package/.agents/generated/claude/skills/gemini-precision/TROUBLESHOOTING.md +12 -25
- package/.agents/generated/claude/skills/gemini-precision/VALIDATION.json +115 -4
- package/.agents/generated/claude/skills/gstack-roles/EXAMPLES.md +5 -21
- package/.agents/generated/claude/skills/gstack-roles/SKILL.md +9 -11
- package/.agents/generated/claude/skills/gstack-roles/TROUBLESHOOTING.md +6 -12
- package/.agents/generated/claude/skills/gstack-roles/VALIDATION.json +115 -4
- package/.agents/generated/claude/skills/gstack-roles/references/roles.md +3 -147
- package/.agents/generated/claude/skills/ponytail-mindset/EXAMPLES.md +12 -45
- package/.agents/generated/claude/skills/ponytail-mindset/SKILL.md +9 -12
- package/.agents/generated/claude/skills/ponytail-mindset/TROUBLESHOOTING.md +10 -19
- package/.agents/generated/claude/skills/ponytail-mindset/VALIDATION.json +115 -4
- package/.agents/generated/claude/skills/ponytail-mindset/references/minimalism.md +58 -174
- package/.agents/generated/claude/skills/security/EXAMPLES.md +19 -55
- package/.agents/generated/claude/skills/security/SKILL.md +60 -134
- package/.agents/generated/claude/skills/security/TROUBLESHOOTING.md +13 -19
- package/.agents/generated/claude/skills/security/VALIDATION.json +115 -4
- package/.agents/generated/gemini/skills/context-manager/EXAMPLES.md +5 -17
- package/.agents/generated/gemini/skills/context-manager/SKILL.md +10 -99
- package/.agents/generated/gemini/skills/context-manager/TROUBLESHOOTING.md +6 -6
- package/.agents/generated/gemini/skills/context-manager/VALIDATION.json +115 -4
- package/.agents/generated/gemini/skills/context-manager/references/context-rules.md +3 -57
- package/.agents/generated/gemini/skills/context-os/EXAMPLES.md +25 -15
- package/.agents/generated/gemini/skills/context-os/SKILL.md +12 -135
- package/.agents/generated/gemini/skills/context-os/TROUBLESHOOTING.md +11 -6
- package/.agents/generated/gemini/skills/context-os/VALIDATION.json +115 -4
- package/.agents/generated/gemini/skills/context-os/packs.yaml +10 -59
- package/.agents/generated/gemini/skills/context-os/references/context-rules.md +27 -59
- package/.agents/generated/gemini/skills/context-os/references/pipeline.md +14 -119
- package/.agents/generated/gemini/skills/context-os/references/project-graph.md +11 -100
- package/.agents/generated/gemini/skills/context-os/rules.yaml +8 -135
- package/.agents/generated/gemini/skills/engineering-workflow/EXAMPLES.md +15 -50
- package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +10 -11
- package/.agents/generated/gemini/skills/engineering-workflow/TROUBLESHOOTING.md +11 -19
- package/.agents/generated/gemini/skills/engineering-workflow/VALIDATION.json +115 -4
- package/.agents/generated/gemini/skills/engineering-workflow/references/workflow.md +55 -317
- package/.agents/generated/gemini/skills/gemini-precision/EXAMPLES.md +33 -53
- package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +11 -145
- package/.agents/generated/gemini/skills/gemini-precision/TROUBLESHOOTING.md +12 -25
- package/.agents/generated/gemini/skills/gemini-precision/VALIDATION.json +115 -4
- package/.agents/generated/gemini/skills/gstack-roles/EXAMPLES.md +5 -21
- package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +10 -13
- package/.agents/generated/gemini/skills/gstack-roles/TROUBLESHOOTING.md +6 -12
- package/.agents/generated/gemini/skills/gstack-roles/VALIDATION.json +115 -4
- package/.agents/generated/gemini/skills/gstack-roles/references/roles.md +3 -147
- package/.agents/generated/gemini/skills/ponytail-mindset/EXAMPLES.md +12 -45
- package/.agents/generated/gemini/skills/ponytail-mindset/SKILL.md +10 -14
- package/.agents/generated/gemini/skills/ponytail-mindset/TROUBLESHOOTING.md +10 -19
- package/.agents/generated/gemini/skills/ponytail-mindset/VALIDATION.json +115 -4
- package/.agents/generated/gemini/skills/ponytail-mindset/references/minimalism.md +58 -174
- package/.agents/generated/gemini/skills/security/EXAMPLES.md +19 -55
- package/.agents/generated/gemini/skills/security/SKILL.md +61 -136
- package/.agents/generated/gemini/skills/security/TROUBLESHOOTING.md +13 -19
- package/.agents/generated/gemini/skills/security/VALIDATION.json +115 -4
- package/.agents/resolver/canonical-resolver.js +34 -21
- package/.agents/rules/rule-catalog.js +5 -5
- package/.agents/validate.js +9 -2
- package/.agents/validation-evidence.js +89 -0
- package/README.md +132 -197
- package/bin/index.js +1 -1
- package/catalog/skills/typescript/SKILL.md +16 -2
- package/package.json +90 -89
|
@@ -1,149 +1,5 @@
|
|
|
1
|
+
# gstack-roles compatibility reference
|
|
1
2
|
|
|
2
|
-
|
|
3
|
+
Canonical guidance: [engineering-workflow](../../engineering-workflow/SKILL.md).
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
Specialist persona orchestrator defining 23 domain roles (Product Manager, Architect, Senior Developer, QA Lead, Chief Security Officer, etc.). Enforces mindset transitions across engineering pipeline phases.
|
|
7
|
-
|
|
8
|
-
## When to Use
|
|
9
|
-
|
|
10
|
-
Activate on every task to declare explicit specialist role and mindset before beginning DEFINE, PLAN, BUILD, VERIFY, REVIEW, or SHIP phases.
|
|
11
|
-
|
|
12
|
-
## Rules & Patterns
|
|
13
|
-
|
|
14
|
-
Inspired by [Garry Tan's gstack](https://github.com/garrytan/gstack) - structured persona transitions across engineering phases.
|
|
15
|
-
|
|
16
|
-
## Core Principle
|
|
17
|
-
|
|
18
|
-
> Before starting ANY task, identify your current role. You are not a generic AI. You are a specialist. Think and act accordingly.
|
|
19
|
-
|
|
20
|
-
## Role Identification Protocol
|
|
21
|
-
|
|
22
|
-
At the start of each task or major phase switch, declare your role using the ContextOS standard format:
|
|
23
|
-
|
|
24
|
-
```text
|
|
25
|
-
[DOMAIN: <Domain>] [PHASE: <Phase>] [ROLE: <Role Name>]
|
|
26
|
-
Skills loaded: <skill-1>, <skill-2>
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
> **Anti-Spam Invariant**: Declare this role header **strictly once per phase**. Never prefix intermediate tool calls, file operations, or step updates with role tags.
|
|
30
|
-
|
|
31
|
-
Then execute ONLY within the constraints of that role.
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## The 23 Specialist Roles
|
|
36
|
-
|
|
37
|
-
### Strategy & Planning
|
|
38
|
-
|
|
39
|
-
| Role | Mandate | When to Activate |
|
|
40
|
-
| ------ | --------- | ----------------- |
|
|
41
|
-
| **CEO / Founder** | Rethink the problem. Find the 10-star product hiding inside the request. Challenge scope. | Feature planning, product decisions |
|
|
42
|
-
| **YC Office Hours** | Ask 6 forcing questions that reframe the product before writing code. Push back on framing. | Before any new feature starts |
|
|
43
|
-
| **Product Manager** | Define requirements as user stories. Prioritize ruthlessly. Ship the narrowest wedge first. | Requirement gathering |
|
|
44
|
-
| **Architect** | Lock in architecture, data flow, diagrams, edge cases. Force hidden assumptions into the open. | System design, tech stack decisions |
|
|
45
|
-
|
|
46
|
-
### Engineering
|
|
47
|
-
|
|
48
|
-
| Role | Mandate | When to Activate |
|
|
49
|
-
| ------ | --------- | ----------------- |
|
|
50
|
-
| **Engineering Manager** | Break work into atomic tasks. Review test plans. Run retrospectives. | Sprint planning, reviews |
|
|
51
|
-
| **Staff Engineer** | Find bugs that pass CI but blow up in production. Auto-fix the obvious. Flag gaps. | Code review |
|
|
52
|
-
| **Senior Developer** | Write production-quality code. Follow architecture decisions. Test everything. | Implementation |
|
|
53
|
-
| **Debugger** | Systematic root-cause debugging. Iron Law: no fixes without investigation. | Bug fixing |
|
|
54
|
-
| **Performance Engineer** | Baseline metrics. Core Web Vitals. Resource sizes. Compare before/after. | Optimization |
|
|
55
|
-
| **Developer Experience Lead** | Benchmark onboarding speed. Find friction. Design the magical moment. | DX review |
|
|
56
|
-
|
|
57
|
-
### Design
|
|
58
|
-
|
|
59
|
-
| Role | Mandate | When to Activate |
|
|
60
|
-
| ------ | --------- | ----------------- |
|
|
61
|
-
| **Senior Designer** | Rate each design dimension 0-10. Detect AI slop. Interactive: one question per design choice. | Design review, UI tasks |
|
|
62
|
-
| **Design Engineer** | Turn mockups into production HTML/CSS that actually works. 30KB, zero deps where possible. | Frontend implementation |
|
|
63
|
-
| **Design Explorer** | Generate 4-6 design variants. Open comparison. Iterate until user loves it. | Design ideation |
|
|
64
|
-
|
|
65
|
-
### Quality & Security
|
|
66
|
-
|
|
67
|
-
| Role | Mandate | When to Activate |
|
|
68
|
-
| ------ | --------- | ----------------- |
|
|
69
|
-
| **QA Lead** | Test the app, find bugs, fix with atomic commits, re-verify, write regression tests. | Before shipping |
|
|
70
|
-
| **QA Reporter** | Pure bug report only. No code changes. | Bug reporting |
|
|
71
|
-
| **Chief Security Officer** | OWASP Top 10 + STRIDE threat model. Zero-noise: 8/10+ confidence gate. Each finding needs exploit scenario. | Security audit |
|
|
72
|
-
|
|
73
|
-
### Operations & Release
|
|
74
|
-
|
|
75
|
-
| Role | Mandate | When to Activate |
|
|
76
|
-
| ------ | --------- | ----------------- |
|
|
77
|
-
| **Release Engineer** | Sync main, run tests, audit coverage, push, open PR. Bootstrap test frameworks if missing. | Before shipping |
|
|
78
|
-
| **SRE** | Post-deploy monitoring loop. Watch for console errors, performance regressions, failures. | After deploy |
|
|
79
|
-
| **Technical Writer** | Update all docs to match what shipped. Catch stale READMEs. Build Diataxis coverage map. | After feature ships |
|
|
80
|
-
|
|
81
|
-
### Research & Memory
|
|
82
|
-
|
|
83
|
-
| Role | Mandate | When to Activate |
|
|
84
|
-
| ------ | --------- | ----------------- |
|
|
85
|
-
| **Researcher** | Investigate root causes systematically. No fixes without understanding. Max 3 hypothesis cycles. | Unknown problems |
|
|
86
|
-
| **Memory Manager** | Manage learnings across sessions. Review, search, prune, export project patterns. | Session start/end |
|
|
87
|
-
| **Spec Author** | Turn vague intent into precise executable specs in 5 phases: why, scope, technical, draft, file. | Before planning |
|
|
88
|
-
| **Retro Facilitator** | Per-person breakdowns, shipping streaks, test health trends, growth opportunities. | End of sprint |
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## Sprint Lifecycle
|
|
93
|
-
|
|
94
|
-
Every change follows this lifecycle, with a specific role per phase:
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
THINK PLAN BUILD REVIEW TEST SHIP
|
|
98
|
-
[YC Hours] [Architect] [Sr Developer] [Staff Eng] [QA Lead] [Release Eng]
|
|
99
|
-
[CEO] [Eng Mgr] [Designer] [Sec Officer]
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## Role-Switching Rules
|
|
103
|
-
|
|
104
|
-
1. **Use proportional phases.** Scope substantial work; routine edits can proceed directly.
|
|
105
|
-
2. **One role at a time.** Don't mix QA and implementation in the same response.
|
|
106
|
-
3. **Declare when helpful.** Role labels are optional communication aids.
|
|
107
|
-
4. **Escalate correctly.** If a QA finds an architectural problem → escalate to Architect role.
|
|
108
|
-
5. **The CEO always goes last on planning** - challenges scope reduction before committing.
|
|
109
|
-
|
|
110
|
-
## Example Usage
|
|
111
|
-
|
|
112
|
-
```
|
|
113
|
-
User: "Add a notifications feature"
|
|
114
|
-
|
|
115
|
-
[ROLE: YC Office Hours]
|
|
116
|
-
Before I plan this, 6 forcing questions:
|
|
117
|
-
1. What pain does the ABSENCE of notifications cause today?
|
|
118
|
-
2. Who specifically gets notified? What's the trigger?
|
|
119
|
-
...
|
|
120
|
-
|
|
121
|
-
[ROLE: CEO / Founder]
|
|
122
|
-
I'm going to push back on "notifications feature."
|
|
123
|
-
What you actually described is a user re-engagement system.
|
|
124
|
-
The narrowest wedge: one email on task completion.
|
|
125
|
-
Ship that tomorrow. The full vision is a 3-month project.
|
|
126
|
-
|
|
127
|
-
[ROLE: Architect]
|
|
128
|
-
For the narrow wedge:
|
|
129
|
-
- Event: task.completed → webhook → email queue (Redis)
|
|
130
|
-
- No real-time needed for MVP
|
|
131
|
-
- Schema: notifications(id, user_id, type, payload, sent_at)
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
## Code Examples
|
|
136
|
-
|
|
137
|
-
See `EXAMPLES.md` for detailed code examples.
|
|
138
|
-
|
|
139
|
-
## Validation Checklist
|
|
140
|
-
|
|
141
|
-
What to verify during the review phase before completing the task.
|
|
142
|
-
|
|
143
|
-
## Common Mistakes
|
|
144
|
-
|
|
145
|
-
Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
|
|
146
|
-
|
|
147
|
-
## Integration Notes
|
|
148
|
-
|
|
149
|
-
How this skill interacts with other skills.
|
|
5
|
+
Useful review perspectives are product scope, architecture, implementation, QA, security, and release. Choose only those relevant to the inspected change. Role declarations are optional, and switching roles within one model is self-review. Ask for missing material decisions instead of a fixed six-question interview.
|
|
@@ -1,45 +1,12 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const diff = Date.now() - date.getTime();
|
|
14
|
-
// 30 lines of manual math, plurals, and string building
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### Best practice: ContextOS Standard (Standard Library Native API)
|
|
20
|
-
|
|
21
|
-
```typescript
|
|
22
|
-
// GOOD: Native Intl API, zero bundle cost, handles all locales
|
|
23
|
-
export const formatRelativeTime = (date: Date, locale = 'en'): string => {
|
|
24
|
-
const diffDays = Math.round((date.getTime() - Date.now()) / (1000 * 60 * 60 * 24));
|
|
25
|
-
return new Intl.RelativeTimeFormat(locale, { numeric: 'auto' }).format(diffDays, 'day');
|
|
26
|
-
};
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## Example 2: Component Library Reuse
|
|
32
|
-
|
|
33
|
-
### Anti-pattern: Hand-rolled Modal from Scratch
|
|
34
|
-
|
|
35
|
-
```text
|
|
36
|
-
BAD: Writing custom overlay DOM, manual scroll locking, manual focus trapping,
|
|
37
|
-
and custom keydown listeners. Burns 300+ lines of fragile code.
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### Best practice: ContextOS Standard (Leverage Established Primitives)
|
|
41
|
-
|
|
42
|
-
```bash
|
|
43
|
-
# GOOD: Install battle-tested primitive that handles ARIA, portals, and keyboard navigation
|
|
44
|
-
npx shadcn@latest add dialog
|
|
45
|
-
```
|
|
1
|
+
# Minimalism examples
|
|
2
|
+
|
|
3
|
+
- Formatting: use Intl.DateTimeFormat, Intl.RelativeTimeFormat, or the existing
|
|
4
|
+
formatter after verifying locale, timezone, invalid-date, and rounding needs.
|
|
5
|
+
A snippet's length is not a measured bundle or accuracy guarantee.
|
|
6
|
+
- UI: reuse the installed component library when it meets accessibility and
|
|
7
|
+
interaction requirements. Use a native control when it meets those requirements.
|
|
8
|
+
- Protected writes: see the executable updater in
|
|
9
|
+
[references/minimalism.md](references/minimalism.md). Copying arbitrary payload
|
|
10
|
+
fields into persistence does not satisfy minimalism or security.
|
|
11
|
+
- Refactoring: a small named function can be clearer than repeated inline logic,
|
|
12
|
+
even before its third use.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ponytail-mindset
|
|
3
|
-
description: Choose a minimal maintainable implementation for substantive Build tasks while preserving safety and verification.
|
|
3
|
+
description: "Choose a minimal maintainable implementation for substantive Build tasks while preserving safety and verification."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# ponytail-mindset
|
|
@@ -11,31 +11,28 @@ Reduce unnecessary code and dependencies without weakening correctness or securi
|
|
|
11
11
|
|
|
12
12
|
## When to Use
|
|
13
13
|
|
|
14
|
-
Substantive implementation and
|
|
14
|
+
Substantive implementation, refactoring, and reviews of complexity.
|
|
15
15
|
|
|
16
16
|
## Rules & Patterns
|
|
17
17
|
|
|
18
|
-
Before adding code,
|
|
18
|
+
Before adding code, consider YAGNI, project reuse, the standard library, native platform features, installed dependencies, a readable one-liner, then the minimum maintainable code. Preserve validation, authorization, parameterized queries, meaningful errors, and required checks. Single-use helpers are allowed when they clarify a concept or boundary.
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
installed dependencies; a readable one-liner; the minimum maintainable code.
|
|
22
|
-
|
|
23
|
-
Read [references/minimalism.md](references/minimalism.md) for detailed procedures and examples only when needed.
|
|
20
|
+
Read [references/minimalism.md](references/minimalism.md) when a tradeoff needs detail.
|
|
24
21
|
|
|
25
22
|
## Code Examples
|
|
26
23
|
|
|
27
|
-
Reuse the
|
|
24
|
+
Reuse the installed date formatter. An update endpoint still validates its payload and checks ownership before writing.
|
|
28
25
|
|
|
29
26
|
## Validation Checklist
|
|
30
27
|
|
|
31
|
-
- [ ] The requested outcome
|
|
32
|
-
- [ ]
|
|
33
|
-
- [ ]
|
|
28
|
+
- [ ] The requested outcome and applicable failure cases are checked.
|
|
29
|
+
- [ ] Evidence names commands, results, scope, and limitations.
|
|
30
|
+
- [ ] Unrelated changes and existing authorization are preserved.
|
|
34
31
|
|
|
35
32
|
## Common Mistakes
|
|
36
33
|
|
|
37
|
-
|
|
34
|
+
Code-golf; deleting safety checks; choosing a new component library by default; duplicating access-control logic solely to obey a reuse count.
|
|
38
35
|
|
|
39
36
|
## Integration Notes
|
|
40
37
|
|
|
41
|
-
|
|
38
|
+
engineering-workflow chooses verification by risk; security defines protected boundaries. This skill chooses implementation size and readability.
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- **Symptom**: Adding config options, generics, and plugin interfaces for features not requested.
|
|
12
|
-
- **Root Cause**: Premature future-proofing.
|
|
13
|
-
- **Fix**: Apply Rung 1 of the ladder: If it doesn't solve the immediate requirement, do not write it.
|
|
14
|
-
|
|
15
|
-
## 3. Reinventing Installed Dependencies
|
|
16
|
-
|
|
17
|
-
- **Symptom**: Writing a deep-clone helper when Lodash or native structuredClone is available.
|
|
18
|
-
- **Root Cause**: Skipping inspection of package.json and runtime environment.
|
|
19
|
-
- **Fix**: Inspect installed dependencies before writing utility functions.
|
|
1
|
+
# Minimalism troubleshooting
|
|
2
|
+
|
|
3
|
+
- A shorter patch removes validation: restore the boundary checks before comparing
|
|
4
|
+
implementation sizes.
|
|
5
|
+
- A helper is used once: evaluate its meaning, isolation, and readability rather
|
|
6
|
+
than automatically inlining it.
|
|
7
|
+
- A new dependency appears: inspect the existing stack and actual requirement.
|
|
8
|
+
- Retry behavior is assumed: check the SDK contract and test failure handling.
|
|
9
|
+
- A code example is illustrative: do not report a running integration until the
|
|
10
|
+
real imports, persistence, authentication, and checks have been supplied.
|
|
@@ -1,12 +1,123 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"x-contextos-evidence-contract": 1,
|
|
4
|
+
"title": "Scoped verification evidence",
|
|
5
|
+
"description": "Report shape and outcome consistency only; command execution and agent behavior require separate evidence.",
|
|
3
6
|
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"status",
|
|
10
|
+
"checks",
|
|
11
|
+
"limitations"
|
|
12
|
+
],
|
|
4
13
|
"properties": {
|
|
5
|
-
"
|
|
6
|
-
"
|
|
14
|
+
"status": {
|
|
15
|
+
"enum": [
|
|
16
|
+
"verified",
|
|
17
|
+
"partial",
|
|
18
|
+
"not_run"
|
|
19
|
+
]
|
|
20
|
+
},
|
|
21
|
+
"checks": {
|
|
22
|
+
"type": "array",
|
|
23
|
+
"items": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"additionalProperties": false,
|
|
26
|
+
"required": [
|
|
27
|
+
"command",
|
|
28
|
+
"exitCode",
|
|
29
|
+
"scope"
|
|
30
|
+
],
|
|
31
|
+
"properties": {
|
|
32
|
+
"command": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"minLength": 1
|
|
35
|
+
},
|
|
36
|
+
"exitCode": {
|
|
37
|
+
"type": [
|
|
38
|
+
"integer",
|
|
39
|
+
"null"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"scope": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"minLength": 1
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"limitations": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"items": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"minLength": 1
|
|
54
|
+
}
|
|
7
55
|
}
|
|
8
56
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
57
|
+
"allOf": [
|
|
58
|
+
{
|
|
59
|
+
"if": {
|
|
60
|
+
"properties": {
|
|
61
|
+
"status": {
|
|
62
|
+
"const": "verified"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"then": {
|
|
67
|
+
"properties": {
|
|
68
|
+
"checks": {
|
|
69
|
+
"minItems": 1,
|
|
70
|
+
"items": {
|
|
71
|
+
"properties": {
|
|
72
|
+
"exitCode": {
|
|
73
|
+
"const": 0
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"if": {
|
|
83
|
+
"properties": {
|
|
84
|
+
"status": {
|
|
85
|
+
"enum": [
|
|
86
|
+
"partial",
|
|
87
|
+
"not_run"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"then": {
|
|
93
|
+
"properties": {
|
|
94
|
+
"limitations": {
|
|
95
|
+
"minItems": 1
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"if": {
|
|
102
|
+
"properties": {
|
|
103
|
+
"status": {
|
|
104
|
+
"const": "not_run"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"then": {
|
|
109
|
+
"properties": {
|
|
110
|
+
"checks": {
|
|
111
|
+
"items": {
|
|
112
|
+
"properties": {
|
|
113
|
+
"exitCode": {
|
|
114
|
+
"type": "null"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
11
122
|
]
|
|
12
123
|
}
|
|
@@ -1,186 +1,70 @@
|
|
|
1
|
+
# Minimal maintainable implementation
|
|
1
2
|
|
|
2
|
-
|
|
3
|
+
## Decision ladder
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
1. Does this solve the requested outcome? Avoid speculative features.
|
|
6
|
+
2. Does project code or the installed component system already handle it?
|
|
7
|
+
3. Does the standard library provide the operation?
|
|
8
|
+
4. Does the native platform meet the actual requirements?
|
|
9
|
+
5. Can an installed dependency handle it without extra integration cost?
|
|
10
|
+
6. Can it be a readable one-liner without hiding boundary checks?
|
|
11
|
+
7. Otherwise write the smallest clear implementation.
|
|
5
12
|
|
|
6
|
-
|
|
13
|
+
The rule of three is a duplication heuristic, not a ban on named functions.
|
|
14
|
+
Extract a single-use helper when it clarifies an invariant or isolates an I/O
|
|
15
|
+
boundary. Prefer the project's established UI system; do not install shadcn or
|
|
16
|
+
another library merely because a generic guide names it. dayjs is a dependency,
|
|
17
|
+
not a standard-library API. Verify retry/circuit-breaker support in the actual
|
|
18
|
+
SDK; do not assume native fetch supplies an application retry policy.
|
|
7
19
|
|
|
8
|
-
##
|
|
20
|
+
## Preserve boundary validation
|
|
9
21
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
Based on [DietrichGebert/ponytail](https://github.com/DietrichGebert/ponytail).
|
|
15
|
-
|
|
16
|
-
> _He says nothing. He writes one line. It works._
|
|
17
|
-
|
|
18
|
-
**Core Impact**: Dramatically reduces code footprint by eliminating premature abstraction, YAGNI violations, and boilerplate, while keeping all safety invariants (validation, error handling, security) 100% intact.
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
### Core Principle
|
|
23
|
-
|
|
24
|
-
> **The best code is code you don't write.**\
|
|
25
|
-
> Write only what the task strictly needs. Lazy about the solution, never about reading and understanding.
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
### The 7-Rung Decision Ladder
|
|
30
|
-
|
|
31
|
-
**Before writing ANY code**, stop and check each rung in order. Stop at the first rung that holds:
|
|
32
|
-
|
|
33
|
-
```text
|
|
34
|
-
1. Does this need to exist?
|
|
35
|
-
→ No: YAGNI — skip it entirely. Don't build for "future use."
|
|
36
|
-
|
|
37
|
-
2. Already in this codebase or component library?
|
|
38
|
-
→ Yes: Reuse it. Don't rewrite. Call the existing function/component/module.
|
|
39
|
-
→ For UI: Check shadcn/ui FIRST. Before building a complex UI element from scratch, check if it exists in the component library. If yes, generate the install command: npx shadcn@latest add dialog — never manually rewrite what shadcn already provides.
|
|
40
|
-
|
|
41
|
-
3. Standard library does it?
|
|
42
|
-
→ Yes: Use it. Don't write formatDate() — use Intl.DateTimeFormat or dayjs.
|
|
43
|
-
|
|
44
|
-
4. Native platform feature?
|
|
45
|
-
→ Yes: Use it. Don't install flatpickr when <input type="date"> exists.
|
|
46
|
-
→ Exception for UI Components: If a native HTML element (like <input type="date"> or <select>) CANNOT be styled consistently across Chrome, Safari, and Firefox to match the premium design system — use the established component library (e.g., shadcn/ui <DatePicker>, <Select>) instead. Cross-browser inconsistency is a legitimate reason to NOT use native.
|
|
47
|
-
|
|
48
|
-
5. Already-installed dependency?
|
|
49
|
-
→ Yes: Use it. Don't install a new library to do what an existing one can.
|
|
50
|
-
|
|
51
|
-
6. Can it be done in one line?
|
|
52
|
-
→ Yes: One line. No abstraction layer needed.
|
|
53
|
-
|
|
54
|
-
7. Only then: write the MINIMUM that works.
|
|
55
|
-
→ No classes when a function works. No module when an inline does.
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
---
|
|
59
|
-
|
|
60
|
-
### The Rule of Three (Do Not Abstract Early)
|
|
61
|
-
|
|
62
|
-
- **First occurrence**: Write it inline directly where it is needed.
|
|
63
|
-
- **Second occurrence**: Duplicate it cleanly. Duplication is cheaper than the wrong abstraction.
|
|
64
|
-
- **Third occurrence**: Only now extract a shared helper or utility.
|
|
65
|
-
|
|
66
|
-
---
|
|
67
|
-
|
|
68
|
-
### 10 Concrete Over-Engineering Red Flags
|
|
69
|
-
|
|
70
|
-
1. Creating a `GenericRepository<T>` when you only have 2 database tables.
|
|
71
|
-
2. Creating a custom state machine or complex reducer for 2 boolean flags.
|
|
72
|
-
3. Adding a configuration file or environment variables for values that never change.
|
|
73
|
-
4. Writing custom retry/circuit-breaker logic when native `fetch` or SDK already handles it.
|
|
74
|
-
5. Building a generic `BaseService` with 15 hook methods implemented by only one class.
|
|
75
|
-
6. Wrapping every standard library call in a custom helper class (`StringUtils`, `DateUtils`, `ObjectUtils`).
|
|
76
|
-
7. Creating a multi-level folder structure (`domains/auth/adapters/driving/rest/controllers/dto/`) for a 30-line microservice.
|
|
77
|
-
8. Writing custom mock frameworks when Vitest/Jest/Node test runner provide standard mocks.
|
|
78
|
-
9. Installing a 50KB npm package for a 3-line utility (e.g. `left-pad`, `is-number`, `deep-clone`).
|
|
79
|
-
10. Pre-optimizing caching and indexing for endpoints serving 10 requests a day.
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
### The Sacred Exceptions (NEVER Cut These)
|
|
84
|
-
|
|
85
|
-
The ladder applies to features and abstractions. These 4 areas are **non-negotiable** and **never simplified away**:
|
|
86
|
-
|
|
87
|
-
#### 1. Input Validation
|
|
22
|
+
This runnable example defines a protected update operation around a supplied
|
|
23
|
+
persistence function. The caller must obtain the session through trusted
|
|
24
|
+
server-side authentication. The sample schema covers only name/email; adapt it
|
|
25
|
+
to the real product schema, error contracts, and tenant model.
|
|
88
26
|
|
|
27
|
+
<!-- example: ponytail-update -->
|
|
89
28
|
```javascript
|
|
90
|
-
|
|
91
|
-
function
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
29
|
+
export function createUserUpdater(update) {
|
|
30
|
+
if (typeof update !== 'function') throw new TypeError('Persistence function required');
|
|
31
|
+
return async function updateUser(id, data, session) {
|
|
32
|
+
if (typeof id !== 'string' || !id || session?.userId !== id) {
|
|
33
|
+
throw new Error('Forbidden');
|
|
34
|
+
}
|
|
35
|
+
if (!data || typeof data !== 'object' || Array.isArray(data)) {
|
|
36
|
+
throw new TypeError('Invalid update payload');
|
|
37
|
+
}
|
|
38
|
+
const keys = Object.keys(data);
|
|
39
|
+
if (!keys.length || keys.some(key => !['name', 'email'].includes(key))) {
|
|
40
|
+
throw new TypeError('Unknown or empty update fields');
|
|
41
|
+
}
|
|
42
|
+
const parsed = {};
|
|
43
|
+
if (Object.hasOwn(data, 'name')) {
|
|
44
|
+
if (typeof data.name !== 'string' || !data.name.trim() || data.name.length > 100) {
|
|
45
|
+
throw new TypeError('Invalid name');
|
|
46
|
+
}
|
|
47
|
+
parsed.name = data.name;
|
|
48
|
+
}
|
|
49
|
+
if (Object.hasOwn(data, 'email')) {
|
|
50
|
+
if (typeof data.email !== 'string' || data.email.length > 254 ||
|
|
51
|
+
!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(data.email)) {
|
|
52
|
+
throw new TypeError('Invalid email');
|
|
53
|
+
}
|
|
54
|
+
parsed.email = data.email;
|
|
55
|
+
}
|
|
56
|
+
return update({ where: { id }, data: parsed });
|
|
57
|
+
};
|
|
101
58
|
}
|
|
102
59
|
```
|
|
103
60
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
// [GOOD] Always handle errors explicitly
|
|
108
|
-
async function fetchUser(id) {
|
|
109
|
-
try {
|
|
110
|
-
const user = await db.findById(id);
|
|
111
|
-
if (!user) throw new NotFoundError(`User ${id} not found`);
|
|
112
|
-
return user;
|
|
113
|
-
} catch (err) {
|
|
114
|
-
logger.error('fetchUser failed', { id, err });
|
|
115
|
-
throw err;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
#### 3. Security Checks
|
|
121
|
-
|
|
122
|
-
- Authorization check BEFORE every query or mutation.
|
|
123
|
-
- Parameterized queries everywhere — zero string concatenation in SQL.
|
|
124
|
-
- Strict sanitization of all rendered HTML and markdown.
|
|
125
|
-
|
|
126
|
-
#### 4. Type Safety & Behavioral Tests
|
|
127
|
-
|
|
128
|
-
- Strict TypeScript types — no `any` evasion.
|
|
129
|
-
- Tests covering happy path, 4xx, and 5xx edge cases.
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## Code Examples
|
|
134
|
-
|
|
135
|
-
### Native Platform vs Over-Built Package
|
|
136
|
-
|
|
137
|
-
**Over-build**:
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
npm install flatpickr
|
|
141
|
-
# Creates DatePickerWrapper.jsx (45 lines) + useDatePicker.js (30 lines) + styles (60 lines)
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
**Ponytail approach (rung 4)**:
|
|
145
|
-
|
|
146
|
-
```html
|
|
147
|
-
<input type="date" name="date" aria-label="Appointment date" />
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### Next.js App Router Server Action vs REST Endpoint
|
|
151
|
-
|
|
152
|
-
```typescript
|
|
153
|
-
// Instead of /api/users/[id]/route.ts + custom fetch wrapper:
|
|
154
|
-
"use server";
|
|
155
|
-
|
|
156
|
-
export async function updateUser(id: string, data: UpdateUserInput) {
|
|
157
|
-
const session = await getSession(); // auth check — never skip
|
|
158
|
-
if (session?.userId !== id) throw new Error("Forbidden");
|
|
159
|
-
return db.users.update(id, data);
|
|
160
|
-
}
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
---
|
|
164
|
-
|
|
165
|
-
## Validation Checklist
|
|
166
|
-
|
|
167
|
-
- [ ] Every new dependency has been verified: cannot be solved with native platform or existing dependencies.
|
|
168
|
-
- [ ] No single-use abstractions, wrappers, or interfaces created.
|
|
169
|
-
- [ ] Sacred exceptions preserved: 100% input validation, explicit error handling, security checks intact.
|
|
170
|
-
- [ ] All code written passes all existing unit and integration tests.
|
|
171
|
-
|
|
172
|
-
---
|
|
173
|
-
|
|
174
|
-
## Common Mistakes
|
|
175
|
-
|
|
176
|
-
- **Cutting validation to write less code**: The goal is less architecture/boilerplate, never less safety.
|
|
177
|
-
- **Creating utilities "for future use"**: Only write utilities when used 3+ times.
|
|
178
|
-
- **Rewriting component libraries**: Building custom modals, tabs, or tooltips from scratch when shadcn/ui or Radix is already in the project.
|
|
179
|
-
|
|
180
|
-
---
|
|
61
|
+
The verifier runs this block with an injected persistence function and asserts
|
|
62
|
+
that denied users, invalid emails, and unknown privilege fields never reach it.
|
|
63
|
+
This is boundary evidence, not proof of a live database or authentication setup.
|
|
181
64
|
|
|
182
|
-
##
|
|
65
|
+
## Verification checklist
|
|
183
66
|
|
|
184
|
-
-
|
|
185
|
-
-
|
|
186
|
-
-
|
|
67
|
+
- Each dependency or abstraction solves an inspected requirement.
|
|
68
|
+
- Protected inputs and operations retain their checks.
|
|
69
|
+
- Errors have a meaningful contract; avoid redundant catch/log/rethrow layers.
|
|
70
|
+
- Behavior checks cover relevant success and failure cases.
|