cc-codeconductor 0.4.3 → 0.5.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/README.md +1 -1
- package/dist/index.js +2642 -226
- package/package.json +1 -1
- package/presets/agy/skills/evaluation/SKILL.md +6 -0
- package/presets/agy/skills/openspec/SKILL.md +32 -0
- package/presets/agy/workflows/cc-openspec.md +62 -0
- package/presets/agy/workflows/cc-scorecard.md +17 -0
- package/presets/claude/commands/cc/openspec.md +144 -0
- package/presets/claude/commands/cc/review.md +13 -2
- package/presets/claude/commands/cc/scorecard.md +65 -0
- package/presets/claude/skills/evaluation/SKILL.md +42 -0
- package/presets/claude/skills/openspec/SKILL.md +54 -0
- package/presets/codex/AGENTS.md +57 -0
- package/presets/cursor/.cursorignore +15 -0
- package/presets/cursor/AGENTS.md +504 -0
- package/presets/cursor/agents/architect.md +211 -0
- package/presets/cursor/agents/complexity-auditor.md +76 -0
- package/presets/cursor/agents/contract-builder.md +75 -0
- package/presets/cursor/agents/docs.md +180 -0
- package/presets/cursor/agents/goal-planner.md +71 -0
- package/presets/cursor/agents/implementer.md +161 -0
- package/presets/cursor/agents/orchestrator.md +377 -0
- package/presets/cursor/agents/repo-explorer.md +100 -0
- package/presets/cursor/agents/reviewer.md +237 -0
- package/presets/cursor/agents/security-reviewer.md +113 -0
- package/presets/cursor/agents/task-coach.md +145 -0
- package/presets/cursor/agents/tester.md +241 -0
- package/presets/cursor/commands/cc/api-contract.md +58 -0
- package/presets/cursor/commands/cc/db-migration.md +58 -0
- package/presets/cursor/commands/cc/feature.md +115 -0
- package/presets/cursor/commands/cc/fix.md +121 -0
- package/presets/cursor/commands/cc/openspec.md +144 -0
- package/presets/cursor/commands/cc/pagespeed.md +103 -0
- package/presets/cursor/commands/cc/refactor.md +148 -0
- package/presets/cursor/commands/cc/review.md +137 -0
- package/presets/cursor/commands/cc/scorecard.md +65 -0
- package/presets/cursor/commands/cc/tdd-cycle.md +226 -0
- package/presets/cursor/commands/cc/test-plan.md +138 -0
- package/presets/cursor/rules/behavioral-discipline.mdc +14 -0
- package/presets/cursor/rules/context-budget.mdc +12 -0
- package/presets/cursor/rules/orchestration.mdc +12 -0
- package/presets/cursor/rules/yagni-stdlib.mdc +11 -0
- package/presets/cursor/skills/android/SKILL.md +122 -0
- package/presets/cursor/skills/api-versioning/SKILL.md +394 -0
- package/presets/cursor/skills/astro/SKILL.md +322 -0
- package/presets/cursor/skills/auth-token-inspector/SKILL.md +33 -0
- package/presets/cursor/skills/code-review/SKILL.md +208 -0
- package/presets/cursor/skills/conductor-setup/SKILL.md +127 -0
- package/presets/cursor/skills/django-orm/SKILL.md +463 -0
- package/presets/cursor/skills/django-testing/SKILL.md +417 -0
- package/presets/cursor/skills/django-uv/SKILL.md +409 -0
- package/presets/cursor/skills/drizzle-schema-architect/SKILL.md +54 -0
- package/presets/cursor/skills/evaluation/SKILL.md +8 -0
- package/presets/cursor/skills/fastapi-pydantic-strict/SKILL.md +46 -0
- package/presets/cursor/skills/find-skills/SKILL.md +144 -0
- package/presets/cursor/skills/jpa-nplusone-detector/SKILL.md +49 -0
- package/presets/cursor/skills/jpa-postgres/SKILL.md +626 -0
- package/presets/cursor/skills/laravel-specialist/SKILL.md +267 -0
- package/presets/cursor/skills/laravel-specialist/references/eloquent.md +351 -0
- package/presets/cursor/skills/laravel-specialist/references/livewire.md +512 -0
- package/presets/cursor/skills/laravel-specialist/references/queues.md +423 -0
- package/presets/cursor/skills/laravel-specialist/references/routing.md +362 -0
- package/presets/cursor/skills/laravel-specialist/references/testing.md +522 -0
- package/presets/cursor/skills/livewire-alpine-bridge/SKILL.md +39 -0
- package/presets/cursor/skills/multi-agent-orchestration/README.md +144 -0
- package/presets/cursor/skills/multi-agent-orchestration/SKILL.md +579 -0
- package/presets/cursor/skills/multi-agent-orchestration/examples/framework_implementations.py +362 -0
- package/presets/cursor/skills/multi-agent-orchestration/examples/orchestration_patterns.py +411 -0
- package/presets/cursor/skills/multi-agent-orchestration/scripts/agent_communication.py +334 -0
- package/presets/cursor/skills/multi-agent-orchestration/scripts/benchmarking.py +341 -0
- package/presets/cursor/skills/multi-agent-orchestration/scripts/workflow_management.py +334 -0
- package/presets/cursor/skills/nextjs-typescript/SKILL.md +394 -0
- package/presets/cursor/skills/openspec/SKILL.md +52 -0
- package/presets/cursor/skills/pagespeed-insights/SKILL.md +445 -0
- package/presets/cursor/skills/pagespeed-insights/reference.md +50 -0
- package/presets/cursor/skills/pagespeed-perf/SKILL.md +281 -0
- package/presets/cursor/skills/php-pro/SKILL.md +210 -0
- package/presets/cursor/skills/php-pro/references/async-patterns.md +412 -0
- package/presets/cursor/skills/php-pro/references/laravel-patterns.md +377 -0
- package/presets/cursor/skills/php-pro/references/modern-php-features.md +323 -0
- package/presets/cursor/skills/php-pro/references/symfony-patterns.md +466 -0
- package/presets/cursor/skills/php-pro/references/testing-quality.md +466 -0
- package/presets/cursor/skills/python/SKILL.md +613 -0
- package/presets/cursor/skills/python-django-stack/SKILL.md +500 -0
- package/presets/cursor/skills/python-fastapi-stack/SKILL.md +464 -0
- package/presets/cursor/skills/security/SKILL.md +384 -0
- package/presets/cursor/skills/seo-analytics-injector/SKILL.md +44 -0
- package/presets/cursor/skills/spring-auth-auditor/SKILL.md +33 -0
- package/presets/cursor/skills/spring-boot-feature/SKILL.md +566 -0
- package/presets/cursor/skills/spring-boot-kotlin/SKILL.md +408 -0
- package/presets/cursor/skills/spring-boot-testing-strategy/SKILL.md +479 -0
- package/presets/cursor/skills/sqlalchemy/SKILL.md +473 -0
- package/presets/cursor/skills/tailwind-responsive-auditor/SKILL.md +32 -0
- package/presets/cursor/skills/tdd-mutation-tester/SKILL.md +28 -0
- package/presets/cursor/skills/testing-tdd/SKILL.md +592 -0
- package/presets/cursor/skills/workflow-orchestration-patterns/SKILL.md +98 -0
- package/presets/cursor/skills/workflow-orchestration-patterns/references/details.md +223 -0
- package/presets/opencode/agents/architect.md +1 -2
- package/presets/opencode/agents/complexity-auditor.md +1 -0
- package/presets/opencode/agents/contract-builder.md +93 -0
- package/presets/opencode/agents/docs.md +1 -2
- package/presets/opencode/agents/goal-planner.md +82 -0
- package/presets/opencode/agents/implementer.md +9 -2
- package/presets/opencode/agents/orchestrator.md +50 -12
- package/presets/opencode/agents/repo-explorer.md +0 -1
- package/presets/opencode/agents/reviewer.md +23 -2
- package/presets/opencode/agents/security-reviewer.md +129 -0
- package/presets/opencode/agents/task-coach.md +1 -2
- package/presets/opencode/agents/tester.md +1 -2
- package/presets/opencode/commands/cc-openspec.md +61 -0
- package/presets/opencode/commands/cc-scorecard.md +16 -0
- package/presets/opencode/prompts/v0.5.0/architect.md +222 -0
- package/presets/opencode/prompts/v0.5.0/complexity-auditor.md +91 -0
- package/presets/opencode/prompts/v0.5.0/contract-builder.md +84 -0
- package/presets/opencode/prompts/v0.5.0/docs.md +190 -0
- package/presets/opencode/prompts/v0.5.0/goal-planner.md +80 -0
- package/presets/opencode/prompts/v0.5.0/implementer.md +171 -0
- package/presets/opencode/prompts/v0.5.0/orchestrator.md +388 -0
- package/presets/opencode/prompts/v0.5.0/repo-explorer.md +111 -0
- package/presets/opencode/prompts/v0.5.0/reviewer.md +248 -0
- package/presets/opencode/prompts/v0.5.0/security-reviewer.md +123 -0
- package/presets/opencode/prompts/v0.5.0/task-coach.md +156 -0
- package/presets/opencode/prompts/v0.5.0/tester.md +252 -0
- package/presets/opencode/skills/evaluation/SKILL.md +6 -0
- package/presets/opencode/skills/openspec/SKILL.md +50 -0
- package/presets/templates/BACKLOG.md +33 -0
- package/presets/templates/execution-profile.yml +6 -0
- package/presets/templates/model-comparison.md +11 -0
- package/presets/templates/regression-checklist.yml +10 -0
- package/src/presets/manifests/agy.yml +2 -2
- package/src/presets/manifests/claude.yml +2 -2
- package/src/presets/manifests/codex.yml +2 -2
- package/src/presets/manifests/cursor.yml +19 -3
- package/src/presets/manifests/gemini.yml +2 -2
- package/src/presets/manifests/opencode.yml +2 -2
- package/src/presets/models/agy.yml +21 -0
- package/src/presets/models/claude.yml +18 -0
- package/src/presets/models/codex.yml +18 -0
- package/src/presets/models/cursor.yml +39 -9
- package/src/presets/models/gemini.yml +18 -0
- package/src/presets/models/opencode.yml +18 -0
|
@@ -0,0 +1,409 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: django-uv
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
name: Django + UV
|
|
5
|
+
description: >
|
|
6
|
+
Provides expert knowledge for building Django 5+ projects with UV as the package manager, domain-driven app structure, ruff for linting, and pytest-django for testing.
|
|
7
|
+
|
|
8
|
+
user-invokable: true
|
|
9
|
+
license: MIT
|
|
10
|
+
metadata:
|
|
11
|
+
author: lgzarturo
|
|
12
|
+
category: django
|
|
13
|
+
|
|
14
|
+
compatibility:
|
|
15
|
+
tools: [claude, codex, gemini, agy, opencode]
|
|
16
|
+
stacks:
|
|
17
|
+
languages: []
|
|
18
|
+
frameworks: []
|
|
19
|
+
|
|
20
|
+
risk:
|
|
21
|
+
level: medium
|
|
22
|
+
can_execute_shell: false
|
|
23
|
+
can_modify_files: true
|
|
24
|
+
requires_network: false
|
|
25
|
+
|
|
26
|
+
inputs: []
|
|
27
|
+
|
|
28
|
+
outputs: []
|
|
29
|
+
|
|
30
|
+
quality:
|
|
31
|
+
reviewed_by: codeconductor-core
|
|
32
|
+
version: 0.1.0
|
|
33
|
+
paths:
|
|
34
|
+
- "**/pyproject.toml"
|
|
35
|
+
- "**/uv.lock"
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
# Django + UV
|
|
41
|
+
|
|
42
|
+
## Project Setup with UV
|
|
43
|
+
|
|
44
|
+
UV replaces pip, pip-tools, virtualenv, and pyenv in a single binary. Always
|
|
45
|
+
use UV for dependency management.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Create project
|
|
49
|
+
uv init my-project
|
|
50
|
+
cd my-project
|
|
51
|
+
|
|
52
|
+
# Add Django and dependencies
|
|
53
|
+
uv add django psycopg[binary] djangorestframework django-environ
|
|
54
|
+
|
|
55
|
+
# Add dev dependencies
|
|
56
|
+
uv add --dev pytest pytest-django ruff factory-boy coverage
|
|
57
|
+
|
|
58
|
+
# Run management commands
|
|
59
|
+
uv run python manage.py migrate
|
|
60
|
+
uv run python manage.py runserver
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### pyproject.toml Layout
|
|
64
|
+
|
|
65
|
+
```toml
|
|
66
|
+
[project]
|
|
67
|
+
name = "my-project"
|
|
68
|
+
version = "0.1.0"
|
|
69
|
+
requires-python = ">=3.12"
|
|
70
|
+
dependencies = [
|
|
71
|
+
"django>=5.0",
|
|
72
|
+
"psycopg[binary]>=3.1",
|
|
73
|
+
"djangorestframework>=3.15",
|
|
74
|
+
"django-environ>=0.11",
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
[project.optional-dependencies]
|
|
78
|
+
dev = [
|
|
79
|
+
"pytest>=8.0",
|
|
80
|
+
"pytest-django>=4.8",
|
|
81
|
+
"ruff>=0.4",
|
|
82
|
+
"factory-boy>=3.3",
|
|
83
|
+
"coverage>=7.4",
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
[tool.ruff]
|
|
87
|
+
line-length = 88
|
|
88
|
+
target-version = "py312"
|
|
89
|
+
|
|
90
|
+
[tool.ruff.lint]
|
|
91
|
+
select = ["E", "F", "I", "N", "UP", "B", "SIM"]
|
|
92
|
+
ignore = ["E501"]
|
|
93
|
+
|
|
94
|
+
[tool.pytest.ini_options]
|
|
95
|
+
DJANGO_SETTINGS_MODULE = "config.settings.test"
|
|
96
|
+
python_files = ["test_*.py", "*_test.py"]
|
|
97
|
+
python_classes = ["Test*"]
|
|
98
|
+
python_functions = ["test_*"]
|
|
99
|
+
|
|
100
|
+
[tool.coverage.run]
|
|
101
|
+
source = ["."]
|
|
102
|
+
omit = ["*/migrations/*", "*/tests/*", "manage.py"]
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## App Structure (Domain-Driven)
|
|
106
|
+
|
|
107
|
+
Organize by domain, not by technical layer. Each Django app owns its domain
|
|
108
|
+
entirely.
|
|
109
|
+
|
|
110
|
+
```text
|
|
111
|
+
my_project/
|
|
112
|
+
config/
|
|
113
|
+
settings/
|
|
114
|
+
base.py — shared settings
|
|
115
|
+
dev.py — local overrides
|
|
116
|
+
test.py — test-specific settings
|
|
117
|
+
prod.py — production settings
|
|
118
|
+
urls.py
|
|
119
|
+
wsgi.py
|
|
120
|
+
apps/
|
|
121
|
+
users/
|
|
122
|
+
models.py
|
|
123
|
+
services.py — business logic, never in views
|
|
124
|
+
views.py — thin; delegates to services
|
|
125
|
+
serializers.py
|
|
126
|
+
admin.py
|
|
127
|
+
urls.py
|
|
128
|
+
tests/
|
|
129
|
+
test_models.py
|
|
130
|
+
test_services.py
|
|
131
|
+
test_views.py
|
|
132
|
+
factories.py
|
|
133
|
+
orders/
|
|
134
|
+
...
|
|
135
|
+
manage.py
|
|
136
|
+
pyproject.toml
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Settings Split
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
# config/settings/base.py
|
|
143
|
+
from pathlib import Path
|
|
144
|
+
import environ
|
|
145
|
+
|
|
146
|
+
env = environ.Env()
|
|
147
|
+
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
|
148
|
+
|
|
149
|
+
SECRET_KEY = env("SECRET_KEY")
|
|
150
|
+
DEBUG = env.bool("DEBUG", default=False)
|
|
151
|
+
|
|
152
|
+
INSTALLED_APPS = [
|
|
153
|
+
"django.contrib.admin",
|
|
154
|
+
"django.contrib.auth",
|
|
155
|
+
"django.contrib.contenttypes",
|
|
156
|
+
"rest_framework",
|
|
157
|
+
"apps.users",
|
|
158
|
+
"apps.orders",
|
|
159
|
+
]
|
|
160
|
+
|
|
161
|
+
DATABASES = {
|
|
162
|
+
"default": env.db("DATABASE_URL")
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
# config/settings/test.py
|
|
168
|
+
from .base import * # noqa: F403
|
|
169
|
+
|
|
170
|
+
DATABASES = {
|
|
171
|
+
"default": {
|
|
172
|
+
"ENGINE": "django.db.backends.sqlite3",
|
|
173
|
+
"NAME": ":memory:",
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
# Never send real emails in tests
|
|
178
|
+
EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend"
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Models
|
|
182
|
+
|
|
183
|
+
```python
|
|
184
|
+
# apps/users/models.py
|
|
185
|
+
import uuid
|
|
186
|
+
from django.db import models
|
|
187
|
+
from django.contrib.auth.models import AbstractUser
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class User(AbstractUser):
|
|
191
|
+
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
|
192
|
+
email = models.EmailField(unique=True)
|
|
193
|
+
bio = models.TextField(blank=True)
|
|
194
|
+
created_at = models.DateTimeField(auto_now_add=True)
|
|
195
|
+
updated_at = models.DateTimeField(auto_now=True)
|
|
196
|
+
|
|
197
|
+
USERNAME_FIELD = "email"
|
|
198
|
+
REQUIRED_FIELDS = ["username"]
|
|
199
|
+
|
|
200
|
+
class Meta:
|
|
201
|
+
ordering = ["-created_at"]
|
|
202
|
+
|
|
203
|
+
def __str__(self) -> str:
|
|
204
|
+
return self.email
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Rules:
|
|
208
|
+
|
|
209
|
+
- Use UUID primary keys — never expose sequential integer IDs in public APIs
|
|
210
|
+
- `auto_now_add` and `auto_now` for timestamps — never set manually
|
|
211
|
+
- Always define `__str__` — it appears in admin and error messages
|
|
212
|
+
- Use `blank=True` for optional strings (form validation), `null=True` only for
|
|
213
|
+
nullable FK/non-string fields
|
|
214
|
+
|
|
215
|
+
## Service Layer
|
|
216
|
+
|
|
217
|
+
Business logic lives in `services.py`. Views are thin HTTP adapters.
|
|
218
|
+
|
|
219
|
+
```python
|
|
220
|
+
# apps/users/services.py
|
|
221
|
+
from django.db import transaction
|
|
222
|
+
from django.contrib.auth.hashers import make_password
|
|
223
|
+
from .models import User
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
class UserService:
|
|
227
|
+
|
|
228
|
+
@staticmethod
|
|
229
|
+
def create_user(*, email: str, password: str, username: str) -> User:
|
|
230
|
+
if User.objects.filter(email=email).exists():
|
|
231
|
+
raise ValueError(f"Email {email!r} is already registered")
|
|
232
|
+
|
|
233
|
+
with transaction.atomic():
|
|
234
|
+
user = User.objects.create(
|
|
235
|
+
email=email,
|
|
236
|
+
username=username,
|
|
237
|
+
password=make_password(password),
|
|
238
|
+
)
|
|
239
|
+
return user
|
|
240
|
+
|
|
241
|
+
@staticmethod
|
|
242
|
+
def deactivate_user(*, user_id: str) -> User:
|
|
243
|
+
user = User.objects.get(id=user_id)
|
|
244
|
+
user.is_active = False
|
|
245
|
+
user.save(update_fields=["is_active", "updated_at"])
|
|
246
|
+
return user
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Rules:
|
|
250
|
+
|
|
251
|
+
- Use keyword-only arguments (`*` separator) in service methods — prevents
|
|
252
|
+
positional argument confusion
|
|
253
|
+
- Use `update_fields` in `save()` — avoids overwriting unintended fields and
|
|
254
|
+
reduces the UPDATE query scope
|
|
255
|
+
- Wrap multi-step writes in `transaction.atomic()`
|
|
256
|
+
- Never import from `views.py` in `services.py` — keep the dependency direction
|
|
257
|
+
strict: views → services → models
|
|
258
|
+
|
|
259
|
+
## Views (DRF)
|
|
260
|
+
|
|
261
|
+
```python
|
|
262
|
+
# apps/users/views.py
|
|
263
|
+
from rest_framework import status
|
|
264
|
+
from rest_framework.decorators import api_view, permission_classes
|
|
265
|
+
from rest_framework.permissions import IsAuthenticated
|
|
266
|
+
from rest_framework.request import Request
|
|
267
|
+
from rest_framework.response import Response
|
|
268
|
+
|
|
269
|
+
from .serializers import CreateUserSerializer, UserSerializer
|
|
270
|
+
from .services import UserService
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
@api_view(["POST"])
|
|
274
|
+
def create_user(request: Request) -> Response:
|
|
275
|
+
serializer = CreateUserSerializer(data=request.data)
|
|
276
|
+
serializer.is_valid(raise_exception=True)
|
|
277
|
+
|
|
278
|
+
user = UserService.create_user(**serializer.validated_data)
|
|
279
|
+
return Response(UserSerializer(user).data, status=status.HTTP_201_CREATED)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
@api_view(["DELETE"])
|
|
283
|
+
@permission_classes([IsAuthenticated])
|
|
284
|
+
def deactivate_user(request: Request, user_id: str) -> Response:
|
|
285
|
+
UserService.deactivate_user(user_id=user_id)
|
|
286
|
+
return Response(status=status.HTTP_204_NO_CONTENT)
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## Testing with pytest-django
|
|
290
|
+
|
|
291
|
+
### Test Factories
|
|
292
|
+
|
|
293
|
+
```python
|
|
294
|
+
# apps/users/tests/factories.py
|
|
295
|
+
import factory
|
|
296
|
+
from factory.django import DjangoModelFactory
|
|
297
|
+
from apps.users.models import User
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
class UserFactory(DjangoModelFactory):
|
|
301
|
+
class Meta:
|
|
302
|
+
model = User
|
|
303
|
+
|
|
304
|
+
email = factory.Sequence(lambda n: f"user{n}@example.com")
|
|
305
|
+
username = factory.Sequence(lambda n: f"user{n}")
|
|
306
|
+
password = factory.PostGenerationMethodCall("set_password", "testpass123")
|
|
307
|
+
is_active = True
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Service Tests
|
|
311
|
+
|
|
312
|
+
```python
|
|
313
|
+
# apps/users/tests/test_services.py
|
|
314
|
+
import pytest
|
|
315
|
+
from apps.users.services import UserService
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
@pytest.mark.django_db
|
|
319
|
+
class TestUserService:
|
|
320
|
+
|
|
321
|
+
def test_create_user_succeeds_with_valid_data(self):
|
|
322
|
+
user = UserService.create_user(
|
|
323
|
+
email="new@example.com",
|
|
324
|
+
password="secure123",
|
|
325
|
+
username="newuser",
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
assert user.pk is not None
|
|
329
|
+
assert user.email == "new@example.com"
|
|
330
|
+
assert user.check_password("secure123")
|
|
331
|
+
|
|
332
|
+
def test_create_user_raises_when_email_exists(self, user_factory):
|
|
333
|
+
existing = user_factory(email="taken@example.com")
|
|
334
|
+
|
|
335
|
+
with pytest.raises(ValueError, match="already registered"):
|
|
336
|
+
UserService.create_user(
|
|
337
|
+
email=existing.email,
|
|
338
|
+
password="any",
|
|
339
|
+
username="other",
|
|
340
|
+
)
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### View Tests
|
|
344
|
+
|
|
345
|
+
```python
|
|
346
|
+
# apps/users/tests/test_views.py
|
|
347
|
+
import pytest
|
|
348
|
+
from django.urls import reverse
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
@pytest.mark.django_db
|
|
352
|
+
class TestCreateUser:
|
|
353
|
+
|
|
354
|
+
def test_returns_201_with_valid_payload(self, client):
|
|
355
|
+
response = client.post(
|
|
356
|
+
reverse("users:create"),
|
|
357
|
+
data={"email": "new@example.com", "password": "secure123", "username": "new"},
|
|
358
|
+
content_type="application/json",
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
assert response.status_code == 201
|
|
362
|
+
assert response.data["email"] == "new@example.com"
|
|
363
|
+
|
|
364
|
+
def test_returns_400_with_invalid_email(self, client):
|
|
365
|
+
response = client.post(
|
|
366
|
+
reverse("users:create"),
|
|
367
|
+
data={"email": "not-an-email", "password": "x", "username": "y"},
|
|
368
|
+
content_type="application/json",
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
assert response.status_code == 400
|
|
372
|
+
|
|
373
|
+
def test_returns_400_when_email_already_exists(self, client, user_factory):
|
|
374
|
+
user_factory(email="taken@example.com")
|
|
375
|
+
|
|
376
|
+
response = client.post(
|
|
377
|
+
reverse("users:create"),
|
|
378
|
+
data={"email": "taken@example.com", "password": "pass", "username": "z"},
|
|
379
|
+
content_type="application/json",
|
|
380
|
+
)
|
|
381
|
+
|
|
382
|
+
assert response.status_code == 400
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### conftest.py
|
|
386
|
+
|
|
387
|
+
```python
|
|
388
|
+
# conftest.py
|
|
389
|
+
import pytest
|
|
390
|
+
from pytest_factoryboy import register
|
|
391
|
+
from apps.users.tests.factories import UserFactory
|
|
392
|
+
|
|
393
|
+
register(UserFactory) # makes user_factory fixture available everywhere
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
## Linting
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
# Check
|
|
400
|
+
uv run ruff check .
|
|
401
|
+
|
|
402
|
+
# Fix auto-fixable issues
|
|
403
|
+
uv run ruff check --fix .
|
|
404
|
+
|
|
405
|
+
# Format
|
|
406
|
+
uv run ruff format .
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
Run ruff in CI on every pull request. Do not merge code that fails lint.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: drizzle-schema-architect
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
name: Drizzle Schema Architect
|
|
5
|
+
description: >
|
|
6
|
+
Generates strictly typed Drizzle ORM schemas for PostgreSQL with indexes,
|
|
7
|
+
foreign keys, and Zod schema deduction.
|
|
8
|
+
user-invokable: true
|
|
9
|
+
license: MIT
|
|
10
|
+
metadata:
|
|
11
|
+
author: lgzarturo
|
|
12
|
+
category: database
|
|
13
|
+
compatibility:
|
|
14
|
+
tools: [claude, codex, gemini, agy, opencode]
|
|
15
|
+
stacks:
|
|
16
|
+
languages: [typescript, javascript]
|
|
17
|
+
frameworks: [nextjs, drizzle]
|
|
18
|
+
databases: [postgresql]
|
|
19
|
+
paths:
|
|
20
|
+
- "**/schema.ts"
|
|
21
|
+
- "**/drizzle/**"
|
|
22
|
+
---
|
|
23
|
+
# Drizzle Schema Architect
|
|
24
|
+
|
|
25
|
+
## Core Principles
|
|
26
|
+
|
|
27
|
+
1. **Strict Typing**: All table columns must be explicitly typed. Do not rely on loose implicit types.
|
|
28
|
+
2. **PostgreSQL Focus**: Use pg-specific column types (e.g. `pgTable`, `uuid`, `timestamp`, `varchar`, `integer`).
|
|
29
|
+
3. **Zod Validation Integration**: Always output Zod schemas inferred from Drizzle schemas using `drizzle-zod`'s `createInsertSchema` and `createSelectSchema`.
|
|
30
|
+
|
|
31
|
+
## Schema Guidelines
|
|
32
|
+
|
|
33
|
+
- **Primary Keys**: Prefer UUIDs generated by `gen_random_uuid()` or autoincrementing integers depending on the table volume.
|
|
34
|
+
- **Indices**: Declare explicit indexes on foreign key columns and query filters.
|
|
35
|
+
- **Dates**: Always store timestamps using `timestamp('created_at', { withTimezone: true, mode: 'date' }).defaultNow().notNull()`.
|
|
36
|
+
|
|
37
|
+
### Example Schema Pattern
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { pgTable, uuid, varchar, timestamp, index } from 'drizzle-orm/pg-core';
|
|
41
|
+
import { createInsertSchema, createSelectSchema } from 'drizzle-zod';
|
|
42
|
+
|
|
43
|
+
export const users = pgTable('users', {
|
|
44
|
+
id: uuid('id').defaultRandom().primaryKey(),
|
|
45
|
+
email: varchar('email', { length: 255 }).notNull().unique(),
|
|
46
|
+
name: varchar('name', { length: 255 }),
|
|
47
|
+
createdAt: timestamp('created_at', { withTimezone: true, mode: 'date' }).defaultNow().notNull(),
|
|
48
|
+
}, (table) => [
|
|
49
|
+
index('email_idx').on(table.email)
|
|
50
|
+
]);
|
|
51
|
+
|
|
52
|
+
export const insertUserSchema = createInsertSchema(users);
|
|
53
|
+
export const selectUserSchema = createSelectSchema(users);
|
|
54
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: fastapi-pydantic-strict
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
name: FastAPI Pydantic Strict
|
|
5
|
+
description: >
|
|
6
|
+
Enforces Pydantic v2 strict models, asynchronous dependency generators, and uv environment setup.
|
|
7
|
+
user-invokable: true
|
|
8
|
+
license: MIT
|
|
9
|
+
metadata:
|
|
10
|
+
author: lgzarturo
|
|
11
|
+
category: validation
|
|
12
|
+
compatibility:
|
|
13
|
+
tools: [claude, codex, gemini, agy, opencode]
|
|
14
|
+
stacks:
|
|
15
|
+
languages: [python]
|
|
16
|
+
frameworks: [fastapi, pydantic]
|
|
17
|
+
paths:
|
|
18
|
+
- "**/*.py"
|
|
19
|
+
---
|
|
20
|
+
# FastAPI Pydantic Strict
|
|
21
|
+
|
|
22
|
+
## Core Principles
|
|
23
|
+
|
|
24
|
+
1. **Pydantic v2 Model Configuration**: Always configure models with `model_config = ConfigDict(strict=True)` to enforce type correctness.
|
|
25
|
+
2. **Async Dependencies**: Rely on async FastAPI dependency generators (`async def get_db()`) to handle context managers correctly.
|
|
26
|
+
3. **Environment Management**: Use `uv` for lightning-fast package installs and lockfile consistency.
|
|
27
|
+
|
|
28
|
+
## Code Blueprint
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from fastapi import FastAPI, Depends
|
|
32
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
33
|
+
|
|
34
|
+
app = FastAPI()
|
|
35
|
+
|
|
36
|
+
class StrictUser(BaseModel):
|
|
37
|
+
model_config = ConfigDict(strict=True)
|
|
38
|
+
|
|
39
|
+
id: int
|
|
40
|
+
name: str = Field(..., min_length=2)
|
|
41
|
+
email: str
|
|
42
|
+
|
|
43
|
+
@app.post("/users", response_model=StrictUser)
|
|
44
|
+
async def create_user(user: StrictUser):
|
|
45
|
+
return user
|
|
46
|
+
```
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: find-skills
|
|
3
|
+
description: Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
|
|
4
|
+
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Find Skills
|
|
9
|
+
|
|
10
|
+
This skill helps you discover and install skills from the open agent skills ecosystem.
|
|
11
|
+
|
|
12
|
+
## When to Use This Skill
|
|
13
|
+
|
|
14
|
+
Use this skill when the user:
|
|
15
|
+
|
|
16
|
+
- Asks "how do I do X" where X might be a common task with an existing skill
|
|
17
|
+
- Says "find a skill for X" or "is there a skill for X"
|
|
18
|
+
- Asks "can you do X" where X is a specialized capability
|
|
19
|
+
- Expresses interest in extending agent capabilities
|
|
20
|
+
- Wants to search for tools, templates, or workflows
|
|
21
|
+
- Mentions they wish they had help with a specific domain (design, testing, deployment, etc.)
|
|
22
|
+
|
|
23
|
+
## What is the Skills CLI?
|
|
24
|
+
|
|
25
|
+
The Skills CLI (`npx skills`) is the package manager for the open agent skills ecosystem. Skills are modular packages that extend agent capabilities with specialized knowledge, workflows, and tools.
|
|
26
|
+
|
|
27
|
+
**Key commands:**
|
|
28
|
+
|
|
29
|
+
- `npx skills find [query]` - Search for skills interactively or by keyword
|
|
30
|
+
- `npx skills add <package>` - Install a skill from GitHub or other sources
|
|
31
|
+
- `npx skills check` - Check for skill updates
|
|
32
|
+
- `npx skills update` - Update all installed skills
|
|
33
|
+
|
|
34
|
+
**Browse skills at:** https://skills.sh/
|
|
35
|
+
|
|
36
|
+
## How to Help Users Find Skills
|
|
37
|
+
|
|
38
|
+
### Step 1: Understand What They Need
|
|
39
|
+
|
|
40
|
+
When a user asks for help with something, identify:
|
|
41
|
+
|
|
42
|
+
1. The domain (e.g., React, testing, design, deployment)
|
|
43
|
+
2. The specific task (e.g., writing tests, creating animations, reviewing PRs)
|
|
44
|
+
3. Whether this is a common enough task that a skill likely exists
|
|
45
|
+
|
|
46
|
+
### Step 2: Check the Leaderboard First
|
|
47
|
+
|
|
48
|
+
Before running a CLI search, check the [skills.sh leaderboard](https://skills.sh/) to see if a well-known skill already exists for the domain. The leaderboard ranks skills by total installs, surfacing the most popular and battle-tested options.
|
|
49
|
+
|
|
50
|
+
For example, top skills for web development include:
|
|
51
|
+
- `vercel-labs/agent-skills` — React, Next.js, web design (100K+ installs each)
|
|
52
|
+
- `anthropics/skills` — Frontend design, document processing (100K+ installs)
|
|
53
|
+
|
|
54
|
+
### Step 3: Search for Skills
|
|
55
|
+
|
|
56
|
+
If the leaderboard doesn't cover the user's need, run the find command:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx skills find [query]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
For example:
|
|
63
|
+
|
|
64
|
+
- User asks "how do I make my React app faster?" → `npx skills find react performance`
|
|
65
|
+
- User asks "can you help me with PR reviews?" → `npx skills find pr review`
|
|
66
|
+
- User asks "I need to create a changelog" → `npx skills find changelog`
|
|
67
|
+
|
|
68
|
+
### Step 4: Verify Quality Before Recommending
|
|
69
|
+
|
|
70
|
+
**Do not recommend a skill based solely on search results.** Always verify:
|
|
71
|
+
|
|
72
|
+
1. **Install count** — Prefer skills with 1K+ installs. Be cautious with anything under 100.
|
|
73
|
+
2. **Source reputation** — Official sources (`vercel-labs`, `anthropics`, `microsoft`) are more trustworthy than unknown authors.
|
|
74
|
+
3. **GitHub stars** — Check the source repository. A skill from a repo with <100 stars should be treated with skepticism.
|
|
75
|
+
|
|
76
|
+
### Step 5: Present Options to the User
|
|
77
|
+
|
|
78
|
+
When you find relevant skills, present them to the user with:
|
|
79
|
+
|
|
80
|
+
1. The skill name and what it does
|
|
81
|
+
2. The install count and source
|
|
82
|
+
3. The install command they can run
|
|
83
|
+
4. A link to learn more at skills.sh
|
|
84
|
+
|
|
85
|
+
Example response:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
I found a skill that might help! The "react-best-practices" skill provides
|
|
89
|
+
React and Next.js performance optimization guidelines from Vercel Engineering.
|
|
90
|
+
(185K installs)
|
|
91
|
+
|
|
92
|
+
To install it:
|
|
93
|
+
npx skills add vercel-labs/agent-skills@react-best-practices
|
|
94
|
+
|
|
95
|
+
Learn more: https://skills.sh/vercel-labs/agent-skills/react-best-practices
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Step 6: Offer to Install
|
|
99
|
+
|
|
100
|
+
If the user wants to proceed, you can install the skill for them:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npx skills add <owner/repo@skill> -g -y
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The `-g` flag installs globally (user-level) and `-y` skips confirmation prompts.
|
|
107
|
+
|
|
108
|
+
## Common Skill Categories
|
|
109
|
+
|
|
110
|
+
When searching, consider these common categories:
|
|
111
|
+
|
|
112
|
+
| Category | Example Queries |
|
|
113
|
+
| --------------- | ---------------------------------------- |
|
|
114
|
+
| Web Development | react, nextjs, typescript, css, tailwind |
|
|
115
|
+
| Testing | testing, jest, playwright, e2e |
|
|
116
|
+
| DevOps | deploy, docker, kubernetes, ci-cd |
|
|
117
|
+
| Documentation | docs, readme, changelog, api-docs |
|
|
118
|
+
| Code Quality | review, lint, refactor, best-practices |
|
|
119
|
+
| Design | ui, ux, design-system, accessibility |
|
|
120
|
+
| Productivity | workflow, automation, git |
|
|
121
|
+
|
|
122
|
+
## Tips for Effective Searches
|
|
123
|
+
|
|
124
|
+
1. **Use specific keywords**: "react testing" is better than just "testing"
|
|
125
|
+
2. **Try alternative terms**: If "deploy" doesn't work, try "deployment" or "ci-cd"
|
|
126
|
+
3. **Check popular sources**: Many skills come from `vercel-labs/agent-skills` or `ComposioHQ/awesome-claude-skills`
|
|
127
|
+
|
|
128
|
+
## When No Skills Are Found
|
|
129
|
+
|
|
130
|
+
If no relevant skills exist:
|
|
131
|
+
|
|
132
|
+
1. Acknowledge that no existing skill was found
|
|
133
|
+
2. Offer to help with the task directly using your general capabilities
|
|
134
|
+
3. Suggest the user could create their own skill with `npx skills init`
|
|
135
|
+
|
|
136
|
+
Example:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
I searched for skills related to "xyz" but didn't find any matches.
|
|
140
|
+
I can still help you with this task directly! Would you like me to proceed?
|
|
141
|
+
|
|
142
|
+
If this is something you do often, you could create your own skill:
|
|
143
|
+
npx skills init my-xyz-skill
|
|
144
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: jpa-nplusone-detector
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
name: JPA N+1 Query Detector
|
|
5
|
+
description: >
|
|
6
|
+
Audits Hibernate database interactions to prevent N+1 query problems in JVM apps.
|
|
7
|
+
user-invokable: true
|
|
8
|
+
license: MIT
|
|
9
|
+
metadata:
|
|
10
|
+
author: lgzarturo
|
|
11
|
+
category: performance
|
|
12
|
+
compatibility:
|
|
13
|
+
tools: [claude, codex, gemini, agy, opencode]
|
|
14
|
+
stacks:
|
|
15
|
+
languages: [kotlin, java]
|
|
16
|
+
frameworks: [spring-boot, spring-data-jpa, hibernate]
|
|
17
|
+
paths:
|
|
18
|
+
- "**/*.kt"
|
|
19
|
+
- "**/*.java"
|
|
20
|
+
---
|
|
21
|
+
# JPA N+1 Query Detector
|
|
22
|
+
|
|
23
|
+
## Core Principles
|
|
24
|
+
|
|
25
|
+
1. **Hibernate Fetches**: Avoid lazy-loading relationships within loops or stream operations.
|
|
26
|
+
2. **Batch Fetching & Joins**: Resolve N+1 issues by using `@EntityGraph` or `JOIN FETCH` inside custom JPQL queries.
|
|
27
|
+
3. **Hibernate Statistics**: Enable Hibernate statistics in development to verify query counts.
|
|
28
|
+
|
|
29
|
+
## Remediation Patterns
|
|
30
|
+
|
|
31
|
+
### Ineffective Pattern (Triggers N+1 queries)
|
|
32
|
+
```kotlin
|
|
33
|
+
val users = userRepository.findAll()
|
|
34
|
+
for (user in users) {
|
|
35
|
+
println(user.posts.size) // Post is loaded lazily for each user
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Remediation A: Using JOIN FETCH
|
|
40
|
+
```kotlin
|
|
41
|
+
@Query("SELECT u FROM User u LEFT JOIN FETCH u.posts")
|
|
42
|
+
fun findAllWithPosts(): List<User>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Remediation B: Using @EntityGraph
|
|
46
|
+
```kotlin
|
|
47
|
+
@EntityGraph(attributePaths = ["posts"])
|
|
48
|
+
override fun findAll(): List<User>
|
|
49
|
+
```
|