@h1dr0n/skill-pool 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +296 -0
- package/bin/cli.js +157 -0
- package/package.json +41 -0
- package/skills/api/agents/backend-specialist.md +69 -0
- package/skills/api/agents/database-optimizer.md +176 -0
- package/skills/api/manifest.yaml +20 -0
- package/skills/api/rules/auth-security.md +45 -0
- package/skills/api/skills/api-patterns/SKILL.md +81 -0
- package/skills/api/skills/api-patterns/api-style.md +42 -0
- package/skills/api/skills/api-patterns/auth.md +24 -0
- package/skills/api/skills/api-patterns/documentation.md +26 -0
- package/skills/api/skills/api-patterns/graphql.md +41 -0
- package/skills/api/skills/api-patterns/rate-limiting.md +31 -0
- package/skills/api/skills/api-patterns/response.md +37 -0
- package/skills/api/skills/api-patterns/rest.md +40 -0
- package/skills/api/skills/api-patterns/scripts/api_validator.py +211 -0
- package/skills/api/skills/api-patterns/security-testing.md +122 -0
- package/skills/api/skills/api-patterns/trpc.md +41 -0
- package/skills/api/skills/api-patterns/versioning.md +22 -0
- package/skills/api/skills/database-patterns.md +126 -0
- package/skills/api/skills/deployment-patterns.md +105 -0
- package/skills/api/skills/docker-patterns.md +135 -0
- package/skills/common/agents/code-reviewer.md +78 -0
- package/skills/common/agents/planner.md +80 -0
- package/skills/common/agents/security-reviewer.md +82 -0
- package/skills/common/agents/software-architect.md +81 -0
- package/skills/common/manifest.yaml +25 -0
- package/skills/common/rules/coding-style.md +39 -0
- package/skills/common/rules/git-workflow.md +33 -0
- package/skills/common/rules/security.md +25 -0
- package/skills/common/skills/architecture/SKILL.md +55 -0
- package/skills/common/skills/architecture/context-discovery.md +43 -0
- package/skills/common/skills/architecture/examples.md +94 -0
- package/skills/common/skills/architecture/pattern-selection.md +68 -0
- package/skills/common/skills/architecture/patterns-reference.md +50 -0
- package/skills/common/skills/architecture/trade-off-analysis.md +77 -0
- package/skills/common/skills/brainstorming/SKILL.md +163 -0
- package/skills/common/skills/brainstorming/dynamic-questioning.md +350 -0
- package/skills/common/skills/clean-code.md +99 -0
- package/skills/common/skills/code-review-checklist.md +86 -0
- package/skills/common/skills/plan-writing/SKILL.md +152 -0
- package/skills/common/skills/skill-feedback.md +94 -0
- package/skills/common/skills/tdd-workflow.md +130 -0
- package/skills/common/skills/verification-loop.md +112 -0
- package/skills/cpp/agents/cpp-build-resolver.md +90 -0
- package/skills/cpp/agents/cpp-reviewer.md +72 -0
- package/skills/cpp/manifest.yaml +15 -0
- package/skills/cpp/skills/cpp-coding-standards.md +722 -0
- package/skills/cpp/skills/cpp-testing.md +323 -0
- package/skills/devops/agents/devops-automator.md +376 -0
- package/skills/devops/agents/sre.md +90 -0
- package/skills/devops/manifest.yaml +20 -0
- package/skills/devops/skills/deployment-patterns.md +427 -0
- package/skills/devops/skills/deployment-procedures/SKILL.md +241 -0
- package/skills/devops/skills/docker-patterns.md +364 -0
- package/skills/devops/skills/e2e-testing.md +326 -0
- package/skills/devops/skills/github-ops.md +144 -0
- package/skills/django/manifest.yaml +16 -0
- package/skills/django/skills/django-patterns.md +734 -0
- package/skills/django/skills/django-security.md +593 -0
- package/skills/django/skills/django-tdd.md +729 -0
- package/skills/django/skills/django-verification.md +469 -0
- package/skills/dotnet/agents/csharp-reviewer.md +101 -0
- package/skills/dotnet/manifest.yaml +14 -0
- package/skills/dotnet/skills/csharp-testing.md +321 -0
- package/skills/dotnet/skills/dotnet-patterns.md +321 -0
- package/skills/go/agents/code-reviewer.md +76 -0
- package/skills/go/agents/go-build-resolver.md +94 -0
- package/skills/go/agents/go-reviewer.md +76 -0
- package/skills/go/manifest.yaml +17 -0
- package/skills/go/rules/go-style.md +55 -0
- package/skills/go/skills/golang-patterns.md +674 -0
- package/skills/go/skills/golang-testing.md +720 -0
- package/skills/java/agents/java-build-resolver.md +153 -0
- package/skills/java/agents/java-reviewer.md +92 -0
- package/skills/java/manifest.yaml +18 -0
- package/skills/java/skills/java-coding-standards.md +147 -0
- package/skills/java/skills/jpa-patterns.md +151 -0
- package/skills/java/skills/springboot-patterns.md +314 -0
- package/skills/java/skills/springboot-security.md +272 -0
- package/skills/kotlin/agents/kotlin-build-resolver.md +118 -0
- package/skills/kotlin/agents/kotlin-reviewer.md +159 -0
- package/skills/kotlin/manifest.yaml +17 -0
- package/skills/kotlin/skills/kotlin-coroutines-flows.md +284 -0
- package/skills/kotlin/skills/kotlin-patterns.md +711 -0
- package/skills/kotlin/skills/kotlin-testing.md +824 -0
- package/skills/laravel/manifest.yaml +15 -0
- package/skills/laravel/skills/laravel-patterns.md +409 -0
- package/skills/laravel/skills/laravel-security.md +279 -0
- package/skills/laravel/skills/laravel-tdd.md +277 -0
- package/skills/laravel/skills/laravel-verification.md +173 -0
- package/skills/mobile/agents/dart-build-resolver.md +201 -0
- package/skills/mobile/agents/flutter-reviewer.md +243 -0
- package/skills/mobile/manifest.yaml +19 -0
- package/skills/mobile/skills/android-clean-architecture.md +339 -0
- package/skills/mobile/skills/dart-flutter-patterns.md +563 -0
- package/skills/mobile/skills/swiftui-patterns.md +259 -0
- package/skills/nestjs/manifest.yaml +13 -0
- package/skills/nestjs/skills/nestjs-patterns.md +230 -0
- package/skills/perl/manifest.yaml +13 -0
- package/skills/perl/skills/perl-patterns.md +504 -0
- package/skills/perl/skills/perl-security.md +503 -0
- package/skills/perl/skills/perl-testing.md +475 -0
- package/skills/python/agents/python-reviewer.md +98 -0
- package/skills/python/manifest.yaml +18 -0
- package/skills/python/rules/python-style.md +69 -0
- package/skills/python/skills/python-patterns/SKILL.md +441 -0
- package/skills/python/skills/python-patterns.md +90 -0
- package/skills/python/skills/python-testing.md +81 -0
- package/skills/rust/agents/rust-build-resolver.md +148 -0
- package/skills/rust/agents/rust-reviewer.md +94 -0
- package/skills/rust/manifest.yaml +16 -0
- package/skills/rust/rules/rust-style.md +107 -0
- package/skills/rust/skills/rust-patterns.md +499 -0
- package/skills/rust/skills/rust-testing.md +500 -0
- package/skills/security/agents/accessibility-auditor.md +316 -0
- package/skills/security/agents/security-reviewer.md +108 -0
- package/skills/security/manifest.yaml +19 -0
- package/skills/security/skills/red-team-tactics/SKILL.md +199 -0
- package/skills/security/skills/security-bounty-hunter.md +99 -0
- package/skills/security/skills/security-review.md +495 -0
- package/skills/security/skills/security-scan.md +165 -0
- package/skills/security/skills/vulnerability-scanner/SKILL.md +276 -0
- package/skills/security/skills/vulnerability-scanner/checklists.md +121 -0
- package/skills/security/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
- package/skills/swift/manifest.yaml +16 -0
- package/skills/swift/skills/swift-actor-persistence.md +142 -0
- package/skills/swift/skills/swift-concurrency.md +216 -0
- package/skills/swift/skills/swift-protocol-di-testing.md +190 -0
- package/skills/swift/skills/swiftui-patterns.md +259 -0
- package/skills/unity/agents/game-designer.md +167 -0
- package/skills/unity/agents/unity-architect.md +52 -0
- package/skills/unity/agents/unity-editor-tool-developer.md +310 -0
- package/skills/unity/agents/unity-multiplayer-engineer.md +321 -0
- package/skills/unity/agents/unity-shader-graph-artist.md +269 -0
- package/skills/unity/manifest.yaml +21 -0
- package/skills/unity/rules/csharp-patterns.md +48 -0
- package/skills/unity/rules/unity-specific.md +53 -0
- package/skills/unity/skills/systematic-debugging.md +92 -0
- package/skills/unity/skills/unity-architecture.md +173 -0
- package/skills/unreal/agents/level-designer.md +208 -0
- package/skills/unreal/agents/technical-artist.md +229 -0
- package/skills/unreal/agents/unreal-multiplayer-architect.md +313 -0
- package/skills/unreal/agents/unreal-systems-engineer.md +310 -0
- package/skills/unreal/agents/unreal-technical-artist.md +256 -0
- package/skills/unreal/agents/unreal-world-builder.md +273 -0
- package/skills/unreal/manifest.yaml +21 -0
- package/skills/unreal/skills/unreal-patterns.md +183 -0
- package/skills/web/agents/frontend-specialist.md +71 -0
- package/skills/web/agents/ui-designer.md +383 -0
- package/skills/web/agents/ux-architect.md +469 -0
- package/skills/web/manifest.yaml +22 -0
- package/skills/web/rules/accessibility.md +54 -0
- package/skills/web/rules/css-performance.md +52 -0
- package/skills/web/skills/e2e-testing.md +132 -0
- package/skills/web/skills/frontend-design/SKILL.md +452 -0
- package/skills/web/skills/frontend-design/animation-guide.md +331 -0
- package/skills/web/skills/frontend-design/color-system.md +311 -0
- package/skills/web/skills/frontend-design/decision-trees.md +418 -0
- package/skills/web/skills/frontend-design/motion-graphics.md +306 -0
- package/skills/web/skills/frontend-design/scripts/accessibility_checker.py +183 -0
- package/skills/web/skills/frontend-design/scripts/ux_audit.py +722 -0
- package/skills/web/skills/frontend-design/typography-system.md +345 -0
- package/skills/web/skills/frontend-design/ux-psychology.md +1116 -0
- package/skills/web/skills/frontend-design/visual-effects.md +383 -0
- package/skills/web/skills/react-nextjs.md +135 -0
- package/skills/web/skills/tailwind-patterns/SKILL.md +269 -0
- package/src/adapters/antigravity.js +164 -0
- package/src/adapters/claude.js +188 -0
- package/src/adapters/cursor.js +161 -0
- package/src/adapters/index.js +67 -0
- package/src/adapters/windsurf.js +158 -0
- package/src/commands/add.js +266 -0
- package/src/commands/create.js +127 -0
- package/src/commands/diff.js +78 -0
- package/src/commands/info.js +88 -0
- package/src/commands/init.js +224 -0
- package/src/commands/install.js +90 -0
- package/src/commands/list.js +54 -0
- package/src/commands/remove.js +101 -0
- package/src/commands/targets.js +32 -0
- package/src/commands/update.js +57 -0
- package/src/core/manifest.js +57 -0
- package/src/core/plugins.js +86 -0
- package/src/core/resolver.js +84 -0
- package/src/core/tracker.js +49 -0
- package/src/utils/fs.js +80 -0
- package/src/utils/git.js +52 -0
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: django-verification
|
|
3
|
+
description: "Verification loop for Django projects: migrations, linting, tests with coverage, security scans, and deployment readiness checks before release or PR."
|
|
4
|
+
origin: ECC
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Django Verification Loop
|
|
8
|
+
|
|
9
|
+
Run before PRs, after major changes, and pre-deploy to ensure Django application quality and security.
|
|
10
|
+
|
|
11
|
+
## When to Activate
|
|
12
|
+
|
|
13
|
+
- Before opening a pull request for a Django project
|
|
14
|
+
- After major model changes, migration updates, or dependency upgrades
|
|
15
|
+
- Pre-deployment verification for staging or production
|
|
16
|
+
- Running full environment → lint → test → security → deploy readiness pipeline
|
|
17
|
+
- Validating migration safety and test coverage
|
|
18
|
+
|
|
19
|
+
## Phase 1: Environment Check
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Verify Python version
|
|
23
|
+
python --version # Should match project requirements
|
|
24
|
+
|
|
25
|
+
# Check virtual environment
|
|
26
|
+
which python
|
|
27
|
+
pip list --outdated
|
|
28
|
+
|
|
29
|
+
# Verify environment variables
|
|
30
|
+
python -c "import os; import environ; print('DJANGO_SECRET_KEY set' if os.environ.get('DJANGO_SECRET_KEY') else 'MISSING: DJANGO_SECRET_KEY')"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
If environment is misconfigured, stop and fix.
|
|
34
|
+
|
|
35
|
+
## Phase 2: Code Quality & Formatting
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Type checking
|
|
39
|
+
mypy . --config-file pyproject.toml
|
|
40
|
+
|
|
41
|
+
# Linting with ruff
|
|
42
|
+
ruff check . --fix
|
|
43
|
+
|
|
44
|
+
# Formatting with black
|
|
45
|
+
black . --check
|
|
46
|
+
black . # Auto-fix
|
|
47
|
+
|
|
48
|
+
# Import sorting
|
|
49
|
+
isort . --check-only
|
|
50
|
+
isort . # Auto-fix
|
|
51
|
+
|
|
52
|
+
# Django-specific checks
|
|
53
|
+
python manage.py check --deploy
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Common issues:
|
|
57
|
+
- Missing type hints on public functions
|
|
58
|
+
- PEP 8 formatting violations
|
|
59
|
+
- Unsorted imports
|
|
60
|
+
- Debug settings left in production configuration
|
|
61
|
+
|
|
62
|
+
## Phase 3: Migrations
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# Check for unapplied migrations
|
|
66
|
+
python manage.py showmigrations
|
|
67
|
+
|
|
68
|
+
# Create missing migrations
|
|
69
|
+
python manage.py makemigrations --check
|
|
70
|
+
|
|
71
|
+
# Dry-run migration application
|
|
72
|
+
python manage.py migrate --plan
|
|
73
|
+
|
|
74
|
+
# Apply migrations (test environment)
|
|
75
|
+
python manage.py migrate
|
|
76
|
+
|
|
77
|
+
# Check for migration conflicts
|
|
78
|
+
python manage.py makemigrations --merge # Only if conflicts exist
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Report:
|
|
82
|
+
- Number of pending migrations
|
|
83
|
+
- Any migration conflicts
|
|
84
|
+
- Model changes without migrations
|
|
85
|
+
|
|
86
|
+
## Phase 4: Tests + Coverage
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Run all tests with pytest
|
|
90
|
+
pytest --cov=apps --cov-report=html --cov-report=term-missing --reuse-db
|
|
91
|
+
|
|
92
|
+
# Run specific app tests
|
|
93
|
+
pytest apps/users/tests/
|
|
94
|
+
|
|
95
|
+
# Run with markers
|
|
96
|
+
pytest -m "not slow" # Skip slow tests
|
|
97
|
+
pytest -m integration # Only integration tests
|
|
98
|
+
|
|
99
|
+
# Coverage report
|
|
100
|
+
open htmlcov/index.html
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Report:
|
|
104
|
+
- Total tests: X passed, Y failed, Z skipped
|
|
105
|
+
- Overall coverage: XX%
|
|
106
|
+
- Per-app coverage breakdown
|
|
107
|
+
|
|
108
|
+
Coverage targets:
|
|
109
|
+
|
|
110
|
+
| Component | Target |
|
|
111
|
+
|-----------|--------|
|
|
112
|
+
| Models | 90%+ |
|
|
113
|
+
| Serializers | 85%+ |
|
|
114
|
+
| Views | 80%+ |
|
|
115
|
+
| Services | 90%+ |
|
|
116
|
+
| Overall | 80%+ |
|
|
117
|
+
|
|
118
|
+
## Phase 5: Security Scan
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Dependency vulnerabilities
|
|
122
|
+
pip-audit
|
|
123
|
+
safety check --full-report
|
|
124
|
+
|
|
125
|
+
# Django security checks
|
|
126
|
+
python manage.py check --deploy
|
|
127
|
+
|
|
128
|
+
# Bandit security linter
|
|
129
|
+
bandit -r . -f json -o bandit-report.json
|
|
130
|
+
|
|
131
|
+
# Secret scanning (if gitleaks is installed)
|
|
132
|
+
gitleaks detect --source . --verbose
|
|
133
|
+
|
|
134
|
+
# Environment variable check
|
|
135
|
+
python -c "from django.core.exceptions import ImproperlyConfigured; from django.conf import settings; settings.DEBUG"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Report:
|
|
139
|
+
- Vulnerable dependencies found
|
|
140
|
+
- Security configuration issues
|
|
141
|
+
- Hardcoded secrets detected
|
|
142
|
+
- DEBUG mode status (should be False in production)
|
|
143
|
+
|
|
144
|
+
## Phase 6: Django Management Commands
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Check for model issues
|
|
148
|
+
python manage.py check
|
|
149
|
+
|
|
150
|
+
# Collect static files
|
|
151
|
+
python manage.py collectstatic --noinput --clear
|
|
152
|
+
|
|
153
|
+
# Create superuser (if needed for tests)
|
|
154
|
+
echo "from apps.users.models import User; User.objects.create_superuser('admin@example.com', 'admin')" | python manage.py shell
|
|
155
|
+
|
|
156
|
+
# Database integrity
|
|
157
|
+
python manage.py check --database default
|
|
158
|
+
|
|
159
|
+
# Cache verification (if using Redis)
|
|
160
|
+
python -c "from django.core.cache import cache; cache.set('test', 'value', 10); print(cache.get('test'))"
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Phase 7: Performance Checks
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Django Debug Toolbar output (check for N+1 queries)
|
|
167
|
+
# Run in dev mode with DEBUG=True and access a page
|
|
168
|
+
# Look for duplicate queries in SQL panel
|
|
169
|
+
|
|
170
|
+
# Query count analysis
|
|
171
|
+
django-admin debugsqlshell # If django-debug-sqlshell installed
|
|
172
|
+
|
|
173
|
+
# Check for missing indexes
|
|
174
|
+
python manage.py shell << EOF
|
|
175
|
+
from django.db import connection
|
|
176
|
+
with connection.cursor() as cursor:
|
|
177
|
+
cursor.execute("SELECT table_name, index_name FROM information_schema.statistics WHERE table_schema = 'public'")
|
|
178
|
+
print(cursor.fetchall())
|
|
179
|
+
EOF
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Report:
|
|
183
|
+
- Number of queries per page (should be < 50 for typical pages)
|
|
184
|
+
- Missing database indexes
|
|
185
|
+
- Duplicate queries detected
|
|
186
|
+
|
|
187
|
+
## Phase 8: Static Assets
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# Check for npm dependencies (if using npm)
|
|
191
|
+
npm audit
|
|
192
|
+
npm audit fix
|
|
193
|
+
|
|
194
|
+
# Build static files (if using webpack/vite)
|
|
195
|
+
npm run build
|
|
196
|
+
|
|
197
|
+
# Verify static files
|
|
198
|
+
ls -la staticfiles/
|
|
199
|
+
python manage.py findstatic css/style.css
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Phase 9: Configuration Review
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
# Run in Python shell to verify settings
|
|
206
|
+
python manage.py shell << EOF
|
|
207
|
+
from django.conf import settings
|
|
208
|
+
import os
|
|
209
|
+
|
|
210
|
+
# Critical checks
|
|
211
|
+
checks = {
|
|
212
|
+
'DEBUG is False': not settings.DEBUG,
|
|
213
|
+
'SECRET_KEY set': bool(settings.SECRET_KEY and len(settings.SECRET_KEY) > 30),
|
|
214
|
+
'ALLOWED_HOSTS set': len(settings.ALLOWED_HOSTS) > 0,
|
|
215
|
+
'HTTPS enabled': getattr(settings, 'SECURE_SSL_REDIRECT', False),
|
|
216
|
+
'HSTS enabled': getattr(settings, 'SECURE_HSTS_SECONDS', 0) > 0,
|
|
217
|
+
'Database configured': settings.DATABASES['default']['ENGINE'] != 'django.db.backends.sqlite3',
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
for check, result in checks.items():
|
|
221
|
+
status = '✓' if result else '✗'
|
|
222
|
+
print(f"{status} {check}")
|
|
223
|
+
EOF
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Phase 10: Logging Configuration
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
# Test logging output
|
|
230
|
+
python manage.py shell << EOF
|
|
231
|
+
import logging
|
|
232
|
+
logger = logging.getLogger('django')
|
|
233
|
+
logger.warning('Test warning message')
|
|
234
|
+
logger.error('Test error message')
|
|
235
|
+
EOF
|
|
236
|
+
|
|
237
|
+
# Check log files (if configured)
|
|
238
|
+
tail -f /var/log/django/django.log
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Phase 11: API Documentation (if DRF)
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# Generate schema
|
|
245
|
+
python manage.py generateschema --format openapi-json > schema.json
|
|
246
|
+
|
|
247
|
+
# Validate schema
|
|
248
|
+
# Check if schema.json is valid JSON
|
|
249
|
+
python -c "import json; json.load(open('schema.json'))"
|
|
250
|
+
|
|
251
|
+
# Access Swagger UI (if using drf-yasg)
|
|
252
|
+
# Visit http://localhost:8000/swagger/ in browser
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Phase 12: Diff Review
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
# Show diff statistics
|
|
259
|
+
git diff --stat
|
|
260
|
+
|
|
261
|
+
# Show actual changes
|
|
262
|
+
git diff
|
|
263
|
+
|
|
264
|
+
# Show changed files
|
|
265
|
+
git diff --name-only
|
|
266
|
+
|
|
267
|
+
# Check for common issues
|
|
268
|
+
git diff | grep -i "todo\|fixme\|hack\|xxx"
|
|
269
|
+
git diff | grep "print(" # Debug statements
|
|
270
|
+
git diff | grep "DEBUG = True" # Debug mode
|
|
271
|
+
git diff | grep "import pdb" # Debugger
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Checklist:
|
|
275
|
+
- No debugging statements (print, pdb, breakpoint())
|
|
276
|
+
- No TODO/FIXME comments in critical code
|
|
277
|
+
- No hardcoded secrets or credentials
|
|
278
|
+
- Database migrations included for model changes
|
|
279
|
+
- Configuration changes documented
|
|
280
|
+
- Error handling present for external calls
|
|
281
|
+
- Transaction management where needed
|
|
282
|
+
|
|
283
|
+
## Output Template
|
|
284
|
+
|
|
285
|
+
```
|
|
286
|
+
DJANGO VERIFICATION REPORT
|
|
287
|
+
==========================
|
|
288
|
+
|
|
289
|
+
Phase 1: Environment Check
|
|
290
|
+
✓ Python 3.11.5
|
|
291
|
+
✓ Virtual environment active
|
|
292
|
+
✓ All environment variables set
|
|
293
|
+
|
|
294
|
+
Phase 2: Code Quality
|
|
295
|
+
✓ mypy: No type errors
|
|
296
|
+
✗ ruff: 3 issues found (auto-fixed)
|
|
297
|
+
✓ black: No formatting issues
|
|
298
|
+
✓ isort: Imports properly sorted
|
|
299
|
+
✓ manage.py check: No issues
|
|
300
|
+
|
|
301
|
+
Phase 3: Migrations
|
|
302
|
+
✓ No unapplied migrations
|
|
303
|
+
✓ No migration conflicts
|
|
304
|
+
✓ All models have migrations
|
|
305
|
+
|
|
306
|
+
Phase 4: Tests + Coverage
|
|
307
|
+
Tests: 247 passed, 0 failed, 5 skipped
|
|
308
|
+
Coverage:
|
|
309
|
+
Overall: 87%
|
|
310
|
+
users: 92%
|
|
311
|
+
products: 89%
|
|
312
|
+
orders: 85%
|
|
313
|
+
payments: 91%
|
|
314
|
+
|
|
315
|
+
Phase 5: Security Scan
|
|
316
|
+
✗ pip-audit: 2 vulnerabilities found (fix required)
|
|
317
|
+
✓ safety check: No issues
|
|
318
|
+
✓ bandit: No security issues
|
|
319
|
+
✓ No secrets detected
|
|
320
|
+
✓ DEBUG = False
|
|
321
|
+
|
|
322
|
+
Phase 6: Django Commands
|
|
323
|
+
✓ collectstatic completed
|
|
324
|
+
✓ Database integrity OK
|
|
325
|
+
✓ Cache backend reachable
|
|
326
|
+
|
|
327
|
+
Phase 7: Performance
|
|
328
|
+
✓ No N+1 queries detected
|
|
329
|
+
✓ Database indexes configured
|
|
330
|
+
✓ Query count acceptable
|
|
331
|
+
|
|
332
|
+
Phase 8: Static Assets
|
|
333
|
+
✓ npm audit: No vulnerabilities
|
|
334
|
+
✓ Assets built successfully
|
|
335
|
+
✓ Static files collected
|
|
336
|
+
|
|
337
|
+
Phase 9: Configuration
|
|
338
|
+
✓ DEBUG = False
|
|
339
|
+
✓ SECRET_KEY configured
|
|
340
|
+
✓ ALLOWED_HOSTS set
|
|
341
|
+
✓ HTTPS enabled
|
|
342
|
+
✓ HSTS enabled
|
|
343
|
+
✓ Database configured
|
|
344
|
+
|
|
345
|
+
Phase 10: Logging
|
|
346
|
+
✓ Logging configured
|
|
347
|
+
✓ Log files writable
|
|
348
|
+
|
|
349
|
+
Phase 11: API Documentation
|
|
350
|
+
✓ Schema generated
|
|
351
|
+
✓ Swagger UI accessible
|
|
352
|
+
|
|
353
|
+
Phase 12: Diff Review
|
|
354
|
+
Files changed: 12
|
|
355
|
+
+450, -120 lines
|
|
356
|
+
✓ No debug statements
|
|
357
|
+
✓ No hardcoded secrets
|
|
358
|
+
✓ Migrations included
|
|
359
|
+
|
|
360
|
+
RECOMMENDATION: WARNING: Fix pip-audit vulnerabilities before deploying
|
|
361
|
+
|
|
362
|
+
NEXT STEPS:
|
|
363
|
+
1. Update vulnerable dependencies
|
|
364
|
+
2. Re-run security scan
|
|
365
|
+
3. Deploy to staging for final testing
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
## Pre-Deployment Checklist
|
|
369
|
+
|
|
370
|
+
- [ ] All tests passing
|
|
371
|
+
- [ ] Coverage ≥ 80%
|
|
372
|
+
- [ ] No security vulnerabilities
|
|
373
|
+
- [ ] No unapplied migrations
|
|
374
|
+
- [ ] DEBUG = False in production settings
|
|
375
|
+
- [ ] SECRET_KEY properly configured
|
|
376
|
+
- [ ] ALLOWED_HOSTS set correctly
|
|
377
|
+
- [ ] Database backups enabled
|
|
378
|
+
- [ ] Static files collected and served
|
|
379
|
+
- [ ] Logging configured and working
|
|
380
|
+
- [ ] Error monitoring (Sentry, etc.) configured
|
|
381
|
+
- [ ] CDN configured (if applicable)
|
|
382
|
+
- [ ] Redis/cache backend configured
|
|
383
|
+
- [ ] Celery workers running (if applicable)
|
|
384
|
+
- [ ] HTTPS/SSL configured
|
|
385
|
+
- [ ] Environment variables documented
|
|
386
|
+
|
|
387
|
+
## Continuous Integration
|
|
388
|
+
|
|
389
|
+
### GitHub Actions Example
|
|
390
|
+
|
|
391
|
+
```yaml
|
|
392
|
+
# .github/workflows/django-verification.yml
|
|
393
|
+
name: Django Verification
|
|
394
|
+
|
|
395
|
+
on: [push, pull_request]
|
|
396
|
+
|
|
397
|
+
jobs:
|
|
398
|
+
verify:
|
|
399
|
+
runs-on: ubuntu-latest
|
|
400
|
+
services:
|
|
401
|
+
postgres:
|
|
402
|
+
image: postgres:14
|
|
403
|
+
env:
|
|
404
|
+
POSTGRES_PASSWORD: postgres
|
|
405
|
+
options: >-
|
|
406
|
+
--health-cmd pg_isready
|
|
407
|
+
--health-interval 10s
|
|
408
|
+
--health-timeout 5s
|
|
409
|
+
--health-retries 5
|
|
410
|
+
|
|
411
|
+
steps:
|
|
412
|
+
- uses: actions/checkout@v3
|
|
413
|
+
|
|
414
|
+
- name: Set up Python
|
|
415
|
+
uses: actions/setup-python@v4
|
|
416
|
+
with:
|
|
417
|
+
python-version: '3.11'
|
|
418
|
+
|
|
419
|
+
- name: Cache pip
|
|
420
|
+
uses: actions/cache@v3
|
|
421
|
+
with:
|
|
422
|
+
path: ~/.cache/pip
|
|
423
|
+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
|
424
|
+
|
|
425
|
+
- name: Install dependencies
|
|
426
|
+
run: |
|
|
427
|
+
pip install -r requirements.txt
|
|
428
|
+
pip install ruff black mypy pytest pytest-django pytest-cov bandit safety pip-audit
|
|
429
|
+
|
|
430
|
+
- name: Code quality checks
|
|
431
|
+
run: |
|
|
432
|
+
ruff check .
|
|
433
|
+
black . --check
|
|
434
|
+
isort . --check-only
|
|
435
|
+
mypy .
|
|
436
|
+
|
|
437
|
+
- name: Security scan
|
|
438
|
+
run: |
|
|
439
|
+
bandit -r . -f json -o bandit-report.json
|
|
440
|
+
safety check --full-report
|
|
441
|
+
pip-audit
|
|
442
|
+
|
|
443
|
+
- name: Run tests
|
|
444
|
+
env:
|
|
445
|
+
DATABASE_URL: postgres://postgres:postgres@localhost:5432/test
|
|
446
|
+
DJANGO_SECRET_KEY: test-secret-key
|
|
447
|
+
run: |
|
|
448
|
+
pytest --cov=apps --cov-report=xml --cov-report=term-missing
|
|
449
|
+
|
|
450
|
+
- name: Upload coverage
|
|
451
|
+
uses: codecov/codecov-action@v3
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
## Quick Reference
|
|
455
|
+
|
|
456
|
+
| Check | Command |
|
|
457
|
+
|-------|---------|
|
|
458
|
+
| Environment | `python --version` |
|
|
459
|
+
| Type checking | `mypy .` |
|
|
460
|
+
| Linting | `ruff check .` |
|
|
461
|
+
| Formatting | `black . --check` |
|
|
462
|
+
| Migrations | `python manage.py makemigrations --check` |
|
|
463
|
+
| Tests | `pytest --cov=apps` |
|
|
464
|
+
| Security | `pip-audit && bandit -r .` |
|
|
465
|
+
| Django check | `python manage.py check --deploy` |
|
|
466
|
+
| Collectstatic | `python manage.py collectstatic --noinput` |
|
|
467
|
+
| Diff stats | `git diff --stat` |
|
|
468
|
+
|
|
469
|
+
Remember: Automated verification catches common issues but doesn't replace manual code review and testing in staging environment.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: csharp-reviewer
|
|
3
|
+
description: Expert C# code reviewer specializing in .NET conventions, async patterns, security, nullable reference types, and performance. Use for all C# code changes. MUST BE USED for C# projects.
|
|
4
|
+
tools: ["Read", "Grep", "Glob", "Bash"]
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are a senior C# code reviewer ensuring high standards of idiomatic .NET code and best practices.
|
|
9
|
+
|
|
10
|
+
When invoked:
|
|
11
|
+
1. Run `git diff -- '*.cs'` to see recent C# file changes
|
|
12
|
+
2. Run `dotnet build` and `dotnet format --verify-no-changes` if available
|
|
13
|
+
3. Focus on modified `.cs` files
|
|
14
|
+
4. Begin review immediately
|
|
15
|
+
|
|
16
|
+
## Review Priorities
|
|
17
|
+
|
|
18
|
+
### CRITICAL — Security
|
|
19
|
+
- **SQL Injection**: String concatenation/interpolation in queries — use parameterized queries or EF Core
|
|
20
|
+
- **Command Injection**: Unvalidated input in `Process.Start` — validate and sanitize
|
|
21
|
+
- **Path Traversal**: User-controlled file paths — use `Path.GetFullPath` + prefix check
|
|
22
|
+
- **Insecure Deserialization**: `BinaryFormatter`, `JsonSerializer` with `TypeNameHandling.All`
|
|
23
|
+
- **Hardcoded secrets**: API keys, connection strings in source — use configuration/secret manager
|
|
24
|
+
- **CSRF/XSS**: Missing `[ValidateAntiForgeryToken]`, unencoded output in Razor
|
|
25
|
+
|
|
26
|
+
### CRITICAL — Error Handling
|
|
27
|
+
- **Empty catch blocks**: `catch { }` or `catch (Exception) { }` — handle or rethrow
|
|
28
|
+
- **Swallowed exceptions**: `catch { return null; }` — log context, throw specific
|
|
29
|
+
- **Missing `using`/`await using`**: Manual disposal of `IDisposable`/`IAsyncDisposable`
|
|
30
|
+
- **Blocking async**: `.Result`, `.Wait()`, `.GetAwaiter().GetResult()` — use `await`
|
|
31
|
+
|
|
32
|
+
### HIGH — Async Patterns
|
|
33
|
+
- **Missing CancellationToken**: Public async APIs without cancellation support
|
|
34
|
+
- **Fire-and-forget**: `async void` except event handlers — return `Task`
|
|
35
|
+
- **ConfigureAwait misuse**: Library code missing `ConfigureAwait(false)`
|
|
36
|
+
- **Sync-over-async**: Blocking calls in async context causing deadlocks
|
|
37
|
+
|
|
38
|
+
### HIGH — Type Safety
|
|
39
|
+
- **Nullable reference types**: Nullable warnings ignored or suppressed with `!`
|
|
40
|
+
- **Unsafe casts**: `(T)obj` without type check — use `obj is T t` or `obj as T`
|
|
41
|
+
- **Raw strings as identifiers**: Magic strings for config keys, routes — use constants or `nameof`
|
|
42
|
+
- **`dynamic` usage**: Avoid `dynamic` in application code — use generics or explicit models
|
|
43
|
+
|
|
44
|
+
### HIGH — Code Quality
|
|
45
|
+
- **Large methods**: Over 50 lines — extract helper methods
|
|
46
|
+
- **Deep nesting**: More than 4 levels — use early returns, guard clauses
|
|
47
|
+
- **God classes**: Classes with too many responsibilities — apply SRP
|
|
48
|
+
- **Mutable shared state**: Static mutable fields — use `ConcurrentDictionary`, `Interlocked`, or DI scoping
|
|
49
|
+
|
|
50
|
+
### MEDIUM — Performance
|
|
51
|
+
- **String concatenation in loops**: Use `StringBuilder` or `string.Join`
|
|
52
|
+
- **LINQ in hot paths**: Excessive allocations — consider `for` loops with pre-allocated buffers
|
|
53
|
+
- **N+1 queries**: EF Core lazy loading in loops — use `Include`/`ThenInclude`
|
|
54
|
+
- **Missing `AsNoTracking`**: Read-only queries tracking entities unnecessarily
|
|
55
|
+
|
|
56
|
+
### MEDIUM — Best Practices
|
|
57
|
+
- **Naming conventions**: PascalCase for public members, `_camelCase` for private fields
|
|
58
|
+
- **Record vs class**: Value-like immutable models should be `record` or `record struct`
|
|
59
|
+
- **Dependency injection**: `new`-ing services instead of injecting — use constructor injection
|
|
60
|
+
- **`IEnumerable` multiple enumeration**: Materialize with `.ToList()` when enumerated more than once
|
|
61
|
+
- **Missing `sealed`**: Non-inherited classes should be `sealed` for clarity and performance
|
|
62
|
+
|
|
63
|
+
## Diagnostic Commands
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
dotnet build # Compilation check
|
|
67
|
+
dotnet format --verify-no-changes # Format check
|
|
68
|
+
dotnet test --no-build # Run tests
|
|
69
|
+
dotnet test --collect:"XPlat Code Coverage" # Coverage
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Review Output Format
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
[SEVERITY] Issue title
|
|
76
|
+
File: path/to/File.cs:42
|
|
77
|
+
Issue: Description
|
|
78
|
+
Fix: What to change
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Approval Criteria
|
|
82
|
+
|
|
83
|
+
- **Approve**: No CRITICAL or HIGH issues
|
|
84
|
+
- **Warning**: MEDIUM issues only (can merge with caution)
|
|
85
|
+
- **Block**: CRITICAL or HIGH issues found
|
|
86
|
+
|
|
87
|
+
## Framework Checks
|
|
88
|
+
|
|
89
|
+
- **ASP.NET Core**: Model validation, auth policies, middleware order, `IOptions<T>` pattern
|
|
90
|
+
- **EF Core**: Migration safety, `Include` for eager loading, `AsNoTracking` for reads
|
|
91
|
+
- **Minimal APIs**: Route grouping, endpoint filters, proper `TypedResults`
|
|
92
|
+
- **Blazor**: Component lifecycle, `StateHasChanged` usage, JS interop disposal
|
|
93
|
+
|
|
94
|
+
## Reference
|
|
95
|
+
|
|
96
|
+
For detailed C# patterns, see skill: `dotnet-patterns`.
|
|
97
|
+
For testing guidelines, see skill: `csharp-testing`.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
Review with the mindset: "Would this code pass review at a top .NET shop or open-source project?"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
name: dotnet
|
|
2
|
+
version: 0.1.0
|
|
3
|
+
description: Idiomatic C# and .NET patterns, testing with xUnit, and expert code review for building robust, maintainable .NET applications.
|
|
4
|
+
depends:
|
|
5
|
+
- common
|
|
6
|
+
tags:
|
|
7
|
+
- csharp
|
|
8
|
+
- dotnet
|
|
9
|
+
rules: []
|
|
10
|
+
skills:
|
|
11
|
+
- skills/dotnet-patterns.md
|
|
12
|
+
- skills/csharp-testing.md
|
|
13
|
+
agents:
|
|
14
|
+
- agents/csharp-reviewer.md
|