sinapse-ai 7.0.5 → 7.2.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/.sinapse-ai/core-config.yaml +2 -26
- package/.sinapse-ai/data/entity-registry.yaml +742 -917
- package/.sinapse-ai/data/registry-update-log.jsonl +22 -0
- package/.sinapse-ai/infrastructure/scripts/ide-sync/index.js +1 -49
- package/.sinapse-ai/infrastructure/scripts/validate-parity.js +0 -7
- package/.sinapse-ai/install-manifest.yaml +11 -43
- package/README.en.md +6 -11
- package/README.md +6 -11
- package/bin/cli.js +116 -75
- package/bin/modules/env-config.js +1 -2
- package/bin/sinapse-init.js +23 -188
- package/docs/ide-integration.md +22 -263
- package/docs/installation/README.md +4 -6
- package/docs/installation/faq.md +10 -33
- package/docs/installation/linux.md +0 -23
- package/docs/installation/macos.md +0 -10
- package/docs/installation/troubleshooting.md +5 -9
- package/docs/installation/v4-quick-start.md +1 -1
- package/docs/installation/windows.md +0 -18
- package/package.json +2 -9
- package/packages/installer/src/config/ide-configs.js +3 -49
- package/squads/claude-code-mastery/CHANGELOG.md +22 -0
- package/squads/claude-code-mastery/README.md +146 -0
- package/squads/claude-code-mastery/agents/claude-mastery-chief.md +554 -0
- package/squads/claude-code-mastery/agents/config-engineer.md +865 -0
- package/squads/claude-code-mastery/agents/hooks-architect.md +1013 -0
- package/squads/claude-code-mastery/agents/mcp-integrator.md +791 -0
- package/squads/claude-code-mastery/agents/project-integrator.md +1196 -0
- package/squads/claude-code-mastery/agents/roadmap-sentinel.md +931 -0
- package/squads/claude-code-mastery/agents/skill-craftsman.md +1250 -0
- package/squads/claude-code-mastery/agents/swarm-orqx.md +1008 -0
- package/squads/claude-code-mastery/checklists/agent-team-readiness-checklist.md +88 -0
- package/squads/claude-code-mastery/checklists/brownfield-readiness-checklist.md +91 -0
- package/squads/claude-code-mastery/checklists/change-checklist.md +75 -0
- package/squads/claude-code-mastery/checklists/context-rot-checklist.md +114 -0
- package/squads/claude-code-mastery/checklists/integration-audit-checklist.md +104 -0
- package/squads/claude-code-mastery/checklists/multi-agent-review-checklist.md +77 -0
- package/squads/claude-code-mastery/checklists/pre-push-checklist.md +79 -0
- package/squads/claude-code-mastery/data/ci-cd-patterns.yaml +412 -0
- package/squads/claude-code-mastery/data/claude-code-quick-ref.yaml +314 -0
- package/squads/claude-code-mastery/data/hook-patterns.yaml +512 -0
- package/squads/claude-code-mastery/data/mcp-integration-catalog.yaml +323 -0
- package/squads/claude-code-mastery/data/project-type-signatures.yaml +335 -0
- package/squads/claude-code-mastery/scripts/validate-setup.js +163 -0
- package/squads/claude-code-mastery/squad.yaml +205 -0
- package/squads/claude-code-mastery/tasks/audit-integration.md +219 -0
- package/squads/claude-code-mastery/tasks/audit-settings.md +206 -0
- package/squads/claude-code-mastery/tasks/audit-setup.md +225 -0
- package/squads/claude-code-mastery/tasks/brownfield-setup.md +322 -0
- package/squads/claude-code-mastery/tasks/ci-cd-setup.md +335 -0
- package/squads/claude-code-mastery/tasks/claude-md-engineer.md +334 -0
- package/squads/claude-code-mastery/tasks/configure-claude-code.md +215 -0
- package/squads/claude-code-mastery/tasks/context-rot-audit.md +329 -0
- package/squads/claude-code-mastery/tasks/create-agent-definition.md +278 -0
- package/squads/claude-code-mastery/tasks/create-rules.md +206 -0
- package/squads/claude-code-mastery/tasks/create-team-topology.md +258 -0
- package/squads/claude-code-mastery/tasks/diagnose.md +166 -0
- package/squads/claude-code-mastery/tasks/enterprise-config.md +346 -0
- package/squads/claude-code-mastery/tasks/hook-designer.md +272 -0
- package/squads/claude-code-mastery/tasks/integrate-project.md +304 -0
- package/squads/claude-code-mastery/tasks/mcp-integration-plan.md +229 -0
- package/squads/claude-code-mastery/tasks/mcp-workflow.md +285 -0
- package/squads/claude-code-mastery/tasks/multi-project-setup.md +228 -0
- package/squads/claude-code-mastery/tasks/optimize-context.md +217 -0
- package/squads/claude-code-mastery/tasks/optimize-workflow.md +226 -0
- package/squads/claude-code-mastery/tasks/parallel-decomposition.md +293 -0
- package/squads/claude-code-mastery/tasks/permission-strategy.md +266 -0
- package/squads/claude-code-mastery/tasks/sandbox-setup.md +279 -0
- package/squads/claude-code-mastery/tasks/setup-repository.md +230 -0
- package/squads/claude-code-mastery/tasks/setup-wizard.md +236 -0
- package/squads/claude-code-mastery/tasks/worktree-strategy.md +320 -0
- package/squads/claude-code-mastery/templates/claude-md-fullstack.md +147 -0
- package/squads/claude-code-mastery/templates/claude-md-library.md +175 -0
- package/squads/claude-code-mastery/templates/claude-md-microservices.md +186 -0
- package/squads/claude-code-mastery/templates/claude-md-mobile.md +198 -0
- package/squads/claude-code-mastery/templates/claude-md-monorepo.md +139 -0
- package/squads/claude-code-mastery/templates/github-actions-claude-ci.yml +348 -0
- package/squads/claude-code-mastery/templates/github-actions-claude-review.yml +179 -0
- package/squads/claude-code-mastery/workflows/wf-audit-complete.yaml +140 -0
- package/squads/claude-code-mastery/workflows/wf-knowledge-update.yaml +165 -0
- package/squads/claude-code-mastery/workflows/wf-project-setup.yaml +192 -0
- package/.sinapse-ai/infrastructure/scripts/ide-sync/transformers/antigravity.js +0 -105
- package/.sinapse-ai/infrastructure/scripts/ide-sync/transformers/cursor.js +0 -94
- package/.sinapse-ai/infrastructure/scripts/ide-sync/transformers/github-copilot.js +0 -184
- package/.sinapse-ai/infrastructure/scripts/validate-gemini-integration.js +0 -151
- package/.sinapse-ai/product/templates/ide-rules/antigravity-rules.md +0 -115
- package/.sinapse-ai/product/templates/ide-rules/copilot-rules.md +0 -92
- package/.sinapse-ai/product/templates/ide-rules/cursor-rules.md +0 -115
- package/.sinapse-ai/product/templates/ide-rules/gemini-rules.md +0 -87
- package/docs/pt/platforms/antigravity.md +0 -508
- package/docs/pt/platforms/cursor.md +0 -633
- package/docs/pt/platforms/gemini-cli.md +0 -481
- package/docs/pt/platforms/github-copilot.md +0 -478
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# CLAUDE.md — Library / Package Project
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
- **Name:** [PACKAGE_NAME]
|
|
6
|
+
- **Description:** [What this library does]
|
|
7
|
+
- **Type:** Reusable library / npm package
|
|
8
|
+
- **Registry:** npm (public / private)
|
|
9
|
+
- **Status:** [Alpha / Beta / Stable]
|
|
10
|
+
- **Current Version:** [X.Y.Z]
|
|
11
|
+
|
|
12
|
+
## Tech Stack
|
|
13
|
+
|
|
14
|
+
| Layer | Technology | Notes |
|
|
15
|
+
|-------|-----------|-------|
|
|
16
|
+
| Language | TypeScript | Strict mode enabled |
|
|
17
|
+
| Bundler | tsup / Rollup / Vite | Dual ESM + CJS output |
|
|
18
|
+
| Testing | Vitest / Jest | Unit + integration |
|
|
19
|
+
| Linting | ESLint + Prettier | Strict rules for library code |
|
|
20
|
+
| Docs | TypeDoc / TSDoc | Auto-generated API docs |
|
|
21
|
+
|
|
22
|
+
## API Surface
|
|
23
|
+
|
|
24
|
+
### Public Exports (src/index.ts)
|
|
25
|
+
|
|
26
|
+
All public API is exported from the package entry point. Every export is part of the
|
|
27
|
+
public contract and subject to semver guarantees.
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
// src/index.ts — the single source of truth for public API
|
|
31
|
+
export { createClient } from './client';
|
|
32
|
+
export { validate } from './validators';
|
|
33
|
+
export type { ClientOptions, ValidationResult } from './types';
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Internal vs Public
|
|
37
|
+
|
|
38
|
+
| Directory | Visibility | Semver Contract |
|
|
39
|
+
|-----------|-----------|----------------|
|
|
40
|
+
| `src/index.ts` | PUBLIC | Breaking changes = major bump |
|
|
41
|
+
| `src/` (non-exported) | INTERNAL | Can change freely |
|
|
42
|
+
| `src/internal/` | INTERNAL | Never import from outside |
|
|
43
|
+
| `src/__tests__/` | INTERNAL | Test utilities, not shipped |
|
|
44
|
+
|
|
45
|
+
### Rules
|
|
46
|
+
- Never export from subdirectories directly; always re-export through `src/index.ts`
|
|
47
|
+
- Prefix internal utilities with `_` or place in `src/internal/`
|
|
48
|
+
- Every public function must have TSDoc comments with `@example` blocks
|
|
49
|
+
- Every public type must be explicitly exported (no implicit exports via inference)
|
|
50
|
+
|
|
51
|
+
## Backward Compatibility
|
|
52
|
+
|
|
53
|
+
### Semver Rules
|
|
54
|
+
- **MAJOR (X.0.0):** Removing exports, changing function signatures, renaming types
|
|
55
|
+
- **MINOR (0.X.0):** Adding new exports, adding optional parameters, new features
|
|
56
|
+
- **PATCH (0.0.X):** Bug fixes, performance improvements, documentation
|
|
57
|
+
|
|
58
|
+
### Breaking Change Checklist
|
|
59
|
+
Before any major version bump:
|
|
60
|
+
- [ ] Document all breaking changes in CHANGELOG.md
|
|
61
|
+
- [ ] Provide migration guide
|
|
62
|
+
- [ ] Update all examples and documentation
|
|
63
|
+
- [ ] Consider deprecation period (mark deprecated in minor, remove in next major)
|
|
64
|
+
|
|
65
|
+
### Deprecation Pattern
|
|
66
|
+
```typescript
|
|
67
|
+
/**
|
|
68
|
+
* @deprecated Use `createClientV2()` instead. Will be removed in v3.0.0.
|
|
69
|
+
*/
|
|
70
|
+
export function createClient(options: OldOptions): Client {
|
|
71
|
+
console.warn('createClient is deprecated. Use createClientV2 instead.');
|
|
72
|
+
return createClientV2(migrateOptions(options));
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Versioning
|
|
77
|
+
|
|
78
|
+
- Follow [Semantic Versioning 2.0.0](https://semver.org/)
|
|
79
|
+
- Use `npm version patch|minor|major` to bump
|
|
80
|
+
- Tag releases: `git tag v1.2.3`
|
|
81
|
+
- Maintain CHANGELOG.md with [Keep a Changelog](https://keepachangelog.com/) format
|
|
82
|
+
|
|
83
|
+
## Testing Strategy
|
|
84
|
+
|
|
85
|
+
### Test Categories
|
|
86
|
+
- **Unit tests:** Every public function, edge cases, error conditions
|
|
87
|
+
- **Integration tests:** Module interactions, real-world usage patterns
|
|
88
|
+
- **Type tests:** Verify TypeScript types with `tsd` or `expect-type`
|
|
89
|
+
- **Snapshot tests:** For serializable outputs (optional)
|
|
90
|
+
|
|
91
|
+
### Coverage Requirements
|
|
92
|
+
- Public API: 100% branch coverage
|
|
93
|
+
- Internal utilities: 80% coverage minimum
|
|
94
|
+
- Type inference: Tested with `expectTypeOf` assertions
|
|
95
|
+
|
|
96
|
+
### Commands
|
|
97
|
+
```bash
|
|
98
|
+
npm test # Run all tests
|
|
99
|
+
npm test -- --coverage # With coverage report
|
|
100
|
+
npm test -- --watch # Watch mode during development
|
|
101
|
+
npm run test:types # Type-level tests
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Documentation Requirements
|
|
105
|
+
|
|
106
|
+
### TSDoc on Every Public Export
|
|
107
|
+
```typescript
|
|
108
|
+
/**
|
|
109
|
+
* Creates a new client instance with the given options.
|
|
110
|
+
*
|
|
111
|
+
* @param options - Configuration options for the client
|
|
112
|
+
* @returns A configured client instance
|
|
113
|
+
* @throws {ValidationError} If options are invalid
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* const client = createClient({ apiKey: 'xxx', timeout: 5000 });
|
|
118
|
+
* const result = await client.query('hello');
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export function createClient(options: ClientOptions): Client {
|
|
122
|
+
// ...
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### README Sections
|
|
127
|
+
- Installation instructions
|
|
128
|
+
- Quick start example
|
|
129
|
+
- API reference (link to generated docs)
|
|
130
|
+
- Configuration options table
|
|
131
|
+
- Error handling guide
|
|
132
|
+
- Migration guides (for major versions)
|
|
133
|
+
|
|
134
|
+
## Build Commands
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
npm run build # Build for distribution (ESM + CJS)
|
|
138
|
+
npm run dev # Watch mode for development
|
|
139
|
+
npm run lint # Lint source code
|
|
140
|
+
npm run lint:fix # Auto-fix lint issues
|
|
141
|
+
npm run typecheck # TypeScript type checking
|
|
142
|
+
npm run docs # Generate API documentation
|
|
143
|
+
npm run prepublishOnly # Pre-publish checks (lint + test + build)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Package.json Fields
|
|
147
|
+
|
|
148
|
+
```jsonc
|
|
149
|
+
{
|
|
150
|
+
"name": "@scope/package-name",
|
|
151
|
+
"version": "1.0.0",
|
|
152
|
+
"type": "module",
|
|
153
|
+
"main": "./dist/index.cjs",
|
|
154
|
+
"module": "./dist/index.js",
|
|
155
|
+
"types": "./dist/index.d.ts",
|
|
156
|
+
"exports": {
|
|
157
|
+
".": {
|
|
158
|
+
"import": "./dist/index.js",
|
|
159
|
+
"require": "./dist/index.cjs",
|
|
160
|
+
"types": "./dist/index.d.ts"
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"files": ["dist", "README.md", "CHANGELOG.md"],
|
|
164
|
+
"sideEffects": false
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Important Notes
|
|
169
|
+
|
|
170
|
+
- Always run the full test suite before publishing
|
|
171
|
+
- Never publish with `--force` or `--no-git-checks`
|
|
172
|
+
- Keep `files` field in package.json minimal (only ship dist/)
|
|
173
|
+
- Test the package locally with `npm link` before publishing
|
|
174
|
+
- Peer dependencies should use wide version ranges (`>=17.0.0`)
|
|
175
|
+
- Bundle size matters: use `bundlephobia` to check before release
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# CLAUDE.md — Microservices Project
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
- **Name:** [PROJECT_NAME]
|
|
6
|
+
- **Description:** [System description]
|
|
7
|
+
- **Type:** Microservices architecture
|
|
8
|
+
- **Deployment:** [Docker / Kubernetes / Cloud Run / ECS]
|
|
9
|
+
- **Status:** [Development / Staging / Production]
|
|
10
|
+
|
|
11
|
+
## Service Architecture
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
services/
|
|
15
|
+
api-gateway/ # Entry point, routing, auth validation
|
|
16
|
+
user-service/ # User management and authentication
|
|
17
|
+
order-service/ # Order processing and management
|
|
18
|
+
payment-service/ # Payment processing
|
|
19
|
+
notification-service/ # Email, SMS, push notifications
|
|
20
|
+
shared/
|
|
21
|
+
proto/ # Protocol Buffer definitions (if gRPC)
|
|
22
|
+
types/ # Shared TypeScript types
|
|
23
|
+
events/ # Event schema definitions
|
|
24
|
+
infrastructure/
|
|
25
|
+
docker/ # Docker Compose files
|
|
26
|
+
k8s/ # Kubernetes manifests
|
|
27
|
+
terraform/ # Infrastructure as Code
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Tech Stack
|
|
31
|
+
|
|
32
|
+
| Layer | Technology | Notes |
|
|
33
|
+
|-------|-----------|-------|
|
|
34
|
+
| Language | TypeScript / Node.js | All services |
|
|
35
|
+
| Framework | Express / Fastify | HTTP handlers |
|
|
36
|
+
| Communication | REST + Event-driven | Sync + async |
|
|
37
|
+
| Message Broker | RabbitMQ / Kafka | Async events |
|
|
38
|
+
| Database | PostgreSQL | Per-service DB |
|
|
39
|
+
| Cache | Redis | Session, rate limiting |
|
|
40
|
+
| Container | Docker | All services containerized |
|
|
41
|
+
| Orchestration | Docker Compose / K8s | Local / Production |
|
|
42
|
+
| API Docs | OpenAPI 3.0 | Per-service spec |
|
|
43
|
+
|
|
44
|
+
## Service Boundaries
|
|
45
|
+
|
|
46
|
+
### Ownership Rules
|
|
47
|
+
- Each service owns its data (database, cache, files)
|
|
48
|
+
- No direct database access between services
|
|
49
|
+
- All communication via defined APIs or events
|
|
50
|
+
- Each service has its own repository or workspace package
|
|
51
|
+
|
|
52
|
+
### Service Template
|
|
53
|
+
Every service follows this structure:
|
|
54
|
+
```
|
|
55
|
+
service-name/
|
|
56
|
+
src/
|
|
57
|
+
routes/ # HTTP route handlers
|
|
58
|
+
services/ # Business logic
|
|
59
|
+
repositories/ # Data access layer
|
|
60
|
+
events/
|
|
61
|
+
publishers/ # Event publishing
|
|
62
|
+
subscribers/ # Event consumption
|
|
63
|
+
middleware/ # Auth, validation, logging
|
|
64
|
+
types/ # Service-specific types
|
|
65
|
+
tests/
|
|
66
|
+
unit/ # Unit tests
|
|
67
|
+
integration/ # Integration tests (with DB)
|
|
68
|
+
Dockerfile # Container definition
|
|
69
|
+
openapi.yaml # API specification
|
|
70
|
+
package.json
|
|
71
|
+
tsconfig.json
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## API Contracts
|
|
75
|
+
|
|
76
|
+
### REST Conventions
|
|
77
|
+
- Base URL: `/{service-name}/api/v{version}/`
|
|
78
|
+
- Use plural nouns: `/users`, `/orders`, `/payments`
|
|
79
|
+
- HTTP methods: GET (read), POST (create), PUT (full update), PATCH (partial), DELETE
|
|
80
|
+
- Response envelope: `{ "data": ..., "error": null, "meta": { "page": 1, "total": 100 } }`
|
|
81
|
+
- Error format: `{ "error": { "code": "USER_NOT_FOUND", "message": "...", "details": [] } }`
|
|
82
|
+
|
|
83
|
+
### API Versioning
|
|
84
|
+
- URL-based versioning: `/api/v1/`, `/api/v2/`
|
|
85
|
+
- Support N-1 versions (current + previous)
|
|
86
|
+
- Deprecation headers: `Sunset: <date>`, `Deprecation: true`
|
|
87
|
+
|
|
88
|
+
### OpenAPI Specification
|
|
89
|
+
- Every service must have an `openapi.yaml` at the root
|
|
90
|
+
- Auto-generate TypeScript types from OpenAPI spec
|
|
91
|
+
- Validate requests against schema in middleware
|
|
92
|
+
|
|
93
|
+
## Inter-Service Communication
|
|
94
|
+
|
|
95
|
+
### Synchronous (HTTP/gRPC)
|
|
96
|
+
- Used for: Real-time queries, user-facing requests
|
|
97
|
+
- Circuit breaker: Required on all external calls (3 failures = open)
|
|
98
|
+
- Timeout: 5 seconds default, 30 seconds for long operations
|
|
99
|
+
- Retry: 3 attempts with exponential backoff (100ms, 200ms, 400ms)
|
|
100
|
+
|
|
101
|
+
### Asynchronous (Events)
|
|
102
|
+
- Used for: State changes, notifications, data sync
|
|
103
|
+
- Event naming: `{service}.{entity}.{action}` (e.g., `order.payment.completed`)
|
|
104
|
+
- Event schema: JSON Schema with version field
|
|
105
|
+
- Idempotency: All event handlers must be idempotent
|
|
106
|
+
- Dead letter queue: Required for all consumers
|
|
107
|
+
|
|
108
|
+
### Event Schema
|
|
109
|
+
```typescript
|
|
110
|
+
interface DomainEvent<T> {
|
|
111
|
+
id: string; // UUID v4
|
|
112
|
+
type: string; // order.payment.completed
|
|
113
|
+
source: string; // payment-service
|
|
114
|
+
version: string; // 1.0.0
|
|
115
|
+
timestamp: string; // ISO 8601
|
|
116
|
+
correlationId: string; // Request trace ID
|
|
117
|
+
data: T; // Event-specific payload
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Deployment Patterns
|
|
122
|
+
|
|
123
|
+
### Local Development
|
|
124
|
+
```bash
|
|
125
|
+
docker-compose up -d # Start all services
|
|
126
|
+
docker-compose up api # Start specific service
|
|
127
|
+
docker-compose logs -f # Follow logs
|
|
128
|
+
docker-compose down # Stop all
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Environment Configuration
|
|
132
|
+
- `.env.local` per service for local development
|
|
133
|
+
- Environment variables injected at runtime (never baked into images)
|
|
134
|
+
- Required vars defined in each service's `.env.example`
|
|
135
|
+
|
|
136
|
+
### Health Checks
|
|
137
|
+
Every service exposes:
|
|
138
|
+
- `GET /health` — Basic liveness (returns 200)
|
|
139
|
+
- `GET /health/ready` — Readiness (checks DB, cache, dependencies)
|
|
140
|
+
- `GET /health/detailed` — Full status with dependency health
|
|
141
|
+
|
|
142
|
+
## Testing Strategy
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Per-service commands
|
|
146
|
+
npm test # Unit tests
|
|
147
|
+
npm run test:integration # Integration (requires Docker)
|
|
148
|
+
npm run test:contract # Consumer-driven contract tests
|
|
149
|
+
npm run test:e2e # End-to-end (full system)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Testing Levels
|
|
153
|
+
| Level | Scope | Dependencies |
|
|
154
|
+
|-------|-------|-------------|
|
|
155
|
+
| Unit | Single function/class | All mocked |
|
|
156
|
+
| Integration | Service + DB | Real DB, mocked services |
|
|
157
|
+
| Contract | Service API shape | Pact or similar |
|
|
158
|
+
| E2E | Full request flow | All services running |
|
|
159
|
+
|
|
160
|
+
## Common Commands
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Development
|
|
164
|
+
docker-compose up -d # Start infrastructure
|
|
165
|
+
npm run dev --workspace=user-service # Dev mode for one service
|
|
166
|
+
|
|
167
|
+
# Testing
|
|
168
|
+
npm test --workspaces # Test all services
|
|
169
|
+
npm run test:integration --workspace=order-service
|
|
170
|
+
|
|
171
|
+
# Building
|
|
172
|
+
docker build -t user-service:latest ./services/user-service
|
|
173
|
+
|
|
174
|
+
# Database
|
|
175
|
+
npm run migrate --workspace=user-service # Run migrations
|
|
176
|
+
npm run seed --workspace=user-service # Seed data
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Important Notes
|
|
180
|
+
|
|
181
|
+
- Never share databases between services — each service owns its data
|
|
182
|
+
- Use correlation IDs for distributed tracing across services
|
|
183
|
+
- Log in structured JSON format for aggregation (ELK/Datadog)
|
|
184
|
+
- Keep services small and focused — if a service grows too large, split it
|
|
185
|
+
- Use feature flags for gradual rollouts across services
|
|
186
|
+
- Always test backward compatibility when changing event schemas
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# CLAUDE.md — Mobile Project (React Native)
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
- **Name:** [APP_NAME]
|
|
6
|
+
- **Description:** [What the app does]
|
|
7
|
+
- **Type:** Mobile application
|
|
8
|
+
- **Framework:** React Native / Expo
|
|
9
|
+
- **Platforms:** iOS + Android
|
|
10
|
+
- **Status:** [Development / Beta / Production]
|
|
11
|
+
|
|
12
|
+
## Tech Stack
|
|
13
|
+
|
|
14
|
+
| Layer | Technology | Version |
|
|
15
|
+
|-------|-----------|---------|
|
|
16
|
+
| Framework | React Native | 0.76.x |
|
|
17
|
+
| Tooling | Expo SDK | 52.x |
|
|
18
|
+
| Language | TypeScript | 5.x |
|
|
19
|
+
| Navigation | React Navigation | 7.x |
|
|
20
|
+
| State (client) | Zustand | 5.x |
|
|
21
|
+
| Data Fetching | TanStack Query | 5.x |
|
|
22
|
+
| Styling | NativeWind / StyleSheet | — |
|
|
23
|
+
| Forms | React Hook Form + Zod | — |
|
|
24
|
+
| Auth | Supabase Auth | — |
|
|
25
|
+
| Testing | Jest + React Native Testing Library | — |
|
|
26
|
+
| E2E Testing | Detox / Maestro | — |
|
|
27
|
+
|
|
28
|
+
## Directory Structure
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
src/
|
|
32
|
+
app/ # Expo Router screens (file-based routing)
|
|
33
|
+
(tabs)/ # Tab navigator group
|
|
34
|
+
(auth)/ # Auth flow screens
|
|
35
|
+
_layout.tsx # Root layout
|
|
36
|
+
components/
|
|
37
|
+
ui/ # Base UI components (Button, Input, Card)
|
|
38
|
+
shared/ # Shared composite components
|
|
39
|
+
features/ # Feature-specific components
|
|
40
|
+
hooks/ # Custom hooks
|
|
41
|
+
stores/ # Zustand stores
|
|
42
|
+
services/ # API services and external integrations
|
|
43
|
+
lib/ # Utility libraries
|
|
44
|
+
types/ # TypeScript type definitions
|
|
45
|
+
constants/ # App constants (colors, spacing, config)
|
|
46
|
+
assets/ # Images, fonts, animations
|
|
47
|
+
images/
|
|
48
|
+
fonts/
|
|
49
|
+
animations/ # Lottie files
|
|
50
|
+
ios/ # iOS native project
|
|
51
|
+
android/ # Android native project
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Platform-Specific Considerations
|
|
55
|
+
|
|
56
|
+
### iOS
|
|
57
|
+
- Minimum deployment target: iOS 15.0
|
|
58
|
+
- Test on both iPhone and iPad if universal
|
|
59
|
+
- Handle safe area insets with `SafeAreaView` or `useSafeAreaInsets()`
|
|
60
|
+
- Request permissions gracefully (camera, location, notifications)
|
|
61
|
+
- Handle keyboard avoidance for forms
|
|
62
|
+
|
|
63
|
+
### Android
|
|
64
|
+
- Minimum SDK: 24 (Android 7.0)
|
|
65
|
+
- Handle back button behavior with navigation
|
|
66
|
+
- Test on various screen densities (mdpi, hdpi, xhdpi, xxhdpi)
|
|
67
|
+
- Handle Android-specific permissions in `AndroidManifest.xml`
|
|
68
|
+
- Test gesture navigation vs button navigation
|
|
69
|
+
|
|
70
|
+
### Platform-Specific Files
|
|
71
|
+
```
|
|
72
|
+
Component.tsx # Shared (default)
|
|
73
|
+
Component.ios.tsx # iOS-only override
|
|
74
|
+
Component.android.tsx # Android-only override
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Use `Platform.select()` for minor differences:
|
|
78
|
+
```typescript
|
|
79
|
+
import { Platform, StyleSheet } from 'react-native';
|
|
80
|
+
|
|
81
|
+
const styles = StyleSheet.create({
|
|
82
|
+
shadow: Platform.select({
|
|
83
|
+
ios: { shadowColor: '#000', shadowOffset: { width: 0, height: 2 } },
|
|
84
|
+
android: { elevation: 4 },
|
|
85
|
+
}),
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Navigation Patterns
|
|
90
|
+
|
|
91
|
+
### Stack Navigation
|
|
92
|
+
```typescript
|
|
93
|
+
// Use typed navigation
|
|
94
|
+
type RootStackParamList = {
|
|
95
|
+
Home: undefined;
|
|
96
|
+
Profile: { userId: string };
|
|
97
|
+
Settings: undefined;
|
|
98
|
+
};
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Tab Navigation
|
|
102
|
+
- Maximum 5 tabs
|
|
103
|
+
- Use icons + labels for accessibility
|
|
104
|
+
- Badge for notification counts
|
|
105
|
+
|
|
106
|
+
### Deep Linking
|
|
107
|
+
- Configure URL scheme: `myapp://`
|
|
108
|
+
- Handle universal links (iOS) and App Links (Android)
|
|
109
|
+
- Test with `npx uri-scheme open myapp://profile/123`
|
|
110
|
+
|
|
111
|
+
## State Management
|
|
112
|
+
|
|
113
|
+
### Local State
|
|
114
|
+
- `useState` for component-scoped state
|
|
115
|
+
- `useReducer` for complex component logic
|
|
116
|
+
|
|
117
|
+
### Global State (Zustand)
|
|
118
|
+
- Persist with `zustand/middleware` + AsyncStorage
|
|
119
|
+
- Wait for hydration before rendering protected screens
|
|
120
|
+
- Separate stores by domain (auth, preferences, cart)
|
|
121
|
+
|
|
122
|
+
### Server State (TanStack Query)
|
|
123
|
+
- Configure offline support with `onlineManager`
|
|
124
|
+
- Use optimistic updates for responsive UX
|
|
125
|
+
- Set `staleTime` appropriately (longer for mobile to reduce data usage)
|
|
126
|
+
|
|
127
|
+
## Common Commands
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Development
|
|
131
|
+
npx expo start # Start Expo dev server
|
|
132
|
+
npx expo start --ios # Open in iOS Simulator
|
|
133
|
+
npx expo start --android # Open in Android Emulator
|
|
134
|
+
npx expo start --web # Open in web browser
|
|
135
|
+
|
|
136
|
+
# Building
|
|
137
|
+
eas build --platform ios # iOS build
|
|
138
|
+
eas build --platform android # Android build
|
|
139
|
+
eas build --platform all # Both platforms
|
|
140
|
+
|
|
141
|
+
# Testing
|
|
142
|
+
npm test # Run Jest tests
|
|
143
|
+
npm run test:e2e:ios # E2E tests on iOS
|
|
144
|
+
npm run test:e2e:android # E2E tests on Android
|
|
145
|
+
|
|
146
|
+
# Code Quality
|
|
147
|
+
npm run lint # ESLint check
|
|
148
|
+
npm run typecheck # TypeScript check
|
|
149
|
+
npm run format # Prettier formatting
|
|
150
|
+
|
|
151
|
+
# Native
|
|
152
|
+
npx pod-install # Install iOS CocoaPods
|
|
153
|
+
npx react-native link # Link native modules (legacy)
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Build and Deploy
|
|
157
|
+
|
|
158
|
+
### EAS Build
|
|
159
|
+
```bash
|
|
160
|
+
eas build:configure # Initial setup
|
|
161
|
+
eas build --profile development # Development build
|
|
162
|
+
eas build --profile preview # Internal testing
|
|
163
|
+
eas build --profile production # Store submission
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Over-the-Air Updates
|
|
167
|
+
```bash
|
|
168
|
+
eas update --branch production # Push OTA update
|
|
169
|
+
eas update --branch preview # Preview update
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Testing Strategy
|
|
173
|
+
|
|
174
|
+
| Level | Tool | Target |
|
|
175
|
+
|-------|------|--------|
|
|
176
|
+
| Unit | Jest | Hooks, utilities, stores |
|
|
177
|
+
| Component | RNTL | UI components (render, interaction) |
|
|
178
|
+
| Integration | Jest + RNTL | Screen-level flows |
|
|
179
|
+
| E2E | Detox/Maestro | Full user journeys |
|
|
180
|
+
| Visual | Storybook RN | Component catalog |
|
|
181
|
+
|
|
182
|
+
### Testing Tips
|
|
183
|
+
- Use `@testing-library/react-native` over Enzyme
|
|
184
|
+
- Mock `react-native` modules: `Animated`, `Platform`, etc.
|
|
185
|
+
- Test both platforms when using `Platform.select()`
|
|
186
|
+
- Use `jest.useFakeTimers()` for animation tests
|
|
187
|
+
- Mock `AsyncStorage` for store tests
|
|
188
|
+
|
|
189
|
+
## Important Notes
|
|
190
|
+
|
|
191
|
+
- Always test on real devices before release (simulators miss performance issues)
|
|
192
|
+
- Keep bundle size small: lazy-load screens, optimize images
|
|
193
|
+
- Handle offline state gracefully — queue actions for sync
|
|
194
|
+
- Follow Apple HIG and Material Design guidelines
|
|
195
|
+
- Never hardcode dimensions — use responsive layouts with Dimensions/useWindowDimensions
|
|
196
|
+
- Test accessibility with screen readers (VoiceOver on iOS, TalkBack on Android)
|
|
197
|
+
- Use `react-native-reanimated` for 60fps animations (avoid Animated API for complex cases)
|
|
198
|
+
- Handle app state changes (background, foreground) for data refresh
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# CLAUDE.md — Monorepo Project
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
- **Name:** [PROJECT_NAME]
|
|
6
|
+
- **Description:** [Brief description]
|
|
7
|
+
- **Type:** Monorepo
|
|
8
|
+
- **Manager:** [Turborepo / Nx / Lerna / pnpm workspaces]
|
|
9
|
+
- **Status:** [Development / Staging / Production]
|
|
10
|
+
|
|
11
|
+
## Package Structure
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
packages/
|
|
15
|
+
core/ # Shared business logic and types
|
|
16
|
+
ui/ # Shared UI component library
|
|
17
|
+
config/ # Shared config (ESLint, TypeScript, Tailwind)
|
|
18
|
+
utils/ # Shared utility functions
|
|
19
|
+
apps/
|
|
20
|
+
web/ # Main web application (Next.js)
|
|
21
|
+
api/ # Backend API service
|
|
22
|
+
docs/ # Documentation site
|
|
23
|
+
admin/ # Admin dashboard
|
|
24
|
+
tooling/
|
|
25
|
+
eslint-config/ # Shared ESLint configuration
|
|
26
|
+
tsconfig/ # Shared TypeScript configuration
|
|
27
|
+
jest-config/ # Shared Jest configuration
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Tech Stack
|
|
31
|
+
|
|
32
|
+
| Layer | Technology | Notes |
|
|
33
|
+
|-------|-----------|-------|
|
|
34
|
+
| Build | Turborepo | Task orchestration and caching |
|
|
35
|
+
| Package Manager | pnpm | Workspace support, strict hoisting |
|
|
36
|
+
| Language | TypeScript | Shared tsconfig in tooling/ |
|
|
37
|
+
| Linting | ESLint | Shared config across packages |
|
|
38
|
+
| Testing | Jest | Shared config, per-package execution |
|
|
39
|
+
|
|
40
|
+
## Shared Dependencies
|
|
41
|
+
|
|
42
|
+
### Internal Packages (workspace:*)
|
|
43
|
+
- `@[scope]/core` — Business logic, types, constants
|
|
44
|
+
- `@[scope]/ui` — React components, design tokens
|
|
45
|
+
- `@[scope]/utils` — Utility functions (date, string, validation)
|
|
46
|
+
- `@[scope]/config` — Shared configuration files
|
|
47
|
+
|
|
48
|
+
### Dependency Rules
|
|
49
|
+
- **Root dependencies:** Only dev tools (turbo, prettier, husky)
|
|
50
|
+
- **Shared deps:** Declared in the package that owns them
|
|
51
|
+
- **Version alignment:** Use `syncpack` or `manypkg` to keep versions consistent
|
|
52
|
+
- **Peer dependencies:** UI components declare React as peer dep
|
|
53
|
+
- Never install the same dependency at different versions across packages
|
|
54
|
+
|
|
55
|
+
## Per-Package Conventions
|
|
56
|
+
|
|
57
|
+
### apps/web (Next.js)
|
|
58
|
+
```bash
|
|
59
|
+
pnpm --filter web dev # Dev server
|
|
60
|
+
pnpm --filter web build # Production build
|
|
61
|
+
pnpm --filter web test # Tests
|
|
62
|
+
```
|
|
63
|
+
- Imports from `@[scope]/ui` and `@[scope]/core`
|
|
64
|
+
- Uses App Router, follows fullstack patterns
|
|
65
|
+
|
|
66
|
+
### apps/api (Express/Fastify)
|
|
67
|
+
```bash
|
|
68
|
+
pnpm --filter api dev # Dev server
|
|
69
|
+
pnpm --filter api build # Compile TypeScript
|
|
70
|
+
pnpm --filter api test # Tests
|
|
71
|
+
```
|
|
72
|
+
- Imports from `@[scope]/core` for shared types
|
|
73
|
+
- Never imports from `@[scope]/ui`
|
|
74
|
+
|
|
75
|
+
### packages/ui (Component Library)
|
|
76
|
+
```bash
|
|
77
|
+
pnpm --filter ui dev # Storybook
|
|
78
|
+
pnpm --filter ui build # Build for consumption
|
|
79
|
+
pnpm --filter ui test # Component tests
|
|
80
|
+
```
|
|
81
|
+
- Exports via package.json `exports` field
|
|
82
|
+
- Uses `tsup` or `unbuild` for compilation
|
|
83
|
+
|
|
84
|
+
### packages/core (Business Logic)
|
|
85
|
+
```bash
|
|
86
|
+
pnpm --filter core build # Compile
|
|
87
|
+
pnpm --filter core test # Unit tests
|
|
88
|
+
```
|
|
89
|
+
- Pure TypeScript, no framework dependencies
|
|
90
|
+
- Exports types, validators, constants
|
|
91
|
+
|
|
92
|
+
## Cross-Package Imports
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
// Correct: use workspace package name
|
|
96
|
+
import { Button } from '@[scope]/ui';
|
|
97
|
+
import { formatDate } from '@[scope]/utils';
|
|
98
|
+
import type { User } from '@[scope]/core';
|
|
99
|
+
|
|
100
|
+
// Wrong: never use relative paths across packages
|
|
101
|
+
import { Button } from '../../packages/ui/src/Button';
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Build and Test Commands
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Root commands (run across all packages)
|
|
108
|
+
pnpm build # Build all packages (respects dependency order)
|
|
109
|
+
pnpm test # Test all packages
|
|
110
|
+
pnpm lint # Lint all packages
|
|
111
|
+
pnpm typecheck # Type-check all packages
|
|
112
|
+
pnpm dev # Dev mode for all apps
|
|
113
|
+
|
|
114
|
+
# Single package
|
|
115
|
+
pnpm --filter [package] [command]
|
|
116
|
+
|
|
117
|
+
# With dependencies
|
|
118
|
+
pnpm --filter [package]... build # Build package and its deps
|
|
119
|
+
|
|
120
|
+
# Turbo-specific
|
|
121
|
+
turbo run build --filter=web # Build web and dependencies
|
|
122
|
+
turbo run test --affected # Test only affected packages
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Naming Conventions
|
|
126
|
+
|
|
127
|
+
- Package names: `@[scope]/package-name` (kebab-case)
|
|
128
|
+
- Internal imports: Always use the package name, never relative paths
|
|
129
|
+
- Shared types: Define in `@[scope]/core/types/`
|
|
130
|
+
- Shared hooks: Define in `@[scope]/ui/hooks/` if UI-related, `@[scope]/core/hooks/` otherwise
|
|
131
|
+
|
|
132
|
+
## Important Notes
|
|
133
|
+
|
|
134
|
+
- Always run `pnpm install` from the root (never inside a package)
|
|
135
|
+
- Changes to shared packages may affect multiple apps — test broadly
|
|
136
|
+
- Turbo caches builds; run `turbo run build --force` to bypass cache
|
|
137
|
+
- When adding a new package, update `pnpm-workspace.yaml`
|
|
138
|
+
- CI should use `turbo run test --affected` for faster builds
|
|
139
|
+
- Never put secrets in shared packages; keep them in app-level `.env`
|