|
| 1 | +# Bitwarden Contributing Docs - Claude Code Configuration |
| 2 | + |
| 3 | +- **OFTEN** prefer editing existing files over creating new ones |
| 4 | +- **ALWAYS** follow the established patterns for frontmatter, conditional content, and structure |
| 5 | +- **ALWAYS** validate code and diagram syntax |
| 6 | + |
| 7 | +## Repository structure |
| 8 | + |
| 9 | +- **docs/** - Documentation content organized into three main sections: |
| 10 | + - **getting-started/** - Setup instructions for various Bitwarden projects (clients, server, |
| 11 | + mobile, SDK) |
| 12 | + - **contributing/** - Contribution guidelines including code style, pull requests, testing, and |
| 13 | + database migrations |
| 14 | + - **architecture/** - Technical architecture documentation, ADRs (Architecture Decision Records), |
| 15 | + and deep dives into specific features |
| 16 | +- **src/** - Docusaurus custom components and React code |
| 17 | +- **static/** - Static assets like images |
| 18 | +- **scripts/** - Build and development scripts |
| 19 | + |
| 20 | +## Key technologies |
| 21 | + |
| 22 | +- **Docusaurus** - Static site generator |
| 23 | +- **React** - UI framework |
| 24 | +- **TypeScript** |
| 25 | +- **Node.js** |
| 26 | + |
| 27 | +## Development commands |
| 28 | + |
| 29 | +```bash |
| 30 | +npm ci # Install dependencies |
| 31 | +npm start # Start local dev server with SSL (requires .env setup) |
| 32 | +npm start:insecure # Start without SSL |
| 33 | +npm run build # Generate static site |
| 34 | +npm run prettier # Format code |
| 35 | +npm run lint # Check code formatting |
| 36 | +npm run spellcheck # Run cspell on Markdown files |
| 37 | +npm run typecheck # Run TypeScript type checking |
| 38 | +``` |
| 39 | + |
| 40 | +## Documentation writing guidelines |
| 41 | + |
| 42 | +### Style guide |
| 43 | + |
| 44 | +- Use numbered paragraphs for instructions/procedures, starting with action-oriented verbs ("click", |
| 45 | + "type", "restart") |
| 46 | +- Headings should start with capitalization but following words are not capitalized |
| 47 | +- Use code blocks for all commands (not inline) |
| 48 | +- Keep paragraphs concise and to-the-point |
| 49 | +- Add custom words to `custom-words.txt` if needed for spellchecking |
| 50 | +- Include trailing commas for multi-line lists |
| 51 | +- Do not use code regions |
| 52 | +- Follow language-specific guidelines for code examples in `docs/contributing/code-style/` |
| 53 | +- Diagrams should use [Mermaid](https://mermaid.js.org/) |
| 54 | +- Large code examples should be in `<details>` blocks |
| 55 | + |
| 56 | +### Conditional content |
| 57 | + |
| 58 | +The site serves both internal Bitwarden employees and external community contributors. Use these |
| 59 | +tags to target specific audiences: |
| 60 | + |
| 61 | +```md |
| 62 | +<Community> |
| 63 | +Content for community contributors only |
| 64 | +</Community> |
| 65 | + |
| 66 | +<Bitwarden> |
| 67 | +Content for Bitwarden employees only |
| 68 | +</Bitwarden> |
| 69 | +``` |
| 70 | + |
| 71 | +To hide pages from navigation, use frontmatter: |
| 72 | + |
| 73 | +```yml |
| 74 | +--- |
| 75 | +sidebar_custom_props: |
| 76 | + access: bitwarden # or community |
| 77 | +--- |
| 78 | +``` |
| 79 | + |
| 80 | +## Code review and ownership |
| 81 | + |
| 82 | +Tech leads generally review all documentation changes. See [.github/CODEOWNERS](.github/CODEOWNERS) |
| 83 | +for full ownership details. |
| 84 | + |
| 85 | +## Pull request strategy |
| 86 | + |
| 87 | +- Prefer small, incremental PRs |
| 88 | +- Merge directly to `main` |
| 89 | +- Avoid using long-lived feature branches and keep content changes relatively small and iterative |
| 90 | + |
| 91 | +## Working with this repository |
| 92 | + |
| 93 | +### When editing documentation |
| 94 | + |
| 95 | +1. Always follow the style guide (numbered instructions, code blocks, brevity) |
| 96 | +2. Consider if content should be conditional using `<Community>` or `<Bitwarden>` tags |
| 97 | +3. Run `npm run spellcheck` before committing |
| 98 | +4. Ensure proper frontmatter is set (sidebar position, access restrictions, etc.) |
| 99 | +5. Reference the appropriate section (getting-started, contributing, or architecture) |
| 100 | + |
| 101 | +### When adding new files |
| 102 | + |
| 103 | +1. Place in the appropriate docs subdirectory |
| 104 | +2. Include frontmatter with at least `sidebar_position` |
| 105 | +3. Add any technical terms to `custom-words.txt` |
| 106 | +4. Update sidebars.js if needed for navigation structure |
| 107 | + |
| 108 | +### Architecture documentation |
| 109 | + |
| 110 | +- ADRs go in `docs/architecture/adr/` with format `####-title.md` |
| 111 | +- Follow existing ADR structure (Status, Context, Decision, Consequences) |
| 112 | + |
| 113 | +## Testing before committing |
| 114 | + |
| 115 | +1. Run `npm run spellcheck` to catch typos |
| 116 | +2. Run `npm run lint` to ensure formatting is correct |
| 117 | +3. Run `npm start` to preview changes locally |
| 118 | +4. Verify conditional content displays correctly by switching between Community/Bitwarden modes in |
| 119 | + the dropdown |
| 120 | + |
| 121 | +For most changes you can rely on making a draft pull request and testing it live with a branch |
| 122 | +deployment. |
0 commit comments