Follow these best practices to ensure smooth development and contributions to the CoSAI Risk Map.
For any ongoing development work:
# Before starting work, create an issue to:
# - Document the planned changes
# - Enable collaboration and discussion
# - Track progress and link related PRs
# - Provide context for reviewersThis helps maintain project visibility and enables better collaboration.
python scripts/hooks/validate_riskmap.py --forceGenerate graphs to see the impact of your changes:
# Generate component relationship graph
python scripts/hooks/validate_riskmap.py --to-graph ./preview-graph.md --force
# Generate control-to-component relationship graph
python scripts/hooks/validate_riskmap.py --to-controls-graph ./preview-controls.md --force
# Generate controls-to-risk relationship graph
python scripts/hooks/validate_riskmap.py --to-risk-graph ./preview-risks.md --forceThough pre-commit handles this automatically, it's useful to format during development:
npx prettier --write risk-map/yaml/*.yamlAdd one component connection at a time to make debugging easier.
Explain complex relationships in commit messages for future maintainers.
Follow the component[Name] convention for components:
- ✅
componentModelTraining - ❌
compMTormodel_training
Apply similar conventions to controls (control[Name]), risks (short acronyms), and personas (persona[Name]).
Schema validation is enforced by pre-commit hooks, but you can also validate manually before committing.
Study established patterns before adding new components to maintain consistency.
When you commit changes to components.yaml, the updated graph is automatically generated and staged.
When graph generation produces unexpected results:
python scripts/hooks/validate_riskmap.py --to-graph ./debug-graph.md --debug --forceWhen adding or modifying controls, generate control graphs to verify your mappings are logical:
# Generate control graph to verify your control mappings
python scripts/hooks/validate_riskmap.py --to-controls-graph ./verify-controls.md --force
# Generate risk graph to verify control-risk relationships
python scripts/hooks/validate_riskmap.py --to-risk-graph ./verify-risks.md --forceRun the full pre-commit suite manually to catch issues early:
# Run the key validations manually before pushing
python scripts/hooks/validate_riskmap.py --force
python scripts/hooks/validate_control_risk_references.py --force
python scripts/hooks/validate_framework_references.py --forceSee CONTRIBUTING.md for the proper branching workflow (develop vs. main).
Use the "This commit does..." format for clarity.
Always reference the related GitHub issue in your pull request description.
Related:
- Validation Tools - All validation commands
- Troubleshooting - Common issues and solutions
- General Workflow - Overall contribution process