원클릭으로
test-driven-development
Use when implementing any feature or bugfix. Write the test first, always.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when implementing any feature or bugfix. Write the test first, always.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Check for drift between spec.md, plan.md, tasks.md, and the actual code. Reports the gaps; does not fix them.
Run a category-specific quality pass (security / performance / accessibility / i18n / privacy / observability) against the current plan and code.
Surface [NEEDS CLARIFICATION] markers in spec.md (or plan.md) to the user, one at a time, and edit the file with the answers.
Bootstrap or amend constitution.md (framework, preset, or project). Inspects existing project context first; enforces the amendment process: issue first, one article per PR, reviewer non-author.
Print the pipeline quick-reference — a one-screen summary of every /aia:* command and its hand-offs, prefixed by a state-aware "Próximo passo" line.
Execute an approved plan + tasks list by dispatching one fresh subagent per task and applying two-stage review (spec compliance, then code quality) before moving on.
| name | test-driven-development |
| description | Use when implementing any feature or bugfix. Write the test first, always. |
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
Wrote code before the test? Delete it. Start over. No exceptions.
Write ONE minimal test showing what should happen.
Requirements:
Verify RED — MANDATORY:
Write the simplest code to make the test pass. Do not add features, do not refactor other code.
Verify GREEN — MANDATORY:
Only after green. Keep tests green. Do not add behavior.
# Location: backend/<app>/tests/test_<module>.py
import pytest
from <app>.models import MyModel
from tests.factories import UserFactory, MyModelFactory
@pytest.mark.django_db
def test_my_behavior(db):
# Arrange
user = UserFactory()
obj = MyModelFactory(user=user, status='pending')
# Act
result = my_service.process(obj.id)
# Assert
assert result.status == 'processed'
obj.refresh_from_db()
assert obj.status == 'processed'
@pytest.mark.django_db
def test_my_authenticated_endpoint(api_client, user_factory):
user = user_factory()
api_client.force_authenticate(user=user)
response = api_client.post('/api/v1/<app>/action/', {'field': 'value'})
assert response.status_code == 201
assert response.data['field'] == 'value'
Run:
cd backend && pytest tests/<app>/test_<module>.py::test_my_behavior -v
@pytest.mark.django_db
def test_my_task_processes_demand(db):
demand = DemandFactory(status='pending')
# Execute task synchronously in test
result = my_task.apply(args=[str(demand.id)])
assert result.successful()
demand.refresh_from_db()
assert demand.status == 'completed'
from unittest.mock import patch, MagicMock
def test_ai_service_generates_content():
mock_result = MagicMock()
mock_result.content = '{"title": "Test", "content": "Content"}'
mock_result.total_tokens = 100
with patch('ai.service.AIService._call', return_value=mock_result):
service = AIService()
result = service.generate_diary(date='2026-03-16', commits=[])
assert result['title'] == 'Test'
assert result['content'] == 'Content'
// Location: frontend/src/__tests__/<Component>.test.tsx
import { render, screen, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { MyComponent } from '../components/MyComponent';
const queryClient = new QueryClient({
defaultOptions: { queries: { retry: false } },
});
const wrapper = ({ children }: { children: React.ReactNode }) => (
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
);
test('should display data after loading', async () => {
render(<MyComponent />, { wrapper });
expect(screen.getByRole('progressbar')).toBeInTheDocument();
await waitFor(() => expect(screen.getByText('Expected Data')).toBeInTheDocument());
});
Run:
cd frontend && npx jest --no-coverage src/__tests__/MyComponent.test.tsx
// Location: <mobile-dir>/src/__tests__/<Screen>.test.tsx
import { render, screen } from '@testing-library/react-native';
import { MyScreen } from '../screens/MyScreen';
test('should render items list', async () => {
render(<MyScreen />);
await screen.findByText('Expected Item');
expect(screen.getByText('Expected Item')).toBeTruthy();
});
Run:
cd <mobile-dir> && npx jest --no-coverage src/__tests__/MyScreen.test.tsx
Thinking about skipping TDD this time? Stop. That's rationalization.
Always commit in complete cycles:
# After GREEN for each test
git add <tested-and-implemented-files>
git commit -m "test(<app>): RED→GREEN <tested-behavior>"