mirror of
https://github.com/bitwarden/android.git
synced 2026-03-09 03:33:36 -05:00
[PM-21659] llm: Add workflow skills and finalize CLAUDE.md restructuring (#6575)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@ Official Android application for Bitwarden Password Manager and Bitwarden Authen
|
||||
- Target users: End-users via Google Play Store and F-Droid
|
||||
|
||||
### Key Concepts
|
||||
|
||||
- **Zero-Knowledge Architecture**: Server never has access to unencrypted vault data or encryption keys
|
||||
- **Bitwarden SDK**: Rust-based cryptographic SDK handling all encryption/decryption operations
|
||||
- **DataState**: Wrapper for streaming data states (Loading, Loaded, Pending, Error, NoNetwork)
|
||||
@@ -55,58 +56,32 @@ User Request (UI Action)
|
||||
|
||||
## Development Guide
|
||||
|
||||
### Adding New Feature Screen
|
||||
### Workflow Skills
|
||||
|
||||
Use the `implementing-android-code` skill for Bitwarden-specific patterns, gotchas, and templates. Steps:
|
||||
> **Quick start**: Use `/work-on-android <task>` to be guided through the full development lifecycle.
|
||||
|
||||
1. **Define State/Event/Action** - `@Parcelize` state, sealed event/action classes with `Internal` subclass
|
||||
2. **Implement ViewModel** - Extend `BaseViewModel<S, E, A>`, persist state via `SavedStateHandle`
|
||||
3. **Implement Screen** - Stateless `@Composable`, use `EventsEffect` for navigation
|
||||
4. **Define Navigation** - `@Serializable` route, `NavGraphBuilder`/`NavController` extensions
|
||||
5. **Write Tests** - Use the `testing-android-code` skill for test patterns and templates
|
||||
These skills define the full development lifecycle. Use them in order:
|
||||
|
||||
### Code Reviews
|
||||
|
||||
Use the `reviewing-changes` skill for structured code review checklists covering MVVM/Compose patterns, security validation, and type-specific review guidance.
|
||||
1. `implementing-android-code` - Patterns, gotchas, and templates for writing code
|
||||
2. `testing-android-code` - Test patterns and templates for verifying code
|
||||
3. `build-test-verify` - Build, test, lint, and deploy commands
|
||||
4. `perform-android-preflight-checklist` - Quality gate before committing
|
||||
5. `committing-android-changes` - Commit message format and pre-commit workflow
|
||||
6. `reviewing-changes` - Code review checklists for MVVM/Compose patterns
|
||||
7. `creating-android-pull-request` - PR creation workflow and templates
|
||||
|
||||
---
|
||||
|
||||
## Data Models
|
||||
|
||||
Key types used throughout the codebase:
|
||||
|
||||
- **`UserState`** (`data/auth/`) - Active user ID, accounts list, pending account state
|
||||
- **`VaultUnlockData`** (`data/vault/repository/model/`) - User ID and vault unlock status
|
||||
- **`NetworkResult<T>`** (`network/`) - HTTP operation result: Success or Failure
|
||||
- **`BitwardenError`** (`network/`) - Error classification: Http, Network, Other
|
||||
|
||||
---
|
||||
|
||||
## Security & Configuration
|
||||
|
||||
### Security Rules
|
||||
## Security Rules
|
||||
|
||||
**MANDATORY - These rules have no exceptions:**
|
||||
|
||||
1. **Zero-Knowledge Architecture**: Never transmit unencrypted vault data or master passwords to the server. All encryption happens client-side via the Bitwarden SDK.
|
||||
|
||||
2. **No Plaintext Key Storage**: Encryption keys must be stored using Android Keystore (biometric unlock) or encrypted with PIN/master password.
|
||||
|
||||
3. **Sensitive Data Cleanup**: On logout, all sensitive data must be cleared from memory and storage via `UserLogoutManager.logout()`.
|
||||
|
||||
4. **Input Validation**: Validate all user inputs before processing, especially URLs and credentials.
|
||||
|
||||
5. **SDK Isolation**: Use scoped SDK sources (`ScopedVaultSdkSource`) to prevent cross-user crypto context leakage.
|
||||
|
||||
### Security Components
|
||||
|
||||
| Component | Location | Purpose |
|
||||
|-----------|----------|---------|
|
||||
| `BiometricsEncryptionManager` | `data/platform/manager/` | Android Keystore integration for biometric unlock |
|
||||
| `VaultLockManager` | `data/vault/manager/` | Vault lock/unlock operations |
|
||||
| `AuthDiskSource` | `data/auth/datasource/disk/` | Secure token and key storage |
|
||||
| `BaseEncryptedDiskSource` | `data/datasource/disk/` | EncryptedSharedPreferences base class |
|
||||
|
||||
---
|
||||
|
||||
## Code Style & Standards
|
||||
@@ -143,8 +118,11 @@ In addition to the Key Principles above, follow these rules:
|
||||
## Quick Reference
|
||||
|
||||
- **Code style**: Full rules: `docs/STYLE_AND_BEST_PRACTICES.md`
|
||||
- **Building/testing**: Use `build-test-verify` skill | App tests: `./gradlew app:testStandardDebugUnitTest`
|
||||
- **Before writing code**: Use `implementing-android-code` skill for Bitwarden-specific patterns, gotchas, and templates
|
||||
- **Before writing tests**: Use `testing-android-code` skill for test patterns and templates
|
||||
- **Building/testing**: Use `build-test-verify` skill | App tests: `./gradlew app:testStandardDebugUnitTest`
|
||||
- **Before committing**: Use `perform-android-preflight-checklist` skill, then `committing-android-changes` skill for message format
|
||||
- **Code review**: Use `reviewing-changes` skill for MVVM/Compose review checklists
|
||||
- **Creating PRs**: Use `creating-android-pull-request` skill for PR workflow and templates
|
||||
- **Troubleshooting**: See `docs/TROUBLESHOOTING.md`
|
||||
- **Architecture**: `docs/ARCHITECTURE.md` | [Bitwarden SDK](https://github.com/bitwarden/sdk) | [Jetpack Compose](https://developer.android.com/jetpack/compose) | [Hilt DI](https://dagger.dev/hilt/)
|
||||
|
||||
66
.claude/commands/work-on-android.md
Normal file
66
.claude/commands/work-on-android.md
Normal file
@@ -0,0 +1,66 @@
|
||||
---
|
||||
description: Guided Android development workflow through all lifecycle phases
|
||||
argument-hint: <task description, plan, or Jira ticket reference>
|
||||
---
|
||||
|
||||
# Android Development Workflow
|
||||
|
||||
You are guiding the developer through a complete Android development lifecycle for the Bitwarden Android project. The task to work on is:
|
||||
|
||||
**Task**: $ARGUMENTS
|
||||
|
||||
## Workflow Phases
|
||||
|
||||
Work through each phase sequentially. **Confirm with the user before advancing to the next phase.** If a phase fails (tests fail, lint errors, etc.), loop on that phase until resolved before advancing. The user may skip phases that are not applicable.
|
||||
|
||||
### Phase 1: Implement
|
||||
|
||||
Invoke the `implementing-android-code` skill and use it to guide your implementation of the task. Understand what needs to be done, explore the relevant code, and write the implementation.
|
||||
|
||||
**Before advancing**: Summarize what was implemented and confirm the user is ready to move to testing.
|
||||
|
||||
### Phase 2: Test
|
||||
|
||||
Invoke the `testing-android-code` skill and use it to write tests for the changes made in Phase 1. Follow the project's test patterns and conventions.
|
||||
|
||||
**Before advancing**: Summarize what tests were written and confirm readiness for build verification.
|
||||
|
||||
### Phase 3: Build & Verify
|
||||
|
||||
Invoke the `build-test-verify` skill to run tests, lint, and detekt. Ensure everything passes.
|
||||
|
||||
**If failures occur**: Fix the issues and re-run verification. Do not advance until all checks pass.
|
||||
|
||||
**Before advancing**: Report build/test/lint results and confirm readiness for self-review.
|
||||
|
||||
### Phase 4: Self-Review
|
||||
|
||||
Invoke the `perform-android-preflight-checklist` skill to perform a quality gate check on all changes. Address any issues found.
|
||||
|
||||
**Before advancing**: Share the self-review results and confirm readiness to commit.
|
||||
|
||||
### Phase 5: Commit
|
||||
|
||||
Invoke the `committing-android-changes` skill to stage and commit the changes with a properly formatted commit message.
|
||||
|
||||
**Before advancing**: Confirm the commit was successful and ask if the user wants to proceed to review and PR creation, or stop here.
|
||||
|
||||
### Phase 6: Review
|
||||
|
||||
**Pre-requisites:**
|
||||
- `bitwarden-code-review` from the [Bitwarden Plugin Marketplace](https://github.com/bitwarden/ai-plugins) must be installed in order to perform this phase. If it is not installed prompt the user to install it, or skip the review phase.
|
||||
|
||||
Launch a subagent with the `/bitwarden-code-review:code-review-local` command to perform a **local** code review of the committed diff. Validate and address any issues found before proceeding.
|
||||
|
||||
**Before advancing**: Share review findings and confirm readiness for PR creation.
|
||||
|
||||
### Phase 7: Pull Request
|
||||
|
||||
Prompt the user to invoke the `creating-android-pull-request` skill to create the pull request with proper description and formatting. **Create as a draft PR by default** unless the user has explicitly requested a ready-for-review PR.
|
||||
|
||||
## Guidelines
|
||||
|
||||
- Be explicit about which phase you are in at all times.
|
||||
- Never proceed to another phase without user confirmation.
|
||||
- If the user wants to skip a phase, acknowledge and move to the next applicable phase.
|
||||
- If starting from a partially completed task (e.g., code already written), skip to the appropriate phase.
|
||||
@@ -1,19 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to the `build-test-verify` skill will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.1.0] - 2026-02-25
|
||||
|
||||
### Added
|
||||
|
||||
- Build, test, lint, and deploy commands extracted from CLAUDE.md, covering:
|
||||
- Environment setup and required tool versions
|
||||
- Gradle build commands for all app flavors and build types
|
||||
- Unit test execution commands per module with correct flavor variants
|
||||
- Lint and detekt static analysis commands
|
||||
- Fastlane deployment workflows and lane references
|
||||
- Codebase structure and module organization
|
||||
- README.md, CHANGELOG.md, CONTRIBUTING.md for marketplace preparation
|
||||
@@ -1,43 +0,0 @@
|
||||
# Contributing to build-test-verify
|
||||
|
||||
## Development
|
||||
|
||||
This skill provides build, test, lint, and deploy commands for the Bitwarden Android project. It consists of one content file:
|
||||
|
||||
- **SKILL.md** - All build, test, lint, deploy commands and codebase structure reference
|
||||
|
||||
## Making Changes
|
||||
|
||||
This skill follows [Semantic Versioning](https://semver.org/):
|
||||
|
||||
- **Patch** (0.1.x): Typo fixes, minor clarifications, command corrections
|
||||
- **Minor** (0.x.0): New command sections, expanded coverage areas, new tool integrations
|
||||
- **Major** (x.0.0): Structural changes, command overhauls, breaking reorganizations
|
||||
|
||||
When making changes:
|
||||
|
||||
1. Update the relevant content in `SKILL.md`
|
||||
2. Bump the `version` field in the SKILL.md YAML frontmatter
|
||||
3. Add an entry to `CHANGELOG.md` under the appropriate version heading
|
||||
|
||||
## Testing Locally
|
||||
|
||||
To test the skill locally with Claude Code:
|
||||
|
||||
```bash
|
||||
# From the repository root, invoke Claude Code and trigger the skill
|
||||
claude "How do I run tests?"
|
||||
```
|
||||
|
||||
Verify that:
|
||||
- The skill triggers on expected phrases
|
||||
- Commands are accurate against the current build system
|
||||
- Gradle task names match the current project configuration
|
||||
|
||||
## Pull Requests
|
||||
|
||||
All pull requests that modify skill content must include:
|
||||
|
||||
1. A version bump in the SKILL.md frontmatter
|
||||
2. A corresponding CHANGELOG.md entry
|
||||
3. Verification that commands work against the current project configuration
|
||||
@@ -1,75 +0,0 @@
|
||||
# build-test-verify
|
||||
|
||||
Build, test, lint, and deploy commands for the Bitwarden Android project. Provides all commands
|
||||
needed to build APKs/AABs, run unit tests, execute lint/detekt checks, deploy via fastlane, and
|
||||
discover codebase structure.
|
||||
|
||||
## Features
|
||||
|
||||
- **Build Commands** - Gradle tasks for assembling debug/release APKs and AABs across app flavors
|
||||
- **Test Commands** - Unit test execution for all modules with correct flavor variants
|
||||
- **Lint/Detekt** - Static analysis and code quality checks
|
||||
- **Deploy/Fastlane** - Release deployment workflows and fastlane lane references
|
||||
- **Codebase Structure** - Module layout, key directories, and project organization
|
||||
|
||||
## Skill Structure
|
||||
|
||||
```
|
||||
build-test-verify/
|
||||
├── SKILL.md # Build, test, lint, deploy commands and codebase structure
|
||||
├── README.md # This file
|
||||
├── CHANGELOG.md # Version history
|
||||
└── CONTRIBUTING.md # Contribution guidelines
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Claude triggers this skill automatically when conversations involve building, testing, linting,
|
||||
deploying, or exploring the structure of the Bitwarden Android project.
|
||||
|
||||
**Example trigger phrases:**
|
||||
|
||||
- "Run tests"
|
||||
- "Build the app"
|
||||
- "Gradle command"
|
||||
- "Lint check"
|
||||
- "Detekt"
|
||||
- "Deploy"
|
||||
- "Fastlane"
|
||||
- "Assemble"
|
||||
- "Verify"
|
||||
- "Coverage"
|
||||
|
||||
## Content Summary
|
||||
|
||||
| Section | Description |
|
||||
|--------------------|--------------------------------------------------------------|
|
||||
| Environment Setup | Required environment variables and tool versions |
|
||||
| Build Commands | Gradle assemble/bundle tasks for all flavors and build types |
|
||||
| Test Commands | Unit test execution per module with correct flavor variants |
|
||||
| Lint/Detekt | Static analysis commands and configuration |
|
||||
| Deploy/Fastlane | Release deployment workflows and fastlane lanes |
|
||||
| Codebase Structure | Module layout, key directories, package organization |
|
||||
|
||||
## Contributing
|
||||
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines, versioning, and pull request
|
||||
requirements.
|
||||
|
||||
## Changelog
|
||||
|
||||
See [CHANGELOG.md](CHANGELOG.md) for version history.
|
||||
|
||||
## License
|
||||
|
||||
This skill is part of the [Bitwarden Android](https://github.com/bitwarden/android) project and
|
||||
follows its licensing terms.
|
||||
|
||||
## Maintainers
|
||||
|
||||
- Bitwarden Android team
|
||||
|
||||
## Support
|
||||
|
||||
For issues or questions, open an issue in
|
||||
the [bitwarden/android](https://github.com/bitwarden/android) repository.
|
||||
@@ -14,7 +14,7 @@ description: Build, test, lint, and deploy commands for the Bitwarden Android pr
|
||||
| Build flavors | - | `standard` (Play Store), `fdroid` (no Google services) |
|
||||
| Build types | - | `debug`, `beta`, `release` |
|
||||
|
||||
If builds fail resolving the Bitwarden SDK, verify `GITHUB_TOKEN` in `ci.properties` or environment and check connectivity to `maven.pkg.github.com`.
|
||||
If builds fail resolving the Bitwarden SDK, verify `GITHUB_TOKEN` in `user.properties` or environment and check connectivity to `maven.pkg.github.com`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
81
.claude/skills/committing-android-changes/SKILL.md
Normal file
81
.claude/skills/committing-android-changes/SKILL.md
Normal file
@@ -0,0 +1,81 @@
|
||||
---
|
||||
name: committing-android-changes
|
||||
version: 0.1.0
|
||||
description: Git commit conventions and workflow for Bitwarden Android. Use when committing code, writing commit messages, or preparing changes for commit. Triggered by "commit", "git commit", "commit message", "prepare commit", "stage changes".
|
||||
---
|
||||
|
||||
# Git Commit Conventions
|
||||
|
||||
## Commit Message Format
|
||||
|
||||
```
|
||||
[PM-XXXXX] <type>: <imperative summary>
|
||||
|
||||
<optional body explaining why, not what>
|
||||
```
|
||||
|
||||
### Rules
|
||||
|
||||
1. **Ticket prefix**: Always include `[PM-XXXXX]` matching the Jira ticket
|
||||
2. **Type keyword**: Include a conventional commit type after the ticket prefix (see table below)
|
||||
3. **Imperative mood**: "Add feature" not "Added feature" or "Adds feature"
|
||||
4. **Short summary**: Under 72 characters for the first line
|
||||
5. **Body**: Explain the "why" not the "what" — the diff shows the what
|
||||
|
||||
### Type Keywords
|
||||
|
||||
Invoke the `labeling-android-changes` skill for the full type keyword table and selection guidance.
|
||||
|
||||
### Example
|
||||
|
||||
```
|
||||
[PM-12345] feat: Add biometric unlock timeout configuration
|
||||
|
||||
Users reported confusion about when biometric prompts appear.
|
||||
This adds a configurable timeout setting to the security preferences.
|
||||
```
|
||||
|
||||
### Followup Commits
|
||||
|
||||
Only the first commit on a branch needs the full format (ticket prefix, type keyword, body). Subsequent commits — whether addressing review feedback, making intermediate changes, or iterating locally — can use a short, descriptive summary with no prefix or body required.
|
||||
|
||||
```
|
||||
Update error handling in login flow
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Pre-Commit Checklist
|
||||
|
||||
Run the `perform-android-preflight-checklist` skill for the full quality gate. At minimum, before staging and committing:
|
||||
|
||||
1. **Run affected module tests** (use `build-test-verify` skill for correct commands)
|
||||
2. **Check lint**: `./gradlew detekt` on changed modules
|
||||
3. **Review staged changes**: `git diff --staged` — verify no unintended modifications
|
||||
4. **Verify no secrets**: No API keys, tokens, passwords, or `.env` files staged
|
||||
5. **Verify no generated files**: No build outputs, `.idea/` changes, or generated code
|
||||
|
||||
---
|
||||
|
||||
## What NOT to Commit
|
||||
|
||||
- `.env` files or `user.properties` with real tokens
|
||||
- Credential files or signing keystores
|
||||
- Build outputs (`build/`, `*.apk`, `*.aab`)
|
||||
- IDE-specific files (`.idea/` changes, `*.iml`)
|
||||
- Large binary files
|
||||
|
||||
---
|
||||
|
||||
## Staging Best Practices
|
||||
|
||||
- **Stage specific files** by name rather than `git add -A` or `git add .`
|
||||
- Put each file path on its own line for readability:
|
||||
```bash
|
||||
git add \
|
||||
path/to/first/File.kt \
|
||||
path/to/second/File.kt \
|
||||
path/to/third/File.kt
|
||||
```
|
||||
- Review each file being staged to avoid accidentally including sensitive data
|
||||
- Use `git status` (without `-uall` flag) to see the working tree state
|
||||
64
.claude/skills/creating-android-pull-request/SKILL.md
Normal file
64
.claude/skills/creating-android-pull-request/SKILL.md
Normal file
@@ -0,0 +1,64 @@
|
||||
---
|
||||
name: creating-android-pull-request
|
||||
version: 0.1.0
|
||||
description: Pull request creation workflow for Bitwarden Android. Use when creating PRs, writing PR descriptions, or preparing branches for review. Triggered by "create PR", "pull request", "open PR", "gh pr create", "PR description".
|
||||
---
|
||||
|
||||
# Create Pull Request
|
||||
|
||||
## PR Title Format
|
||||
|
||||
```
|
||||
[PM-XXXXX] <type>: <short imperative summary>
|
||||
```
|
||||
|
||||
**Examples:**
|
||||
- `[PM-12345] feat: Add autofill support for passkeys`
|
||||
- `[PM-12345] fix: Resolve crash during vault sync`
|
||||
- `[PM-12345] refactor: Simplify authentication flow`
|
||||
|
||||
**Rules:**
|
||||
- Include Jira ticket prefix
|
||||
- Keep under 70 characters total
|
||||
- Use imperative mood in the summary
|
||||
|
||||
**Type keywords** (triggers automatic `t:` label via CI):
|
||||
|
||||
Invoke the `labeling-android-changes` skill for the full type keyword table and selection guidance.
|
||||
|
||||
---
|
||||
|
||||
## PR Body Template
|
||||
|
||||
**IMPORTANT:** Always follow the repo's PR template at `.github/PULL_REQUEST_TEMPLATE.md`. Delete the Screenshots section entirely if there are no UI changes.
|
||||
|
||||
---
|
||||
|
||||
## Pre-PR Checklist
|
||||
|
||||
1. **All tests pass**: Run `./gradlew app:testStandardDebugUnitTest` (and other affected modules)
|
||||
2. **Lint clean**: Run `./gradlew detekt`
|
||||
3. **Self-review done**: Use `perform-android-preflight-checklist` skill
|
||||
4. **No unintended changes**: Check `git diff origin/main...HEAD` for unexpected files
|
||||
5. **Branch up to date**: Rebase on `main` if needed
|
||||
|
||||
---
|
||||
|
||||
## Creating the PR
|
||||
|
||||
```bash
|
||||
# Ensure branch is pushed
|
||||
git push -u origin <branch-name>
|
||||
|
||||
# Create PR as draft by default (body follows .github/PULL_REQUEST_TEMPLATE.md)
|
||||
gh pr create --draft --title "[PM-XXXXX] feat: Short summary" --body "<fill in from PR template>"
|
||||
```
|
||||
|
||||
**Default to draft PRs.** Only create a non-draft (ready for review) PR if the user explicitly requests it.
|
||||
|
||||
---
|
||||
|
||||
## Base Branch
|
||||
|
||||
- Default target: `main`
|
||||
- Check with team if targeting a feature branch instead
|
||||
@@ -1,40 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to the `implementing-android-code` skill will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.1.2] - 2026-02-26
|
||||
|
||||
### Fixed
|
||||
|
||||
- Updated Quick Reference cross-reference to point to `build-test-verify` skill instead of removed CLAUDE.md sections
|
||||
|
||||
## [0.1.1] - 2026-02-25
|
||||
|
||||
### Fixed
|
||||
|
||||
- Added missing `@EncryptedPreferences` and `@UnencryptedPreferences` annotations to `ExampleDiskSourceImpl` code example
|
||||
- Fixed typographic apostrophe example to use correct right single quotation mark (U+2019)
|
||||
|
||||
### Removed
|
||||
|
||||
- Removed redundant "Summary" section that duplicated existing content
|
||||
|
||||
## [0.1.0] - 2026-02-17
|
||||
|
||||
### Added
|
||||
|
||||
- Bitwarden Android implementation patterns covering:
|
||||
- ViewModel State-Action-Event (SAE) pattern with `BaseViewModel`
|
||||
- Type-safe navigation with `@Serializable` routes and `composableWithSlideTransitions`
|
||||
- Screen/Compose implementation with `EventsEffect` and stateless composables
|
||||
- Data layer patterns: repositories, data sources, `DataState<T>`, error handling
|
||||
- UI component library usage and string resource conventions
|
||||
- Security patterns: zero-knowledge architecture, encrypted storage, SDK isolation
|
||||
- Testing quick reference for ViewModels, repositories, compose, and data sources
|
||||
- Clock/time injection patterns for deterministic operations
|
||||
- Anti-patterns and common gotchas
|
||||
- Copy-pasteable code templates (templates.md) for all layer types
|
||||
- README.md, CHANGELOG.md, CONTRIBUTING.md for marketplace preparation
|
||||
@@ -1,44 +0,0 @@
|
||||
# Contributing to implementing-android-code
|
||||
|
||||
## Development
|
||||
|
||||
This skill provides Bitwarden Android implementation patterns, gotchas, and code templates for Claude Code. It consists of two content files:
|
||||
|
||||
- **SKILL.md** - Quick reference for patterns, anti-patterns, and gotchas
|
||||
- **templates.md** - Copy-pasteable code templates for all layer types
|
||||
|
||||
## Making Changes
|
||||
|
||||
This skill follows [Semantic Versioning](https://semver.org/):
|
||||
|
||||
- **Patch** (0.1.x): Typo fixes, minor clarifications, template corrections
|
||||
- **Minor** (0.x.0): New patterns, new templates, expanded coverage areas
|
||||
- **Major** (x.0.0): Structural changes, pattern overhauls, breaking reorganizations
|
||||
|
||||
When making changes:
|
||||
|
||||
1. Update the relevant content in `SKILL.md` and/or `templates.md`
|
||||
2. Bump the `version` field in the SKILL.md YAML frontmatter
|
||||
3. Add an entry to `CHANGELOG.md` under the appropriate version heading
|
||||
|
||||
## Testing Locally
|
||||
|
||||
To test the skill locally with Claude Code:
|
||||
|
||||
```bash
|
||||
# From the repository root, invoke Claude Code and trigger the skill
|
||||
claude "How do I implement a ViewModel?"
|
||||
```
|
||||
|
||||
Verify that:
|
||||
- The skill triggers on expected phrases
|
||||
- Templates render correctly
|
||||
- Pattern references are accurate against the current codebase
|
||||
|
||||
## Pull Requests
|
||||
|
||||
All pull requests that modify skill content must include:
|
||||
|
||||
1. A version bump in the SKILL.md frontmatter
|
||||
2. A corresponding CHANGELOG.md entry
|
||||
3. Verification that templates compile against the current codebase patterns
|
||||
@@ -1,77 +0,0 @@
|
||||
# implementing-android-code
|
||||
|
||||
Bitwarden Android implementation patterns skill for Claude Code. Provides critical patterns, gotchas, anti-patterns, and copy-pasteable templates unique to the Bitwarden Android codebase.
|
||||
|
||||
## Features
|
||||
|
||||
- **ViewModel SAE Pattern** - State-Action-Event with `BaseViewModel`, `SavedStateHandle` persistence, process death recovery
|
||||
- **Type-Safe Navigation** - `@Serializable` routes, `composableWithSlideTransitions`, `NavGraphBuilder`/`NavController` extensions
|
||||
- **Screen/Compose** - Stateless composables, `EventsEffect`, `remember(viewModel)` lambda patterns
|
||||
- **Data Layer** - Repository pattern, `DataState<T>` streaming, `Result` sealed classes, Flow collection via Internal actions
|
||||
- **UI Components** - Bitwarden component library usage, theming, string resources
|
||||
- **Security Patterns** - Zero-knowledge architecture, encrypted storage, SDK isolation
|
||||
- **Testing Patterns** - ViewModel, repository, compose, and data source test structure
|
||||
- **Clock/Time Handling** - `Clock` injection for deterministic time operations
|
||||
|
||||
## Skill Structure
|
||||
|
||||
```
|
||||
implementing-android-code/
|
||||
├── SKILL.md # Quick reference for patterns, gotchas, and anti-patterns
|
||||
├── templates.md # Copy-pasteable code templates for all layer types
|
||||
├── README.md # This file
|
||||
├── CHANGELOG.md # Version history
|
||||
└── CONTRIBUTING.md # Contribution guidelines
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Claude triggers this skill automatically when conversations involve implementing features, screens, ViewModels, data sources, or navigation in the Bitwarden Android app.
|
||||
|
||||
**Example trigger phrases:**
|
||||
- "How do I implement a ViewModel?"
|
||||
- "Create a new screen"
|
||||
- "Add navigation"
|
||||
- "Write a repository"
|
||||
- "BaseViewModel pattern"
|
||||
- "State-Action-Event"
|
||||
- "type-safe navigation"
|
||||
- "Clock injection"
|
||||
|
||||
## Content Summary
|
||||
|
||||
| Section | Description |
|
||||
|---------|-------------|
|
||||
| A. ViewModel Implementation | SAE pattern, `handleAction`, `sendAction`, `SavedStateHandle` |
|
||||
| B. Type-Safe Navigation | `@Serializable` routes, transitions, `NavGraphBuilder` extensions |
|
||||
| C. Screen Implementation | Stateless composables, `EventsEffect`, action lambdas |
|
||||
| D. Data Layer | Repositories, data sources, `DataState`, error handling |
|
||||
| E. UI Components | Bitwarden component library, theming, string resources |
|
||||
| F. Security Patterns | Zero-knowledge, encrypted storage, SDK isolation |
|
||||
| G. Testing Quick Reference | ViewModel, repository, compose, data source tests |
|
||||
| H. Clock/Time Patterns | `Clock` injection, deterministic time testing |
|
||||
|
||||
## References
|
||||
|
||||
- [`docs/ARCHITECTURE.md`](../../../docs/ARCHITECTURE.md) - Comprehensive architecture patterns and examples
|
||||
- [`docs/STYLE_AND_BEST_PRACTICES.md`](../../../docs/STYLE_AND_BEST_PRACTICES.md) - Code style, formatting, Compose conventions
|
||||
|
||||
## Contributing
|
||||
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines, versioning, and pull request requirements.
|
||||
|
||||
## Changelog
|
||||
|
||||
See [CHANGELOG.md](CHANGELOG.md) for version history.
|
||||
|
||||
## License
|
||||
|
||||
This skill is part of the [Bitwarden Android](https://github.com/bitwarden/android) project and follows its licensing terms.
|
||||
|
||||
## Maintainers
|
||||
|
||||
- Bitwarden Android team
|
||||
|
||||
## Support
|
||||
|
||||
For issues or questions, open an issue in the [bitwarden/android](https://github.com/bitwarden/android) repository.
|
||||
40
.claude/skills/labeling-android-changes/SKILL.md
Normal file
40
.claude/skills/labeling-android-changes/SKILL.md
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
name: labeling-android-changes
|
||||
version: 0.1.0
|
||||
description: Conventional commit type keywords for PR titles and commit messages. Use when determining the change type for commits or PRs. Triggered by "what type", "label", "change type", "conventional commit", "t: label".
|
||||
---
|
||||
|
||||
# Labeling Changes
|
||||
|
||||
PR titles and commit messages must include a conventional commit type keyword. This keyword drives automatic `t:` label assignment via CI (`.github/workflows/sdlc-label-pr.yml`).
|
||||
|
||||
## Format
|
||||
|
||||
The type keyword appears after the Jira ticket prefix:
|
||||
|
||||
```
|
||||
[PM-XXXXX] <type>: <imperative summary>
|
||||
```
|
||||
|
||||
## Type Keywords
|
||||
|
||||
| Type | Label | Use for |
|
||||
|------|-------|---------|
|
||||
| `feat` | `t:feature` | New features or functionality |
|
||||
| `fix` | `t:bug` | Bug fixes |
|
||||
| `refactor` | `t:tech-debt` | Code restructuring without behavior change |
|
||||
| `chore` | `t:tech-debt` | Maintenance, cleanup, minor tweaks |
|
||||
| `test` | `t:tech-debt` | Adding or updating tests |
|
||||
| `perf` | `t:tech-debt` | Performance improvements |
|
||||
| `docs` | `t:docs` | Documentation changes |
|
||||
| `ci` / `build` | `t:ci` | CI/CD and build system changes |
|
||||
| `deps` | `t:deps` | Dependency updates |
|
||||
| `llm` | `t:llm` | LLM/Claude configuration changes |
|
||||
| `breaking` | `t:breaking-change` | Breaking changes requiring migration |
|
||||
| `misc` | `t:misc` | Changes that do not fit other categories |
|
||||
|
||||
## Selecting a Type
|
||||
|
||||
Infer the type from the task description and changes made. **If the type cannot be confidently determined, ask the user.**
|
||||
|
||||
The CI labeling script matches `<type>:` or `<type>(` in the lowercased PR title, so the keyword must be followed by a colon or parenthesis. CI also accepts additional aliases (e.g., `revert`, `bugfix`, `cleanup`). See `.github/label-pr.json` for the full mapping.
|
||||
37
.claude/skills/perform-android-preflight-checklist/SKILL.md
Normal file
37
.claude/skills/perform-android-preflight-checklist/SKILL.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: perform-android-preflight-checklist
|
||||
version: 0.1.0
|
||||
description: Quality gate checklist to run before committing or creating a PR. Use when finishing implementation, checking work quality, or preparing to commit. Triggered by "self review", "check my work", "ready to commit", "done implementing", "review checklist", "quality check".
|
||||
---
|
||||
|
||||
# Self-Review Checklist
|
||||
|
||||
Run through this checklist before committing or opening a PR.
|
||||
|
||||
## Tests
|
||||
- [ ] Tests pass with correct flavor: `./gradlew app:testStandardDebugUnitTest`
|
||||
- [ ] New code has corresponding test coverage
|
||||
- [ ] Tests for affected modules also pass (`:core:test`, `:data:test`, etc.)
|
||||
|
||||
## Code Quality
|
||||
- [ ] Lint/detekt clean: `./gradlew detekt`
|
||||
- [ ] No unintended file changes (`git diff` review)
|
||||
- [ ] KDoc on all new public APIs
|
||||
- [ ] No TODO comments left behind (or they reference a ticket)
|
||||
|
||||
## Security
|
||||
- [ ] No plaintext keys, tokens, or secrets in code
|
||||
- [ ] User input validated before processing
|
||||
- [ ] Sensitive data uses encrypted storage patterns
|
||||
- [ ] No logging of sensitive data (passwords, keys, tokens)
|
||||
|
||||
## Bitwarden Patterns
|
||||
- [ ] String resources in `:ui` module with typographic quotes
|
||||
- [ ] Navigation route is `@Serializable` and registered in graph
|
||||
- [ ] New implementations have Hilt `@Binds` or `@Provides` in a module
|
||||
- [ ] ViewModel extends `BaseViewModel<S, E, A>` with proper state persistence
|
||||
- [ ] Async results mapped through internal actions (not direct state updates)
|
||||
|
||||
## Files
|
||||
- [ ] No accidental `.idea/`, build output, or generated files staged
|
||||
- [ ] No credential files or `.env` files included
|
||||
@@ -1,44 +0,0 @@
|
||||
# Testing Android Code Skill
|
||||
|
||||
Quick-reference guide for writing and reviewing tests in the Bitwarden Android codebase.
|
||||
|
||||
## Purpose
|
||||
|
||||
This skill provides tactical testing guidance for Bitwarden-specific patterns. It focuses on base test classes, test utilities, and common gotchas unique to this codebase rather than general testing concepts.
|
||||
|
||||
## When This Skill Activates
|
||||
|
||||
The skill automatically loads when you ask questions like:
|
||||
|
||||
- "How do I test this ViewModel?"
|
||||
- "Why is my Bitwarden test failing?"
|
||||
- "Write tests for this repository"
|
||||
|
||||
Or when you mention terms like: `BaseViewModelTest`, `BitwardenComposeTest`, `stateEventFlow`, `bufferedMutableSharedFlow`, `FakeDispatcherManager`, `createMockCipher`, `asSuccess`
|
||||
|
||||
## What's Included
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `SKILL.md` | Core testing patterns and base class locations |
|
||||
| `references/test-base-classes.md` | Detailed base class documentation |
|
||||
| `references/flow-testing-patterns.md` | Turbine patterns for StateFlow/EventFlow |
|
||||
| `references/critical-gotchas.md` | Anti-patterns and debugging tips |
|
||||
| `examples/viewmodel-test-example.md` | Complete ViewModel test example |
|
||||
| `examples/compose-screen-test-example.md` | Complete Compose screen test |
|
||||
| `examples/repository-test-example.md` | Complete repository test with mocks |
|
||||
|
||||
## Patterns Covered
|
||||
|
||||
1. **BaseViewModelTest** - Automatic dispatcher setup with `stateEventFlow()` helper
|
||||
2. **BitwardenComposeTest** - Pre-configured with all managers and theme
|
||||
3. **BaseServiceTest** - MockWebServer setup for network testing
|
||||
4. **Turbine Flow Testing** - StateFlow (replay) vs EventFlow (no replay)
|
||||
5. **Test Data Builders** - 35+ `createMock*` functions with `number: Int` pattern
|
||||
6. **Fake Implementations** - FakeDispatcherManager, FakeConfigDiskSource
|
||||
7. **Result Type Testing** - `.asSuccess()`, `.asFailure()`, `assertCoroutineThrows`
|
||||
|
||||
## Quick Start
|
||||
|
||||
For comprehensive architecture and testing philosophy, see:
|
||||
- `docs/ARCHITECTURE.md`
|
||||
@@ -7,7 +7,7 @@
|
||||
**Problem**: Cannot resolve Bitwarden SDK from GitHub Packages
|
||||
|
||||
**Solution**:
|
||||
1. Ensure `GITHUB_TOKEN` is set in `ci.properties` or environment
|
||||
1. Ensure `GITHUB_TOKEN` is set in `user.properties` or environment
|
||||
2. Verify token has `read:packages` scope
|
||||
3. Check network connectivity to `maven.pkg.github.com`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user