A comprehensive style guide and ruleset designed for AI code generation tools working with OpenStack Python projects.
quick-rules.md(710 tokens) - Essential rules for immediate usecomprehensive-guide.md(4700 tokens) - Detailed explanations and examples
# Claude Code
claude-code --context-file docs/quick-rules.md
# Cursor
# Add to .cursorrules: @docs/quick-rules.md
# Generic AI tool
curl https://raw.githubusercontent.com/username/openstack-ai-style-guide/main/docs/quick-rules.md
# Local usage
cat docs/quick-rules.md | pbcopy # macOS
cat docs/quick-rules.md | xclip -selection clipboard # Linuxopenstack-ai-style-guide/
├── docs/ # Style guide documentation
│ ├── quick-rules.md # Concise reference (710 tokens)
│ ├── comprehensive-guide.md # Detailed guide (4700 tokens)
│ ├── examples/ # Code examples and patterns
│ │ ├── good/ # Correct OpenStack patterns
│ │ └── bad/ # Anti-patterns to avoid
│ ├── checklists/ # Validation checklists
│ │ ├── pre-submit.md # Before committing and pushing
│ │ └── code-review.md # Reviewing AI code
│ └── templates/ # Code and commit templates
│ ├── python_module.py.template
│ ├── python_test.py.template
│ ├── commit_message.txt
│ └── pre-commit-config.yaml
├── references/ # Authoritative source documents
│ ├── ai-policy.md # OpenInfra AI Policy
│ ├── dco.md # Developer Certificate of Origin
│ ├── hacking.md # OpenStack Hacking Rules
│ └── pep8.md # PEP 8 Style Guide
├── tools/ # Validation and helper scripts
├── CONTRIBUTING.md # Contribution guidelines
├── LICENSE # Apache 2.0 license
└── README.md # This file
- ✅ Real-time code generation
- ✅ Quick validation checks
- ✅ Context-constrained AI tools
- ✅ Fast reference lookups
- 📚 Learning OpenStack patterns
- 🐛 Complex debugging scenarios
- 📝 Policy and compliance questions
- 🔍 Detailed implementation guidance
# Include in system prompt or use context file
claude-code --context-file docs/quick-rules.md --model claude-3-sonnetAdd to your .github/copilot-instructions.md:
Follow the OpenStack style guide at docs/quick-rules.md for all Python code generation.Add to .cursorrules:
@docs/quick-rules.md
Always follow OpenStack Python style guidelines for code generation.
Include the quick rules as system context:
with open('docs/quick-rules.md', 'r') as f:
style_guide = f.read()
# Pass style_guide as system context to your AI modelBefore submitting AI-generated OpenStack code:
- Apache 2.0 license header included
- Line length ≤ 79 characters
- No bare
except:statements -
autospec=Truein all mock decorators - Delayed logging interpolation used
- Proper import organization
- AI attribution in commit message (Generated-By/Assisted-By)
- DCO sign-off included (git commit -s - REQUIRED)
| Context | File | Tokens | Use Case |
|---|---|---|---|
| Minimal | quick-rules.md |
710 | Real-time generation |
| Standard | Both files | 5410 | Complex implementations |
| Full | All docs + examples | ~7100+ | Learning/training |
Token Constraints:
quick-rules.md: Target < 1000 tokens for standalone copying to other reposcomprehensive-guide.md: Target < 5000 tokens for comprehensive reference- Both files designed to be self-contained and readable without external dependencies
See CONTRIBUTING.md for guidelines on:
- Adding new rules and patterns
- Contributing examples
- AI-generated content attribution
- Community review process
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.