@zimezone/z-command 1.1.0 → 1.1.1
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/package.json +4 -1
- package/templates/agents/api-documenter.agent.md +161 -0
- package/templates/agents/architect-review.agent.md +146 -0
- package/templates/agents/arm-cortex-expert.agent.md +288 -0
- package/templates/agents/backend-architect.agent.md +309 -0
- package/templates/agents/backend-security-coder.agent.md +152 -0
- package/templates/agents/bash-pro.agent.md +285 -0
- package/templates/agents/c-pro.agent.md +35 -0
- package/templates/agents/c4-code.agent.md +320 -0
- package/templates/agents/c4-component.agent.md +227 -0
- package/templates/agents/c4-container.agent.md +248 -0
- package/templates/agents/c4-context.agent.md +235 -0
- package/templates/agents/conductor-validator.agent.md +245 -0
- package/templates/agents/csharp-pro.agent.md +38 -0
- package/templates/agents/customer-support.agent.md +148 -0
- package/templates/agents/database-admin.agent.md +142 -0
- package/templates/agents/database-architect.agent.md +238 -0
- package/templates/agents/database-optimizer.agent.md +144 -0
- package/templates/agents/debugger.agent.md +30 -0
- package/templates/agents/deployment-engineer.agent.md +0 -0
- package/templates/agents/devops-troubleshooter.agent.md +138 -0
- package/templates/agents/django-pro.agent.md +159 -0
- package/templates/agents/docs-architect.agent.md +77 -0
- package/templates/agents/dotnet-architect.agent.md +175 -0
- package/templates/agents/dx-optimizer.agent.md +63 -0
- package/templates/agents/elixir-pro.agent.md +38 -0
- package/templates/agents/error-detective.agent.md +32 -0
- package/templates/agents/event-sourcing-architect.agent.md +42 -0
- package/templates/agents/fastapi-pro.agent.md +171 -0
- package/templates/agents/firmware-analyst.agent.md +330 -0
- package/templates/agents/frontend-security-coder.agent.md +149 -0
- package/templates/agents/haskell-pro.agent.md +37 -0
- package/templates/agents/hr-pro.agent.md +105 -0
- package/templates/agents/incident-responder.agent.md +190 -0
- package/templates/agents/ios-developer.agent.md +198 -0
- package/templates/agents/java-pro.agent.md +156 -0
- package/templates/agents/javascript-pro.agent.md +35 -0
- package/templates/agents/julia-pro.agent.md +187 -0
- package/templates/agents/legal-advisor.agent.md +49 -0
- package/templates/agents/malware-analyst.agent.md +272 -0
- package/templates/agents/mermaid-expert.agent.md +39 -0
- package/templates/agents/minecraft-bukkit-pro.agent.md +104 -0
- package/templates/agents/mobile-security-coder.agent.md +163 -0
- package/templates/agents/monorepo-architect.agent.md +44 -0
- package/templates/agents/observability-engineer.agent.md +228 -0
- package/templates/agents/performance-engineer.agent.md +167 -0
- package/templates/agents/php-pro.agent.md +43 -0
- package/templates/agents/posix-shell-pro.agent.md +284 -0
- package/templates/agents/quant-analyst.agent.md +32 -0
- package/templates/agents/reference-builder.agent.md +167 -0
- package/templates/agents/reverse-engineer.agent.md +202 -0
- package/templates/agents/risk-manager.agent.md +41 -0
- package/templates/agents/ruby-pro.agent.md +35 -0
- package/templates/agents/rust-pro.agent.md +156 -0
- package/templates/agents/sales-automator.agent.md +35 -0
- package/templates/agents/scala-pro.agent.md +60 -0
- package/templates/agents/search-specialist.agent.md +59 -0
- package/templates/agents/security-auditor.agent.md +138 -0
- package/templates/agents/seo-authority-builder.agent.md +116 -0
- package/templates/agents/seo-cannibalization-detector.agent.md +103 -0
- package/templates/agents/seo-content-auditor.agent.md +63 -0
- package/templates/agents/seo-content-planner.agent.md +88 -0
- package/templates/agents/seo-content-refresher.agent.md +98 -0
- package/templates/agents/seo-content-writer.agent.md +76 -0
- package/templates/agents/seo-keyword-strategist.agent.md +75 -0
- package/templates/agents/seo-meta-optimizer.agent.md +72 -0
- package/templates/agents/seo-snippet-hunter.agent.md +94 -0
- package/templates/agents/seo-structure-architect.agent.md +88 -0
- package/templates/agents/service-mesh-expert.agent.md +41 -0
- package/templates/agents/sql-pro.agent.md +146 -0
- package/templates/agents/tdd-orchestrator.agent.md +183 -0
- package/templates/agents/temporal-python-pro.agent.md +349 -0
- package/templates/agents/terraform-specialist.agent.md +137 -0
- package/templates/agents/test-automator.agent.md +203 -0
- package/templates/agents/threat-modeling-expert.agent.md +44 -0
- package/templates/agents/tutorial-engineer.agent.md +118 -0
- package/templates/agents/ui-ux-designer.agent.md +188 -0
- package/templates/agents/ui-visual-validator.agent.md +192 -0
- package/templates/agents/vector-database-engineer.agent.md +43 -0
- package/templates/skills/angular-migration/SKILL.md +410 -0
- package/templates/skills/api-design-principles/SKILL.md +528 -0
- package/templates/skills/api-design-principles/assets/api-design-checklist.md +155 -0
- package/templates/skills/api-design-principles/assets/rest-api-template.py +182 -0
- package/templates/skills/api-design-principles/references/graphql-schema-design.md +583 -0
- package/templates/skills/api-design-principles/references/rest-best-practices.md +408 -0
- package/templates/skills/architecture-decision-records/SKILL.md +428 -0
- package/templates/skills/architecture-patterns/SKILL.md +494 -0
- package/templates/skills/async-python-patterns/SKILL.md +694 -0
- package/templates/skills/auth-implementation-patterns/SKILL.md +634 -0
- package/templates/skills/changelog-automation/SKILL.md +552 -0
- package/templates/skills/code-review-excellence/SKILL.md +520 -0
- package/templates/skills/competitive-landscape/SKILL.md +479 -0
- package/templates/skills/context-driven-development/SKILL.md +385 -0
- package/templates/skills/cost-optimization/SKILL.md +274 -0
- package/templates/skills/cqrs-implementation/SKILL.md +554 -0
- package/templates/skills/data-quality-frameworks/SKILL.md +587 -0
- package/templates/skills/data-storytelling/SKILL.md +453 -0
- package/templates/skills/database-migration/SKILL.md +424 -0
- package/templates/skills/dbt-transformation-patterns/SKILL.md +561 -0
- package/templates/skills/debugging-strategies/SKILL.md +527 -0
- package/templates/skills/defi-protocol-templates/SKILL.md +454 -0
- package/templates/skills/dependency-upgrade/SKILL.md +409 -0
- package/templates/skills/deployment-pipeline-design/SKILL.md +359 -0
- package/templates/skills/distributed-tracing/SKILL.md +438 -0
- package/templates/skills/dotnet-backend-patterns/SKILL.md +815 -0
- package/templates/skills/dotnet-backend-patterns/assets/repository-template.cs +523 -0
- package/templates/skills/dotnet-backend-patterns/assets/service-template.cs +336 -0
- package/templates/skills/dotnet-backend-patterns/references/dapper-patterns.md +544 -0
- package/templates/skills/dotnet-backend-patterns/references/ef-core-best-practices.md +355 -0
- package/templates/skills/e2e-testing-patterns/SKILL.md +547 -0
- package/templates/skills/employment-contract-templates/SKILL.md +507 -0
- package/templates/skills/error-handling-patterns/SKILL.md +636 -0
- package/templates/skills/event-store-design/SKILL.md +437 -0
- package/templates/skills/fastapi-templates/SKILL.md +567 -0
- package/templates/skills/git-advanced-workflows/SKILL.md +400 -0
- package/templates/skills/github-actions-templates/SKILL.md +333 -0
- package/templates/skills/go-concurrency-patterns/SKILL.md +655 -0
- package/templates/skills/grafana-dashboards/SKILL.md +369 -0
- package/templates/skills/helm-chart-scaffolding/SKILL.md +544 -0
- package/templates/skills/helm-chart-scaffolding/assets/Chart.yaml.template +42 -0
- package/templates/skills/helm-chart-scaffolding/assets/values.yaml.template +185 -0
- package/templates/skills/helm-chart-scaffolding/references/chart-structure.md +500 -0
- package/templates/skills/helm-chart-scaffolding/scripts/validate-chart.sh +244 -0
- package/templates/skills/javascript-testing-patterns/SKILL.md +1025 -0
- package/templates/skills/langchain-architecture/SKILL.md +338 -0
- package/templates/skills/llm-evaluation/SKILL.md +471 -0
- package/templates/skills/microservices-patterns/SKILL.md +595 -0
- package/templates/skills/modern-javascript-patterns/SKILL.md +911 -0
- package/templates/skills/monorepo-management/SKILL.md +622 -0
- package/templates/skills/nextjs-app-router-patterns/SKILL.md +544 -0
- package/templates/skills/nodejs-backend-patterns/SKILL.md +1020 -0
- package/templates/skills/nx-workspace-patterns/SKILL.md +452 -0
- package/templates/skills/openapi-spec-generation/SKILL.md +1028 -0
- package/templates/skills/paypal-integration/SKILL.md +467 -0
- package/templates/skills/pci-compliance/SKILL.md +466 -0
- package/templates/skills/postgresql/SKILL.md +204 -0
- package/templates/skills/projection-patterns/SKILL.md +490 -0
- package/templates/skills/prometheus-configuration/SKILL.md +392 -0
- package/templates/skills/prompt-engineering-patterns/SKILL.md +201 -0
- package/templates/skills/prompt-engineering-patterns/assets/few-shot-examples.json +106 -0
- package/templates/skills/prompt-engineering-patterns/assets/prompt-template-library.md +246 -0
- package/templates/skills/prompt-engineering-patterns/references/chain-of-thought.md +399 -0
- package/templates/skills/prompt-engineering-patterns/references/few-shot-learning.md +369 -0
- package/templates/skills/prompt-engineering-patterns/references/prompt-optimization.md +414 -0
- package/templates/skills/prompt-engineering-patterns/references/prompt-templates.md +470 -0
- package/templates/skills/prompt-engineering-patterns/references/system-prompts.md +189 -0
- package/templates/skills/prompt-engineering-patterns/scripts/optimize-prompt.py +279 -0
- package/templates/skills/python-packaging/SKILL.md +870 -0
- package/templates/skills/python-performance-optimization/SKILL.md +869 -0
- package/templates/skills/python-testing-patterns/SKILL.md +907 -0
- package/templates/skills/rag-implementation/SKILL.md +403 -0
- package/templates/skills/react-modernization/SKILL.md +513 -0
- package/templates/skills/react-native-architecture/SKILL.md +671 -0
- package/templates/skills/react-state-management/SKILL.md +429 -0
- package/templates/skills/risk-metrics-calculation/SKILL.md +555 -0
- package/templates/skills/rust-async-patterns/SKILL.md +517 -0
- package/templates/skills/secrets-management/SKILL.md +346 -0
- package/templates/skills/security-requirement-extraction/SKILL.md +677 -0
- package/templates/skills/shellcheck-configuration/SKILL.md +454 -0
- package/templates/skills/similarity-search-patterns/SKILL.md +558 -0
- package/templates/skills/slo-implementation/SKILL.md +329 -0
- package/templates/skills/sql-optimization-patterns/SKILL.md +493 -0
- package/templates/skills/stripe-integration/SKILL.md +442 -0
- package/templates/skills/tailwind-design-system/SKILL.md +666 -0
- package/templates/skills/temporal-python-testing/SKILL.md +158 -0
- package/templates/skills/temporal-python-testing/resources/integration-testing.md +455 -0
- package/templates/skills/temporal-python-testing/resources/local-setup.md +553 -0
- package/templates/skills/temporal-python-testing/resources/replay-testing.md +462 -0
- package/templates/skills/temporal-python-testing/resources/unit-testing.md +328 -0
- package/templates/skills/terraform-module-library/SKILL.md +249 -0
- package/templates/skills/terraform-module-library/references/aws-modules.md +63 -0
- package/templates/skills/threat-mitigation-mapping/SKILL.md +745 -0
- package/templates/skills/track-management/SKILL.md +593 -0
- package/templates/skills/typescript-advanced-types/SKILL.md +717 -0
- package/templates/skills/uv-package-manager/SKILL.md +831 -0
- package/templates/skills/vector-index-tuning/SKILL.md +521 -0
- package/templates/skills/wcag-audit-patterns/SKILL.md +555 -0
- package/templates/skills/workflow-orchestration-patterns/SKILL.md +316 -0
- package/templates/skills/workflow-patterns/SKILL.md +623 -0
- package/templates/agents/game-developer.agent.md +0 -57
- package/templates/agents/kubernetes-specialist.agent.md +0 -56
- package/templates/agents/market-researcher.agent.md +0 -47
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Production-ready REST API template using FastAPI.
|
|
3
|
+
Includes pagination, filtering, error handling, and best practices.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from fastapi import FastAPI, HTTPException, Query, Path, Depends, status
|
|
7
|
+
from fastapi.middleware.cors import CORSMiddleware
|
|
8
|
+
from fastapi.middleware.trustedhost import TrustedHostMiddleware
|
|
9
|
+
from fastapi.responses import JSONResponse
|
|
10
|
+
from pydantic import BaseModel, Field, EmailStr, ConfigDict
|
|
11
|
+
from typing import Optional, List, Any
|
|
12
|
+
from datetime import datetime
|
|
13
|
+
from enum import Enum
|
|
14
|
+
|
|
15
|
+
app = FastAPI(
|
|
16
|
+
title="API Template",
|
|
17
|
+
version="1.0.0",
|
|
18
|
+
docs_url="/api/docs"
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
# Security Middleware
|
|
22
|
+
# Trusted Host: Prevents HTTP Host Header attacks
|
|
23
|
+
app.add_middleware(
|
|
24
|
+
TrustedHostMiddleware,
|
|
25
|
+
allowed_hosts=["*"] # TODO: Configure this in production, e.g. ["api.example.com"]
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# CORS: Configures Cross-Origin Resource Sharing
|
|
29
|
+
app.add_middleware(
|
|
30
|
+
CORSMiddleware,
|
|
31
|
+
allow_origins=["*"], # TODO: Update this with specific origins in production
|
|
32
|
+
allow_credentials=False, # TODO: Set to True if you need cookies/auth headers, but restrict origins
|
|
33
|
+
allow_methods=["*"],
|
|
34
|
+
allow_headers=["*"],
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
# Models
|
|
38
|
+
class UserStatus(str, Enum):
|
|
39
|
+
ACTIVE = "active"
|
|
40
|
+
INACTIVE = "inactive"
|
|
41
|
+
SUSPENDED = "suspended"
|
|
42
|
+
|
|
43
|
+
class UserBase(BaseModel):
|
|
44
|
+
email: EmailStr
|
|
45
|
+
name: str = Field(..., min_length=1, max_length=100)
|
|
46
|
+
status: UserStatus = UserStatus.ACTIVE
|
|
47
|
+
|
|
48
|
+
class UserCreate(UserBase):
|
|
49
|
+
password: str = Field(..., min_length=8)
|
|
50
|
+
|
|
51
|
+
class UserUpdate(BaseModel):
|
|
52
|
+
email: Optional[EmailStr] = None
|
|
53
|
+
name: Optional[str] = Field(None, min_length=1, max_length=100)
|
|
54
|
+
status: Optional[UserStatus] = None
|
|
55
|
+
|
|
56
|
+
class User(UserBase):
|
|
57
|
+
id: str
|
|
58
|
+
created_at: datetime
|
|
59
|
+
updated_at: datetime
|
|
60
|
+
|
|
61
|
+
model_config = ConfigDict(from_attributes=True)
|
|
62
|
+
|
|
63
|
+
# Pagination
|
|
64
|
+
class PaginationParams(BaseModel):
|
|
65
|
+
page: int = Field(1, ge=1)
|
|
66
|
+
page_size: int = Field(20, ge=1, le=100)
|
|
67
|
+
|
|
68
|
+
class PaginatedResponse(BaseModel):
|
|
69
|
+
items: List[Any]
|
|
70
|
+
total: int
|
|
71
|
+
page: int
|
|
72
|
+
page_size: int
|
|
73
|
+
pages: int
|
|
74
|
+
|
|
75
|
+
# Error handling
|
|
76
|
+
class ErrorDetail(BaseModel):
|
|
77
|
+
field: Optional[str] = None
|
|
78
|
+
message: str
|
|
79
|
+
code: str
|
|
80
|
+
|
|
81
|
+
class ErrorResponse(BaseModel):
|
|
82
|
+
error: str
|
|
83
|
+
message: str
|
|
84
|
+
details: Optional[List[ErrorDetail]] = None
|
|
85
|
+
|
|
86
|
+
@app.exception_handler(HTTPException)
|
|
87
|
+
async def http_exception_handler(request, exc):
|
|
88
|
+
return JSONResponse(
|
|
89
|
+
status_code=exc.status_code,
|
|
90
|
+
content=ErrorResponse(
|
|
91
|
+
error=exc.__class__.__name__,
|
|
92
|
+
message=exc.detail if isinstance(exc.detail, str) else exc.detail.get("message", "Error"),
|
|
93
|
+
details=exc.detail.get("details") if isinstance(exc.detail, dict) else None
|
|
94
|
+
).model_dump()
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
# Endpoints
|
|
98
|
+
@app.get("/api/users", response_model=PaginatedResponse, tags=["Users"])
|
|
99
|
+
async def list_users(
|
|
100
|
+
page: int = Query(1, ge=1),
|
|
101
|
+
page_size: int = Query(20, ge=1, le=100),
|
|
102
|
+
status: Optional[UserStatus] = Query(None),
|
|
103
|
+
search: Optional[str] = Query(None)
|
|
104
|
+
):
|
|
105
|
+
"""List users with pagination and filtering."""
|
|
106
|
+
# Mock implementation
|
|
107
|
+
total = 100
|
|
108
|
+
items = [
|
|
109
|
+
User(
|
|
110
|
+
id=str(i),
|
|
111
|
+
email=f"user{i}@example.com",
|
|
112
|
+
name=f"User {i}",
|
|
113
|
+
status=UserStatus.ACTIVE,
|
|
114
|
+
created_at=datetime.now(),
|
|
115
|
+
updated_at=datetime.now()
|
|
116
|
+
).model_dump()
|
|
117
|
+
for i in range((page-1)*page_size, min(page*page_size, total))
|
|
118
|
+
]
|
|
119
|
+
|
|
120
|
+
return PaginatedResponse(
|
|
121
|
+
items=items,
|
|
122
|
+
total=total,
|
|
123
|
+
page=page,
|
|
124
|
+
page_size=page_size,
|
|
125
|
+
pages=(total + page_size - 1) // page_size
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
@app.post("/api/users", response_model=User, status_code=status.HTTP_201_CREATED, tags=["Users"])
|
|
129
|
+
async def create_user(user: UserCreate):
|
|
130
|
+
"""Create a new user."""
|
|
131
|
+
# Mock implementation
|
|
132
|
+
return User(
|
|
133
|
+
id="123",
|
|
134
|
+
email=user.email,
|
|
135
|
+
name=user.name,
|
|
136
|
+
status=user.status,
|
|
137
|
+
created_at=datetime.now(),
|
|
138
|
+
updated_at=datetime.now()
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
@app.get("/api/users/{user_id}", response_model=User, tags=["Users"])
|
|
142
|
+
async def get_user(user_id: str = Path(..., description="User ID")):
|
|
143
|
+
"""Get user by ID."""
|
|
144
|
+
# Mock: Check if exists
|
|
145
|
+
if user_id == "999":
|
|
146
|
+
raise HTTPException(
|
|
147
|
+
status_code=status.HTTP_404_NOT_FOUND,
|
|
148
|
+
detail={"message": "User not found", "details": {"id": user_id}}
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
return User(
|
|
152
|
+
id=user_id,
|
|
153
|
+
email="user@example.com",
|
|
154
|
+
name="User Name",
|
|
155
|
+
status=UserStatus.ACTIVE,
|
|
156
|
+
created_at=datetime.now(),
|
|
157
|
+
updated_at=datetime.now()
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
@app.patch("/api/users/{user_id}", response_model=User, tags=["Users"])
|
|
161
|
+
async def update_user(user_id: str, update: UserUpdate):
|
|
162
|
+
"""Partially update user."""
|
|
163
|
+
# Validate user exists
|
|
164
|
+
existing = await get_user(user_id)
|
|
165
|
+
|
|
166
|
+
# Apply updates
|
|
167
|
+
update_data = update.model_dump(exclude_unset=True)
|
|
168
|
+
for field, value in update_data.items():
|
|
169
|
+
setattr(existing, field, value)
|
|
170
|
+
|
|
171
|
+
existing.updated_at = datetime.now()
|
|
172
|
+
return existing
|
|
173
|
+
|
|
174
|
+
@app.delete("/api/users/{user_id}", status_code=status.HTTP_204_NO_CONTENT, tags=["Users"])
|
|
175
|
+
async def delete_user(user_id: str):
|
|
176
|
+
"""Delete user."""
|
|
177
|
+
await get_user(user_id) # Verify exists
|
|
178
|
+
return None
|
|
179
|
+
|
|
180
|
+
if __name__ == "__main__":
|
|
181
|
+
import uvicorn
|
|
182
|
+
uvicorn.run(app, host="0.0.0.0", port=8000)
|