Skip to content

Comments

docs(contact-center): add SDD templates for new service creation#4734

Open
ciscoRankush wants to merge 3 commits intowebex:task-refactorfrom
ciscoRankush:SPARK-775697Templates-new-service
Open

docs(contact-center): add SDD templates for new service creation#4734
ciscoRankush wants to merge 3 commits intowebex:task-refactorfrom
ciscoRankush:SPARK-775697Templates-new-service

Conversation

@ciscoRankush
Copy link

COMPLETES #SPARK-775697

This pull request addresses

AI agents need structured templates to guide new service creation in the @webex/contact-center SDK, ensuring they gather complete requirements before writing code.

by making the following changes

Adds ai-docs/templates/new-service/ with 6 template files:

  • 00-master.md — Orchestrator with workflow overview and pattern links
  • 01-pre-questions.md — STOP gate with 9 interrogative questions, MANDATORY/OPTIONAL labels, event contract table, completion gate, and spec summary template
  • 02-code-generation.md — Service class generation patterns
  • 03-integration.md — Registration and exports in cc.ts
  • 04-test-generation.md — Unit test file generation
  • 05-validation.md — Quality checklist with correct workspace commands (test:styles, test:unit, build:src)

Change Type

  • Documentation update

The following scenarios were tested

  1. Simulated "Create a new Analytics service" prompt — verified decision tree routing to Type A, STOP gate enforcement, all questions interrogative, sections numbered 1-6 with no duplicates, completion gate, and spec summary
  2. Link validation — all relative paths verified correct
  3. Workspace commands verified against actual package.json scripts

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was used to create a draft that was subsequently customized or modified
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Other - Claude Code (Claude Opus 4.6)
  • This PR is related to
    • Tech Debt

I certified that

  • I have read and followed contributing guidelines
  • I discussed changes with code owners prior to submitting this pull request
  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the documentation accordingly

Add Spec-Driven Development templates for creating new services:
- 00-master.md — Orchestrator with workflow overview
- 01-pre-questions.md — STOP gate with interrogative questions,
  MANDATORY/OPTIONAL labels, event contract, spec summary
- 02-code-generation.md — Service class generation patterns
- 03-integration.md — Registration and exports in cc.ts
- 04-test-generation.md — Unit test file generation
- 05-validation.md — Quality checklist with correct workspace commands

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ciscoRankush ciscoRankush requested a review from a team as a code owner February 23, 2026 08:54
@Shreyas281299 Shreyas281299 added the validated If the pull request is validated for automation. label Feb 23, 2026
Copy link
Contributor

@Kesari3008 Kesari3008 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generic comment for new service creation: Everywhere we are assuming that this new service will be created at cc level. What if that's not the case ?
What if we need to expose a service under task folder ?

@@ -0,0 +1,107 @@
# New Service Creation - Master Template

> **Purpose**: Orchestrator for creating new services (like AddressBook, EntryPoint, Queue).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this can be misleading as we are giving only helper classes as refernce for new services, when we are going to treat agents folder, core folder, config folder also as separate services so maybe we can update this purpose to be more accurate

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed as discussed over call


You can land on this template from:
- direct "create new service" requests
- "add feature" requests after placement triage determines the feature should be a standalone service/module
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here it says placement triage and below feature triage, we should refer to it with same name

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

## Workflow Overview

```
Step 1: Requirements → Step 2: Code Generation → Step 3: Integration → Step 4: Tests → Step 5: Validation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be represented as left to right flowchart or a block diagram maybe

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is more machine readable statement , thats why kept like that


Create:
- Service class file (`src/services/ServiceName.ts`)
- Type definitions (in service file or `types.ts`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be updated to say corresponding folder's types.ts

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated


Integrate:
- Initialize in `cc.ts` constructor
- Expose via `cc.serviceName` if public
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are saying expose via cc.serviceName if public but have we mentioned anywhere how it knows what's public ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

## Patterns to Load

Before generating code, read:
1. [`../../patterns/typescript-patterns.md`](../../patterns/typescript-patterns.md) - Type conventions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need update once we have patterns updated

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

- If YES: "Which specific fields?" (e.g., `addressBookId`, `teamIds`)
- If NO: note "No profile dependency"

6. **"Does this service need to process WebSocket events?"**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This point and 4th point are common so can be clubbed

import LoggerProxy from '../logger-proxy';

/**
* Service name and module identifier for logging
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How we have added a heading that type definitions need to be created, we should add similar heading here for constnst also. And we should add a link here saying type definitions in types.ts file and contacnts and enums in contactnts. ts file. If these files are already existing then update there else create new files for this new service

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

// throw new Error('Dependency ID not available. Ensure agent is logged in.');
// }

const queryParams = new URLSearchParams();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code reference seems vers specific, can we not make it generic since it say service template


---

## Code Quality Checklist
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not need to mention about metric in checklist

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Copy link
Contributor

@Shreyas281299 Shreyas281299 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel Priya has covered everything. I dont have any other comments.

Rankush Kumar and others added 2 commits February 24, 2026 14:08
…vice templates

Apply reviewer feedback from Kesari3008 and validate against actual codebase:
- Broaden 00-master.md purpose to cover top-level, sub-module, and internal services
- Add placement Q3 to 01-pre-questions.md with folder-based/single-file/sub-module options
- Merge duplicate event/WebSocket questions into unified Q5
- Rewrite 02-code-generation.md with placement-branched file structures, types, constants
- Add MetricsManager and getErrorDetails as mandatory patterns in code templates
- Rewrite 03-integration.md with Path A (folder-based), Path B (single-file), Path C (sub-module)
- Distinguish AQM (Services singleton) vs non-AQM (cc.ts direct) integration
- Add metrics section and placement-aware checklists to 05-validation.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ation template

Constants exist at multiple levels (root, services, metrics, config, service-specific).
Before creating any new constant, the template now requires searching the full hierarchy
to prevent duplicates and ensure correct placement. A new constants.ts file is only
created when the service is folder-based, no file exists yet, and constants are
service-specific. Validation checklist updated to enforce these checks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

validated If the pull request is validated for automation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants