|
2 | 2 |
|
3 | 3 | This file documents repository-level expectations and instructions intended to guide contributors and AI-assisted editing tools (like Claude Code) when making changes in this project. |
4 | 4 |
|
5 | | -- Ask for approval before any git commit and push |
6 | | -- Always run tests before completing all development of new changes |
7 | | -- Always test the CLI usages |
8 | | -- After any changes, run the folling to reinstall the project: |
9 | | -``` |
| 5 | +## Core Guidelines |
| 6 | + |
| 7 | +- **Ask for approval before any git commit and push** |
| 8 | +- **Always run tests** before completing all development of new changes |
| 9 | +- **Always test the CLI usages** to ensure functionality works end-to-end |
| 10 | +- **Run code quality checks** before committing (see below) |
| 11 | + |
| 12 | +## Development Workflow |
| 13 | + |
| 14 | +### After Any Changes |
| 15 | + |
| 16 | +Reinstall the project to test in production-like environment: |
| 17 | + |
| 18 | +```bash |
10 | 19 | rm -rf dist/* |
11 | 20 | ./install.sh uninstall |
12 | 21 | ./install.sh |
13 | 22 | cp ~/.config/code-assistant-manager/settings.json.bak ~/.config/code-assistant-manager/settings.json |
14 | 23 | ``` |
| 24 | + |
| 25 | +### Code Quality Requirements |
| 26 | + |
| 27 | +Before committing, ensure all quality checks pass: |
| 28 | + |
| 29 | +```bash |
| 30 | +# Quick check (formatting + linting + type-check + tests) |
| 31 | +make check |
| 32 | + |
| 33 | +# Or run individually: |
| 34 | +make format # Auto-format code with Black and isort |
| 35 | +make lint # Check code style with Flake8 |
| 36 | +make type-check # Verify type hints with mypy |
| 37 | +make security # Scan for security issues with Bandit |
| 38 | +make test # Run test suite |
| 39 | +``` |
| 40 | + |
| 41 | +**Pre-commit hooks** are automatically installed with `make dev-install` and will run these checks before each commit. |
| 42 | + |
| 43 | +### Code Style Standards |
| 44 | + |
| 45 | +- **Formatting**: Use Black (line length: 88) |
| 46 | +- **Import sorting**: Use isort (Black-compatible profile) |
| 47 | +- **Linting**: Follow Flake8 rules (see `.flake8`) |
| 48 | +- **Type hints**: Add type hints for new code (checked with mypy) |
| 49 | +- **Docstrings**: Use Google-style docstrings for public functions/classes |
| 50 | +- **Security**: No hardcoded secrets, follow Bandit recommendations |
| 51 | + |
| 52 | +### Testing Requirements |
| 53 | + |
| 54 | +- Write tests for all new functionality |
| 55 | +- Maintain or improve test coverage |
| 56 | +- Use appropriate test markers (`@pytest.mark.unit`, `@pytest.mark.integration`, etc.) |
| 57 | +- Mock external dependencies (APIs, file system, network) |
| 58 | + |
| 59 | +## Quick Reference |
| 60 | + |
| 61 | +### Setup Development Environment |
| 62 | + |
| 63 | +```bash |
| 64 | +# One-time setup |
| 65 | +make dev-install # Install with dev dependencies + pre-commit hooks |
| 66 | +``` |
| 67 | + |
| 68 | +### Common Commands |
| 69 | + |
| 70 | +```bash |
| 71 | +make help # Show all available commands |
| 72 | +make format # Auto-format code |
| 73 | +make check # Run all quality checks |
| 74 | +make test # Run test suite |
| 75 | +make test-cov # Run tests with coverage report |
| 76 | +``` |
| 77 | + |
| 78 | +### Before Submitting Code |
| 79 | + |
| 80 | +1. ✅ Run `make check` - All checks must pass |
| 81 | +2. ✅ Run `make test` - All tests must pass |
| 82 | +3. ✅ Test CLI manually - Ensure functionality works |
| 83 | +4. ✅ Update documentation - If adding/changing features |
| 84 | +5. ✅ Review changes - Use `git diff` before committing |
| 85 | + |
| 86 | +## Documentation |
| 87 | + |
| 88 | +- See `CONTRIBUTING.md` for detailed contribution guidelines |
| 89 | +- See `docs/CODE_QUALITY.md` for comprehensive code quality tool documentation |
| 90 | +- See `docs/DESIGN_PATTERNS_README.md` for architecture patterns |
| 91 | + |
| 92 | +## Attribution |
| 93 | + |
| 94 | +When using AI assistance for code generation, add attribution in commit messages: |
| 95 | + |
| 96 | +```bash |
| 97 | +git commit -m "feat: implement new feature |
| 98 | +
|
| 99 | +Co-Authored-By: Claude <noreply@anthropic.com>" |
| 100 | +``` |
| 101 | + |
| 102 | +## Questions? |
| 103 | + |
| 104 | +- Review this document and `CONTRIBUTING.md` |
| 105 | +- Check code quality documentation in `docs/CODE_QUALITY.md` |
| 106 | +- Consult design patterns guide in `docs/DESIGN_PATTERNS_README.md` |
0 commit comments