maestro-bundle 1.3.1 → 1.4.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.
Files changed (116) hide show
  1. package/package.json +1 -1
  2. package/templates/bundle-ai-agents/skills/agent-orchestration/SKILL.md +107 -41
  3. package/templates/bundle-ai-agents/skills/agent-orchestration/references/graph-patterns.md +50 -0
  4. package/templates/bundle-ai-agents/skills/agent-orchestration/references/routing-strategies.md +47 -0
  5. package/templates/bundle-ai-agents/skills/api-design/SKILL.md +125 -16
  6. package/templates/bundle-ai-agents/skills/api-design/references/pydantic-patterns.md +72 -0
  7. package/templates/bundle-ai-agents/skills/api-design/references/rest-conventions.md +51 -0
  8. package/templates/bundle-ai-agents/skills/clean-architecture/SKILL.md +113 -21
  9. package/templates/bundle-ai-agents/skills/clean-architecture/references/dependency-injection.md +60 -0
  10. package/templates/bundle-ai-agents/skills/clean-architecture/references/layer-rules.md +56 -0
  11. package/templates/bundle-ai-agents/skills/context-engineering/SKILL.md +104 -36
  12. package/templates/bundle-ai-agents/skills/context-engineering/references/compression-techniques.md +76 -0
  13. package/templates/bundle-ai-agents/skills/context-engineering/references/context-budget-calculator.md +45 -0
  14. package/templates/bundle-ai-agents/skills/database-modeling/SKILL.md +146 -19
  15. package/templates/bundle-ai-agents/skills/database-modeling/references/index-strategies.md +48 -0
  16. package/templates/bundle-ai-agents/skills/database-modeling/references/naming-conventions.md +27 -0
  17. package/templates/bundle-ai-agents/skills/docker-containerization/SKILL.md +124 -15
  18. package/templates/bundle-ai-agents/skills/docker-containerization/references/compose-patterns.md +97 -0
  19. package/templates/bundle-ai-agents/skills/docker-containerization/references/dockerfile-checklist.md +37 -0
  20. package/templates/bundle-ai-agents/skills/eval-testing/SKILL.md +113 -25
  21. package/templates/bundle-ai-agents/skills/eval-testing/references/eval-types.md +52 -0
  22. package/templates/bundle-ai-agents/skills/eval-testing/references/golden-dataset-template.md +59 -0
  23. package/templates/bundle-ai-agents/skills/memory-management/SKILL.md +112 -28
  24. package/templates/bundle-ai-agents/skills/memory-management/references/memory-tiers.md +41 -0
  25. package/templates/bundle-ai-agents/skills/memory-management/references/namespace-conventions.md +41 -0
  26. package/templates/bundle-ai-agents/skills/prompt-engineering/SKILL.md +139 -47
  27. package/templates/bundle-ai-agents/skills/prompt-engineering/references/anti-patterns.md +59 -0
  28. package/templates/bundle-ai-agents/skills/prompt-engineering/references/prompt-templates.md +75 -0
  29. package/templates/bundle-ai-agents/skills/rag-pipeline/SKILL.md +104 -27
  30. package/templates/bundle-ai-agents/skills/rag-pipeline/references/chunking-strategies.md +27 -0
  31. package/templates/bundle-ai-agents/skills/rag-pipeline/references/embedding-models.md +31 -0
  32. package/templates/bundle-ai-agents/skills/rag-pipeline/references/rag-evaluation.md +39 -0
  33. package/templates/bundle-ai-agents/skills/testing-strategy/SKILL.md +127 -18
  34. package/templates/bundle-ai-agents/skills/testing-strategy/references/fixture-patterns.md +81 -0
  35. package/templates/bundle-ai-agents/skills/testing-strategy/references/naming-conventions.md +69 -0
  36. package/templates/bundle-base/skills/branch-strategy/SKILL.md +134 -21
  37. package/templates/bundle-base/skills/branch-strategy/references/branch-rules.md +40 -0
  38. package/templates/bundle-base/skills/code-review/SKILL.md +123 -38
  39. package/templates/bundle-base/skills/code-review/references/review-checklist.md +45 -0
  40. package/templates/bundle-base/skills/commit-pattern/SKILL.md +98 -39
  41. package/templates/bundle-base/skills/commit-pattern/references/conventional-commits.md +40 -0
  42. package/templates/bundle-data-pipeline/skills/data-preprocessing/SKILL.md +110 -19
  43. package/templates/bundle-data-pipeline/skills/data-preprocessing/references/pandas-cheatsheet.md +63 -0
  44. package/templates/bundle-data-pipeline/skills/data-preprocessing/references/pandera-schemas.md +44 -0
  45. package/templates/bundle-data-pipeline/skills/docker-containerization/SKILL.md +132 -16
  46. package/templates/bundle-data-pipeline/skills/docker-containerization/references/compose-patterns.md +82 -0
  47. package/templates/bundle-data-pipeline/skills/docker-containerization/references/dockerfile-best-practices.md +57 -0
  48. package/templates/bundle-data-pipeline/skills/feature-engineering/SKILL.md +143 -45
  49. package/templates/bundle-data-pipeline/skills/feature-engineering/references/encoding-guide.md +41 -0
  50. package/templates/bundle-data-pipeline/skills/feature-engineering/references/scaling-guide.md +38 -0
  51. package/templates/bundle-data-pipeline/skills/mlops-pipeline/SKILL.md +156 -37
  52. package/templates/bundle-data-pipeline/skills/mlops-pipeline/references/mlflow-commands.md +69 -0
  53. package/templates/bundle-data-pipeline/skills/model-training/SKILL.md +152 -33
  54. package/templates/bundle-data-pipeline/skills/model-training/references/evaluation-metrics.md +52 -0
  55. package/templates/bundle-data-pipeline/skills/model-training/references/model-selection-guide.md +41 -0
  56. package/templates/bundle-data-pipeline/skills/rag-pipeline/SKILL.md +127 -39
  57. package/templates/bundle-data-pipeline/skills/rag-pipeline/references/chunking-strategies.md +51 -0
  58. package/templates/bundle-data-pipeline/skills/rag-pipeline/references/embedding-models.md +49 -0
  59. package/templates/bundle-frontend-spa/skills/authentication/SKILL.md +196 -13
  60. package/templates/bundle-frontend-spa/skills/authentication/references/jwt-security.md +41 -0
  61. package/templates/bundle-frontend-spa/skills/component-design/SKILL.md +191 -41
  62. package/templates/bundle-frontend-spa/skills/component-design/references/accessibility-checklist.md +41 -0
  63. package/templates/bundle-frontend-spa/skills/component-design/references/tailwind-patterns.md +65 -0
  64. package/templates/bundle-frontend-spa/skills/e2e-testing/SKILL.md +241 -79
  65. package/templates/bundle-frontend-spa/skills/e2e-testing/references/playwright-selectors.md +66 -0
  66. package/templates/bundle-frontend-spa/skills/e2e-testing/references/test-patterns.md +82 -0
  67. package/templates/bundle-frontend-spa/skills/integration-api/SKILL.md +221 -31
  68. package/templates/bundle-frontend-spa/skills/integration-api/references/api-patterns.md +81 -0
  69. package/templates/bundle-frontend-spa/skills/react-patterns/SKILL.md +195 -70
  70. package/templates/bundle-frontend-spa/skills/react-patterns/references/component-checklist.md +22 -0
  71. package/templates/bundle-frontend-spa/skills/react-patterns/references/hook-patterns.md +63 -0
  72. package/templates/bundle-frontend-spa/skills/responsive-layout/SKILL.md +162 -22
  73. package/templates/bundle-frontend-spa/skills/responsive-layout/references/breakpoint-guide.md +63 -0
  74. package/templates/bundle-frontend-spa/skills/state-management/SKILL.md +158 -30
  75. package/templates/bundle-frontend-spa/skills/state-management/references/react-query-config.md +64 -0
  76. package/templates/bundle-frontend-spa/skills/state-management/references/state-patterns.md +78 -0
  77. package/templates/bundle-jhipster-microservices/skills/ci-cd-pipeline/SKILL.md +135 -45
  78. package/templates/bundle-jhipster-microservices/skills/ci-cd-pipeline/references/gitlab-ci-templates.md +93 -0
  79. package/templates/bundle-jhipster-microservices/skills/clean-architecture/SKILL.md +87 -21
  80. package/templates/bundle-jhipster-microservices/skills/clean-architecture/references/layer-rules.md +78 -0
  81. package/templates/bundle-jhipster-microservices/skills/ddd-tactical/SKILL.md +94 -25
  82. package/templates/bundle-jhipster-microservices/skills/ddd-tactical/references/ddd-patterns.md +48 -0
  83. package/templates/bundle-jhipster-microservices/skills/jhipster-angular/SKILL.md +63 -21
  84. package/templates/bundle-jhipster-microservices/skills/jhipster-angular/references/angular-microservices.md +40 -0
  85. package/templates/bundle-jhipster-microservices/skills/jhipster-angular/references/angular-structure.md +59 -0
  86. package/templates/bundle-jhipster-microservices/skills/jhipster-docker-k8s/SKILL.md +125 -91
  87. package/templates/bundle-jhipster-microservices/skills/jhipster-docker-k8s/references/docker-k8s-commands.md +68 -0
  88. package/templates/bundle-jhipster-microservices/skills/jhipster-entities/SKILL.md +72 -20
  89. package/templates/bundle-jhipster-microservices/skills/jhipster-entities/references/cross-service-entities.md +36 -0
  90. package/templates/bundle-jhipster-microservices/skills/jhipster-entities/references/jdl-types.md +56 -0
  91. package/templates/bundle-jhipster-microservices/skills/jhipster-gateway/SKILL.md +80 -8
  92. package/templates/bundle-jhipster-microservices/skills/jhipster-gateway/references/gateway-config.md +43 -0
  93. package/templates/bundle-jhipster-microservices/skills/jhipster-kafka/SKILL.md +115 -22
  94. package/templates/bundle-jhipster-microservices/skills/jhipster-kafka/references/kafka-events.md +39 -0
  95. package/templates/bundle-jhipster-microservices/skills/jhipster-registry/SKILL.md +92 -23
  96. package/templates/bundle-jhipster-microservices/skills/jhipster-registry/references/consul-config.md +61 -0
  97. package/templates/bundle-jhipster-microservices/skills/jhipster-service/SKILL.md +81 -18
  98. package/templates/bundle-jhipster-microservices/skills/jhipster-service/references/service-patterns.md +40 -0
  99. package/templates/bundle-jhipster-microservices/skills/testing-strategy/SKILL.md +101 -20
  100. package/templates/bundle-jhipster-microservices/skills/testing-strategy/references/test-naming.md +55 -0
  101. package/templates/bundle-jhipster-monorepo/skills/clean-architecture/SKILL.md +87 -21
  102. package/templates/bundle-jhipster-monorepo/skills/clean-architecture/references/layer-rules.md +78 -0
  103. package/templates/bundle-jhipster-monorepo/skills/ddd-tactical/SKILL.md +94 -25
  104. package/templates/bundle-jhipster-monorepo/skills/ddd-tactical/references/ddd-patterns.md +48 -0
  105. package/templates/bundle-jhipster-monorepo/skills/jhipster-angular/SKILL.md +99 -52
  106. package/templates/bundle-jhipster-monorepo/skills/jhipster-angular/references/angular-structure.md +59 -0
  107. package/templates/bundle-jhipster-monorepo/skills/jhipster-entities/SKILL.md +89 -36
  108. package/templates/bundle-jhipster-monorepo/skills/jhipster-entities/references/jdl-types.md +56 -0
  109. package/templates/bundle-jhipster-monorepo/skills/jhipster-liquibase/SKILL.md +123 -23
  110. package/templates/bundle-jhipster-monorepo/skills/jhipster-liquibase/references/liquibase-operations.md +95 -0
  111. package/templates/bundle-jhipster-monorepo/skills/jhipster-security/SKILL.md +106 -19
  112. package/templates/bundle-jhipster-monorepo/skills/jhipster-security/references/security-checklist.md +47 -0
  113. package/templates/bundle-jhipster-monorepo/skills/jhipster-spring/SKILL.md +84 -16
  114. package/templates/bundle-jhipster-monorepo/skills/jhipster-spring/references/spring-layers.md +41 -0
  115. package/templates/bundle-jhipster-monorepo/skills/testing-strategy/SKILL.md +101 -20
  116. package/templates/bundle-jhipster-monorepo/skills/testing-strategy/references/test-naming.md +55 -0
@@ -1,27 +1,54 @@
1
1
  ---
2
2
  name: testing-strategy
3
- description: Implementar estratégia de testes com unitários, integração e e2e usando Pytest ou JUnit. Use quando for escrever testes, definir estratégia de testes, ou melhorar cobertura.
3
+ description: Implement testing strategies with unit, integration, and e2e tests using Pytest or JUnit. Use when writing tests, defining test strategy, or improving test coverage.
4
+ version: 1.0.0
5
+ author: Maestro
4
6
  ---
5
7
 
6
- # Estratégia de Testes
8
+ # Testing Strategy
7
9
 
8
- ## Pirâmide
10
+ Implement the testing pyramid with domain unit tests, integration tests for repositories, and e2e tests for API endpoints, following consistent naming and fixture patterns.
11
+
12
+ ## When to Use
13
+ - Writing tests for new features or bug fixes
14
+ - Setting up test infrastructure for a new project
15
+ - Improving test coverage on existing code
16
+ - Reviewing test quality and naming conventions
17
+ - Configuring CI/CD test pipelines
18
+
19
+ ## Available Operations
20
+ 1. Write unit tests for domain entities and value objects
21
+ 2. Write integration tests for repositories and external services
22
+ 3. Write e2e tests for API endpoints
23
+ 4. Configure test fixtures and factories
24
+ 5. Run tests and measure coverage
25
+ 6. Set up test pipelines in CI/CD
26
+
27
+ ## Multi-Step Workflow
28
+
29
+ ### Step 1: Understand the Testing Pyramid
9
30
 
10
31
  ```
11
- / E2E \ Poucos, lentos, caros
12
- / Integr. \ Moderados
13
- / Unitários \ Muitos, rápidos, baratos
32
+ / E2E \ Few, slow, expensive
33
+ / Integr. \ Moderate count
34
+ / Unit Tests \ Many, fast, cheap
14
35
  ```
15
36
 
16
- ## Testes Unitários Domínio
37
+ - **Unit tests**: Test domain logic in isolation. No database, no HTTP, no external services.
38
+ - **Integration tests**: Test adapters (repositories, clients) against real infrastructure.
39
+ - **E2E tests**: Test full API request/response cycles.
17
40
 
18
- Testar regras de negócio sem infraestrutura.
41
+ ### Step 2: Write Unit Tests for Domain Entities
42
+
43
+ Test business rules without any infrastructure dependency.
19
44
 
20
45
  ```python
21
46
  # tests/domain/test_demand.py
47
+ import pytest
48
+
22
49
  class TestDemand:
23
50
  def test_should_decompose_new_demand(self):
24
- demand = Demand(id=DemandId.generate(), description="Criar CRUD")
51
+ demand = Demand(id=DemandId.generate(), description="Create CRUD")
25
52
  planner = FakePlanner(tasks=[Task(...), Task(...)])
26
53
 
27
54
  tasks = demand.decompose(planner)
@@ -30,14 +57,14 @@ class TestDemand:
30
57
  assert demand.status == DemandStatus.PLANNED
31
58
 
32
59
  def test_should_reject_decompose_if_already_planned(self):
33
- demand = Demand(id=DemandId.generate(), description="Criar CRUD")
60
+ demand = Demand(id=DemandId.generate(), description="Create CRUD")
34
61
  demand.decompose(FakePlanner(tasks=[Task(...)]))
35
62
 
36
63
  with pytest.raises(DemandAlreadyDecomposedException):
37
64
  demand.decompose(FakePlanner(tasks=[]))
38
65
 
39
66
  def test_should_not_allow_more_than_20_tasks(self):
40
- demand = Demand(id=DemandId.generate(), description="Mega projeto")
67
+ demand = Demand(id=DemandId.generate(), description="Mega project")
41
68
  for i in range(20):
42
69
  demand.add_task(Task(...))
43
70
 
@@ -45,9 +72,10 @@ class TestDemand:
45
72
  demand.add_task(Task(...))
46
73
  ```
47
74
 
48
- ## Testes Unitários Value Objects
75
+ ### Step 3: Write Unit Tests for Value Objects
49
76
 
50
77
  ```python
78
+ # tests/domain/test_compliance_score.py
51
79
  class TestComplianceScore:
52
80
  def test_passing_score(self):
53
81
  score = ComplianceScore(85.0)
@@ -62,10 +90,16 @@ class TestComplianceScore:
62
90
  ComplianceScore(150.0)
63
91
  ```
64
92
 
65
- ## Testes de Integração Repositórios
93
+ ### Step 4: Write Integration Tests for Repositories
94
+
95
+ Test against a real database using fixtures with rollback.
66
96
 
67
97
  ```python
68
98
  # tests/infrastructure/test_pg_demand_repository.py
99
+ import pytest
100
+ from sqlalchemy import create_engine
101
+ from sqlalchemy.orm import Session
102
+
69
103
  @pytest.fixture
70
104
  def db_session():
71
105
  engine = create_engine(TEST_DATABASE_URL)
@@ -84,12 +118,87 @@ class TestPgDemandRepository:
84
118
  assert found.description == "Test"
85
119
  ```
86
120
 
87
- ## Naming
121
+ ### Step 5: Run Tests and Measure Coverage
122
+
123
+ ```bash
124
+ # Run all tests
125
+ pytest tests/ -v
126
+
127
+ # Run only unit tests
128
+ pytest tests/domain/ -v
129
+
130
+ # Run only integration tests
131
+ pytest tests/infrastructure/ -v --timeout=30
88
132
 
133
+ # Run with coverage report
134
+ pytest tests/ --cov=src --cov-report=term-missing --cov-fail-under=80
135
+
136
+ # Run specific test file
137
+ pytest tests/domain/test_demand.py -v
138
+
139
+ # Run tests matching a pattern
140
+ pytest tests/ -k "test_should_decompose" -v
89
141
  ```
90
- test_should_<resultado>_when_<condição>
91
142
 
92
- test_should_return_error_when_email_is_invalid
93
- test_should_decompose_demand_when_status_is_created
94
- test_should_reject_merge_when_conflicts_exist
143
+ ### Step 6: Set Up CI/CD Test Pipeline
144
+
145
+ ```yaml
146
+ test:
147
+ stage: test
148
+ script:
149
+ - pip install -r requirements-test.txt
150
+ - pytest tests/domain/ -v --junitxml=reports/unit.xml
151
+ - pytest tests/infrastructure/ -v --junitxml=reports/integration.xml --timeout=60
152
+ - pytest tests/ --cov=src --cov-report=xml --cov-fail-under=80
153
+ artifacts:
154
+ reports:
155
+ junit:
156
+ - reports/*.xml
157
+ coverage_report:
158
+ coverage_format: cobertura
159
+ path: coverage.xml
95
160
  ```
161
+
162
+ ## Resources
163
+ - `references/naming-conventions.md` - Test naming patterns and organization guidelines
164
+ - `references/fixture-patterns.md` - Common pytest fixture patterns and factories
165
+
166
+ ## Examples
167
+
168
+ ### Example 1: Write Tests for a New Feature
169
+ User asks: "Write tests for the new user registration feature."
170
+ Response approach:
171
+ 1. Unit test the `User` entity: valid creation, email validation, password rules
172
+ 2. Unit test the `RegisterUser` use case: happy path, duplicate email, invalid data
173
+ 3. Integration test the `PgUserRepository`: save and find
174
+ 4. E2e test the `POST /api/v1/users` endpoint: 201 on success, 422 on invalid data
175
+ 5. Run: `pytest tests/ -v --cov=src`
176
+
177
+ ### Example 2: Improve Test Coverage
178
+ User asks: "Our coverage is at 45%. Get it to 80%."
179
+ Response approach:
180
+ 1. Run `pytest --cov=src --cov-report=term-missing` to find uncovered lines
181
+ 2. Prioritize domain layer (business rules are the most valuable to test)
182
+ 3. Add edge case tests for existing entities (error paths, boundary values)
183
+ 4. Add integration tests for untested repositories
184
+ 5. Skip e2e tests for now (lowest ROI per coverage point)
185
+ 6. Target: domain 95%, application 85%, infrastructure 70%
186
+
187
+ ### Example 3: Set Up Testing for a New Project
188
+ User asks: "Set up the test infrastructure for our new Python project."
189
+ Response approach:
190
+ 1. Install dependencies: `pip install pytest pytest-cov pytest-asyncio`
191
+ 2. Create `conftest.py` with database session fixtures
192
+ 3. Create directory structure: `tests/domain/`, `tests/application/`, `tests/infrastructure/`, `tests/api/`
193
+ 4. Add `pytest.ini` or `pyproject.toml` with test configuration
194
+ 5. Create a sample test to verify the setup
195
+ 6. Add test commands to Makefile or scripts
196
+
197
+ ## Notes
198
+ - Follow the naming convention: `test_should_<result>_when_<condition>`
199
+ - Unit tests must run without any external dependencies (no DB, no HTTP)
200
+ - Use fakes/stubs for dependencies in unit tests, not mocks (fakes are more maintainable)
201
+ - Integration tests should roll back database changes after each test
202
+ - Coverage threshold: 80% minimum, but focus on testing business rules, not getters/setters
203
+ - Run unit tests first in CI (fast feedback), integration tests second, e2e last
204
+ - Each test should test one behavior -- avoid testing multiple things in a single test
@@ -0,0 +1,81 @@
1
+ # Fixture Patterns Reference
2
+
3
+ ## Database Session Fixture (with rollback)
4
+
5
+ ```python
6
+ @pytest.fixture
7
+ def db_session():
8
+ engine = create_engine(TEST_DATABASE_URL)
9
+ connection = engine.connect()
10
+ transaction = connection.begin()
11
+ session = Session(bind=connection)
12
+
13
+ yield session
14
+
15
+ session.close()
16
+ transaction.rollback()
17
+ connection.close()
18
+ ```
19
+
20
+ ## Factory Fixtures
21
+
22
+ ```python
23
+ @pytest.fixture
24
+ def make_demand():
25
+ def _make(
26
+ description: str = "Test demand",
27
+ status: DemandStatus = DemandStatus.CREATED,
28
+ ) -> Demand:
29
+ return Demand(
30
+ id=DemandId.generate(),
31
+ description=description,
32
+ status=status,
33
+ )
34
+ return _make
35
+
36
+ # Usage in test
37
+ def test_something(make_demand):
38
+ demand = make_demand(description="Custom demand")
39
+ ```
40
+
41
+ ## Async Fixtures
42
+
43
+ ```python
44
+ @pytest.fixture
45
+ async def async_client(app):
46
+ async with AsyncClient(app=app, base_url="http://test") as client:
47
+ yield client
48
+ ```
49
+
50
+ ## Fake Implementations
51
+
52
+ ```python
53
+ class FakeDemandRepository(DemandRepository):
54
+ def __init__(self):
55
+ self._demands: dict[str, Demand] = {}
56
+
57
+ def find_by_id(self, id: DemandId) -> Demand:
58
+ demand = self._demands.get(str(id))
59
+ if not demand:
60
+ raise DemandNotFoundException(id)
61
+ return demand
62
+
63
+ def save(self, demand: Demand) -> None:
64
+ self._demands[str(demand.id)] = demand
65
+
66
+ class FakeEventBus(EventBus):
67
+ def __init__(self):
68
+ self.published_events: list[DomainEvent] = []
69
+
70
+ def publish(self, event: DomainEvent) -> None:
71
+ self.published_events.append(event)
72
+ ```
73
+
74
+ ## Fixture Scoping
75
+
76
+ | Scope | Lifecycle | Use For |
77
+ |---|---|---|
78
+ | `function` (default) | Each test | Most fixtures |
79
+ | `class` | Each test class | Shared setup within a class |
80
+ | `module` | Each test file | Expensive setup (DB schema) |
81
+ | `session` | Entire test run | One-time setup (create DB) |
@@ -0,0 +1,69 @@
1
+ # Test Naming Conventions Reference
2
+
3
+ ## Test Method Naming
4
+
5
+ ```
6
+ test_should_<expected_result>_when_<condition>
7
+ ```
8
+
9
+ ### Examples
10
+
11
+ ```python
12
+ # Good names
13
+ test_should_return_error_when_email_is_invalid
14
+ test_should_decompose_demand_when_status_is_created
15
+ test_should_reject_merge_when_conflicts_exist
16
+ test_should_create_user_when_data_is_valid
17
+ test_should_raise_not_found_when_id_does_not_exist
18
+
19
+ # Bad names
20
+ test_demand() # What about demand?
21
+ test_error() # What error? When?
22
+ test_create() # Create what? Under what condition?
23
+ test_1() # Meaningless
24
+ ```
25
+
26
+ ## Test Class Naming
27
+
28
+ ```python
29
+ class TestDemand: # Domain entity tests
30
+ class TestDecomposeDemand: # Use case tests
31
+ class TestPgDemandRepository: # Repository integration tests
32
+ class TestDemandEndpoints: # API e2e tests
33
+ ```
34
+
35
+ ## File Organization
36
+
37
+ ```
38
+ tests/
39
+ domain/
40
+ test_demand.py
41
+ test_task.py
42
+ test_compliance_score.py
43
+ application/
44
+ test_decompose_demand.py
45
+ test_create_demand.py
46
+ infrastructure/
47
+ test_pg_demand_repository.py
48
+ test_pg_task_repository.py
49
+ api/
50
+ test_demand_endpoints.py
51
+ test_task_endpoints.py
52
+ conftest.py # Shared fixtures
53
+ ```
54
+
55
+ ## Test Structure (AAA Pattern)
56
+
57
+ ```python
58
+ def test_should_decompose_demand_when_status_is_created(self):
59
+ # Arrange
60
+ demand = Demand(id=DemandId.generate(), description="Create CRUD")
61
+ planner = FakePlanner(tasks=[Task(...)])
62
+
63
+ # Act
64
+ tasks = demand.decompose(planner)
65
+
66
+ # Assert
67
+ assert len(tasks) == 1
68
+ assert demand.status == DemandStatus.PLANNED
69
+ ```
@@ -1,42 +1,155 @@
1
1
  ---
2
2
  name: branch-strategy
3
- description: Criar e gerenciar branches seguindo a estratégia Git da organização. Use quando for criar branch, iniciar uma feature, ou organizar o fluxo de branches.
3
+ description: Create and manage Git branches following the organization's branching strategy. Use when creating branches, starting features, managing releases, or organizing Git workflow.
4
+ version: 1.0.0
5
+ author: Maestro
4
6
  ---
5
7
 
6
- # Estratégia de Branches Maestro
8
+ # Branch Strategy
7
9
 
8
- ## Branches permanentes
10
+ Create and manage Git branches following the Maestro branching strategy with permanent and temporary branches.
9
11
 
10
- | Branch | Propósito | Proteção |
11
- |---|---|---|
12
- | `main` | Código em produção | Protegida, só via MR aprovado |
13
- | `develop` | Integração de features | Protegida, MR com 1+ reviewer |
12
+ ## When to Use
13
+ - When creating a new feature branch
14
+ - When starting a bug fix or hotfix
15
+ - When preparing a release
16
+ - When merging branches or resolving conflicts
17
+ - When setting up agent worktrees
18
+
19
+ ## Available Operations
20
+ 1. Create a feature branch
21
+ 2. Create a fix/hotfix branch
22
+ 3. Create a release branch
23
+ 4. Rebase and prepare for merge request
24
+ 5. Set up agent worktree with isolated branch
14
25
 
15
- ## Branches temporárias
26
+ ## Multi-Step Workflow
16
27
 
17
- | Padrão | Exemplo | Origem | Destino |
28
+ ### Step 1: Identify Branch Type
29
+
30
+ | Pattern | Example | Origin | Target |
18
31
  |---|---|---|---|
19
- | `feature/<modulo>-<desc>` | `feature/demands-auto-decompose` | `develop` | `develop` |
20
- | `fix/<modulo>-<desc>` | `fix/agents-timeout-skill` | `develop` | `develop` |
32
+ | `feature/<module>-<desc>` | `feature/demands-auto-decompose` | `develop` | `develop` |
33
+ | `fix/<module>-<desc>` | `fix/agents-timeout-skill` | `develop` | `develop` |
21
34
  | `hotfix/<desc>` | `hotfix/fix-login-crash` | `main` | `main` + `develop` |
22
- | `release/<versao>` | `release/1.2.0` | `develop` | `main` + `develop` |
35
+ | `release/<version>` | `release/1.2.0` | `develop` | `main` + `develop` |
36
+
37
+ Permanent branches:
38
+
39
+ | Branch | Purpose | Protection |
40
+ |---|---|---|
41
+ | `main` | Production code | Protected, merge only via approved MR |
42
+ | `develop` | Feature integration | Protected, MR with 1+ reviewer |
43
+
44
+ ### Step 2: Create the Branch
45
+
46
+ ```bash
47
+ # Feature branch
48
+ git checkout develop
49
+ git pull origin develop
50
+ git checkout -b feature/demands-auto-decompose
23
51
 
24
- ## Fluxo para agentes do Maestro
52
+ # Fix branch
53
+ git checkout develop
54
+ git pull origin develop
55
+ git checkout -b fix/agents-timeout-skill
25
56
 
26
- Cada agente trabalha em worktree isolada com seu próprio branch:
57
+ # Hotfix branch (from main)
58
+ git checkout main
59
+ git pull origin main
60
+ git checkout -b hotfix/fix-login-crash
27
61
 
62
+ # Release branch
63
+ git checkout develop
64
+ git pull origin develop
65
+ git checkout -b release/1.2.0
66
+ ```
67
+
68
+ ### Step 3: Work and Commit
69
+ Follow the commit-pattern skill for commit messages.
70
+
71
+ ```bash
72
+ git add <files>
73
+ git commit -m "feat(demands): adicionar decomposicao automatica de tasks"
74
+ ```
75
+
76
+ ### Step 4: Rebase Before Merge Request
77
+
78
+ ```bash
79
+ git fetch origin
80
+ git rebase origin/develop
81
+ # Resolve conflicts if any, then:
82
+ git rebase --continue
83
+ ```
84
+
85
+ ### Step 5: Push and Create Merge Request
86
+
87
+ ```bash
88
+ git push origin feature/demands-auto-decompose
89
+ # Create MR via GitLab/GitHub UI or CLI
90
+ ```
91
+
92
+ ### Step 6: Clean Up After Merge
93
+
94
+ ```bash
95
+ git checkout develop
96
+ git pull origin develop
97
+ git branch -d feature/demands-auto-decompose
98
+ git push origin --delete feature/demands-auto-decompose
99
+ ```
100
+
101
+ ### Agent Worktree Flow
102
+ For Maestro agents working in isolated worktrees:
103
+
104
+ ```bash
105
+ # Create worktree for agent
106
+ git worktree add ../agent-frontend-workspace feature/agent-frontend-<task-id>
107
+
108
+ # Agent works in its worktree
109
+ cd ../agent-frontend-workspace
110
+ # ... make changes, commit ...
111
+
112
+ # Remove worktree after merge
113
+ git worktree remove ../agent-frontend-workspace
114
+ ```
115
+
116
+ Agent branch naming:
28
117
  ```
29
118
  feature/agent-frontend-<task-id>
30
119
  feature/agent-backend-<task-id>
31
120
  feature/agent-devops-<task-id>
32
121
  ```
33
122
 
34
- O agente orquestrador faz o merge após aprovação humana.
123
+ ## Resources
124
+ - `references/branch-rules.md` - Branch naming rules and protection policies
125
+
126
+ ## Examples
127
+ ### Example 1: Start a New Feature
128
+ User asks: "Create a branch for the new dashboard feature"
129
+ Response approach:
130
+ 1. Run `git checkout develop && git pull origin develop`
131
+ 2. Run `git checkout -b feature/dashboard-metrics`
132
+ 3. Confirm branch created with `git branch --show-current`
133
+
134
+ ### Example 2: Hotfix in Production
135
+ User asks: "We need to fix a critical login bug in production"
136
+ Response approach:
137
+ 1. Run `git checkout main && git pull origin main`
138
+ 2. Run `git checkout -b hotfix/fix-login-crash`
139
+ 3. After fix, merge to both `main` and `develop`
35
140
 
36
- ## Regras
141
+ ### Example 3: Prepare for Merge
142
+ User asks: "My feature is ready, prepare it for review"
143
+ Response approach:
144
+ 1. Run `git fetch origin && git rebase origin/develop`
145
+ 2. Resolve any conflicts
146
+ 3. Run `git push origin feature/<branch-name>`
147
+ 4. Guide user to create the MR
37
148
 
38
- 1. Nunca commitar direto na `main` ou `develop`
39
- 2. Branches de feature vivem no máximo 5 dias
40
- 3. Rebase antes de abrir MR (manter histórico limpo)
41
- 4. Deletar branch após merge
42
- 5. Um branch = uma task/issue
149
+ ## Notes
150
+ - Never commit directly to `main` or `develop`
151
+ - Feature branches should live at most 5 days
152
+ - Always rebase before opening MR to keep clean history
153
+ - Delete branch after merge
154
+ - One branch = one task/issue
155
+ - The orchestrator agent handles merge after human approval
@@ -0,0 +1,40 @@
1
+ # Branch Rules Reference
2
+
3
+ ## Naming Convention
4
+ ```
5
+ feature/<module>-<short-description>
6
+ fix/<module>-<short-description>
7
+ hotfix/<short-description>
8
+ release/<semver>
9
+ ```
10
+
11
+ ## Branch Lifecycle
12
+ 1. Create from correct base branch
13
+ 2. Work and commit (max 5 days for features)
14
+ 3. Rebase onto latest base before MR
15
+ 4. Open Merge Request with 1+ reviewer
16
+ 5. Merge after approval
17
+ 6. Delete branch after merge
18
+
19
+ ## Protection Rules
20
+ | Branch | Direct Push | MR Required | Reviewers |
21
+ |---|---|---|---|
22
+ | `main` | No | Yes | 2+ |
23
+ | `develop` | No | Yes | 1+ |
24
+ | `feature/*` | Yes | N/A | N/A |
25
+ | `release/*` | Yes | Yes (to main) | 2+ |
26
+
27
+ ## Agent Worktree Branches
28
+ ```
29
+ feature/agent-frontend-<task-id>
30
+ feature/agent-backend-<task-id>
31
+ feature/agent-devops-<task-id>
32
+ ```
33
+ - Each agent works in an isolated Git worktree
34
+ - Orchestrator merges after human approval
35
+ - Worktree is removed after merge
36
+
37
+ ## Merge Strategy
38
+ - Feature/Fix to develop: Squash merge (clean history)
39
+ - Release to main: Merge commit (preserve history)
40
+ - Hotfix to main: Merge commit, then cherry-pick to develop