Skip to content

Commit 65dab58

Browse files
docs: add constitution guidance for AI assistants
Address PR#104 review feedback: - Add Project Constitution section in CLAUDE.md emphasizing use for all changes (including day-to-day work not requiring full SDD) - Create .github/copilot-instructions.md to instruct GitHub Copilot to follow the project constitution during code generation Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent f132842 commit 65dab58

2 files changed

Lines changed: 81 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Copilot Instructions
2+
3+
## Project Constitution
4+
5+
All code changes MUST comply with the project constitution at `.specify/memory/constitution.md`. This document defines the team's non-negotiable standards for correctness, testing, security, observability, naming, PR discipline, and architectural simplicity. Read it before proposing changes.
6+
7+
## Tech Stack
8+
9+
This is a **Flutter SDK** wrapping native Optimizely SDKs for iOS and Android.
10+
11+
**Technology Stack:**
12+
- **Dart/Flutter**: Cross-platform API layer (>=2.16.2, Flutter >=2.5.0)
13+
- **Swift**: iOS native bridge (Swift 5.0, iOS 10.0+)
14+
- **Kotlin/Java**: Android native bridge (Kotlin 2.1.0, Android 5.0+)
15+
- **Native SDKs**: OptimizelySwiftSDK 5.2.1 (iOS), android-sdk 5.1.1 (Android)
16+
17+
## Folder Structure
18+
19+
- `lib/` - Dart SDK code (public API, wrapper, data objects, user context)
20+
- `android/` - Android native plugin code (Java/Kotlin)
21+
- `ios/` - iOS native plugin code (Swift)
22+
- `test/` - Dart unit tests
23+
- `example/` - Example Flutter app demonstrating SDK usage
24+
25+
## Code Conventions
26+
27+
### Dart
28+
- Follow official [Dart style guide](https://dart.dev/guides/language/effective-dart/style)
29+
- Use `lowerCamelCase` for variables, methods, parameters
30+
- Use `UpperCamelCase` for classes, types
31+
- Prefix private members with underscore `_privateMethod`
32+
- ALL methods return `BaseResponse` derivatives (never throw exceptions)
33+
- Check `success` boolean and `reason` string for errors
34+
35+
### Swift (iOS)
36+
- Follow Swift naming conventions
37+
- Use type-safe Optional unwrapping
38+
- iOS attributes need type metadata: `{"value": 123, "type": "int"}`
39+
40+
### Java/Kotlin (Android)
41+
- Follow Android/Kotlin style guide
42+
- Android uses direct primitives: `{"attribute": 123}`
43+
44+
## Testing
45+
46+
Run tests with:
47+
```bash
48+
flutter test # All tests
49+
flutter test test/cmab_test.dart # Specific test
50+
flutter test --coverage # With coverage
51+
```
52+
53+
**Requirements:**
54+
- Tests required for all code changes
55+
- All CI checks must pass (4 parallel workflows)
56+
- Test both success and error paths
57+
- Mock platform channels appropriately
58+
59+
## Commit Messages
60+
61+
Follow [Angular guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines):
62+
- `feat:` - New features
63+
- `fix:` - Bug fixes
64+
- `chore:` - Maintenance
65+
- `docs:` - Documentation
66+
- `refactor:` - Code restructuring
67+
- `test:` - Test additions
68+
69+
**Never commit directly to `master`** - use feature branches and PRs.

CLAUDE.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,18 @@ Month Day, Year
133133

134134
## Contributing Guidelines
135135

136+
### Project Constitution
137+
138+
**All code changes MUST comply with the project constitution** at `.specify/memory/constitution.md`. This document defines the team's non-negotiable standards for correctness, testing, security, observability, naming, PR discipline, and architectural simplicity.
139+
140+
**When to consult the constitution:**
141+
- Before implementing any feature (large or small)
142+
- During code reviews to validate adherence
143+
- When making architectural decisions
144+
- For day-to-day changes that don't require full SDD workflow
145+
146+
Read the constitution before proposing changes.
147+
136148
### Commit Messages
137149
Follow [Angular guidelines](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines):
138150
- `feat:` - New features

0 commit comments

Comments
 (0)