Overview
This skill analyzes architecture files to identify all external integrations (APIs, services, databases, etc.), then generates:
- Function wrappers (
function_*.py) — Clean, tested functions that use each integration exactly as specified in the architecture
- Individual test files (
test_*.py) — Comprehensive tests for each function covering success cases, failure modes, edge cases, and diverse input types
- Heavy API test suites (when needed) — Separate test files for integrations requiring extensive data or API calls
- Integration test runner (
run_all_tests.py) — Master test orchestrator that runs all tests, collects results, and generates the final report
- Debug log (
integrations.debug.log) — Complete execution trace for troubleshooting
- Summary report (
ITEMIZED_FUNCTIONS_REPORT.md) — Detailed findings: function signatures, actual API responses (sanitized), latency metrics, test results, learnings
Purpose: Understand the exact behavior of every 3rd-party integration before building the full project. No assumptions. Real execution. Real data.
Activation
Trigger phrases:
- "generate itemized functions"
- "create integration tests"
- "itemized functions from architecture"
- "test all integrations"
Required input: Architecture files must be provided or referenced. The skill reads the full architecture to understand all integrations, their purpose, and how they're used.
Output: All generated files are created in an integration_tests/ directory at the repository root.
Workflow
Phase 1: Architecture Analysis
- Read all provided architecture files (scan thoroughly, don't ask questions)
- Identify all external integrations:
- API services (Ollama, OpenAI, Anthropic, etc.)
- Database systems (PostgreSQL, MongoDB, Redis, etc.)
- File processing tools (GitHub Linguist, ImageMagick, etc.)
- Message queues, cache systems, external webhooks, etc.
- For each integration, extract:
- Primary purpose (what the architecture says it's used for)
- Specific use cases (e.g., "Ollama for tool calling" vs "Ollama for chat")
- Expected inputs/outputs
- Failure modes to test
- Performance constraints or requirements
- Determine test complexity:
- Standard test: ≤10 API calls, <50MB data, simple responses
- Heavy test: >10 API calls, >50MB data, streaming responses, or complex orchestration
Phase 2: Credential Setup
Generate .env.dev at repository root with template entries for all required credentials:
# Ollama
OLLAMA_API_URL=http://localhost:11434
OLLAMA_MODEL=neural-chat
# GitHub Linguist
GITHUB_LINGUIST_PATH=/path/to/github-linguist
# PostgreSQL
DB_HOST=localhost
DB_PORT=5432
DB_NAME=testdb
DB_USER=testuser
DB_PASSWORD=
# [Other integrations...]
Note: User must fill in actual values before running tests.
Phase 3: Generate Function Wrappers
For each integration, create integration_tests/function_[service].py:
Requirements:
- Clean, production-ready function signatures
- Proper type hints (Python 3.8+)
- Error handling with meaningful error messages
- Timeout handling (appropriate per service)
- Input validation where needed
- Logging to
integrations.debug.log
- Return consistent, testable response objects
Example structure:
import os
import logging
from typing import Any, Dict, List
import requests
from datetime import datetime
logger = logging.getLogger(__name__)
def call_ollama_chat(prompt: str, model: str = None, temperature: float = 0.7, timeout: int = 30) -> Dict[str, Any]:
"""
Call Ollama API for chat completion.
Args:
prompt: The user prompt
model: Model name (uses OLLAMA_MODEL env var if not provided)
temperature: Sampling temperature (0.0-1.0)
timeout: Request timeout in seconds
Returns:
Dict with keys: response, model, created_at, latency_ms
Raises:
ValueError: If credentials/config missing
requests.Timeout: If request exceeds timeout
requests.RequestException: For API errors
"""
try:
start_time = datetime.now()
api_url = os.getenv("OLLAMA_API_URL", "http://localhost:11434")
model = model or os.getenv("OLLAMA_MODEL")
if not model:
raise ValueError("OLLAMA_MODEL not set in environment")
response = requests.post(
f"{api_url}/api/chat",
json={
"model": model,
"messages": [{"role": "user", "content": prompt}],
"temperature": temperature,
"stream": False
},
timeout=timeout
)
response.raise_for_status()
latency_ms = (datetime.now() - start_time).total_seconds() * 1000
result = response.json()
result["latency_ms"] = latency_ms
logger.debug(f"Ollama chat call successful. Latency: {latency_ms}ms")
return result
except requests.Timeout:
logger.error(f"Ollama API timeout after {timeout}s")
raise
except requests.RequestException as e:
logger.error(f"Ollama API error: {str(e)}")
raise
except Exception as e:
logger.error(f"Unexpected error calling Ollama: {str(e)}")
raise
Phase 4: Generate Test Files
For each function, create integration_tests/test_[service].py:
Requirements:
- Use pytest framework
- Test success cases with typical inputs
- Test success cases with diverse/edge case inputs (smart per-service)
- Test failure modes: auth failure, timeout, malformed response, rate limiting, service down
- Capture actual API responses (sanitize credentials)
- Measure latency
- Each test logs to
integrations.debug.log
- Each test validates response structure
Example structure:
import pytest
import os
from unittest.mock import patch, MagicMock
import requests
from function_ollama import call_ollama_chat
@pytest.fixture
def setup_env(monkeypatch):
"""Setup environment variables for testing."""
monkeypatch.setenv("OLLAMA_API_URL", "http://localhost:11434")
monkeypatch.setenv("OLLAMA_MODEL", "neural-chat")
class TestOllamaChatSuccess:
"""Test successful Ollama chat calls."""
def test_basic_chat(self, setup_env):
"""Test basic chat completion."""
response = call_ollama_chat("What is 2+2?")
assert "response" in response
assert response["model"] == "neural-chat"
assert "latency_ms" in response
assert response["latency_ms"] > 0
def test_chat_with_temperature(self, setup_env):
"""Test chat with different temperature values."""
for temp in [0.0, 0.5, 1.0]:
response = call_ollama_chat("Tell a story", temperature=temp)
assert "response" in response
assert response["latency_ms"] > 0
def test_long_prompt(self, setup_env):
"""Test with very long prompt."""
long_prompt = "What is the meaning of life? " * 100
response = call_ollama_chat(long_prompt)
assert "response" in response
class TestOllamaChatFailures:
"""Test failure modes."""
def test_auth_failure(self, setup_env, monkeypatch):
"""Test behavior when API authentication fails."""
monkeypatch.setenv("OLLAMA_API_URL", "http://invalid-url:11434")
with pytest.raises(requests.RequestException):
call_ollama_chat("test")
def test_timeout(self, setup_env, monkeypatch):
"""Test timeout handling."""
with patch('requests.post') as mock_post:
mock_post.side_effect = requests.Timeout()
with pytest.raises(requests.Timeout):
call_ollama_chat("test", timeout=1)
def test_missing_credentials(self, monkeypatch):
"""Test when required env vars are missing."""
monkeypatch.delenv("OLLAMA_MODEL", raising=False)
with pytest.raises(ValueError):
call_ollama_chat("test")
Phase 5: Heavy API Test Suites (When Applicable)
If an integration qualifies as "heavy" (>10 API calls, >50MB data, streaming, complex orchestration), create a separate integration_tests/heavy_test_[service].py:
Include in heavy tests:
- Large data processing (if applicable)
- Streaming response handling
- Multiple chained API calls
- Performance benchmarks
- Resource usage patterns
- Rate limiting behavior
Header with reasoning:
"""
Heavy API test suite for [service].
Reasoning:
- [Service] requires extensive testing due to [specific reason]:
- Streaming responses with large payloads
- Multiple chained API calls (25+ total)
- Data processing >50MB
- Complex state management across calls
- Critical performance path in architecture
These tests are separated from standard tests to avoid:
- Excessive API quota usage during CI/CD
- Extended test execution time
- Unnecessary load on rate-limited endpoints
"""
Phase 6: Integration Test Runner
Create integration_tests/run_all_tests.py:
Responsibilities:
- Import and run all test files using pytest
- Collect results: passed, failed, skipped
- For each test, capture:
- Test name
- Status (passed/failed/skipped)
- Execution time
- Error message (if failed)
- Sample response data (if success)
- Aggregate latency metrics per service
- Generate summary statistics
- Write all to
ITEMIZED_FUNCTIONS_REPORT.md
Example output structure:
Test Results Summary:
- Total: 42 tests
- Passed: 38
- Failed: 2
- Skipped: 2
Service Latency Metrics:
- Ollama Chat: avg 145ms, min 89ms, max 287ms (10 calls)
- GitHub Linguist: avg 234ms, min 156ms, max 412ms (8 calls)
- PostgreSQL: avg 12ms, min 8ms, max 31ms (10 calls)
[Detailed results for each service...]
Phase 7: Debug Logging
All generated code writes to integration_tests/integrations.debug.log:
- Timestamp, log level, service name, message
- Request/response bodies (sanitize credentials)
- Timing information
- Error stack traces
- Environment info (for debugging credential/setup issues)
Format:
[2024-01-15 14:32:15.342] DEBUG [ollama] Calling /api/chat with model=neural-chat
[2024-01-15 14:32:15.521] DEBUG [ollama] Response received: 145ms latency, 1250 chars
[2024-01-15 14:32:16.012] ERROR [github-linguist] FAILED_TO_TEST - Connection refused (auth_required, network_error, timeout, api_error, etc.)
Phase 8: Summary Report
Create ITEMIZED_FUNCTIONS_REPORT.md:
Structure:
# Itemized Functions Report
**Generated:** [timestamp]
**Architecture Analyzed:** [list of architecture files]
**Total Integrations Tested:** [count]
**Test Success Rate:** [X%]
## Executive Summary
- [count] integrations identified and tested
- [X] tests passed, [Y] failed, [Z] skipped
- Key findings and blockers (if any)
## Integration Details
### [Service Name] (e.g., Ollama)
**Purpose (from architecture):** [extracted from architecture]
**Function Signature:**
\`\`\`python
def call_ollama_chat(prompt: str, model: str = None, temperature: float = 0.7, timeout: int = 30) -> Dict[str, Any]
\`\`\`
**Test Coverage:** [count tests, all passed/mixed/failed]
**Latency:** avg X ms, min Y ms, max Z ms (10 calls)
**Sample API Response (sanitized):**
\`\`\`json
{
"response": "2 + 2 = 4",
"model": "neural-chat",
"created_at": "2024-01-15T14:32:15Z",
"latency_ms": 145
}
\`\`\`
**Failure Modes Tested:**
- ✓ Timeout (handled correctly, raises Timeout exception)
- ✓ Auth failure (handled correctly, raises RequestException)
- ✓ Malformed response (handled correctly, raises JSONDecodeError)
- ✓ Service unavailable (raises ConnectionError)
**Key Learnings:**
- [Finding 1]: [detail]
- [Finding 2]: [detail]
- [Gotcha/quirk if discovered]: [detail]
**Heavy Tests:** None
(or if applicable: `heavy_test_ollama.py` — [reason])
---
### [Next Service...]
[Same structure as above]
---
## Failed Tests & Blockers
### [Service Name] - FAILED_TO_TEST
**Reason:** [auth_required, network_error, timeout, api_error, service_down, etc.]
**Error Message:** [exact error]
**Suggestion:** [how to resolve, e.g., "Set OLLAMA_API_URL in .env.dev and ensure Ollama service is running"]
---
## Cross-Service Insights
[Any patterns, dependencies, or interactions discovered across integrations]
---
## Recommendations
- [Any critical issues or setup requirements]
- [Performance or scaling considerations]
- [Dependencies between services]
---
## Test Execution Log
[Link to or excerpt from integrations.debug.log]
Standards & Requirements
Code Generation
- Python 3.8+ compatible — Type hints, f-strings, async/await support if needed
- Error messages are meaningful — Not generic "error occurred", but "OLLAMA_API_URL not set" or "Connection refused on localhost:11434"
- Timeouts are sensible per service — LLM APIs: 60s, Database: 10s, File processing: 30s, etc.
- No hardcoded values — All config from environment
- Logging is comprehensive — Every significant action logged
Testing
- Pytest conventions —
test_*.py files, fixtures, clear test names, assertions with messages
- Real execution — Actually call the APIs (not mocked), unless explicitly impossible
- Diverse inputs per service — Smart, not generic:
- LLM APIs: different prompt lengths, temperatures, contexts
- File processing: different file types/sizes
- Databases: different query patterns, edge cases
- Time-series: different time ranges, aggregations
- Failure mode coverage — Auth, network, timeout, rate limit, malformed data
- Response validation — Verify structure, types, required fields
- Latency tracking — Measure every call
Report Generation
- No credentials exposed — Sanitize all env vars, passwords, tokens, API keys in report
- Full response bodies — Show actual data (sanitized) so developer understands exact format
- Timestamps throughout — When was this run, when was each test executed
- Actionable findings — Not just "failed" but "why" and "how to fix"
- Report all failures and anomalies — Do not omit unexpected behavior because it seems minor. Every quirk discovered now prevents a production incident later
- Output goes under the user's name — The report becomes their reference document. Incomplete or softened findings waste the testing effort
Special Cases
Streaming APIs (e.g., LLM chat with stream=true):
- Test both streamed and non-streamed responses
- Measure latency from first token to completion
- Validate chunk format
Databases:
- Test CRUD operations
- Test connection pooling if applicable
- Test transaction handling
- Test query timeouts
File Processing APIs:
- Test with multiple file types
- Test error handling for unsupported formats
- Test large file handling
Rate-Limited APIs:
- Detect rate limit headers
- Test behavior when rate limited
- Suggest backoff strategies in report
Webhook/Async APIs:
- If applicable, test callback handling
- Test idempotency if needed
Directory Structure (Final)
integration_tests/
├── .env.dev # Template credentials file
├── integrations.debug.log # Debug log from test execution
├── ITEMIZED_FUNCTIONS_REPORT.md # Final summary report
├── run_all_tests.py # Master test runner
├── function_ollama.py # Function wrapper
├── test_ollama.py # Standard tests
├── heavy_test_ollama.py # (if needed) Heavy tests
├── function_github_linguist.py # Another wrapper
├── test_github_linguist.py # Standard tests
├── function_postgres.py # Another wrapper
├── test_postgres.py # Standard tests
└── [More function/test pairs...]
Execution
- User provides architecture files and triggers skill
- Skill generates all files in
integration_tests/
- User fills in
.env.dev with actual credentials
- User runs:
python run_all_tests.py
- All tests execute, report generated
- Developer reviews
ITEMIZED_FUNCTIONS_REPORT.md and integrations.debug.log
Quality Assurance
- No questions asked — Read architecture, infer integrations, generate tests
- LLM confidence in test design — Trust that generated tests cover the right scenarios
- Sanitization is rigorous — Scan all report content for credentials before writing
- File encoding is UTF-8 — Handle responses with special characters correctly
- All files importable — Generated Python is syntactically correct and runs
1---2name: itemized-functions3description: Generate exhaustive integration functions with comprehensive test suites for all 3rd-party APIs and external services. Automatically creates function wrappers, individual test files, integrated test runners, and a detailed report of API behavior, response signatures, latency, and failure modes.4---56## Overview78This skill analyzes architecture files to identify all external integrations (APIs, services, databases, etc.), then generates:9101. **Function wrappers** (`function_*.py`) — Clean, tested functions that use each integration exactly as specified in the architecture112. **Individual test files** (`test_*.py`) — Comprehensive tests for each function covering success cases, failure modes, edge cases, and diverse input types123. **Heavy API test suites** (when needed) — Separate test files for integrations requiring extensive data or API calls134. **Integration test runner** (`run_all_tests.py`) — Master test orchestrator that runs all tests, collects results, and generates the final report145. **Debug log** (`integrations.debug.log`) — Complete execution trace for troubleshooting156. **Summary report** (`ITEMIZED_FUNCTIONS_REPORT.md`) — Detailed findings: function signatures, actual API responses (sanitized), latency metrics, test results, learnings1617**Purpose:** Understand the *exact* behavior of every 3rd-party integration before building the full project. No assumptions. Real execution. Real data.1819## Activation2021**Trigger phrases:**22- "generate itemized functions"23- "create integration tests"24- "itemized functions from architecture"25- "test all integrations"2627**Required input:** Architecture files must be provided or referenced. The skill reads the full architecture to understand all integrations, their purpose, and how they're used.2829**Output:** All generated files are created in an `integration_tests/` directory at the repository root.3031## Workflow3233### Phase 1: Architecture Analysis34351. **Read all provided architecture files** (scan thoroughly, don't ask questions)362. **Identify all external integrations**:37 - API services (Ollama, OpenAI, Anthropic, etc.)38 - Database systems (PostgreSQL, MongoDB, Redis, etc.)39 - File processing tools (GitHub Linguist, ImageMagick, etc.)40 - Message queues, cache systems, external webhooks, etc.413. **For each integration, extract**:42 - Primary purpose (what the architecture says it's used for)43 - Specific use cases (e.g., "Ollama for tool calling" vs "Ollama for chat")44 - Expected inputs/outputs45 - Failure modes to test46 - Performance constraints or requirements474. **Determine test complexity**:48 - Standard test: ≤10 API calls, <50MB data, simple responses49 - Heavy test: >10 API calls, >50MB data, streaming responses, or complex orchestration5051### Phase 2: Credential Setup5253Generate `.env.dev` at repository root with template entries for all required credentials:5455```56# Ollama57OLLAMA_API_URL=http://localhost:1143458OLLAMA_MODEL=neural-chat5960# GitHub Linguist61GITHUB_LINGUIST_PATH=/path/to/github-linguist6263# PostgreSQL64DB_HOST=localhost65DB_PORT=543266DB_NAME=testdb67DB_USER=testuser68DB_PASSWORD=6970# [Other integrations...]71```7273**Note:** User must fill in actual values before running tests.7475### Phase 3: Generate Function Wrappers7677For each integration, create `integration_tests/function_[service].py`:7879**Requirements:**80- Clean, production-ready function signatures81- Proper type hints (Python 3.8+)82- Error handling with meaningful error messages83- Timeout handling (appropriate per service)84- Input validation where needed85- Logging to `integrations.debug.log`86- Return consistent, testable response objects8788**Example structure:**89```python90import os91import logging92from typing import Any, Dict, List93import requests94from datetime import datetime9596logger = logging.getLogger(__name__)9798def call_ollama_chat(prompt: str, model: str = None, temperature: float = 0.7, timeout: int = 30) -> Dict[str, Any]:99 """100 Call Ollama API for chat completion.101 102 Args:103 prompt: The user prompt104 model: Model name (uses OLLAMA_MODEL env var if not provided)105 temperature: Sampling temperature (0.0-1.0)106 timeout: Request timeout in seconds107 108 Returns:109 Dict with keys: response, model, created_at, latency_ms110 111 Raises:112 ValueError: If credentials/config missing113 requests.Timeout: If request exceeds timeout114 requests.RequestException: For API errors115 """116 try:117 start_time = datetime.now()118 119 api_url = os.getenv("OLLAMA_API_URL", "http://localhost:11434")120 model = model or os.getenv("OLLAMA_MODEL")121 122 if not model:123 raise ValueError("OLLAMA_MODEL not set in environment")124 125 response = requests.post(126 f"{api_url}/api/chat",127 json={128 "model": model,129 "messages": [{"role": "user", "content": prompt}],130 "temperature": temperature,131 "stream": False132 },133 timeout=timeout134 )135 response.raise_for_status()136 137 latency_ms = (datetime.now() - start_time).total_seconds() * 1000138 result = response.json()139 result["latency_ms"] = latency_ms140 141 logger.debug(f"Ollama chat call successful. Latency: {latency_ms}ms")142 return result143 144 except requests.Timeout:145 logger.error(f"Ollama API timeout after {timeout}s")146 raise147 except requests.RequestException as e:148 logger.error(f"Ollama API error: {str(e)}")149 raise150 except Exception as e:151 logger.error(f"Unexpected error calling Ollama: {str(e)}")152 raise153```154155### Phase 4: Generate Test Files156157For each function, create `integration_tests/test_[service].py`:158159**Requirements:**160- Use pytest framework161- Test success cases with typical inputs162- Test success cases with diverse/edge case inputs (smart per-service)163- Test failure modes: auth failure, timeout, malformed response, rate limiting, service down164- Capture actual API responses (sanitize credentials)165- Measure latency166- Each test logs to `integrations.debug.log`167- Each test validates response structure168169**Example structure:**170```python171import pytest172import os173from unittest.mock import patch, MagicMock174import requests175from function_ollama import call_ollama_chat176177@pytest.fixture178def setup_env(monkeypatch):179 """Setup environment variables for testing."""180 monkeypatch.setenv("OLLAMA_API_URL", "http://localhost:11434")181 monkeypatch.setenv("OLLAMA_MODEL", "neural-chat")182183class TestOllamaChatSuccess:184 """Test successful Ollama chat calls."""185 186 def test_basic_chat(self, setup_env):187 """Test basic chat completion."""188 response = call_ollama_chat("What is 2+2?")189 assert "response" in response190 assert response["model"] == "neural-chat"191 assert "latency_ms" in response192 assert response["latency_ms"] > 0193 194 def test_chat_with_temperature(self, setup_env):195 """Test chat with different temperature values."""196 for temp in [0.0, 0.5, 1.0]:197 response = call_ollama_chat("Tell a story", temperature=temp)198 assert "response" in response199 assert response["latency_ms"] > 0200 201 def test_long_prompt(self, setup_env):202 """Test with very long prompt."""203 long_prompt = "What is the meaning of life? " * 100204 response = call_ollama_chat(long_prompt)205 assert "response" in response206207class TestOllamaChatFailures:208 """Test failure modes."""209 210 def test_auth_failure(self, setup_env, monkeypatch):211 """Test behavior when API authentication fails."""212 monkeypatch.setenv("OLLAMA_API_URL", "http://invalid-url:11434")213 with pytest.raises(requests.RequestException):214 call_ollama_chat("test")215 216 def test_timeout(self, setup_env, monkeypatch):217 """Test timeout handling."""218 with patch('requests.post') as mock_post:219 mock_post.side_effect = requests.Timeout()220 with pytest.raises(requests.Timeout):221 call_ollama_chat("test", timeout=1)222 223 def test_missing_credentials(self, monkeypatch):224 """Test when required env vars are missing."""225 monkeypatch.delenv("OLLAMA_MODEL", raising=False)226 with pytest.raises(ValueError):227 call_ollama_chat("test")228```229230### Phase 5: Heavy API Test Suites (When Applicable)231232If an integration qualifies as "heavy" (>10 API calls, >50MB data, streaming, complex orchestration), create a separate `integration_tests/heavy_test_[service].py`:233234**Include in heavy tests:**235- Large data processing (if applicable)236- Streaming response handling237- Multiple chained API calls238- Performance benchmarks239- Resource usage patterns240- Rate limiting behavior241242**Header with reasoning:**243```python244"""245Heavy API test suite for [service].246247Reasoning:248- [Service] requires extensive testing due to [specific reason]:249 - Streaming responses with large payloads250 - Multiple chained API calls (25+ total)251 - Data processing >50MB252 - Complex state management across calls253 - Critical performance path in architecture254255These tests are separated from standard tests to avoid:256- Excessive API quota usage during CI/CD257- Extended test execution time258- Unnecessary load on rate-limited endpoints259"""260```261262### Phase 6: Integration Test Runner263264Create `integration_tests/run_all_tests.py`:265266**Responsibilities:**2671. Import and run all test files using pytest2682. Collect results: passed, failed, skipped2693. For each test, capture:270 - Test name271 - Status (passed/failed/skipped)272 - Execution time273 - Error message (if failed)274 - Sample response data (if success)2754. Aggregate latency metrics per service2765. Generate summary statistics2776. Write all to `ITEMIZED_FUNCTIONS_REPORT.md`278279**Example output structure:**280```281Test Results Summary:282- Total: 42 tests283- Passed: 38284- Failed: 2285- Skipped: 2286287Service Latency Metrics:288- Ollama Chat: avg 145ms, min 89ms, max 287ms (10 calls)289- GitHub Linguist: avg 234ms, min 156ms, max 412ms (8 calls)290- PostgreSQL: avg 12ms, min 8ms, max 31ms (10 calls)291292[Detailed results for each service...]293```294295### Phase 7: Debug Logging296297All generated code writes to `integration_tests/integrations.debug.log`:298299- Timestamp, log level, service name, message300- Request/response bodies (sanitize credentials)301- Timing information302- Error stack traces303- Environment info (for debugging credential/setup issues)304305Format:306```307[2024-01-15 14:32:15.342] DEBUG [ollama] Calling /api/chat with model=neural-chat308[2024-01-15 14:32:15.521] DEBUG [ollama] Response received: 145ms latency, 1250 chars309[2024-01-15 14:32:16.012] ERROR [github-linguist] FAILED_TO_TEST - Connection refused (auth_required, network_error, timeout, api_error, etc.)310```311312### Phase 8: Summary Report313314Create `ITEMIZED_FUNCTIONS_REPORT.md`:315316**Structure:**317```markdown318# Itemized Functions Report319320**Generated:** [timestamp]321**Architecture Analyzed:** [list of architecture files]322**Total Integrations Tested:** [count]323**Test Success Rate:** [X%]324325## Executive Summary326- [count] integrations identified and tested327- [X] tests passed, [Y] failed, [Z] skipped328- Key findings and blockers (if any)329330## Integration Details331332### [Service Name] (e.g., Ollama)333334**Purpose (from architecture):** [extracted from architecture]335336**Function Signature:**337\`\`\`python338def call_ollama_chat(prompt: str, model: str = None, temperature: float = 0.7, timeout: int = 30) -> Dict[str, Any]339\`\`\`340341**Test Coverage:** [count tests, all passed/mixed/failed]342343**Latency:** avg X ms, min Y ms, max Z ms (10 calls)344345**Sample API Response (sanitized):**346\`\`\`json347{348 "response": "2 + 2 = 4",349 "model": "neural-chat",350 "created_at": "2024-01-15T14:32:15Z",351 "latency_ms": 145352}353\`\`\`354355**Failure Modes Tested:**356- ✓ Timeout (handled correctly, raises Timeout exception)357- ✓ Auth failure (handled correctly, raises RequestException)358- ✓ Malformed response (handled correctly, raises JSONDecodeError)359- ✓ Service unavailable (raises ConnectionError)360361**Key Learnings:**362- [Finding 1]: [detail]363- [Finding 2]: [detail]364- [Gotcha/quirk if discovered]: [detail]365366**Heavy Tests:** None367(or if applicable: `heavy_test_ollama.py` — [reason])368369---370371### [Next Service...]372373[Same structure as above]374375---376377## Failed Tests & Blockers378379### [Service Name] - FAILED_TO_TEST380**Reason:** [auth_required, network_error, timeout, api_error, service_down, etc.]381**Error Message:** [exact error]382**Suggestion:** [how to resolve, e.g., "Set OLLAMA_API_URL in .env.dev and ensure Ollama service is running"]383384---385386## Cross-Service Insights387388[Any patterns, dependencies, or interactions discovered across integrations]389390---391392## Recommendations393394- [Any critical issues or setup requirements]395- [Performance or scaling considerations]396- [Dependencies between services]397398---399400## Test Execution Log401402[Link to or excerpt from integrations.debug.log]403```404405## Standards & Requirements406407### Code Generation408409- **Python 3.8+ compatible** — Type hints, f-strings, async/await support if needed410- **Error messages are meaningful** — Not generic "error occurred", but "OLLAMA_API_URL not set" or "Connection refused on localhost:11434"411- **Timeouts are sensible per service** — LLM APIs: 60s, Database: 10s, File processing: 30s, etc.412- **No hardcoded values** — All config from environment413- **Logging is comprehensive** — Every significant action logged414415### Testing416417- **Pytest conventions** — `test_*.py` files, fixtures, clear test names, assertions with messages418- **Real execution** — Actually call the APIs (not mocked), unless explicitly impossible419- **Diverse inputs per service** — Smart, not generic:420 - LLM APIs: different prompt lengths, temperatures, contexts421 - File processing: different file types/sizes422 - Databases: different query patterns, edge cases423 - Time-series: different time ranges, aggregations424- **Failure mode coverage** — Auth, network, timeout, rate limit, malformed data425- **Response validation** — Verify structure, types, required fields426- **Latency tracking** — Measure every call427428### Report Generation429430- **No credentials exposed** — Sanitize all env vars, passwords, tokens, API keys in report431- **Full response bodies** — Show actual data (sanitized) so developer understands exact format432- **Timestamps throughout** — When was this run, when was each test executed433- **Actionable findings** — Not just "failed" but "why" and "how to fix"434- **Report all failures and anomalies** — Do not omit unexpected behavior because it seems minor. Every quirk discovered now prevents a production incident later435- **Output goes under the user's name** — The report becomes their reference document. Incomplete or softened findings waste the testing effort436437## Special Cases438439**Streaming APIs (e.g., LLM chat with stream=true):**440- Test both streamed and non-streamed responses441- Measure latency from first token to completion442- Validate chunk format443444**Databases:**445- Test CRUD operations446- Test connection pooling if applicable447- Test transaction handling448- Test query timeouts449450**File Processing APIs:**451- Test with multiple file types452- Test error handling for unsupported formats453- Test large file handling454455**Rate-Limited APIs:**456- Detect rate limit headers457- Test behavior when rate limited458- Suggest backoff strategies in report459460**Webhook/Async APIs:**461- If applicable, test callback handling462- Test idempotency if needed463464## Directory Structure (Final)465466```467integration_tests/468├── .env.dev # Template credentials file469├── integrations.debug.log # Debug log from test execution470├── ITEMIZED_FUNCTIONS_REPORT.md # Final summary report471├── run_all_tests.py # Master test runner472├── function_ollama.py # Function wrapper473├── test_ollama.py # Standard tests474├── heavy_test_ollama.py # (if needed) Heavy tests475├── function_github_linguist.py # Another wrapper476├── test_github_linguist.py # Standard tests477├── function_postgres.py # Another wrapper478├── test_postgres.py # Standard tests479└── [More function/test pairs...]480```481482## Execution4834841. User provides architecture files and triggers skill4852. Skill generates all files in `integration_tests/`4863. User fills in `.env.dev` with actual credentials4874. User runs: `python run_all_tests.py`4885. All tests execute, report generated4896. Developer reviews `ITEMIZED_FUNCTIONS_REPORT.md` and `integrations.debug.log`490491## Quality Assurance492493- **No questions asked** — Read architecture, infer integrations, generate tests494- **LLM confidence in test design** — Trust that generated tests cover the right scenarios495- **Sanitization is rigorous** — Scan all report content for credentials before writing496- **File encoding is UTF-8** — Handle responses with special characters correctly497- **All files importable** — Generated Python is syntactically correct and runs