Skip to content

Workflow Usage Guide: Practical Examples#

Date: 2025-11-09 Related: Setup Conversation Purpose: Provide step-by-step examples of using the documentation-driven development workflows

๐ŸŽฏ Overview#

This guide shows practical examples of executing the complete workflow from requirements through code generation using the prompts and instructions created in this template.

๐Ÿ“‹ Table of Contents#

  1. Complete Workflow Example
  2. Using Workflow Orchestration Prompts
  3. Using Individual Prompts
  4. Quality Review at Each Stage
  5. Troubleshooting Common Issues

Complete Workflow Example: User Authentication#

Let's walk through implementing a user authentication feature from scratch.

Stage 0: Environment Setup#

Prompt:

Check the UV environment following .github/instructions/uv-environment-setup.instructions.md.
If environment doesn't exist, create it.

Expected outcome:

  • โœ… UV environment exists
  • โœ… Ready to use uv add for packages

Stage 1: Requirements โ†’ Specification#

Using orchestration prompt (recommended):

Execute the workflow-requirements-to-spec prompt for docs/requirements/req-user-auth.md with threat model scope per-requirement

This single command will:

  1. โœ… Generate docs/specifications/spec_ser-auth.md
  2. โœ… Create docs/diagrams/threat-model_user-auth.md
  3. โœ… Create docs/diagrams/architecture_user-auth.md
  4. โœ… Run specification quality review
  5. โœ… Update cross-reference table and index
  6. โœ… Create execution log

Expected output summary:

โœ… Requirements โ†’ Specification Workflow Complete

๐Ÿ“ Files Created:
- [docs/specifications/spec_user-auth.md](../specifications/spec_user-auth.md)
- [docs/diagrams/threat-model_user-auth.md](../diagrams/threat-model_user-auth.md)
- [docs/diagrams/architecture-user-auth.md](../diagrams/architecture_user-auth.md)

๐Ÿ“ Files Updated:
- [docs/SPEC-CROSS-REFERENCE.md](../SPEC-CROSS-REFERENCE.md)
- [docs/INDEX.md](../INDEX.md)

๐Ÿ”’ CodeGuard Files Referenced:
- [codeguard-0-authentication-mfa.instructions.md](../../.github/instructions/codeguard-0-authentication-mfa.instructions.md)
- [codeguard-0-input-validation-injection.instructions.md](../../.github/instructions/codeguard-0-input-validation-injection.instructions.md)
- [codeguard-0-session-management-and-cookies.instructions.md](../../.github/instructions/codeguard-0-session-management-and-cookies.instructions.md)

๐Ÿ“‹ Quality Review: โœ… PASSED

โณ Next Step: Human review and approval

Human review checkpoint: Review the generated files and approve to proceed.


Stage 2: Specification โ†’ Code#

Using orchestration prompt (recommended):

Execute the workflow-spec-to-code prompt for docs/specifications/spec_user-auth.md

This single command will:

  1. โœ… Implement code using TDD (RED-GREEN-REFACTOR cycles)
  2. โœ… Generate tests before code
  3. โœ… Apply CodeGuard security rules
  4. โœ… Run security review
  5. โœ… Run quality validation (pytest, coverage, ruff)
  6. โœ… Update documentation
  7. โœ… Create execution log

Expected output summary:

โœ… Specification โ†’ Code Workflow Complete

๐Ÿ“ Files Created:
- src/auth/login.py
- src/auth/session.py
- test/test_auth/test_login.py
- test/test_auth/test_session.py

๐Ÿงช Test Results:
- Total tests: 24
- Passed: 24 โœ…
- Coverage: 94%

๐Ÿ”’ CodeGuard Files Applied:
- [codeguard-0-authentication-mfa.instructions.md](../../.github/instructions/codeguard-0-authentication-mfa.instructions.md)
- [codeguard-0-input-validation-injection.instructions.md](../../.github/instructions/codeguard-0-input-validation-injection.instructions.md)
- [codeguard-0-session-management-and-cookies.instructions.md](../../.github/instructions/codeguard-0-session-management-and-cookies.instructions.md)

๐Ÿ“‹ Quality Review: โœ… PASSED
๐Ÿ”’ Security Review: โœ… PASSED

โณ Next Step: Human code review and approval

Using Workflow Orchestration Prompts#

Benefits#

  • ๐Ÿš€ Fast: Single command runs entire workflow
  • โœ… Complete: Includes all quality gates
  • ๐Ÿ“‹ Traceable: Creates comprehensive logs
  • ๐Ÿ”’ Secure: Automatically applies CodeGuard

Requirements โ†’ Specification Workflow#

Prompt file: workflow-requirements-to-spec.prompt.md

Usage with Claude Code:

Execute the workflow-requirements-to-spec prompt for docs/requirements/req-{name}.md with threat model scope {per-requirement|high-level-aggregate|grouped-by-feature}

Usage with GitHub Copilot:

@workspace Follow @.github/prompts/workflow-requirements-to-spec.prompt.md to generate complete specification from @docs/requirements/req-{name}.md

What it does:

  1. Generates specification
  2. Creates threat model
  3. Creates architecture diagram
  4. Runs specification quality review
  5. Updates cross-reference table
  6. Creates execution log

Specification โ†’ Code Workflow#

Prompt file: workflow-spec-to-code.prompt.md

Usage with Claude Code:

Execute the workflow-spec-to-code prompt for docs/specifications/spec_{name}.md

Usage with GitHub Copilot:

@workspace Follow @.github/prompts/workflow-spec-to-code.prompt.md to implement @docs/specifications/spec_{name}.md

What it does:

  1. Reviews specification
  2. Implements using TDD workflow
  3. Runs security review
  4. Runs quality validation
  5. Conducts post-test review
  6. Updates documentation
  7. Creates execution log

Using Individual Prompts#

When to Use Individual Prompts#

  • ๐ŸŽฏ Specific task: Only need one operation
  • ๐Ÿ”„ Iterating: Regenerating one component
  • ๐Ÿ“š Learning: Understanding each step

Generate Specification#

Prompt file: generate-spec-from-requirement.prompt.md

Use the generate-spec-from-requirement prompt for docs/requirements/req-{name}.md

Outputs:

Create Threat Model#

Prompt file: create-threat-model.prompt.md

Use the create-threat-model prompt for docs/requirements/req-{name}.md with scope per-requirement

Outputs:

  • docs/diagrams/threat-model-{name}.md
  • STRIDE analysis
  • CodeGuard references

Create Architecture Diagram#

Prompt file: create-architecture-diagram.prompt.md

Use the create-architecture-diagram prompt for docs/specifications/spec_{name}.md

Outputs:

  • docs/diagrams/architecture-{name}.md
  • Mermaid diagrams
  • Security annotations

Generate Code with TDD#

Prompt file: generate-code-from-spec.prompt.md

Use the generate-code-from-spec prompt for docs/specifications/spec_{name}.md

Outputs:

  • Source files in src/
  • Test files in test/
  • Execution log with TDD cycles documented

Quality Review at Each Stage#

Requirements Stage Quality Review#

Reference: Quality Checklists - Requirements Stage

Prompt:

Conduct requirements stage quality review for docs/requirements/req-{name}.md following .github/instructions/quality-checklists.md

Key checks:

  • โœ… Problem statement clear
  • โœ… Acceptance criteria measurable
  • โœ… Dependencies identified
  • โœ… Security considerations noted

Specification Stage Quality Review#

Reference: Quality Checklists - Specification Stage

Prompt:

Conduct specification stage quality review for docs/specifications/spec_{name}.md following .github/instructions/quality-checklists.md

Key checks:

  • โœ… Architecture defined
  • โœ… TDD planning complete
  • โœ… Threat model created
  • โœ… CodeGuard files referenced
  • โœ… Filename includes -tdd suffix

Code Generation Stage Quality Review#

Reference: Quality Checklists - Code Generation Stage

Prompt:

Conduct code generation stage quality review for src/{module}/ following .github/instructions/quality-checklists.md

Key checks:

  • โœ… All tests pass
  • โœ… Coverage โ‰ฅ 90%
  • โœ… Ruff checks pass
  • โœ… Docstrings follow standards
  • โœ… CodeGuard compliance verified

Manual commands:

# Run tests
pytest -v

# Check coverage
pytest --cov=src --cov-report=term

# Run ruff
ruff check src/ test/
ruff format src/ test/

Troubleshooting Common Issues#

Issue: Quality Review Fails#

Symptom:

โŒ Quality review failed: Test coverage only 65% (threshold 90%)

Solution:

# Identify uncovered lines
pytest --cov=src --cov-report=html
open htmlcov/index.html

# Add tests for missing scenarios
# Re-run quality review

Issue: Security Review Fails#

Symptom:

โŒ Security review failed: Hardcoded credential found

Solution:

  1. Review relevant CodeGuard file
  2. Move credentials to environment variables
  3. Update code to use os.getenv()
  4. Add to error resolution KB
  5. Re-run security review

Issue: Tests Fail After Refactoring#

Symptom: Tests pass in GREEN but fail after REFACTOR phase

Solution:

  1. Review changes made during refactoring
  2. Ensure logic hasn't changed
  3. Check test expectations are still valid
  4. Add debug logging temporarily
  5. Request human guidance if stuck

Issue: Prompt Not Executing#

Symptom: AI doesn't recognize the prompt reference

Solution:

Read .github/prompts/{prompt-file}.prompt.md and execute that prompt for {target-file}

Quick Reference#

Workflow Orchestration#

# Requirements โ†’ Specification (complete)
Execute workflow-requirements-to-spec prompt for docs/requirements/{name}.md with scope per-requirement

# Specification โ†’ Code (complete)
Execute workflow-spec-to-code prompt for docs/specifications/spec_{name}.md

Individual Operations#

# Generate specification
Use generate-spec-from-requirement prompt for docs/requirements/{name}.md

# Create threat model
Use create-threat-model prompt for docs/requirements/{name}.md with scope per-requirement

# Create architecture diagram
Use create-architecture-diagram prompt for docs/specifications/spec_{name}.md

# Generate code with TDD
Use generate-code-from-spec prompt for docs/specifications/spec_{name}.md

Quality Reviews#

# Requirements quality review
Conduct requirements stage quality review for docs/requirements/{name}.md following .github/instructions/quality-checklists.md

# Specification quality review
Conduct specification stage quality review for docs/specifications/spec_{name}.md following .github/instructions/quality-checklists.md

# Code quality review
Conduct code generation stage quality review for src/{module}/ following .github/instructions/quality-checklists.md

Manual Quality Checks#

# Run all tests
pytest -v

# Check coverage with report
pytest --cov=src --cov-report=term --cov-report=html

# Ruff linting
ruff check src/ test/

# Ruff formatting
ruff format src/ test/

# Combined check
pytest -v && pytest --cov=src && ruff check src/ test/


Last Updated: 2025-11-09