Skip to content

doc(contact-center): add ai-docs SDD templates for code generation#4722

Open
ciscoRankush wants to merge 4 commits intowebex:task-refactorfrom
ciscoRankush:SPARK-775697Templates
Open

doc(contact-center): add ai-docs SDD templates for code generation#4722
ciscoRankush wants to merge 4 commits intowebex:task-refactorfrom
ciscoRankush:SPARK-775697Templates

Conversation

@ciscoRankush
Copy link

@ciscoRankush ciscoRankush commented Feb 19, 2026

COMPLETES #SPARK-775697

This pull request addresses

AI agents working on the @webex/contact-center SDK need structured code generation templates that enforce a spec-driven workflow — gathering requirements, presenting spec summaries for developer approval, and
following validation checklists before completing work. Without these templates, agents produce inconsistent code that misses SDK patterns like LoggerProxy, MetricsManager, and error handling.

by making the following changes

  • Adds ai-docs/templates/ with 5 template files across 2 categories:
    • existing-service/ (2 files) — Bug-fix template with Section A/B split (developer questions vs agent investigation) and root-cause gate; Feature-enhancement template with always-present placement triage, Type
      F skip-triage support, and spec summary gate
    • documentation/ (2 files) — Templates for generating service-level AGENTS.md and ARCHITECTURE.md
    • README.md — Template index with categories, directory structure, and usage flow

All templates include:
- STOP gates preventing code generation before information gathering
- Interrogative phrasing (questions, not fill-in forms)
- MANDATORY/OPTIONAL labels per section
- Completion gates with checklists
- Spec summary templates requiring developer approval
- Direct clickable links to related files (no vague references)

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

  1. Type A (New Service) — Simulated "Create a new Analytics service" prompt; verified decision tree routing, pre-questions STOP gate, all 9 questions interrogative, sections numbered 1-6 (no duplicates),
    MANDATORY/OPTIONAL labels, completion gate, spec summary, and 05-validation.md links to root AGENTS.md Service Routing Table
  2. Type B (New Method) — Verified 01-requirements.md has STOP gate, 12 interrogative questions, event contract table, metrics section, completion gate, spec summary with getBuddyAgents example
  3. Type C (Bug Fix) — Simulated "consultTransfer is broken" prompt; verified Section A STOP gate blocks investigation, 6 interrogative questions, completion gate, root-cause gate (Step 3) requires developer
    approval
  4. Type D (Feature Enhancement) — Verified Step 0 triage always presented, spec summary gate present, completion gate with 8 items
  5. Type F (Modify Existing Method) — Simulated "Update stationLogin method" prompt; verified skip-triage Note links to root AGENTS.md with clickable path, jumps to Step 0B correctly
  6. Link Validation — All relative links in template files verified (pattern links use ../../patterns/, AGENTS.md paths use ../../../AGENTS.md)

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Other - Claude Code (Claude Opus 4.6)
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

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

@ciscoRankush ciscoRankush requested a review from a team as a code owner February 19, 2026 09:29
@ciscoRankush ciscoRankush changed the title feat(contact-center): add ai-docs SDD templates for code generation doc(contact-center): add ai-docs SDD templates for code generation Feb 19, 2026
@Shreyas281299 Shreyas281299 added the validated If the pull request is validated for automation. label Feb 20, 2026
@Shreyas281299
Copy link
Contributor

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d7d180360

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

Partial Review.

  • new-method
  • new-service
    Above folders are still left to be reviewed

@Shreyas281299
Copy link
Contributor

@codex review the PR more thoroughly, the PR is to create templating that will be used the AI agents to detect the type of task the user is prompting it to do

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d7d180360

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

ciscoRankush pushed a commit to ciscoRankush/webex-js-sdk that referenced this pull request Feb 20, 2026
Changes based on reviewer feedback on PR webex#4722:
- Fix validation commands in all 4 templates to use actual workspace
  scripts: test:styles, test:unit, build:src
- Clarify event contract "Emitted/Received On" field to explicitly ask
  which object (cc, task, taskManager) the event is emitted/received on

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ciscoRankush pushed a commit to ciscoRankush/webex-js-sdk that referenced this pull request Feb 23, 2026
Changes based on reviewer feedback on PR webex#4722:
- Fix validation commands in all 4 templates to use actual workspace
  scripts: test:styles, test:unit, build:src
- Clarify event contract "Emitted/Received On" field to explicitly ask
  which object (cc, task, taskManager) the event is emitted/received on

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

Add Spec-Driven Development templates for modifying existing services:
- existing-service/bug-fix.md — Section A/B workflow with STOP gate,
  6 interrogative questions, root-cause gate before implementation
- existing-service/feature-enhancement.md — Always-present placement
  triage, Type F skip-triage support, spec summary gate
- documentation/create-agents-md.md — Template for service AGENTS.md
- documentation/create-architecture-md.md — Template for ARCHITECTURE.md
- templates/README.md — Template index with categories and usage flow

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

- test:styles → test:style (singular, matches package.json)
- test -- --testPathPattern → test:unit (consistent with SDK convention)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6bf8f3bac4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

## Related Documentation

- [ARCHITECTURE.md](ARCHITECTURE.md) - Technical deep-dive
- [Pattern files](../../../ai-docs/patterns/) - Coding patterns

Choose a reason for hiding this comment

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

P2 Badge Fix broken pattern-docs link in generated AGENTS template

This template is meant to generate service docs under src/services/<service>/ai-docs/AGENTS.md, but the embedded link ../../../ai-docs/patterns/ resolves to src/ai-docs/patterns from that location, not the package-level ai-docs/patterns directory. As a result, every generated AGENTS file will contain a dead “Pattern files” reference, so agents following the docs cannot reach the intended guidance.

Useful? React with 👍 / 👎.

Comment on lines +69 to +70
### Creating Service Documentation (Task Type E)
Use: [`documentation/create-agents-md.md`](documentation/create-agents-md.md)

Choose a reason for hiding this comment

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

P2 Badge Keep task type E mapped to architecture analysis

The root decision tree defines Type E as read-only architecture understanding (packages/@webex/contact-center/AGENTS.md), but this README labels Type E as “Creating Service Documentation” and routes it to documentation/create-agents-md.md. That mismatch will misroute Type E requests to a doc-generation workflow instead of the intended analysis flow.

Useful? React with 👍 / 👎.

Comment on lines +86 to +89
4. Present Spec Summary to developer, wait for approval
|
v
5. If task is "Add Feature", run placement triage (existing vs new service)

Choose a reason for hiding this comment

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

P2 Badge Run feature placement triage before spec approval

The usage flow asks for a Spec Summary approval before running feature placement triage, but triage determines whether the work should stay in existing-service/feature-enhancement.md or reroute to new-service/00-master.md. Following this order can produce an approved spec for the wrong scope and then force a post-approval reroute.

Useful? React with 👍 / 👎.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9e1ca7a973

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

## Usage Examples

### [Use Case 1]
```typescript

Choose a reason for hiding this comment

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

P2 Badge Escape nested fences in AGENTS template sample

The ## AGENTS.md Structure block is opened with ```markdown and then contains an unescaped inner fence at this line, which closes the outer block in standard Markdown renderers. In GitHub/docs rendering, everything after this point is interpreted as live document content instead of the intended literal template, so agents cannot reliably copy the full sample structure.

Useful? React with 👍 / 👎.


## File Structure

```

Choose a reason for hiding this comment

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

P2 Badge Escape nested fences in ARCHITECTURE template sample

The ## ARCHITECTURE.md Structure example starts as a fenced Markdown block, but this inner triple-backtick fence terminates it early. As a result, the rest of the supposed template renders as normal page content rather than a literal snippet, breaking the documentation workflow for anyone trying to copy/paste the generated ARCHITECTURE skeleton.

Useful? React with 👍 / 👎.

- [ ] Types
- [ ] Not sure (this is fine — you will investigate)

5. **"Are there any error messages or stack traces you can share?"**
Copy link
Contributor

Choose a reason for hiding this comment

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

5th and 6th point here are also being checked under 3rd point's section. Do we need them in both places ?

Bug fix is complete when:
1. Root cause identified and confirmed with developer
2. Fix implemented after developer approval
3. Regression test added
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it understand what regression test implies here ?


### Triage Questions — Always Ask These:

1. **"Does this feature fit within the responsibility of an existing service, or does it introduce a new domain/responsibility?"**
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if any one of these questions are skipped > Or that even possible ?

})),
```

### Plugin Layer (cc.ts)
Copy link
Contributor

Choose a reason for hiding this comment

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

If the new service is being exposed from cc then this would be coprrect but we won't be always exposing public methods from cc so won;t this need change. Same is applicable for other headings as well


---

## Step 1: Design the Feature
Copy link
Contributor

Choose a reason for hiding this comment

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

What are these steps for, a description or heading would be helpful because before this also we were doing steps and it can get confused with the order


---

## File Structure
Copy link
Contributor

Choose a reason for hiding this comment

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

We have removed file stucture from architecture.md to Agents.md so probably we can update that

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf55cc1861

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


Errors are thrown as `Error` with:
- `message`: Error description
- `data.reason`: Error reason code

Choose a reason for hiding this comment

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

P2 Badge Describe the real error reason field in AGENTS template

This template tells readers to inspect error.data.reason, but SDK errors produced by getErrorDetails store the human-readable reason in error.message and only attach {message, fieldName} to error.data (src/services/core/Utils.ts). If service docs are generated from this template, developers following the documented error-handling pattern will read an undefined field and miss the actual failure reason.

Useful? React with 👍 / 👎.

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