Skip to content

Commit 0dfaba8

Browse files
docs: restructure CLAUDE.md into modular rules
Split verbose CLAUDE.md (295 lines) into focused files: - .claude/rules/commit-conventions.md - .claude/rules/package-creation.md - .claude/rules/coding-patterns.md Main CLAUDE.md now 84 lines with essential info only. Co-Authored-By: Claude Opus 4.5 <[email protected]> Signed-off-by: JasonXuDeveloper - 傑 <[email protected]>
1 parent 9682ac9 commit 0dfaba8

File tree

4 files changed

+175
-225
lines changed

4 files changed

+175
-225
lines changed

.claude/rules/coding-patterns.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# JEngine Coding Patterns
2+
3+
## Async Patterns
4+
5+
Use `UniTask` for async operations, not `System.Threading.Tasks.Task`:
6+
```csharp
7+
public async UniTask<bool> LoadAssetAsync() { }
8+
```
9+
10+
## Thread Safety
11+
12+
For properties accessed across callbacks:
13+
```csharp
14+
private static volatile bool _flag;
15+
public static bool Flag => _flag;
16+
```
17+
18+
## Encryption Architecture
19+
20+
JEngine supports three encryption algorithms:
21+
- **XOR** (`EncryptionOption.Xor`) - Fast, simple
22+
- **AES** (`EncryptionOption.Aes`) - Moderate security
23+
- **ChaCha20** (`EncryptionOption.ChaCha20`) - High security
24+
25+
Each has implementations for bundles and manifests in `Runtime/Encrypt/`.
26+
27+
### Adding New Encryption
28+
29+
1. Create config class in `Runtime/Encrypt/Config/`
30+
2. Implement bundle encryption in `Runtime/Encrypt/Bundle/`
31+
3. Implement manifest encryption in `Runtime/Encrypt/Manifest/`
32+
4. Add to `EncryptionOption` enum
33+
5. Update `EncryptionMapping` class
34+
35+
## ScriptableObject Configuration
36+
37+
Use `ScriptableObject` for runtime configuration:
38+
```csharp
39+
public abstract class ConfigBase<T> : ScriptableObject where T : ConfigBase<T>
40+
{
41+
public static T Instance { get; }
42+
}
43+
```
44+
45+
## Editor Scripts
46+
47+
- Use `[InitializeOnLoad]` for editor initialization
48+
- Handle Unity domain reloads properly (state resets on recompile)
49+
- Use `SessionState` or `EditorPrefs` for persistent editor state
50+
- Clean up resources in `EditorApplication.quitting`
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Commit Message Format
2+
3+
All commits should follow the Conventional Commits specification to enable automatic changelog generation.
4+
5+
## Format
6+
7+
```
8+
<type>(<scope>): <subject>
9+
10+
<body>
11+
12+
<footer>
13+
```
14+
15+
## Types
16+
17+
- `feat:` - New feature (appears in changelog as "Feature")
18+
- `fix:` - Bug fix (appears in changelog as "Fixed")
19+
- `docs:` - Documentation only changes (not in changelog)
20+
- `style:` - Code style/formatting changes (not in changelog)
21+
- `refactor:` - Code refactoring (not in changelog)
22+
- `test:` - Test changes (not in changelog)
23+
- `chore:` - Build/config changes (not in changelog)
24+
- `BREAKING CHANGE:` - Breaking changes (in footer, triggers major version bump)
25+
26+
## Scopes
27+
28+
- `core` - Changes to JEngine.Core package
29+
- `util` - Changes to JEngine.Util package
30+
- `ui` - Changes to JEngine.UI package
31+
- `ci` - Changes to CI/CD workflows
32+
- `docs` - Changes to documentation
33+
34+
## Examples
35+
36+
```bash
37+
feat(core): add ChaCha20 encryption support
38+
fix(util): resolve JAction memory leak on cancellation
39+
docs: update installation guide for Unity 2022.3
40+
refactor(core): simplify bootstrap initialization
41+
test(util): add coverage for JAction edge cases
42+
chore(ci): update GameCI Unity version to 2022.3.55f1
43+
```
44+
45+
## Breaking Changes
46+
47+
For breaking changes, include `BREAKING CHANGE:` in the footer:
48+
49+
```bash
50+
feat(core)!: redesign encryption API
51+
52+
BREAKING CHANGE: EncryptionManager.Encrypt() now requires EncryptionConfig parameter
53+
```
54+
55+
## Guidelines
56+
57+
- Keep subject line under 72 characters
58+
- Use imperative mood ("add" not "added" or "adds")
59+
- Don't capitalize first letter of subject
60+
- Don't end subject with a period
61+
- Separate subject from body with blank line
62+
- Wrap body at 72 characters
63+
- Use body to explain what and why (not how)
64+
65+
## Developer Certificate of Origin (DCO)
66+
67+
All commits must be signed off using `--signoff` (or `-s`) flag:
68+
69+
```bash
70+
git commit -s -m "feat(core): add new feature"
71+
```
72+
73+
This adds a `Signed-off-by` line certifying you have the right to submit the code under the project's license.

.claude/rules/package-creation.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Creating New JEngine Packages
2+
3+
When creating a new JEngine package:
4+
5+
1. **Version**: Start at `0.0.0` (not `1.0.0`)
6+
2. **Naming**: Use `com.jasonxudeveloper.jengine.<name>` format
7+
3. **Location**: `Packages/com.jasonxudeveloper.jengine.<name>/`
8+
9+
## Required Files
10+
11+
- `package.json` - Package manifest with version `0.0.0`
12+
- `Runtime/<Name>.asmdef` - Assembly definition
13+
- `README.md` - Package documentation (optional)
14+
15+
## Example package.json
16+
17+
```json
18+
{
19+
"name": "com.jasonxudeveloper.jengine.<name>",
20+
"version": "0.0.0",
21+
"displayName": "JEngine.<Name>",
22+
"description": "Description here.",
23+
"license": "MIT",
24+
"unity": "2022.3",
25+
"author": {
26+
"name": "Jason Xu",
27+
"email": "[email protected]",
28+
"url": "https://github.com/JasonXuDeveloper"
29+
},
30+
"dependencies": {}
31+
}
32+
```
33+
34+
## CI Updates Required
35+
36+
1. Add package path to `.github/workflows/pr-tests.yml`
37+
2. Add release support to `.github/workflows/release.yml`
38+
3. Add new scope to commit message conventions

0 commit comments

Comments
 (0)