Comprehensive developer toolkit providing reusable skills for Java/Spring Boot, TypeScript/NestJS/React/Next.js, Python, PHP, AWS CloudFormation, AI/RAG, DevOps, and more.
90
90%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Risky
Do not use without reviewing
#!/usr/bin/env python3
"""Tests for specs-task-tdd-handoff.py."""
import importlib.util
import json
import os
import sys
import tempfile
import textwrap
from pathlib import Path
from unittest import mock
hooks_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
handoff_path = os.path.join(hooks_dir, "specs-task-tdd-handoff.py")
spec = importlib.util.spec_from_file_location("specs_task_tdd_handoff", handoff_path)
task_tdd_handoff = importlib.util.module_from_spec(spec)
sys.modules["specs_task_tdd_handoff"] = task_tdd_handoff
spec.loader.exec_module(task_tdd_handoff)
def write_task_file(directory: str, content: str) -> str:
path = Path(directory) / "tasks" / "TASK-013.md"
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(textwrap.dedent(content).strip() + "\n", encoding="utf-8")
return str(path)
def build_task(
directory: str,
*,
test_references: str | None = None,
red_phase: str | None = None,
) -> str:
extra_frontmatter = []
if test_references is not None:
extra_frontmatter.append(f"testReferences: {test_references}")
if red_phase is not None:
extra_frontmatter.append(f"redPhase: {red_phase}")
return write_task_file(
directory,
f"""
---
id: TASK-013
title: "Implementation Handoff Preparation"
spec: docs/specs/002-tdd-command/2026-04-05--tdd-command.md
lang: python
dependencies: [TASK-011]
status: pending
{'\n'.join(extra_frontmatter)}
---
# TASK-013: Implementation Handoff Preparation
**Functional Description**: Prepare documentation and context for smooth transition to task-implementation phase.
## Acceptance Criteria
- [ ] Summary of generated tests is created and displayed
- [ ] Next steps for implementation are clearly documented
## Technical Context (from Codebase Analysis)
- Existing patterns: command completion summaries
- Shared components: summary generator and handoff creator
""",
)
def test_prepare_handoff_creates_markdown_summary_with_next_steps():
test_references = json.dumps(
[
{
"path": "tests/test_task_file_updates.py",
"test_type": "both",
"language": "python",
"generated_at": "2026-04-05",
"scenario_count": 2,
}
],
separators=(",", ": "),
)
red_phase = json.dumps(
{
"status": "red-confirmed",
"verified": True,
"verified_at": "2026-04-05",
"framework": "pytest",
"test_file": "tests/test_task_file_updates.py",
"summary": "RED phase confirmed: generated tests failed as expected.",
"command": ["pytest", "tests/test_task_file_updates.py", "-q"],
"warnings": [],
},
separators=(",", ": "),
)
with tempfile.TemporaryDirectory() as temp_dir:
task_file = build_task(
temp_dir,
test_references=test_references,
red_phase=red_phase,
)
result = task_tdd_handoff.prepare_handoff(task_file, project_root=temp_dir)
handoff_doc = Path(result.handoff_path).read_text(encoding="utf-8")
assert result.generated_test_count == 1
assert result.red_phase_confirmed is True
assert result.handoff_path.endswith("_drift/tdd-handoff-task-013.md")
assert "RED phase confirmed via `pytest`." in handoff_doc
assert "`tests/test_task_file_updates.py` (both, python, scenarios: 2)" in handoff_doc
assert "/specs:task-implementation --lang=python" in handoff_doc
assert "## Context To Preserve" in handoff_doc
def test_prepare_handoff_warns_when_no_test_references_exist():
red_phase = json.dumps(
{
"status": "unexpected-pass",
"verified": False,
"verified_at": "2026-04-05",
"framework": "pytest",
"test_file": "tests/test_task_file_updates.py",
"summary": "Generated tests passed unexpectedly during RED verification.",
"command": ["pytest", "tests/test_task_file_updates.py", "-q"],
"warnings": ["Generated tests passed unexpectedly."],
},
separators=(",", ": "),
)
with tempfile.TemporaryDirectory() as temp_dir:
task_file = build_task(temp_dir, red_phase=red_phase)
result = task_tdd_handoff.prepare_handoff(task_file, project_root=temp_dir)
handoff_doc = Path(result.handoff_path).read_text(encoding="utf-8")
assert result.generated_test_count == 0
assert result.red_phase_confirmed is False
assert "No generated tests were recorded in task metadata." in handoff_doc
assert "RED phase is not confirmed yet." in handoff_doc
assert any("No generated test references" in warning for warning in result.warnings)
def test_prepare_handoff_raises_e4_when_write_fails():
test_references = json.dumps([], separators=(",", ": "))
red_phase = json.dumps({}, separators=(",", ": "))
with tempfile.TemporaryDirectory() as temp_dir:
task_file = build_task(
temp_dir,
test_references=test_references,
red_phase=red_phase,
)
with mock.patch.object(Path, "write_text", side_effect=PermissionError("no write")):
try:
task_tdd_handoff.prepare_handoff(task_file, project_root=temp_dir)
assert False, "Expected TddHandoffError"
except task_tdd_handoff.TddHandoffError as exc:
assert exc.code == "E4"
assert "handoff file" in str(exc)docs
plugins
developer-kit-ai
developer-kit-aws
agents
docs
skills
aws
aws-cli-beast
aws-cost-optimization
aws-drawio-architecture-diagrams
aws-sam-bootstrap
aws-cloudformation
aws-cloudformation-auto-scaling
aws-cloudformation-bedrock
aws-cloudformation-cloudfront
aws-cloudformation-cloudwatch
aws-cloudformation-dynamodb
aws-cloudformation-ec2
aws-cloudformation-ecs
aws-cloudformation-elasticache
references
aws-cloudformation-iam
references
aws-cloudformation-lambda
aws-cloudformation-rds
aws-cloudformation-s3
aws-cloudformation-security
aws-cloudformation-task-ecs-deploy-gh
aws-cloudformation-vpc
references
developer-kit-core
agents
commands
skills
developer-kit-devops
developer-kit-java
agents
commands
docs
skills
aws-lambda-java-integration
aws-rds-spring-boot-integration
aws-sdk-java-v2-bedrock
aws-sdk-java-v2-core
aws-sdk-java-v2-dynamodb
aws-sdk-java-v2-kms
aws-sdk-java-v2-lambda
aws-sdk-java-v2-messaging
aws-sdk-java-v2-rds
aws-sdk-java-v2-s3
aws-sdk-java-v2-secrets-manager
clean-architecture
graalvm-native-image
langchain4j-ai-services-patterns
references
langchain4j-mcp-server-patterns
references
langchain4j-rag-implementation-patterns
references
langchain4j-spring-boot-integration
langchain4j-testing-strategies
langchain4j-tool-function-calling-patterns
langchain4j-vector-stores-configuration
references
qdrant
references
spring-ai-mcp-server-patterns
spring-boot-actuator
spring-boot-cache
spring-boot-crud-patterns
spring-boot-dependency-injection
spring-boot-event-driven-patterns
spring-boot-openapi-documentation
spring-boot-project-creator
spring-boot-resilience4j
spring-boot-rest-api-standards
spring-boot-saga-pattern
spring-boot-security-jwt
assets
references
scripts
spring-boot-test-patterns
spring-data-jpa
references
spring-data-neo4j
references
unit-test-application-events
unit-test-bean-validation
unit-test-boundary-conditions
unit-test-caching
unit-test-config-properties
references
unit-test-controller-layer
unit-test-exception-handler
references
unit-test-json-serialization
unit-test-mapper-converter
references
unit-test-parameterized
unit-test-scheduled-async
references
unit-test-service-layer
references
unit-test-utility-methods
unit-test-wiremock-rest-api
references
developer-kit-php
developer-kit-project-management
developer-kit-python
developer-kit-specs
commands
docs
hooks
test-templates
tests
skills
developer-kit-tools
developer-kit-typescript
agents
docs
hooks
rules
skills
aws-cdk
aws-lambda-typescript-integration
better-auth
clean-architecture
drizzle-orm-patterns
dynamodb-toolbox-patterns
references
nestjs
nestjs-best-practices
nestjs-code-review
nestjs-drizzle-crud-generator
nextjs-app-router
nextjs-authentication
nextjs-code-review
nextjs-data-fetching
nextjs-deployment
nextjs-performance
nx-monorepo
react-code-review
react-patterns
shadcn-ui
tailwind-css-patterns
tailwind-design-system
references
turborepo-monorepo
typescript-docs
typescript-security-review
zod-validation-utilities
references
github-spec-kit