Browse Source

docs: add code style guidelines to CLAUDE.md

Added comprehensive code style section documenting:
- Brace placement preferences (opening braces on new lines)
- Variable naming conventions by scope (snake_case locals, camelCase members/parameters)
- Benefits and examples of preferred style

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
arch-001-screen-capture-manager
Quildra 5 months ago
parent
commit
a8b458ed0b
  1. 57
      CLAUDE.md

57
CLAUDE.md

@ -159,6 +159,63 @@ app/src/main/java/com/quillstudios/pokegoalshelper/
- Use interfaces for dependency injection
- Keep functions small and focused
### Code Style Guidelines
#### Brace Placement
- Opening braces `{` go on the line **below** functions and statements
- This improves visual separation and readability
```kotlin
// Preferred style
fun myFunction()
{
if (condition)
{
// code here
}
}
// NOT this style
fun myFunction() {
if (condition) {
// code here
}
}
```
#### Variable Naming Conventions
Use different naming patterns to distinguish variable scope at a glance:
- **Local variables**: `snake_case` (e.g., `display_metrics`, `captured_image`, `window_manager`)
- **Member variables**: `camelCase` (e.g., `screenWidth`, `mediaProjection`, `isActive`)
- **Function parameters**: `camelCase` (e.g., `resultData`, `callback`, `className`)
- **Constants**: `UPPER_SNAKE_CASE` (e.g., `TAG`, `BUFFER_COUNT`)
```kotlin
class ExampleClass
{
// Member variables in camelCase
private var screenWidth = 0
private var mediaProjection: MediaProjection? = null
// Function parameters in camelCase
fun processData(inputData: String, callback: (String) -> Unit)
{
// Local variables in snake_case
val processed_result = inputData.uppercase()
val final_output = "Result: $processed_result"
callback(final_output)
}
}
```
#### Benefits of This Style
- **Instant recognition**: Variable scope is immediately visible
- **Improved debugging**: Easy to distinguish locals from members
- **Better readability**: Clean visual structure with separated braces
- **Consistent codebase**: All new code follows the same patterns
### Documentation
- Update this file when patterns change
- Document complex business logic

Loading…
Cancel
Save