@maestro-ai/cli 1.0.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 +59 -0
- package/content/guides/Cat/303/241logo de Stacks para Cloud Moderna.md" +119 -0
- package/content/guides/Cat/303/241logo de Stacks para Hospedagem Compartilhada.md" +147 -0
- package/content/guides/Checklist Mestre de Entrega.md +68 -0
- package/content/guides/Gates de Qualidade.md +209 -0
- package/content/guides/Guia de Adi/303/247/303/243o de Novas Funcionalidades.md" +355 -0
- package/content/guides/Guia de Chaos Engineering.md +267 -0
- package/content/guides/Guia de Debugging com IA.md +135 -0
- package/content/guides/Guia de Estrat/303/251gias de Cache.md" +352 -0
- package/content/guides/Guia de Migrations Zero-Downtime.md +311 -0
- package/content/guides/Guia de Multi-tenancy.md +368 -0
- package/content/guides/Guia de Otimiza/303/247/303/243o de Custos Cloud.md" +195 -0
- package/content/guides/Guia de Refatora/303/247/303/243o de C/303/263digo Legado com IA.md" +162 -0
- package/content/guides/Guia de SLOs e Error Budgets.md +315 -0
- package/content/guides/M/303/251tricas de Efici/303/252ncia do Desenvolvimento com IA.md" +93 -0
- package/content/guides/Rules base.md +90 -0
- package/content/prompts/README.md +203 -0
- package/content/prompts/acessibilidade/analise-acessibilidade.md +257 -0
- package/content/prompts/apis/design-api-rest.md +303 -0
- package/content/prompts/apis/idempotencia.md +254 -0
- package/content/prompts/apis/versionamento.md +313 -0
- package/content/prompts/arquitetura/arquitetura-c4-completo.md +190 -0
- package/content/prompts/arquitetura/clean-architecture.md +151 -0
- package/content/prompts/arquitetura/ddd-bounded-contexts.md +183 -0
- package/content/prompts/arquitetura/ddd-cqrs.md +176 -0
- package/content/prompts/arquitetura/modelo-dominio.md +207 -0
- package/content/prompts/arquitetura/multi-tenancy.md +235 -0
- package/content/prompts/database/migrations-zero-downtime.md +192 -0
- package/content/prompts/database/otimizacao-queries.md +296 -0
- package/content/prompts/desenvolvimento/code-review.md +301 -0
- package/content/prompts/desenvolvimento/gerar-servico.md +271 -0
- package/content/prompts/devops/docker-compose.md +336 -0
- package/content/prompts/devops/feature-flags.md +374 -0
- package/content/prompts/devops/kubernetes-deploy.md +460 -0
- package/content/prompts/devops/pipeline-cicd.md +358 -0
- package/content/prompts/devops/terraform-iac.md +502 -0
- package/content/prompts/escalabilidade/analise-performance.md +240 -0
- package/content/prompts/escalabilidade/analise-performance.txt +94 -0
- package/content/prompts/escalabilidade/caching.md +255 -0
- package/content/prompts/observabilidade/chaos-testing.md +237 -0
- package/content/prompts/observabilidade/estrategia-observabilidade.md +263 -0
- package/content/prompts/observabilidade/estrategia-observabilidade.txt +134 -0
- package/content/prompts/observabilidade/slos.md +215 -0
- package/content/prompts/produto/discovery-inicial.md +203 -0
- package/content/prompts/produto/discovery-inicial.txt +33 -0
- package/content/prompts/requisitos/refinar-requisitos.md +232 -0
- package/content/prompts/requisitos/refinar-requisitos.txt +40 -0
- package/content/prompts/seguranca/analise-seguranca.md +243 -0
- package/content/prompts/seguranca/pentest-checklist.md +333 -0
- package/content/prompts/seguranca/rate-limiting.md +356 -0
- package/content/prompts/seguranca/revisao-lgpd.md +227 -0
- package/content/prompts/seguranca/threat-modeling.md +224 -0
- package/content/prompts/testes/contract-testing.md +340 -0
- package/content/prompts/testes/gerar-testes-unitarios.md +474 -0
- package/content/prompts/testes/testes-e2e.md +460 -0
- package/content/prompts/testes/testes-integracao.md +418 -0
- package/content/prompts/testes/testes-performance.md +458 -0
- package/content/prompts/ux/gerar-ui-stitch.md +151 -0
- package/content/skills/api-patterns/SKILL.md +81 -0
- package/content/skills/api-patterns/api-style.md +42 -0
- package/content/skills/api-patterns/auth.md +24 -0
- package/content/skills/api-patterns/documentation.md +26 -0
- package/content/skills/api-patterns/graphql.md +41 -0
- package/content/skills/api-patterns/rate-limiting.md +31 -0
- package/content/skills/api-patterns/response.md +37 -0
- package/content/skills/api-patterns/rest.md +40 -0
- package/content/skills/api-patterns/scripts/api_validator.py +211 -0
- package/content/skills/api-patterns/security-testing.md +122 -0
- package/content/skills/api-patterns/trpc.md +41 -0
- package/content/skills/api-patterns/versioning.md +22 -0
- package/content/skills/app-builder/SKILL.md +75 -0
- package/content/skills/app-builder/agent-coordination.md +71 -0
- package/content/skills/app-builder/feature-building.md +53 -0
- package/content/skills/app-builder/project-detection.md +34 -0
- package/content/skills/app-builder/scaffolding.md +118 -0
- package/content/skills/app-builder/tech-stack.md +40 -0
- package/content/skills/app-builder/templates/SKILL.md +39 -0
- package/content/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
- package/content/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
- package/content/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/content/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
- package/content/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
- package/content/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
- package/content/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
- package/content/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +82 -0
- package/content/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +100 -0
- package/content/skills/app-builder/templates/nextjs-static/TEMPLATE.md +106 -0
- package/content/skills/app-builder/templates/nuxt-app/TEMPLATE.md +101 -0
- package/content/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
- package/content/skills/app-builder/templates/react-native-app/TEMPLATE.md +93 -0
- package/content/skills/architecture/SKILL.md +55 -0
- package/content/skills/architecture/context-discovery.md +43 -0
- package/content/skills/architecture/examples.md +94 -0
- package/content/skills/architecture/pattern-selection.md +68 -0
- package/content/skills/architecture/patterns-reference.md +50 -0
- package/content/skills/architecture/trade-off-analysis.md +77 -0
- package/content/skills/bash-linux/SKILL.md +199 -0
- package/content/skills/behavioral-modes/SKILL.md +242 -0
- package/content/skills/brainstorming/SKILL.md +163 -0
- package/content/skills/brainstorming/dynamic-questioning.md +350 -0
- package/content/skills/clean-code/SKILL.md +201 -0
- package/content/skills/code-review-checklist/SKILL.md +109 -0
- package/content/skills/database-design/SKILL.md +52 -0
- package/content/skills/database-design/database-selection.md +43 -0
- package/content/skills/database-design/indexing.md +39 -0
- package/content/skills/database-design/migrations.md +48 -0
- package/content/skills/database-design/optimization.md +36 -0
- package/content/skills/database-design/orm-selection.md +30 -0
- package/content/skills/database-design/schema-design.md +56 -0
- package/content/skills/database-design/scripts/schema_validator.py +172 -0
- package/content/skills/deployment-procedures/SKILL.md +241 -0
- package/content/skills/doc.md +177 -0
- package/content/skills/documentation-templates/SKILL.md +194 -0
- package/content/skills/frontend-design/SKILL.md +396 -0
- package/content/skills/frontend-design/animation-guide.md +331 -0
- package/content/skills/frontend-design/color-system.md +311 -0
- package/content/skills/frontend-design/decision-trees.md +418 -0
- package/content/skills/frontend-design/motion-graphics.md +306 -0
- package/content/skills/frontend-design/scripts/accessibility_checker.py +183 -0
- package/content/skills/frontend-design/scripts/ux_audit.py +722 -0
- package/content/skills/frontend-design/typography-system.md +345 -0
- package/content/skills/frontend-design/ux-psychology.md +541 -0
- package/content/skills/frontend-design/visual-effects.md +383 -0
- package/content/skills/game-development/2d-games/SKILL.md +119 -0
- package/content/skills/game-development/3d-games/SKILL.md +135 -0
- package/content/skills/game-development/SKILL.md +167 -0
- package/content/skills/game-development/game-art/SKILL.md +185 -0
- package/content/skills/game-development/game-audio/SKILL.md +190 -0
- package/content/skills/game-development/game-design/SKILL.md +129 -0
- package/content/skills/game-development/mobile-games/SKILL.md +108 -0
- package/content/skills/game-development/multiplayer/SKILL.md +132 -0
- package/content/skills/game-development/pc-games/SKILL.md +144 -0
- package/content/skills/game-development/vr-ar/SKILL.md +123 -0
- package/content/skills/game-development/web-games/SKILL.md +150 -0
- package/content/skills/geo-fundamentals/SKILL.md +156 -0
- package/content/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
- package/content/skills/i18n-localization/SKILL.md +154 -0
- package/content/skills/i18n-localization/scripts/i18n_checker.py +241 -0
- package/content/skills/intelligent-routing/SKILL.md +334 -0
- package/content/skills/lint-and-validate/SKILL.md +45 -0
- package/content/skills/lint-and-validate/scripts/lint_runner.py +172 -0
- package/content/skills/lint-and-validate/scripts/type_coverage.py +173 -0
- package/content/skills/mcp-builder/SKILL.md +176 -0
- package/content/skills/mobile-design/SKILL.md +394 -0
- package/content/skills/mobile-design/decision-trees.md +516 -0
- package/content/skills/mobile-design/mobile-backend.md +491 -0
- package/content/skills/mobile-design/mobile-color-system.md +420 -0
- package/content/skills/mobile-design/mobile-debugging.md +122 -0
- package/content/skills/mobile-design/mobile-design-thinking.md +357 -0
- package/content/skills/mobile-design/mobile-navigation.md +458 -0
- package/content/skills/mobile-design/mobile-performance.md +767 -0
- package/content/skills/mobile-design/mobile-testing.md +356 -0
- package/content/skills/mobile-design/mobile-typography.md +433 -0
- package/content/skills/mobile-design/platform-android.md +666 -0
- package/content/skills/mobile-design/platform-ios.md +561 -0
- package/content/skills/mobile-design/scripts/mobile_audit.py +670 -0
- package/content/skills/mobile-design/touch-psychology.md +537 -0
- package/content/skills/nextjs-best-practices/SKILL.md +203 -0
- package/content/skills/nodejs-best-practices/SKILL.md +333 -0
- package/content/skills/parallel-agents/SKILL.md +175 -0
- package/content/skills/performance-profiling/SKILL.md +143 -0
- package/content/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
- package/content/skills/plan-writing/SKILL.md +152 -0
- package/content/skills/powershell-windows/SKILL.md +167 -0
- package/content/skills/python-patterns/SKILL.md +441 -0
- package/content/skills/react-patterns/SKILL.md +198 -0
- package/content/skills/red-team-tactics/SKILL.md +199 -0
- package/content/skills/seo-fundamentals/SKILL.md +129 -0
- package/content/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
- package/content/skills/server-management/SKILL.md +161 -0
- package/content/skills/systematic-debugging/SKILL.md +109 -0
- package/content/skills/tailwind-patterns/SKILL.md +269 -0
- package/content/skills/tdd-workflow/SKILL.md +149 -0
- package/content/skills/testing-patterns/SKILL.md +178 -0
- package/content/skills/testing-patterns/scripts/test_runner.py +219 -0
- package/content/skills/vulnerability-scanner/SKILL.md +276 -0
- package/content/skills/vulnerability-scanner/checklists.md +121 -0
- package/content/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
- package/content/skills/webapp-testing/SKILL.md +187 -0
- package/content/skills/webapp-testing/scripts/playwright_runner.py +173 -0
- package/content/specialists/Especialista em Acessibilidade.md +266 -0
- package/content/specialists/Especialista em An/303/241lise de Testes.md" +434 -0
- package/content/specialists/Especialista em Arquitetura Avan/303/247ada.md" +358 -0
- package/content/specialists/Especialista em Arquitetura de Software.md +177 -0
- package/content/specialists/Especialista em Banco de Dados.md +260 -0
- package/content/specialists/Especialista em Contrato de API.md +172 -0
- package/content/specialists/Especialista em Dados e Analytics com IA.md +246 -0
- package/content/specialists/Especialista em Debugging e Troubleshooting.md +191 -0
- package/content/specialists/Especialista em Desenvolvimento Frontend.md +477 -0
- package/content/specialists/Especialista em Desenvolvimento Mobile.md +241 -0
- package/content/specialists/Especialista em Desenvolvimento e Vibe Coding Estruturado.md +417 -0
- package/content/specialists/Especialista em DevOps e Infraestrutura.md +294 -0
- package/content/specialists/Especialista em Documenta/303/247/303/243o T/303/251cnica.md" +227 -0
- package/content/specialists/Especialista em Engenharia de Requisitos com IA.md +299 -0
- package/content/specialists/Especialista em Explora/303/247/303/243o de Codebase.md" +179 -0
- package/content/specialists/Especialista em Gest/303/243o de Produto.md" +179 -0
- package/content/specialists/Especialista em Migra/303/247/303/243o e Moderniza/303/247/303/243o.md" +410 -0
- package/content/specialists/Especialista em Modelagem e Arquitetura de Dom/303/255nio com IA.md" +248 -0
- package/content/specialists/Especialista em Observabilidade.md +415 -0
- package/content/specialists/Especialista em Performance e Escalabilidade.md +373 -0
- package/content/specialists/Especialista em Plano de Execu/303/247/303/243o com IA.md" +341 -0
- package/content/specialists/Especialista em Prototipagem R/303/241pida com Google Stitch.md" +419 -0
- package/content/specialists/Especialista em Seguran/303/247a da Informa/303/247/303/243o.md" +508 -0
- package/content/specialists/Especialista em UX Design.md +453 -0
- package/content/specialists/INDEX.md +43 -0
- package/content/templates/PRD.md +165 -0
- package/content/templates/README.md +65 -0
- package/content/templates/adr.md +103 -0
- package/content/templates/arquitetura.md +279 -0
- package/content/templates/backlog.md +185 -0
- package/content/templates/checklist-seguranca.md +180 -0
- package/content/templates/contexto.md +120 -0
- package/content/templates/criterios-aceite.md +99 -0
- package/content/templates/design-banco.md +270 -0
- package/content/templates/design-doc.md +240 -0
- package/content/templates/feature.md +88 -0
- package/content/templates/historia-backend.md +84 -0
- package/content/templates/historia-frontend.md +75 -0
- package/content/templates/historia-usuario.md +125 -0
- package/content/templates/mapa-navegacao.md +133 -0
- package/content/templates/matriz-rastreabilidade.md +121 -0
- package/content/templates/modelo-dominio.md +219 -0
- package/content/templates/plano-testes.md +199 -0
- package/content/templates/prototipo-stitch.md +138 -0
- package/content/templates/requisitos.md +162 -0
- package/content/templates/slo-sli.md +197 -0
- package/content/workflows/README-MCP.md +363 -0
- package/content/workflows/brainstorm.md +113 -0
- package/content/workflows/create.md +59 -0
- package/content/workflows/debug.md +103 -0
- package/content/workflows/deploy.md +176 -0
- package/content/workflows/enhance.md +63 -0
- package/content/workflows/mcp-debug.md +506 -0
- package/content/workflows/mcp-feature.md +385 -0
- package/content/workflows/mcp-gate.md +413 -0
- package/content/workflows/mcp-next.md +388 -0
- package/content/workflows/mcp-refactor.md +600 -0
- package/content/workflows/mcp-start.md +304 -0
- package/content/workflows/mcp-status.md +400 -0
- package/content/workflows/orchestrate.md +237 -0
- package/content/workflows/plan.md +89 -0
- package/content/workflows/preview.md +81 -0
- package/content/workflows/status.md +86 -0
- package/content/workflows/test.md +144 -0
- package/content/workflows/ui-ux-pro-max.md +296 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.js +138 -0
- package/dist/commands/update.d.ts +5 -0
- package/dist/commands/update.js +50 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +21 -0
- package/package.json +48 -0
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
# Prompt: Testes de Performance
|
|
2
|
+
|
|
3
|
+
> **Quando usar**: Antes de ir para produção, ou ao identificar gargalos
|
|
4
|
+
> **Especialista**: [Performance e Escalabilidade](../../02-especialistas/Especialista%20em%20Performance%20e%20Escalabilidade.md)
|
|
5
|
+
> **Nível**: Médio a Complexo
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Fluxo de Contexto
|
|
10
|
+
|
|
11
|
+
Antes de usar este prompt, tenha em mãos:
|
|
12
|
+
- `docs/CONTEXTO.md` - Entendimento do projeto
|
|
13
|
+
- `docs/05-arquitetura/arquitetura.md` - Arquitetura e endpoints
|
|
14
|
+
- Requisitos de performance (SLAs/SLOs)
|
|
15
|
+
|
|
16
|
+
Após gerar, salve o resultado em:
|
|
17
|
+
- `tests/performance/` - Scripts de teste
|
|
18
|
+
- `docs/10-performance/baseline.md` - Resultados
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Prompt Completo
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
Atue como especialista em testes de performance e load testing.
|
|
26
|
+
|
|
27
|
+
## Contexto do Projeto
|
|
28
|
+
|
|
29
|
+
[COLE O CONTEÚDO DE docs/CONTEXTO.md]
|
|
30
|
+
|
|
31
|
+
## Stack Tecnológica
|
|
32
|
+
|
|
33
|
+
- Backend: [Framework/Linguagem]
|
|
34
|
+
- Banco de dados: [Tipo]
|
|
35
|
+
- Cache: [Redis/Memcached/Nenhum]
|
|
36
|
+
- Infra: [Cloud provider, região]
|
|
37
|
+
|
|
38
|
+
## Endpoints a Testar
|
|
39
|
+
|
|
40
|
+
| Endpoint | Método | Criticidade | SLA (p95) |
|
|
41
|
+
|----------|--------|-------------|-----------|
|
|
42
|
+
| /api/auth/login | POST | Alta | 200ms |
|
|
43
|
+
| /api/products | GET | Alta | 100ms |
|
|
44
|
+
| /api/orders | POST | Crítica | 500ms |
|
|
45
|
+
|
|
46
|
+
## Requisitos de Performance
|
|
47
|
+
|
|
48
|
+
- Usuários simultâneos esperados: [número]
|
|
49
|
+
- Requests por segundo (RPS): [número]
|
|
50
|
+
- Latência p95 aceitável: [ms]
|
|
51
|
+
- Latência p99 aceitável: [ms]
|
|
52
|
+
- Taxa de erro aceitável: [%]
|
|
53
|
+
|
|
54
|
+
## Ferramenta
|
|
55
|
+
|
|
56
|
+
- [ ] k6
|
|
57
|
+
- [ ] Artillery
|
|
58
|
+
- [ ] JMeter
|
|
59
|
+
- [ ] Locust
|
|
60
|
+
- [ ] Gatling
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Sua Missão
|
|
65
|
+
|
|
66
|
+
Gere testes de performance completos:
|
|
67
|
+
|
|
68
|
+
### 1. Estrutura do Projeto
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
tests/performance/
|
|
72
|
+
├── scripts/
|
|
73
|
+
│ ├── smoke.js
|
|
74
|
+
│ ├── load.js
|
|
75
|
+
│ ├── stress.js
|
|
76
|
+
│ └── soak.js
|
|
77
|
+
├── scenarios/
|
|
78
|
+
│ ├── auth-flow.js
|
|
79
|
+
│ └── checkout-flow.js
|
|
80
|
+
├── lib/
|
|
81
|
+
│ ├── helpers.js
|
|
82
|
+
│ └── config.js
|
|
83
|
+
├── data/
|
|
84
|
+
│ └── users.csv
|
|
85
|
+
└── results/
|
|
86
|
+
└── .gitkeep
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 2. Configuração Base (k6)
|
|
90
|
+
|
|
91
|
+
```javascript
|
|
92
|
+
// lib/config.js
|
|
93
|
+
export const BASE_URL = __ENV.BASE_URL || 'http://localhost:3000';
|
|
94
|
+
|
|
95
|
+
export const thresholds = {
|
|
96
|
+
http_req_duration: ['p(95)<200', 'p(99)<500'],
|
|
97
|
+
http_req_failed: ['rate<0.01'], // < 1% de erro
|
|
98
|
+
http_reqs: ['rate>100'], // > 100 RPS
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export const defaultHeaders = {
|
|
102
|
+
'Content-Type': 'application/json',
|
|
103
|
+
'Accept': 'application/json',
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// lib/helpers.js
|
|
107
|
+
import http from 'k6/http';
|
|
108
|
+
import { check, sleep } from 'k6';
|
|
109
|
+
import { BASE_URL, defaultHeaders } from './config.js';
|
|
110
|
+
|
|
111
|
+
export function login(email, password) {
|
|
112
|
+
const res = http.post(
|
|
113
|
+
`${BASE_URL}/api/auth/login`,
|
|
114
|
+
JSON.stringify({ email, password }),
|
|
115
|
+
{ headers: defaultHeaders }
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
check(res, {
|
|
119
|
+
'login successful': (r) => r.status === 200,
|
|
120
|
+
'has token': (r) => r.json('token') !== undefined,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
return res.json('token');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function authenticatedRequest(token) {
|
|
127
|
+
return {
|
|
128
|
+
...defaultHeaders,
|
|
129
|
+
'Authorization': `Bearer ${token}`,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 3. Smoke Test (Verificação Básica)
|
|
135
|
+
|
|
136
|
+
```javascript
|
|
137
|
+
// scripts/smoke.js
|
|
138
|
+
import http from 'k6/http';
|
|
139
|
+
import { check, sleep } from 'k6';
|
|
140
|
+
import { BASE_URL } from '../lib/config.js';
|
|
141
|
+
import { login } from '../lib/helpers.js';
|
|
142
|
+
|
|
143
|
+
export const options = {
|
|
144
|
+
vus: 1,
|
|
145
|
+
duration: '1m',
|
|
146
|
+
thresholds: {
|
|
147
|
+
http_req_duration: ['p(99)<1500'],
|
|
148
|
+
http_req_failed: ['rate<0.05'],
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export default function () {
|
|
153
|
+
// Health check
|
|
154
|
+
let res = http.get(`${BASE_URL}/api/health`);
|
|
155
|
+
check(res, {
|
|
156
|
+
'health check ok': (r) => r.status === 200,
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// Login
|
|
160
|
+
const token = login('test@example.com', 'Test123!');
|
|
161
|
+
|
|
162
|
+
// Endpoint protegido
|
|
163
|
+
res = http.get(`${BASE_URL}/api/me`, {
|
|
164
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
165
|
+
});
|
|
166
|
+
check(res, {
|
|
167
|
+
'authenticated request ok': (r) => r.status === 200,
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
sleep(1);
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### 4. Load Test (Carga Normal)
|
|
175
|
+
|
|
176
|
+
```javascript
|
|
177
|
+
// scripts/load.js
|
|
178
|
+
import http from 'k6/http';
|
|
179
|
+
import { check, sleep, group } from 'k6';
|
|
180
|
+
import { Counter, Trend } from 'k6/metrics';
|
|
181
|
+
import { BASE_URL, thresholds, defaultHeaders } from '../lib/config.js';
|
|
182
|
+
import { login, authenticatedRequest } from '../lib/helpers.js';
|
|
183
|
+
|
|
184
|
+
// Custom metrics
|
|
185
|
+
const ordersCreated = new Counter('orders_created');
|
|
186
|
+
const orderDuration = new Trend('order_duration');
|
|
187
|
+
|
|
188
|
+
export const options = {
|
|
189
|
+
stages: [
|
|
190
|
+
{ duration: '2m', target: 50 }, // Ramp up
|
|
191
|
+
{ duration: '5m', target: 50 }, // Stay at 50 VUs
|
|
192
|
+
{ duration: '2m', target: 100 }, // Ramp up more
|
|
193
|
+
{ duration: '5m', target: 100 }, // Stay at 100 VUs
|
|
194
|
+
{ duration: '2m', target: 0 }, // Ramp down
|
|
195
|
+
],
|
|
196
|
+
thresholds: {
|
|
197
|
+
http_req_duration: ['p(95)<200', 'p(99)<500'],
|
|
198
|
+
http_req_failed: ['rate<0.01'],
|
|
199
|
+
orders_created: ['count>100'],
|
|
200
|
+
order_duration: ['p(95)<1000'],
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export function setup() {
|
|
205
|
+
// Preparar dados de teste
|
|
206
|
+
const token = login('loadtest@example.com', 'Test123!');
|
|
207
|
+
return { token };
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export default function (data) {
|
|
211
|
+
const headers = authenticatedRequest(data.token);
|
|
212
|
+
|
|
213
|
+
group('browsing', () => {
|
|
214
|
+
// Listar produtos
|
|
215
|
+
let res = http.get(`${BASE_URL}/api/products`, { headers });
|
|
216
|
+
check(res, {
|
|
217
|
+
'products loaded': (r) => r.status === 200,
|
|
218
|
+
'has products': (r) => r.json('data').length > 0,
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
sleep(Math.random() * 2); // Think time
|
|
222
|
+
|
|
223
|
+
// Ver detalhes
|
|
224
|
+
res = http.get(`${BASE_URL}/api/products/1`, { headers });
|
|
225
|
+
check(res, { 'product detail ok': (r) => r.status === 200 });
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
group('checkout', () => {
|
|
229
|
+
const start = Date.now();
|
|
230
|
+
|
|
231
|
+
// Criar pedido
|
|
232
|
+
const orderData = {
|
|
233
|
+
items: [{ productId: 1, quantity: 1 }],
|
|
234
|
+
addressId: 1,
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
const res = http.post(
|
|
238
|
+
`${BASE_URL}/api/orders`,
|
|
239
|
+
JSON.stringify(orderData),
|
|
240
|
+
{ headers }
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
const success = check(res, {
|
|
244
|
+
'order created': (r) => r.status === 201,
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
if (success) {
|
|
248
|
+
ordersCreated.add(1);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
orderDuration.add(Date.now() - start);
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
sleep(1);
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
### 5. Stress Test (Encontrar Limite)
|
|
259
|
+
|
|
260
|
+
```javascript
|
|
261
|
+
// scripts/stress.js
|
|
262
|
+
import http from 'k6/http';
|
|
263
|
+
import { check, sleep } from 'k6';
|
|
264
|
+
import { BASE_URL } from '../lib/config.js';
|
|
265
|
+
|
|
266
|
+
export const options = {
|
|
267
|
+
stages: [
|
|
268
|
+
{ duration: '2m', target: 100 },
|
|
269
|
+
{ duration: '5m', target: 100 },
|
|
270
|
+
{ duration: '2m', target: 200 },
|
|
271
|
+
{ duration: '5m', target: 200 },
|
|
272
|
+
{ duration: '2m', target: 300 }, // Acima do esperado
|
|
273
|
+
{ duration: '5m', target: 300 },
|
|
274
|
+
{ duration: '2m', target: 400 }, // Estressar
|
|
275
|
+
{ duration: '5m', target: 400 },
|
|
276
|
+
{ duration: '10m', target: 0 }, // Recovery
|
|
277
|
+
],
|
|
278
|
+
thresholds: {
|
|
279
|
+
http_req_duration: ['p(95)<500'], // Mais tolerante
|
|
280
|
+
http_req_failed: ['rate<0.10'], // Até 10% de erro
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
export default function () {
|
|
285
|
+
const res = http.get(`${BASE_URL}/api/products`);
|
|
286
|
+
check(res, {
|
|
287
|
+
'status is 200 or 503': (r) => [200, 503].includes(r.status),
|
|
288
|
+
});
|
|
289
|
+
sleep(0.5);
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
### 6. Soak Test (Longa Duração)
|
|
294
|
+
|
|
295
|
+
```javascript
|
|
296
|
+
// scripts/soak.js
|
|
297
|
+
import http from 'k6/http';
|
|
298
|
+
import { check, sleep } from 'k6';
|
|
299
|
+
import { BASE_URL } from '../lib/config.js';
|
|
300
|
+
import { login, authenticatedRequest } from '../lib/helpers.js';
|
|
301
|
+
|
|
302
|
+
export const options = {
|
|
303
|
+
stages: [
|
|
304
|
+
{ duration: '5m', target: 50 }, // Ramp up
|
|
305
|
+
{ duration: '4h', target: 50 }, // 4 horas de carga constante
|
|
306
|
+
{ duration: '5m', target: 0 }, // Ramp down
|
|
307
|
+
],
|
|
308
|
+
thresholds: {
|
|
309
|
+
http_req_duration: ['p(95)<200'],
|
|
310
|
+
http_req_failed: ['rate<0.01'],
|
|
311
|
+
},
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
// Detecção de memory leak: monitorar métricas do servidor
|
|
315
|
+
// durante a execução deste teste
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### 7. Cenário de Fluxo Realista
|
|
319
|
+
|
|
320
|
+
```javascript
|
|
321
|
+
// scenarios/checkout-flow.js
|
|
322
|
+
import http from 'k6/http';
|
|
323
|
+
import { check, sleep, group } from 'k6';
|
|
324
|
+
import { SharedArray } from 'k6/data';
|
|
325
|
+
import { BASE_URL } from '../lib/config.js';
|
|
326
|
+
|
|
327
|
+
// Carregar dados de usuários de CSV
|
|
328
|
+
const users = new SharedArray('users', function () {
|
|
329
|
+
return open('../data/users.csv').split('\n').slice(1).map(line => {
|
|
330
|
+
const [email, password] = line.split(',');
|
|
331
|
+
return { email, password };
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
export const options = {
|
|
336
|
+
scenarios: {
|
|
337
|
+
checkout_flow: {
|
|
338
|
+
executor: 'ramping-vus',
|
|
339
|
+
startVUs: 0,
|
|
340
|
+
stages: [
|
|
341
|
+
{ duration: '5m', target: 20 },
|
|
342
|
+
{ duration: '10m', target: 20 },
|
|
343
|
+
{ duration: '5m', target: 0 },
|
|
344
|
+
],
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
export default function () {
|
|
350
|
+
const user = users[Math.floor(Math.random() * users.length)];
|
|
351
|
+
|
|
352
|
+
group('1. Login', () => {
|
|
353
|
+
const res = http.post(`${BASE_URL}/api/auth/login`,
|
|
354
|
+
JSON.stringify(user),
|
|
355
|
+
{ headers: { 'Content-Type': 'application/json' } }
|
|
356
|
+
);
|
|
357
|
+
check(res, { 'login ok': (r) => r.status === 200 });
|
|
358
|
+
return res.json('token');
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
sleep(2); // Thinking time
|
|
362
|
+
|
|
363
|
+
group('2. Browse products', () => {
|
|
364
|
+
http.get(`${BASE_URL}/api/products`);
|
|
365
|
+
sleep(3);
|
|
366
|
+
http.get(`${BASE_URL}/api/products/featured`);
|
|
367
|
+
sleep(2);
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
group('3. Add to cart', () => {
|
|
371
|
+
http.post(`${BASE_URL}/api/cart/items`,
|
|
372
|
+
JSON.stringify({ productId: 1, quantity: 1 })
|
|
373
|
+
);
|
|
374
|
+
sleep(1);
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
group('4. Checkout', () => {
|
|
378
|
+
http.get(`${BASE_URL}/api/cart`);
|
|
379
|
+
sleep(2);
|
|
380
|
+
http.post(`${BASE_URL}/api/orders`, JSON.stringify({ /* ... */ }));
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
sleep(5);
|
|
384
|
+
}
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### 8. Análise de Resultados
|
|
388
|
+
|
|
389
|
+
```javascript
|
|
390
|
+
// handleSummary para relatório customizado
|
|
391
|
+
export function handleSummary(data) {
|
|
392
|
+
const summary = {
|
|
393
|
+
timestamp: new Date().toISOString(),
|
|
394
|
+
duration: data.state.testRunDurationMs,
|
|
395
|
+
metrics: {
|
|
396
|
+
http_reqs: data.metrics.http_reqs?.values?.count || 0,
|
|
397
|
+
http_req_duration_p95: data.metrics.http_req_duration?.values['p(95)'],
|
|
398
|
+
http_req_duration_p99: data.metrics.http_req_duration?.values['p(99)'],
|
|
399
|
+
http_req_failed_rate: data.metrics.http_req_failed?.values?.rate,
|
|
400
|
+
},
|
|
401
|
+
thresholds: data.thresholds,
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
return {
|
|
405
|
+
'results/summary.json': JSON.stringify(summary, null, 2),
|
|
406
|
+
'results/report.html': htmlReport(data),
|
|
407
|
+
stdout: textSummary(data, { indent: ' ', enableColors: true }),
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### 9. Comandos e CI
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
# Executar testes
|
|
416
|
+
k6 run scripts/smoke.js
|
|
417
|
+
k6 run scripts/load.js --env BASE_URL=https://staging.example.com
|
|
418
|
+
k6 run scripts/stress.js --out json=results/stress.json
|
|
419
|
+
|
|
420
|
+
# Com métricas para Grafana
|
|
421
|
+
k6 run scripts/load.js --out influxdb=http://localhost:8086/k6
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
```yaml
|
|
425
|
+
# .github/workflows/performance.yml
|
|
426
|
+
name: Performance Tests
|
|
427
|
+
|
|
428
|
+
on:
|
|
429
|
+
workflow_dispatch:
|
|
430
|
+
schedule:
|
|
431
|
+
- cron: '0 6 * * *' # Diário às 6h
|
|
432
|
+
|
|
433
|
+
jobs:
|
|
434
|
+
load-test:
|
|
435
|
+
runs-on: ubuntu-latest
|
|
436
|
+
steps:
|
|
437
|
+
- uses: actions/checkout@v4
|
|
438
|
+
- uses: grafana/k6-action@v0.3.1
|
|
439
|
+
with:
|
|
440
|
+
filename: tests/performance/scripts/load.js
|
|
441
|
+
flags: --env BASE_URL=${{ secrets.STAGING_URL }}
|
|
442
|
+
```
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
## Checklist Pós-Geração
|
|
448
|
+
|
|
449
|
+
- [ ] Smoke test criado (verificação rápida)
|
|
450
|
+
- [ ] Load test com cenário realista
|
|
451
|
+
- [ ] Stress test para encontrar limites
|
|
452
|
+
- [ ] Soak test para detecção de leaks (opcional)
|
|
453
|
+
- [ ] Thresholds definidos (latência, erro, RPS)
|
|
454
|
+
- [ ] Custom metrics para métricas de negócio
|
|
455
|
+
- [ ] Think times realistas entre requests
|
|
456
|
+
- [ ] Dados de teste variados (CSV/JSON)
|
|
457
|
+
- [ ] handleSummary para relatórios
|
|
458
|
+
- [ ] CI configurado para execução regular
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Prompt: Gerar Prompts para Google Stitch
|
|
2
|
+
|
|
3
|
+
## Quando Usar
|
|
4
|
+
Após ter os requisitos definidos, use este prompt para gerar entradas otimizadas para o Google Stitch (stitch.withgoogle.com).
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Prompt Principal
|
|
9
|
+
|
|
10
|
+
```text
|
|
11
|
+
Atue como especialista em UI/UX e prototipagem com IA.
|
|
12
|
+
|
|
13
|
+
Contexto do projeto:
|
|
14
|
+
[COLE O CONTEÚDO DE docs/CONTEXTO.md]
|
|
15
|
+
|
|
16
|
+
Requisitos funcionais:
|
|
17
|
+
[COLE OS RFs DE docs/02-requisitos/requisitos.md]
|
|
18
|
+
|
|
19
|
+
Sua tarefa: Gerar prompts otimizados em INGLÊS para o Google Stitch
|
|
20
|
+
(stitch.withgoogle.com) que criarão protótipos de UI de alta qualidade.
|
|
21
|
+
|
|
22
|
+
Para cada tela principal do sistema, forneça:
|
|
23
|
+
|
|
24
|
+
## Tela: [Nome em português]
|
|
25
|
+
|
|
26
|
+
### Prompt para o Stitch (copiar e colar)
|
|
27
|
+
```
|
|
28
|
+
[Prompt em inglês, 3-6 linhas, detalhado]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Componentes Esperados
|
|
32
|
+
- [Lista de componentes que devem aparecer]
|
|
33
|
+
|
|
34
|
+
### Campos de Dados
|
|
35
|
+
- [Campos que precisam existir, mapeados aos requisitos]
|
|
36
|
+
|
|
37
|
+
### Sugestão Visual
|
|
38
|
+
- Tema: [dark/light]
|
|
39
|
+
- Cor principal: [hex ou nome]
|
|
40
|
+
- Estilo: [modern/minimal/corporate/playful]
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
Gere prompts para as seguintes telas principais:
|
|
45
|
+
1. [Tela de login/home]
|
|
46
|
+
2. [Dashboard/listagem principal]
|
|
47
|
+
3. [Formulário principal]
|
|
48
|
+
4. [Detalhes/visualização]
|
|
49
|
+
5. [Outras telas críticas baseadas nos requisitos]
|
|
50
|
+
|
|
51
|
+
Dicas para os prompts:
|
|
52
|
+
- Use inglês (Stitch funciona melhor)
|
|
53
|
+
- Seja específico sobre layout e componentes
|
|
54
|
+
- Mencione cores e tema
|
|
55
|
+
- Descreva hierarquia visual
|
|
56
|
+
- Inclua tipo (mobile app / web app / dashboard)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Prompt de Análise (Após Testar no Stitch)
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
Testei o protótipo no Google Stitch e exportei o código.
|
|
65
|
+
|
|
66
|
+
Contexto do projeto:
|
|
67
|
+
[COLE O CONTEÚDO DE docs/CONTEXTO.md]
|
|
68
|
+
|
|
69
|
+
Código HTML/CSS ou React gerado:
|
|
70
|
+
[COLE O CÓDIGO]
|
|
71
|
+
|
|
72
|
+
Analise o código gerado e:
|
|
73
|
+
|
|
74
|
+
## 1. Componentes Identificados
|
|
75
|
+
Liste cada componente visual encontrado no código.
|
|
76
|
+
|
|
77
|
+
## 2. Mapeamento para o Domínio
|
|
78
|
+
Relacione elementos de UI com entidades/campos dos requisitos.
|
|
79
|
+
|
|
80
|
+
## 3. Componentes Reutilizáveis
|
|
81
|
+
Identifique padrões que aparecem múltiplas vezes e podem virar componentes.
|
|
82
|
+
|
|
83
|
+
## 4. Estrutura de Pastas Sugerida
|
|
84
|
+
Proponha organização para os componentes no projeto.
|
|
85
|
+
|
|
86
|
+
## 5. Ajustes Necessários
|
|
87
|
+
O que precisa ser modificado para alinhar com a arquitetura planejada?
|
|
88
|
+
|
|
89
|
+
## 6. Próximos Passos
|
|
90
|
+
O que o UX Designer deve refinar a partir deste protótipo?
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Exemplos de Prompts de Alta Qualidade
|
|
96
|
+
|
|
97
|
+
### Dashboard SaaS
|
|
98
|
+
```
|
|
99
|
+
Create a modern SaaS analytics dashboard with:
|
|
100
|
+
- Top navbar: logo on left, search bar center, user avatar and notification bell right
|
|
101
|
+
- Left sidebar: collapsible menu with icons for Dashboard, Analytics, Reports, Settings
|
|
102
|
+
- Main area: 4 KPI cards in a row showing metrics with sparkline charts
|
|
103
|
+
- Below cards: large area chart showing trends over time
|
|
104
|
+
- Bottom section: data table with sortable columns and pagination
|
|
105
|
+
- Use Inter font, white background, blue (#3B82F6) accent color
|
|
106
|
+
- Add subtle shadows and rounded corners for modern feel
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Mobile E-commerce
|
|
110
|
+
```
|
|
111
|
+
Design a mobile product listing page for a fashion e-commerce app:
|
|
112
|
+
- Top: search bar with filter icon and cart badge
|
|
113
|
+
- Category pills: horizontally scrollable chips for Women, Men, Kids, Sale
|
|
114
|
+
- Product grid: 2 columns of product cards with image, name, price, heart icon
|
|
115
|
+
- Each card has rounded corners and subtle shadow on tap
|
|
116
|
+
- Floating filter button at bottom right corner
|
|
117
|
+
- Bottom navigation: Home, Categories, Wishlist, Cart, Profile
|
|
118
|
+
- Clean white theme with coral (#FF6B6B) accent for sale items
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Formulário Complexo
|
|
122
|
+
```
|
|
123
|
+
Create a multi-step form for user onboarding:
|
|
124
|
+
- Progress bar at top showing 4 steps with current step highlighted
|
|
125
|
+
- Step 1: Personal info - name, email, phone fields with labels above
|
|
126
|
+
- Avatar upload circle with camera icon
|
|
127
|
+
- Date picker for birthdate
|
|
128
|
+
- "Next" button at bottom, full width, primary color
|
|
129
|
+
- Validation states: red outline for errors, green checkmark for valid
|
|
130
|
+
- Light theme, plenty of whitespace, modern sans-serif font
|
|
131
|
+
- Subtle animations mentioned but not implemented
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Fluxo Completo
|
|
137
|
+
|
|
138
|
+
```mermaid
|
|
139
|
+
flowchart TD
|
|
140
|
+
A[Requisitos prontos] --> B[Gerar prompts com IA]
|
|
141
|
+
B --> C[Copiar prompt]
|
|
142
|
+
C --> D[Colar no stitch.withgoogle.com]
|
|
143
|
+
D --> E{Gostou do resultado?}
|
|
144
|
+
E -->|Não| F[Ajustar prompt]
|
|
145
|
+
F --> D
|
|
146
|
+
E -->|Sim| G[Validar com stakeholders]
|
|
147
|
+
G --> H[Exportar código]
|
|
148
|
+
H --> I[Colar código na IA]
|
|
149
|
+
I --> J[IA analisa e organiza]
|
|
150
|
+
J --> K[Prosseguir para UX Design]
|
|
151
|
+
```
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-patterns
|
|
3
|
+
description: API design principles and decision-making. REST vs GraphQL vs tRPC selection, response formats, versioning, pagination.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Glob, Grep
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# API Patterns
|
|
8
|
+
|
|
9
|
+
> API design principles and decision-making for 2025.
|
|
10
|
+
> **Learn to THINK, not copy fixed patterns.**
|
|
11
|
+
|
|
12
|
+
## 🎯 Selective Reading Rule
|
|
13
|
+
|
|
14
|
+
**Read ONLY files relevant to the request!** Check the content map, find what you need.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 📑 Content Map
|
|
19
|
+
|
|
20
|
+
| File | Description | When to Read |
|
|
21
|
+
|------|-------------|--------------|
|
|
22
|
+
| `api-style.md` | REST vs GraphQL vs tRPC decision tree | Choosing API type |
|
|
23
|
+
| `rest.md` | Resource naming, HTTP methods, status codes | Designing REST API |
|
|
24
|
+
| `response.md` | Envelope pattern, error format, pagination | Response structure |
|
|
25
|
+
| `graphql.md` | Schema design, when to use, security | Considering GraphQL |
|
|
26
|
+
| `trpc.md` | TypeScript monorepo, type safety | TS fullstack projects |
|
|
27
|
+
| `versioning.md` | URI/Header/Query versioning | API evolution planning |
|
|
28
|
+
| `auth.md` | JWT, OAuth, Passkey, API Keys | Auth pattern selection |
|
|
29
|
+
| `rate-limiting.md` | Token bucket, sliding window | API protection |
|
|
30
|
+
| `documentation.md` | OpenAPI/Swagger best practices | Documentation |
|
|
31
|
+
| `security-testing.md` | OWASP API Top 10, auth/authz testing | Security audits |
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 🔗 Related Skills
|
|
36
|
+
|
|
37
|
+
| Need | Skill |
|
|
38
|
+
|------|-------|
|
|
39
|
+
| API implementation | `@[skills/backend-development]` |
|
|
40
|
+
| Data structure | `@[skills/database-design]` |
|
|
41
|
+
| Security details | `@[skills/security-hardening]` |
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## ✅ Decision Checklist
|
|
46
|
+
|
|
47
|
+
Before designing an API:
|
|
48
|
+
|
|
49
|
+
- [ ] **Asked user about API consumers?**
|
|
50
|
+
- [ ] **Chosen API style for THIS context?** (REST/GraphQL/tRPC)
|
|
51
|
+
- [ ] **Defined consistent response format?**
|
|
52
|
+
- [ ] **Planned versioning strategy?**
|
|
53
|
+
- [ ] **Considered authentication needs?**
|
|
54
|
+
- [ ] **Planned rate limiting?**
|
|
55
|
+
- [ ] **Documentation approach defined?**
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## ❌ Anti-Patterns
|
|
60
|
+
|
|
61
|
+
**DON'T:**
|
|
62
|
+
- Default to REST for everything
|
|
63
|
+
- Use verbs in REST endpoints (/getUsers)
|
|
64
|
+
- Return inconsistent response formats
|
|
65
|
+
- Expose internal errors to clients
|
|
66
|
+
- Skip rate limiting
|
|
67
|
+
|
|
68
|
+
**DO:**
|
|
69
|
+
- Choose API style based on context
|
|
70
|
+
- Ask about client requirements
|
|
71
|
+
- Document thoroughly
|
|
72
|
+
- Use appropriate status codes
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Script
|
|
77
|
+
|
|
78
|
+
| Script | Purpose | Command |
|
|
79
|
+
|--------|---------|---------|
|
|
80
|
+
| `scripts/api_validator.py` | API endpoint validation | `python scripts/api_validator.py <project_path>` |
|
|
81
|
+
|