@study-lenses/create-package 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,575 @@
1
+ # AI Agent Context
2
+
3
+ This file provides specific context for AI assistants working with this `@study-lenses` package.
4
+
5
+ - [Project Overview](#project-overview)
6
+ - [Key Technical Context](#key-technical-context)
7
+ - [Architecture](#architecture)
8
+ - [Critical Conventions](#critical-conventions)
9
+ - [Type System](#type-system)
10
+ - [Testing Approach](#testing-approach)
11
+ - [Linting Approach](#linting-approach)
12
+ - [Incremental TDD Workflow](#incremental-tdd-workflow)
13
+ - [Safety Guardrails](#safety-guardrails)
14
+ - [Adversarial Review Protocol](#adversarial-review-protocol)
15
+ - [LLM Collaboration Conventions](#llm-collaboration-conventions)
16
+ - [References](#references)
17
+
18
+ ## Project Overview
19
+
20
+ See [README.md](./README.md) for what this package does and where it fits in
21
+ the `@study-lenses` ecosystem.
22
+
23
+ > **⚠️ Plan Mode First:** Discuss changes with Claude in plan mode before implementation.
24
+ > Exceptions: trivial fixes, user says "skip plan mode", or pure research tasks. Plan mode
25
+ > prevents wasted effort from misunderstandings and catches issues before code exists.
26
+
27
+ ## Key Technical Context
28
+
29
+ ### Architecture
30
+
31
+ See [README.md § Architecture](./README.md#architecture) for an overview
32
+ and [DEV.md](./DEV.md) for internal conventions and module boundaries.
33
+
34
+ ### Critical Conventions
35
+
36
+ #### 1. Export Conventions
37
+
38
+ - **One default export per file**: Named function/const, then `export default` at bottom
39
+ - **No barrel files**: Import directly from source files (no `index.ts` re-exports except `/src/index.ts`)
40
+ - **Always `.js` extension** in imports
41
+
42
+ ```javascript
43
+ // ✅ CORRECT
44
+ function myFunction() { ... }
45
+ export default myFunction;
46
+
47
+ // ❌ WRONG
48
+ export default function() { ... } // inline default
49
+ export function myFunction() { ... } // named export
50
+ import { x } from './index.js'; // barrel import
51
+ ```
52
+
53
+ #### Type Location
54
+
55
+ Types live in `<module>/types.ts` with the code they document.
56
+
57
+ | Location | Purpose |
58
+ | ----------------------- | ------------------------------------- |
59
+ | `src/<module>/types.ts` | Types for that module |
60
+ | `src/index.ts` | Re-exports public types for consumers |
61
+
62
+ #### 2. Object-Threading Pattern
63
+
64
+ All pipeline functions follow this pattern:
65
+
66
+ ```javascript
67
+ function stage(input) {
68
+ const { existingData } = input;
69
+ const newData = process(existingData);
70
+ return { ...input, newData };
71
+ }
72
+ ```
73
+
74
+ #### 3. Pure Functional Approach
75
+
76
+ - No mutations
77
+ - No side effects in core functions
78
+ - Explicit state passing
79
+ - Deterministic behavior
80
+
81
+ #### 4. Function Conventions
82
+
83
+ - Use named `function` declarations by default
84
+ - Arrow functions ONLY as anonymous inline callbacks: single expression, implicit return, readable at a glance
85
+ - Arrows NEVER assigned to variables (`const fn = () => ...` is banned)
86
+ - Non-trivial callbacks: extract as named `function` declarations, pass by name
87
+ - Hoisting encouraged: define helper functions below where they're first called
88
+
89
+ #### 5. No `this` Keyword
90
+
91
+ Banned. Exception: low-level code interfacing with libraries that require it.
92
+
93
+ #### 6. No Mutable Closures
94
+
95
+ Closures over mutable variables (`let`, reassigned bindings) are banned.
96
+ Closures over immutable values (cached config in currying) are fine.
97
+
98
+ #### 7. Method Shorthand in Objects
99
+
100
+ Use `{ process() {} }` not `{ process: function process() {} }`.
101
+
102
+ #### 8. Default Empty Object for Destructured Parameters
103
+
104
+ All destructured object params get `= {}` default:
105
+
106
+ ```javascript
107
+ function processConfig({ preset = 'detailed' } = {}) {}
108
+ ```
109
+
110
+ #### 9. Naming
111
+
112
+ - Functions: verb-first (`extractId`, `createConfig`, `isActive`)
113
+ - Predicates: prefix with `is`/`has`/`can`/`should`
114
+ - Callbacks: describe the transform (`extractId` not `mapUser`)
115
+
116
+ #### 10. Imports
117
+
118
+ - Always include `.js` extension
119
+ - Group: externals → internals → type imports (separated by blank lines)
120
+
121
+ #### 11. Types
122
+
123
+ - Prefer `type` over `interface`
124
+ - Types live in `types.ts` files per module
125
+
126
+ #### 12. Comments
127
+
128
+ - JSDoc for public functions (TypeDoc generates `docs/` from these)
129
+ - TSDoc `@remarks` for consumer-facing "why" context that belongs in generated docs
130
+ - Inline comments explain WHY, not WHAT
131
+ - `DOCS.md` per directory for architecture/decisions/why — for contributors, not consumers (see Documentation Convention below)
132
+
133
+ #### 13. File Structure
134
+
135
+ - One concept per file, named after its default export
136
+ - `kebab-case` for all files and directories
137
+ - Unit tests in `tests/` subdirectory at the same level as source files
138
+ - Every source directory has a `README.md` (brief: what is this module, why does it exist)
139
+
140
+ #### 14. Prefer `const`
141
+
142
+ Use `let` only when reassignment is genuinely needed (loop counters, accumulators).
143
+
144
+ #### 15. Deep Freeze Return Values
145
+
146
+ Objects and arrays returned from functions MUST be deep frozen. This codebase is consumed by
147
+ LLMs that cannot be trusted not to mutate returned data.
148
+
149
+ - **Clone + freeze**: For objects we don't own (caller-provided, external). Clones first, returns new frozen reference
150
+ - **Freeze in place**: For objects we just built (fresh results, config wrappers). Same reference, now frozen
151
+
152
+ Use a deep-freeze utility from your package's dependencies for both operations.
153
+
154
+ **When to freeze**: Function return values, config objects, constants, shared defaults.
155
+
156
+ **Exception**: Performance-critical hot paths where profiling proves freeze overhead is
157
+ unacceptable. Must be documented with a `// perf: skip freeze — [reason]` comment.
158
+
159
+ > See DEV.md § Codebase Conventions for full rationale and examples.
160
+
161
+ ### Readability Patterns
162
+
163
+ These patterns shape how code reads, not just what it does. See DEV.md § 12 for full examples.
164
+
165
+ **Guard-first, happy-path-last** — early returns for edge/error cases at the top; the happy
166
+ path sits uncluttered at the bottom. Works with the linter: deep nesting is a complexity
167
+ violation.
168
+
169
+ **Name intermediate values** — when a sub-expression has a clear identity, capture it in a
170
+ `const`. Name the thing, then use the name.
171
+
172
+ ```typescript
173
+ const tracerModule = tracers[tracer]; // ✅ — named, then checked
174
+ if (!tracerModule) throw ...;
175
+ ```
176
+
177
+ **Ternary: transparent value selection only** — both branches produce the same kind of thing;
178
+ the variable name captures the identity regardless of which path executes. When branches do
179
+ structurally different things, use `if-else`.
180
+
181
+ **Within-file helpers for readability; separate file for reuse** — extract a file-private
182
+ helper when it makes the main function read like a story (single use is fine). Extract to a
183
+ separate file only when the logic is used in 2+ places.
184
+
185
+ **WHY comments for non-obvious JS semantics** — when code relies on language mechanics that
186
+ aren't universally known, add a comment explaining WHY this approach is required.
187
+
188
+ ```typescript
189
+ // typeof null === 'object' in JS — must explicitly exclude null
190
+ if (thing === null) return false;
191
+ ```
192
+
193
+ **Numbered step comments for multi-phase functions** — when a function has distinct phases,
194
+ number them. Makes long functions skimmable without reading every line.
195
+
196
+ ```typescript
197
+ // 1. Validate input (sync)
198
+ // 2. Prepare config (sync)
199
+ // 3. Execute (async)
200
+ ```
201
+
202
+ **Blank lines as paragraph breaks** — separate distinct phases of logic. One blank line ends
203
+ one thought and starts the next. Group related statements; don't break every line.
204
+
205
+ ### Documentation Convention
206
+
207
+ | Content | Where | Audience |
208
+ | --------------------------------------------------- | -------------------------- | ------------ |
209
+ | API reference (signatures, params, returns, throws) | JSDoc/TSDoc → `docs/` | Consumers |
210
+ | Consumer-facing "why" context | TSDoc `@remarks` → `docs/` | Consumers |
211
+ | What this module does, how to navigate it | `README.md` per directory | Contributors |
212
+ | Architecture, design decisions, why this approach | `DOCS.md` per directory | Developers |
213
+ | Non-obvious implementation detail | Inline `//` comment | Code readers |
214
+
215
+ **Rules:**
216
+
217
+ - Every directory has a `README.md` (brief: what is this, how to navigate it)
218
+ - Directories with non-obvious architecture or key design decisions also have a `DOCS.md`
219
+ - `DOCS.md` is for the "why" — tradeoffs, alternatives considered, constraints. NOT an API reference.
220
+ Hand-maintained: fix it or delete it if it goes stale.
221
+ - Public functions have JSDoc/TSDoc in source; TypeDoc generates `docs/` (gitignored, CI-only)
222
+ - `@remarks` for consumer-facing "why" context (appears alongside signatures in TypeDoc output)
223
+
224
+ ### Type System
225
+
226
+ Full TypeScript strict mode. Types live with the code they document (`types.ts` per module).
227
+
228
+ ### Testing Approach
229
+
230
+ See DEV.md § Testing Strategy for full conventions. Summary:
231
+
232
+ - Explicit vitest imports: `import { describe, it, expect } from 'vitest'` (no globals)
233
+ - Unit tests in `tests/` subdirectory (never alongside source files)
234
+ - File suffix: `.test.ts` (never `.spec.ts`)
235
+ - One assertion per `it`; nest `describe` blocks for grouping
236
+ - Direct description naming with implicit arrows for compactness
237
+ - Test ordering: feature → happy path → edge cases → errors → performance
238
+ - Inline test data only — no shared fixtures
239
+ - `.toThrow()` for errors — no try-catch patterns
240
+ - No comments — test names are documentation
241
+
242
+ ### Linting Approach
243
+
244
+ See DEV.md § Linting Conventions for full details. Summary:
245
+
246
+ - **Three-tool pipeline**: ESLint (logic/patterns) + Prettier (formatting) + TypeScript (types)
247
+ - Most functional/import/style conventions auto-enforced via ESLint
248
+ - Pre-commit hooks run `lint:fix` and `format` on staged files
249
+ - Manual review for: default `= {}` params, verb-first naming, file granularity, comment quality
250
+ - Run `npm run validate` to check all three tools at once
251
+
252
+ ### Incremental TDD Workflow
253
+
254
+ All development uses TDD with atomic increments. See DEV.md § Incremental Development Workflow
255
+ for the full process.
256
+
257
+ #### Claude-Specific Workflow Notes
258
+
259
+ **Plan constraints:**
260
+
261
+ - Plans MUST NOT include already-implemented functions — code is developed incrementally
262
+ - Plans start with a brief context line referencing completed work, then list ONLY unimplemented work
263
+ - **Plans describe BEHAVIOR, not code** — never include full implementations in plans. TDD discovers
264
+ implementation
265
+ - Before starting work, verify understanding with the user: what will be built, what constraints
266
+ apply, what success looks like
267
+ - Before writing any code, explain in plain language what you're about to do and why
268
+
269
+ **During TDD cycles:**
270
+
271
+ - Run lint checkpoints on specific modified files, not the whole codebase: `npm run lint <file>`
272
+ - At step 12 (self-review): Run through LLM Anti-Pattern Checklist. Reality check: did I run it?
273
+ Did I trigger the exact behavior I changed? Would I bet $100 this works? Flag what you're least
274
+ confident about for the user to review
275
+ - At step 13: Show actual output from quality checks — don't just claim "tests pass"
276
+
277
+ **Git prompts** (Claude prompts, user executes):
278
+
279
+ - Before a sprint: "Create a feature branch from main for this work"
280
+ - After each passing TDD cycle: "Ready for atomic commit: `add: [description]`"
281
+ - After the last increment: "Sprint complete — ready to push and open a PR or merge to main"
282
+
283
+ **Interrupt and redirect** if the user tries to skip planning, documentation, tests, or quality
284
+ checks — even if they insist.
285
+
286
+ #### Git: Humans Only
287
+
288
+ Claude MUST NOT run any git command that creates, modifies, or deletes history.
289
+
290
+ **Allowed** (read-only):
291
+
292
+ - `git status`, `git diff`, `git log`, `git show`, `git blame`, `git branch --list`
293
+
294
+ **Forbidden** (modifies history):
295
+
296
+ - `git commit`, `git push`, `git merge`, `git rebase`, `git reset`, `git revert`,
297
+ `git cherry-pick`, `git tag`, `git stash push/pop/drop`, `git commit --amend`, `git push --force`
298
+
299
+ **Instead:** Claude prompts the human for all git actions.
300
+
301
+ ### Context Compaction Protocol
302
+
303
+ Long sessions hit context limits, triggering automatic summarization.
304
+
305
+ #### Trigger Mechanisms
306
+
307
+ **Proactive (Claude's judgment):**
308
+
309
+ - ~80% through estimated context window
310
+ - Long multi-file implementation sessions
311
+ - After 10+ incremental commits without break
312
+
313
+ **User-initiated:**
314
+
315
+ - User says `/checkpoint`, "context check", or similar
316
+
317
+ #### Compaction Preparation Checklist
318
+
319
+ When context is approaching capacity, Claude MUST:
320
+
321
+ 1. **Update plan file** — capture current state, what's done, what's left
322
+ 2. **Update docs** — ensure AGENTS.md/DEV.md/README.md reflect current reality
323
+ 3. **Prompt user to commit** — atomic checkpoint before compaction
324
+ 4. **Summarize active context** — write session summary to plan file:
325
+ - Current branch and recent commits
326
+ - Files being modified
327
+ - Open questions or blockers
328
+ - Next immediate task
329
+ 5. **Alert the user** with this format:
330
+
331
+ ```text
332
+ ⚠️ Context approaching capacity.
333
+
334
+ I've documented the current state:
335
+ - Plan file: [path]
336
+ - Branch: [current branch]
337
+ - Last commit: [summary]
338
+ - Next task: [what's next]
339
+
340
+ Ready for session handoff or continuation after compaction.
341
+ ```
342
+
343
+ #### Post-Compaction Recovery
344
+
345
+ After context resets:
346
+
347
+ 1. Re-read AGENTS.md, DEV.md, relevant README.md files
348
+ 2. Read plan file to restore session context
349
+ 3. Verify understanding with user before resuming
350
+
351
+ ### When Working on This Codebase
352
+
353
+ 1. **Follow the Incremental TDD Workflow above** for all development work
354
+ 2. Follow export conventions strictly (named-then-export, no barrels)
355
+ 3. Import directly from source files (no barrel imports), always with `.js` extension
356
+ 4. Maintain object-threading pattern where applicable
357
+ 5. Keep functions pure and deterministic
358
+ 6. Use named `function` declarations (arrows only for inline callbacks)
359
+ 7. No `this` keyword, no mutable closures
360
+ 8. Default empty object `= {}` on all destructured parameters
361
+ 9. Verb-first naming; predicates prefixed with `is`/`has`/`can`/`should`
362
+ 10. Prefer `type` over `interface`; types in `types.ts` files
363
+ 11. Add TypeScript types for all public APIs
364
+ 12. JSDoc/TSDoc for public functions; `@remarks` for consumer-facing "why"; inline comments for
365
+ implementation "why"
366
+ 13. `DOCS.md` per directory for architecture/decisions (hand-maintained, not auto-generated)
367
+ 14. Throw on invalid input; fail fast for critical errors
368
+ 15. Place tests in `tests/` subdirectory, `.test.ts` suffix
369
+ 16. Ensure `README.md` exists and is current in every directory you modify
370
+ 17. Deep freeze all returned objects/arrays (clone-then-freeze for external, freeze-in-place for freshly built)
371
+
372
+ ### Safety Guardrails
373
+
374
+ Claude must actively protect the codebase — especially from its own worst tendencies.
375
+
376
+ #### Risk Assessment
377
+
378
+ Before starting any task involving multiple files, refactoring, cleanup, or architectural changes,
379
+ Claude must warn the user and push toward incremental breakdown. These patterns are especially
380
+ dangerous and must never be repeated:
381
+
382
+ - "Simplification" refactors that break working functionality
383
+ - Architectural rewrites that replace working systems with broken ones
384
+ - File deletion sprees that remove working code
385
+ - Over-abstraction that makes simple things complex
386
+ - Enthusiastic agreement to large changes without risk assessment
387
+
388
+ #### Emergency Brake
389
+
390
+ Work stops immediately if:
391
+
392
+ - Scope creeps beyond the original plan
393
+ - Test failures that aren't immediately understood
394
+ - Breaking changes to public APIs without explicit approval
395
+ - Claude catches itself skipping workflow steps
396
+
397
+ #### Intellectual Honesty
398
+
399
+ When Claude doesn't know something — say so explicitly, then suggest how to find out. Never guess
400
+ confidently. When stuck, say "I'm stuck" — asking for help is better than shipping broken code.
401
+
402
+ #### Defensive Development
403
+
404
+ Never edit a file without reading it first in the current session. Before changing existing code,
405
+ understand why it exists. When something breaks, revert to the last known working state and try
406
+ a different approach.
407
+
408
+ #### LLM Anti-Patterns (Resist These Tendencies)
409
+
410
+ | Anti-Pattern | Rule | Example Fix |
411
+ | -------------------- | -------------------------------- | ----------------------------------------------- |
412
+ | **Over-engineering** | Helper used once? Inline it | `const x = getX(o)` → `const x = o.x` |
413
+ | **Class addiction** | Linter blocks, but check first | `class X` → `function createX()` |
414
+ | **Future-proofing** | User didn't ask? Don't add it | `options = {}` with unused fields → direct impl |
415
+ | **Defensive coding** | Validate at boundaries only | Remove internal re-validation |
416
+ | **Verbose docs** | Name + types explain? Skip JSDoc | Only document WHY or non-obvious contracts |
417
+
418
+ ##### Pre-Proposal Checklist
419
+
420
+ Before proposing code, answer YES to ALL:
421
+
422
+ - [ ] **Simplest solution?** Not most "elegant" or "extensible"
423
+ - [ ] **Only what requested?** No future-proofing, no "nice-to-haves"
424
+ - [ ] **Helpers used >1x?** If used once, inline it
425
+ - [ ] **Validate at boundaries only?** No re-validating internal calls
426
+ - [ ] **Junior-maintainable?** Understandable without explanation
427
+
428
+ ## LLM Collaboration Conventions
429
+
430
+ ### Code Organization for LLM Generation
431
+
432
+ The conventions in DEV.md are designed to help LLMs generate correct code on the first attempt:
433
+
434
+ - **Complete TypeScript types** prevent guessing field names/types
435
+ - **Predictable `kebab-case` filenames** enable discovery without searching
436
+ - **"Why" comments** signal intent that syntax can't convey
437
+ - **Self-documenting error messages** include context for debugging
438
+ - **Structural consistency** (imports → helpers → main → export) enables prediction
439
+
440
+ ### Communication Discipline
441
+
442
+ - No false confidence: never claim something works without running it
443
+ - No sycophancy: never agree with an approach just because the user suggested it
444
+ - Express uncertainty with confidence levels ("~80% confident this is correct")
445
+ - When uncertain, investigate first rather than confirming assumptions
446
+ - Lead with problems and risks, not optimism
447
+
448
+ ### Working with Claude
449
+
450
+ - Treat Claude as an iterative partner, not a one-shot solution
451
+ - Save your state (git commit) before letting Claude make large changes
452
+ - Core business logic needs close human oversight; peripheral features can run more autonomously
453
+
454
+ ## Adversarial Review Protocol
455
+
456
+ Adversarial reviews use a separate agent instance acting as devil's advocate.
457
+ The reviewer agent has READ-ONLY access and produces a structured report with
458
+ concerns, counter-proposals, and a verdict (PROCEED / CONSIDER / PAUSE).
459
+
460
+ Only the **human** can skip an adversarial review. The implementing agent must
461
+ never skip its own review — that defeats the purpose.
462
+
463
+ ### How to Run an Adversarial Review
464
+
465
+ Spawn a separate agent instance with read-only access to the codebase. The
466
+ implementing agent or human initiates the review by providing:
467
+
468
+ 1. The review type (AR-1 through AR-4) and its focus areas
469
+ 2. The relevant files or diff to review
470
+ 3. Context about what was built/proposed and why
471
+
472
+ The reviewer agent produces a structured report. The implementing agent or
473
+ human then responds to each concern before proceeding.
474
+
475
+ Tool-specific examples:
476
+
477
+ - **Claude Code**: use the Agent tool with subagent_type="general-purpose"
478
+ - **Cursor/Copilot**: use chat with the adversarial prompt pasted in
479
+ - **CLI tools**: spawn a second agent session with the review prompt
480
+
481
+ ### Agent Prompt Structure
482
+
483
+ Every adversarial review prompt follows this structure:
484
+
485
+ 1. **Role**: "You are an adversarial reviewer — a senior engineer whose job is to
486
+ find problems, challenge assumptions, and propose better alternatives."
487
+ 2. **Context**: What was built/proposed and why
488
+ 3. **Focus areas**: Specific to each review type (see below)
489
+ 4. **Constraints**: Read-only, must produce structured output
490
+ 5. **Output format**: Concerns list (numbered, with severity), counter-proposals, verdict
491
+
492
+ ### Verdict Definitions
493
+
494
+ - **PROCEED**: No significant issues found. Note minor observations if any.
495
+ - **CONSIDER**: Issues found that are worth thinking about but don't block progress.
496
+ List specific concerns with suggested alternatives.
497
+ - **PAUSE**: Significant issues found that should be resolved before continuing.
498
+ List blocking concerns with rationale for why they block.
499
+
500
+ ### Resolution Rules
501
+
502
+ - Human always has final authority
503
+ - PROCEED: continue immediately
504
+ - CONSIDER: document your response to each concern, then continue
505
+ - PAUSE: present concerns to human, wait for decision before continuing
506
+ - Never skip a PAUSE verdict — it exists to protect the codebase
507
+
508
+ ### AR-1: Design Challenge
509
+
510
+ **Trigger:** During Phase 0, after README spec, before types.ts locks the contract.
511
+ **Skip:** Only when the human explicitly opts out.
512
+
513
+ **Focus areas:**
514
+
515
+ - Is this the right level of abstraction?
516
+ - Are there simpler alternatives that achieve the same goal?
517
+ - What edge cases are missing from the spec?
518
+ - What decisions will be hard to change later?
519
+ - Does this follow existing patterns in the codebase, or introduce new ones unnecessarily?
520
+ - Are the types over- or under-specified?
521
+
522
+ **Provide to agent:** README updates, any design notes, existing codebase patterns
523
+
524
+ ### AR-2: Test Strategy Challenge
525
+
526
+ **Trigger:** After first failing test is written for an increment.
527
+ **Skip:** Only when the human explicitly opts out.
528
+
529
+ **Focus areas:**
530
+
531
+ - Are we testing behavior or implementation details?
532
+ - What edge cases are missing?
533
+ - Are we over-testing (brittle tests that break on refactor)?
534
+ - Is the test naming clear and descriptive?
535
+ - Does the test ordering follow convention (feature → happy → edge → error)?
536
+
537
+ **Provide to agent:** The test file, the stub/types being tested, related existing tests
538
+
539
+ ### AR-3: Implementation Audit
540
+
541
+ **Trigger:** After self-review (step 12) for an increment.
542
+ **Skip:** Only when the human explicitly opts out.
543
+
544
+ **Focus areas:**
545
+
546
+ - Is this the simplest solution? Could it be done in fewer lines?
547
+ - Are there existing utilities being ignored (check src/utils/)?
548
+ - Does it follow the codebase's functional conventions (no this, no mutable closures)?
549
+ - Are there subtle bugs (off-by-one, null handling, async footguns)?
550
+ - Is error handling appropriate (validate at boundaries only)?
551
+ - Would a junior developer understand this without explanation?
552
+
553
+ **Provide to agent:** The implementation file, its test file, types, any utilities used
554
+
555
+ ### AR-4: Pre-Merge Review
556
+
557
+ **Trigger:** After all increments complete, before commit prompt.
558
+ **Skip:** Only when the human explicitly opts out.
559
+
560
+ **Focus areas:**
561
+
562
+ - Cross-file consistency: do naming, patterns, and conventions align?
563
+ - Documentation sync: do README, types, JSDoc, and tests all agree?
564
+ - Missing test scenarios: are there untested code paths?
565
+ - Convention compliance: does the full changeset follow DEV.md conventions?
566
+ - Architecture: does this fit cleanly into the existing layer stack?
567
+ - Scope: did we add anything beyond what was requested?
568
+
569
+ **Provide to agent:** Full diff (git diff), modified files list, the original task description
570
+
571
+ ## References
572
+
573
+ - See DEV.md for architecture and code conventions
574
+ - See `src/` directory READMEs for module-specific context
575
+ - API documentation generated to `docs/` via `npm run docs`
@@ -0,0 +1,3 @@
1
+ # Claude Code — project instructions are in AGENTS.md
2
+
3
+ @AGENTS.md
@@ -0,0 +1,39 @@
1
+ # Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to a positive environment:
10
+
11
+ - Using welcoming and inclusive language
12
+ - Being respectful of differing viewpoints and experiences
13
+ - Gracefully accepting constructive criticism
14
+ - Focusing on what is best for the community
15
+ - Showing empathy towards other community members
16
+
17
+ Examples of unacceptable behavior:
18
+
19
+ - The use of sexualized language or imagery and unwelcome sexual attention or advances
20
+ - Trolling, insulting or derogatory comments, and personal or political attacks
21
+ - Public or private harassment
22
+ - Publishing others' private information without explicit permission
23
+ - Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Enforcement Responsibilities
26
+
27
+ Project maintainers are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
28
+
29
+ ## Scope
30
+
31
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces.
32
+
33
+ ## Enforcement
34
+
35
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainers. All complaints will be reviewed and investigated promptly and fairly.
36
+
37
+ ## Attribution
38
+
39
+ This Code of Conduct is adapted from the Contributor Covenant, version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
@@ -0,0 +1,53 @@
1
+ # Contributing
2
+
3
+ Thank you for your interest in contributing!
4
+
5
+ ## Quick Start
6
+
7
+ 1. Fork and clone the repository
8
+ 2. Install dependencies: `npm install`
9
+ 3. Create a feature branch: `git checkout -b feature/your-feature`
10
+ 4. Make your changes following our conventions (see DEV.md)
11
+ 5. Run tests: `npm test`
12
+ 6. Run full validation: `npm run validate`
13
+ 7. Submit a pull request
14
+
15
+ ## Development Guidelines
16
+
17
+ - Follow all conventions in [DEV.md § Codebase Conventions](./DEV.md#codebase-conventions)
18
+ - Maintain pure functional approach
19
+ - Add tests in a `tests/` subdirectory alongside source (see [DEV.md § Test Organization](./DEV.md#test-organization))
20
+ - Maintain `README.md` in every source directory (see [DEV.md § Directory Documentation Convention](./DEV.md#directory-documentation-convention))
21
+ - Update documentation as needed
22
+
23
+ Full conventions with rationale and examples: see [DEV.md](./DEV.md).
24
+
25
+ ## Reporting Issues
26
+
27
+ When reporting issues, please include:
28
+
29
+ - Clear description of the problem
30
+ - Minimal code example reproducing the issue
31
+ - Expected vs actual behavior
32
+ - Your environment (Node version, OS)
33
+
34
+ ## Pull Request Process
35
+
36
+ 1. Run `npm run validate` (lint, typecheck, and tests must all pass)
37
+ 2. Update relevant documentation
38
+ 3. Ensure `README.md` is current in every modified directory
39
+ 4. Follow existing code patterns
40
+ 5. Keep commits focused and descriptive
41
+ 6. Reference any related issues
42
+
43
+ ## Code of Conduct
44
+
45
+ See [CODE-OF-CONDUCT.md](./CODE-OF-CONDUCT.md) for our community guidelines.
46
+
47
+ ## Questions?
48
+
49
+ Open an issue for clarification or discussion about potential changes.
50
+
51
+ ## License
52
+
53
+ By contributing, you agree that your contributions will be licensed under the project's MIT License.