-
Notifications
You must be signed in to change notification settings - Fork 396
doc(contact-center): add ai-docs SDD templates for code generation #4722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
9a6c0cd
6bf8f3b
9e1ca7a
cf55cc1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| # Contact Center SDK - Templates | ||
|
|
||
| > **Purpose**: Code generation templates for AI agents to create, modify, and document SDK components. | ||
|
|
||
| --- | ||
|
|
||
| ## Template Categories | ||
|
|
||
| | Category | Purpose | Use When | | ||
| |----------|---------|----------| | ||
| | **new-service/** | Creating new services (like AddressBook, Queue) | Adding new data/API services | | ||
| | **new-method/** | Adding methods to existing services | Extending service capabilities | | ||
| | **existing-service/** | Bug fixes, feature enhancements, and modifications to existing methods | Modifying existing code | | ||
| | **documentation/** | Generating AGENTS.md and ARCHITECTURE.md | Creating service-level docs | | ||
|
|
||
| --- | ||
|
|
||
| ## Template Directory Structure | ||
|
|
||
| ``` | ||
| templates/ | ||
| ├── README.md # This file | ||
| ├── new-service/ # New service creation | ||
| │ ├── 00-master.md # Orchestrator | ||
| │ ├── 01-pre-questions.md # Requirements gathering (STOP gate) | ||
| │ ├── 02-code-generation.md # Service class generation | ||
| │ ├── 03-integration.md # Registration and exports | ||
| │ ├── 04-test-generation.md # Test file generation | ||
| │ └── 05-validation.md # Quality checklist | ||
| ├── new-method/ # New method addition | ||
| │ ├── 00-master.md # Orchestrator | ||
| │ ├── 01-requirements.md # Method requirements (STOP gate) | ||
| │ ├── 02-implementation.md # Code implementation | ||
| │ ├── 03-tests.md # Test generation | ||
| │ └── 04-validation.md # Quality checklist | ||
| ├── existing-service/ # Modifications | ||
| │ ├── bug-fix.md # Bug fix workflow (STOP gate in Section A) | ||
| │ └── feature-enhancement.md # Feature addition / modify existing method (STOP gate in Step 0) | ||
| └── documentation/ # Doc generation | ||
| ├── create-agents-md.md # AGENTS.md template | ||
| └── create-architecture-md.md # ARCHITECTURE.md template | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Quick Reference | ||
|
|
||
| ### Creating a New Service (Task Type A) | ||
| Start with: [`new-service/00-master.md`](new-service/00-master.md) | ||
|
|
||
| ### Adding a New Method (Task Type B) | ||
| Start with: [`new-method/00-master.md`](new-method/00-master.md) | ||
|
|
||
| ### Fixing a Bug (Task Type C) | ||
| Use: [`existing-service/bug-fix.md`](existing-service/bug-fix.md) | ||
|
|
||
| ### Adding a Feature (Task Type D) | ||
| Start with: [`existing-service/feature-enhancement.md`](existing-service/feature-enhancement.md) | ||
|
|
||
| **Important:** Feature template includes a mandatory placement triage: | ||
| - if feature fits existing service -> continue feature-enhancement flow | ||
| - if feature needs standalone ownership -> reroute to [`new-service/00-master.md`](new-service/00-master.md) | ||
|
|
||
| ### Modifying an Existing Method (Task Type F) | ||
| Use: [`existing-service/feature-enhancement.md`](existing-service/feature-enhancement.md) | ||
|
|
||
| **Important:** When modifying an existing method (changing signature, parameters, return type, or behavior), use the feature-enhancement template but **skip Step 0 (Placement Triage)** since the method already exists. Start directly at Step 0B (Pre-Enhancement Questions). | ||
|
|
||
| ### Creating Service Documentation (Task Type E) | ||
| Use: [`documentation/create-agents-md.md`](documentation/create-agents-md.md) | ||
|
|
||
| --- | ||
|
|
||
| ## Template Usage Flow | ||
|
|
||
| ``` | ||
| 1. Classify task using root AGENTS.md decision tree (../../AGENTS.md) | ||
| | | ||
| v | ||
| 2. Route to appropriate template | ||
| | | ||
| v | ||
| 3. STOP — Present pre-questions to developer, wait for answers | ||
| | | ||
| v | ||
| 4. Present Spec Summary to developer, wait for approval | ||
| | | ||
| v | ||
| 5. If task is "Add Feature", run placement triage (existing vs new service) | ||
|
Comment on lines
+86
to
+89
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The usage flow asks for a Spec Summary approval before running feature placement triage, but triage determines whether the work should stay in Useful? React with 👍 / 👎. |
||
| | | ||
| v | ||
| 6. Load relevant patterns as specified | ||
| | | ||
| v | ||
| 7. Generate/modify code | ||
| | | ||
| v | ||
| 8. Run validation checklist | ||
| | | ||
| v | ||
| 9. Update documentation if needed | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,240 @@ | ||
| # Create AGENTS.md Template | ||
|
|
||
| > **Purpose**: Template for generating service-level AGENTS.md files optimized for LLM consumption. | ||
|
|
||
| --- | ||
|
|
||
| ## Pre-Generation Questions | ||
|
|
||
| Answer before writing: | ||
|
|
||
| 1. **Package/Service Name**: What is this service called? | ||
| 2. **Purpose**: What problem does this service solve? (1-2 sentences) | ||
| 3. **Key Capabilities**: What are the main features? (3-5 bullets) | ||
| 4. **Usage Examples**: What are the most common use cases? | ||
| 5. **API Surface**: What methods/properties are exposed? | ||
| 6. **Dependencies**: What does this service depend on? | ||
|
|
||
| --- | ||
|
|
||
| ## AGENTS.md Structure | ||
|
|
||
| ```markdown | ||
| # [Service Name] - AI Agent Guide | ||
|
|
||
| > **Purpose**: [One sentence describing what this service does] | ||
|
|
||
| --- | ||
|
|
||
| ## Quick Start | ||
|
|
||
| [3-5 line code example showing most basic usage] | ||
|
|
||
| --- | ||
|
|
||
| ## Key Capabilities | ||
|
|
||
| - [Capability 1]: [Brief description] | ||
| - [Capability 2]: [Brief description] | ||
| - [Capability 3]: [Brief description] | ||
|
|
||
| --- | ||
|
|
||
| ## Usage Examples | ||
|
|
||
| ### [Use Case 1] | ||
| ```typescript | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The Useful? React with 👍 / 👎. |
||
| // Example code | ||
| ``` | ||
|
|
||
| ### [Use Case 2] | ||
| ```typescript | ||
| // Example code | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## API Reference | ||
|
|
||
| ### Properties | ||
|
|
||
| | Property | Type | Description | | ||
| |----------|------|-------------| | ||
| | `propertyName` | `Type` | Description | | ||
|
|
||
| ### Methods | ||
|
|
||
| #### `methodName(params)` | ||
|
|
||
| Description of what this method does. | ||
|
|
||
| **Parameters**: | ||
| - `param1` (Type): Description | ||
| - `param2` (Type, optional): Description | ||
|
|
||
| **Returns**: `Promise<ReturnType>` - Description | ||
|
|
||
| **Example**: | ||
| ```typescript | ||
| const result = await service.methodName({ | ||
| param1: 'value', | ||
| }); | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Events (if applicable) | ||
|
|
||
| | Event | Data | When Emitted | | ||
| |-------|------|--------------| | ||
| | `event:name` | `EventData` | Description | | ||
|
|
||
| --- | ||
|
|
||
| ## Common Patterns | ||
|
|
||
| ### [Pattern Name] | ||
| ```typescript | ||
| // Pattern example | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Error Handling | ||
|
|
||
| Errors are thrown as `Error` with: | ||
| - `message`: Error description | ||
| - `data.reason`: Error reason code | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This template tells readers to inspect Useful? React with 👍 / 👎. |
||
|
|
||
| ```typescript | ||
| try { | ||
| await service.method(); | ||
| } catch (error) { | ||
| console.error(error.message); | ||
| console.error(error.data?.reason); | ||
| } | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Dependencies | ||
|
|
||
| - Requires: [dependency description] | ||
| - Used by: [what uses this service] | ||
|
|
||
| --- | ||
|
|
||
| ## Related Documentation | ||
|
|
||
| - [ARCHITECTURE.md](ARCHITECTURE.md) - Technical deep-dive | ||
| - [Pattern files](../../../ai-docs/patterns/) - Coding patterns | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This template is meant to generate service docs under Useful? React with 👍 / 👎. |
||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Content Guidelines | ||
|
|
||
| ### Purpose Section | ||
| - One clear sentence | ||
| - Focus on business value, not implementation | ||
|
|
||
| ### Quick Start | ||
| - Show the happy path | ||
| - Minimal code to demonstrate value | ||
| - Include all required setup steps | ||
|
|
||
| ### Examples | ||
| - Use realistic parameter values | ||
| - Show common variations | ||
| - Include error handling when relevant | ||
|
|
||
| ### API Reference | ||
| - List all public methods | ||
| - Include parameter types and descriptions | ||
| - Show return types | ||
| - Provide example for each method | ||
|
|
||
| ### Error Handling | ||
| - Document common error scenarios | ||
| - Show how to access error details | ||
|
|
||
| --- | ||
|
|
||
| ## Token Optimization Strategy | ||
|
|
||
| For LLM efficiency: | ||
| 1. **AGENTS.md first**: Contains usage info (most commonly needed) | ||
| 2. **ARCHITECTURE.md linked at end**: For deep technical questions | ||
| 3. **Concise examples**: Just enough to demonstrate | ||
| 4. **Tables for reference**: Quick scanning | ||
|
|
||
| --- | ||
|
|
||
| ## Validation Checklist | ||
|
|
||
| - [ ] Purpose is clear and concise | ||
| - [ ] Quick start works as-is | ||
| - [ ] All public methods documented | ||
| - [ ] Examples are realistic and working | ||
| - [ ] Error handling documented | ||
| - [ ] Links to ARCHITECTURE.md included | ||
| - [ ] No implementation details (save for ARCHITECTURE.md) | ||
|
|
||
| --- | ||
|
|
||
| ## Example: Services/Agent AGENTS.md | ||
|
|
||
| ```markdown | ||
| # Agent Service - AI Agent Guide | ||
|
|
||
| > **Purpose**: Manage agent lifecycle including login, logout, and state changes. | ||
|
|
||
| --- | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ```typescript | ||
| const cc = webex.cc; | ||
| await cc.register(); | ||
|
|
||
| // Login | ||
| await cc.stationLogin({ | ||
| teamId: 'team-123', | ||
| loginOption: 'BROWSER', | ||
| }); | ||
|
|
||
| // Set available | ||
| await cc.setAgentState({ | ||
| state: 'Available', | ||
| auxCodeId: '0', | ||
| }); | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Key Capabilities | ||
|
|
||
| - **Station Login**: Login with browser, extension, or dial number | ||
| - **Station Logout**: Logout from current station | ||
| - **State Management**: Change between Available/Idle states | ||
| - **Buddy Agents**: Retrieve list of available agents | ||
|
|
||
| --- | ||
|
|
||
| ## API Reference | ||
|
|
||
| ### `stationLogin(params)` | ||
|
|
||
| Login agent to a station. | ||
|
|
||
| **Parameters**: | ||
| - `teamId` (string): Team to login to | ||
| - `loginOption` ('BROWSER' | 'EXTENSION' | 'AGENT_DN'): Device type | ||
| - `dialNumber` (string, optional): Required for EXTENSION/AGENT_DN | ||
|
|
||
| **Returns**: `Promise<StationLoginResponse>` | ||
|
|
||
| --- | ||
|
|
||
| See [ARCHITECTURE.md](ARCHITECTURE.md) for technical details. | ||
| ``` | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 todocumentation/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 👍 / 👎.