Article generation

From Happy-Technologies-LLC/happy-platform-skills · View interactive version

Article generation is an AI agent skill from the GitHub repository Happy-Technologies-LLC/happy-platform-skills. Generate knowledge articles from resolved incidents, problem records, and change implementations with proper KB structure including symptoms, cause, resolution, and related articles

How to use this skill

Skill file

Knowledge Article Generation

Overview

This skill provides a structured workflow for generating knowledge articles from resolved ServiceNow records including incidents, problem records, and change requests. Well-documented resolutions become reusable knowledge that reduces future resolution time and enables self-service.

This skill helps you:

When to use: After resolving recurring incidents, closing problem investigations with root cause, completing change implementations that affect user workflows, or during periodic knowledge harvesting sessions.

Prerequisites

Procedure

Step 1: Identify Source Records for Article Generation

Find resolved incidents, problems, or changes that are good candidates for knowledge articles.

Criteria for good candidates:

Using MCP (recurring incidents):

Tool: SN-Query-Table
Parameters:
  table_name: incident
  query: state=6^opened_at>=javascript:gs.daysAgoStart(30)^close_notesISNOTEMPTY^kb_knowledgeISEMPTY
  fields: sys_id,number,short_description,description,close_notes,category,subcategory,cmdb_ci,assignment_group,resolution_code,resolved_by
  limit: 30

Using REST API:

GET /api/now/table/incident?sysparm_query=state=6^opened_at>=javascript:gs.daysAgoStart(30)^close_notesISNOTEMPTY^kb_knowledgeISEMPTY&sysparm_fields=sys_id,number,short_description,description,close_notes,category,subcategory,cmdb_ci,assignment_group,resolution_code,resolved_by&sysparm_limit=30

Using MCP (problem records with root cause):

Tool: SN-Query-Table
Parameters:
  table_name: problem
  query: state=4^cause_notesISNOTEMPTY^opened_at>=javascript:gs.daysAgoStart(90)
  fields: sys_id,number,short_description,description,cause_notes,fix_notes,category,subcategory,cmdb_ci,known_error,workaround
  limit: 20

Using REST API:

GET /api/now/table/problem?sysparm_query=state=4^cause_notesISNOTEMPTY^opened_at>=javascript:gs.daysAgoStart(90)&sysparm_fields=sys_id,number,short_description,description,cause_notes,fix_notes,category,subcategory,cmdb_ci,known_error,workaround&sysparm_limit=20

Using MCP (change requests with implementation notes):

Tool: SN-Query-Table
Parameters:
  table_name: change_request
  query: state=3^close_notesISNOTEMPTY^type=normal^opened_at>=javascript:gs.daysAgoStart(90)
  fields: sys_id,number,short_description,description,close_notes,implementation_plan,backout_plan,category,cmdb_ci
  limit: 20

Step 2: Check for Existing Articles to Avoid Duplicates

Before creating a new article, verify no existing article covers the same topic.

Using MCP:

Tool: SN-Query-Table
Parameters:
  table_name: kb_knowledge
  query: workflow_state=published^short_descriptionLIKEoutlook^short_descriptionLIKEcalendar^ORshort_descriptionLIKEsync
  fields: sys_id,number,short_description,kb_knowledge_base,kb_category,workflow_state,sys_updated_on
  limit: 10

Using REST API:

GET /api/now/table/kb_knowledge?sysparm_query=workflow_state=published^short_descriptionLIKEoutlook^short_descriptionLIKEcalendar^ORshort_descriptionLIKEsync&sysparm_fields=sys_id,number,short_description,kb_knowledge_base,kb_category,workflow_state,sys_updated_on&sysparm_limit=10

If a matching article exists, consider updating it rather than creating a duplicate.

Step 3: Identify the Target Knowledge Base and Category

Find the appropriate knowledge base and category for the new article.

Using MCP:

Tool: SN-Query-Table
Parameters:
  table_name: kb_knowledge_base
  query: active=true
  fields: sys_id,title,description,kb_version,owner,active
  limit: 20
Tool: SN-Query-Table
Parameters:
  table_name: kb_category
  query: kb_knowledge_base=[target_kb_sys_id]^active=true
  fields: sys_id,label,parent_id,full_category
  limit: 30

Using REST API:

GET /api/now/table/kb_knowledge_base?sysparm_query=active=true&sysparm_fields=sys_id,title,description,kb_version,owner,active&sysparm_limit=20
GET /api/now/table/kb_category?sysparm_query=kb_knowledge_base=[target_kb_sys_id]^active=true&sysparm_fields=sys_id,label,parent_id,full_category&sysparm_limit=30

Step 4: Structure the Article Content

Organize the extracted information into a standard knowledge article format. The article body should follow this template:

Article Structure Template:

<h2>Symptoms</h2>
<p>[Describe what the user experiences - error messages, unexpected behavior, inability to perform a task]</p>

<h2>Cause</h2>
<p>[Explain the root cause or contributing factors]</p>

<h2>Resolution</h2>
<ol>
  <li>[Step-by-step resolution instructions]</li>
  <li>[Include screenshots or commands where applicable]</li>
  <li>[Specify expected outcome after each step]</li>
</ol>

<h2>Workaround</h2>
<p>[If a permanent fix is not available, describe temporary workaround]</p>

<h2>Additional Information</h2>
<ul>
  <li>Affected Systems: [CI or service name]</li>
  <li>Source: [INC/PRB/CHG number]</li>
  <li>Related Articles: [KB numbers]</li>
</ul>

Step 5: Create the Draft Knowledge Article

Using MCP:

Tool: SN-Create-Record
Parameters:
  table_name: kb_knowledge
  data:
    short_description: "How to Resolve Outlook Calendar Sync Errors on Mobile Devices"
    text: "<h2>Symptoms</h2><p>Users report that Outlook calendar events are not syncing to their mobile devices (iOS or Android). Events created on the desktop client do not appear on the mobile app, or events appear with incorrect times.</p><h2>Cause</h2><p>The ActiveSync profile on the mobile device has a stale authentication token, often triggered by a recent password change or multi-factor authentication policy update.</p><h2>Resolution</h2><ol><li>On the mobile device, navigate to Settings > Accounts > Exchange/Outlook</li><li>Remove the existing Exchange account</li><li>Restart the device</li><li>Re-add the Exchange account using current credentials</li><li>Wait 5 minutes for initial sync to complete</li><li>Verify calendar events appear correctly</li></ol><h2>Workaround</h2><p>If re-adding the account does not resolve the issue, use Outlook Web Access (OWA) on the mobile browser as a temporary alternative.</p><h2>Additional Information</h2><ul><li>Affected Systems: Microsoft Exchange, Outlook Mobile</li><li>Source: INC0012345, INC0012678, INC0013001</li><li>Related Articles: KB0010100 - Outlook Desktop Sync Issues</li></ul>"
    kb_knowledge_base: [target_kb_sys_id]
    kb_category: [target_category_sys_id]
    workflow_state: draft
    article_type: text
    valid_to: 2027-03-19
    meta_description: "Resolve Outlook calendar sync errors on iOS and Android mobile devices caused by stale authentication tokens"

Using REST API:

POST /api/now/table/kb_knowledge
Content-Type: application/json

{
  "short_description": "How to Resolve Outlook Calendar Sync Errors on Mobile Devices",
  "text": "<h2>Symptoms</h2><p>Users report that Outlook calendar events are not syncing...</p>...",
  "kb_knowledge_base": "[target_kb_sys_id]",
  "kb_category": "[target_category_sys_id]",
  "workflow_state": "draft",
  "article_type": "text",
  "valid_to": "2027-03-19",
  "meta_description": "Resolve Outlook calendar sync errors on mobile devices"
}

Step 6: Link Source Records to the New Article

Create a relationship between the source incident/problem and the new KB article.

Using MCP:

Tool: SN-Create-Record
Parameters:
  table_name: m2m_kb_task
  data:
    kb_knowledge: [new_article_sys_id]
    task: [source_incident_sys_id]

Using REST API:

POST /api/now/table/m2m_kb_task
Content-Type: application/json

{
  "kb_knowledge": "[new_article_sys_id]",
  "task": "[source_incident_sys_id]"
}

Step 7: Generate Article from Problem Record

Problem records provide richer root cause data. Extract cause notes, fix notes, and workarounds.

Using MCP:

Tool: SN-Query-Table
Parameters:
  table_name: problem
  query: number=PRB0005678
  fields: sys_id,number,short_description,description,cause_notes,fix_notes,workaround,category,subcategory,cmdb_ci,related_incidents
  limit: 1

Map problem fields to article sections:

Step 8: Generate Article from Change Request

Change implementations often introduce new procedures that users need to know about.

Using MCP:

Tool: SN-Query-Table
Parameters:
  table_name: change_request
  query: number=CHG0009876
  fields: sys_id,number,short_description,description,close_notes,implementation_plan,backout_plan,test_plan,category,cmdb_ci
  limit: 1

Map change fields to article sections:

Step 9: Add Work Notes to Source Record

Document that a knowledge article was generated from the source record.

Using MCP:

Tool: SN-Add-Work-Notes
Parameters:
  sys_id: [source_record_sys_id]
  work_notes: |
    === KNOWLEDGE ARTICLE GENERATED ===
    Article: KB0015678 - "How to Resolve Outlook Calendar Sync Errors on Mobile Devices"
    Status: Draft (pending review)
    Knowledge Base: IT Support
    Category: Email / Mobile

    Generated from resolution data in this incident.
    Article includes symptoms, root cause, step-by-step resolution, and workaround.
    Linked to 3 related incidents: INC0012345, INC0012678, INC0013001.

Tool Usage

MCP Tools Reference

| Tool | When to Use |

|------|-------------|

| SN-Query-Table | Retrieve source records, KB bases, categories |

| SN-Natural-Language-Search | Check for existing articles on the topic |

| SN-Create-Record | Create new KB article and link records |

| SN-Update-Record | Update existing articles with new content |

| SN-Add-Work-Notes | Document article creation on source records |

REST API Reference

| Endpoint | Method | Purpose |

|----------|--------|---------|

| /api/now/table/incident | GET | Retrieve resolved incidents |

| /api/now/table/problem | GET | Retrieve problem root cause data |

| /api/now/table/change_request | GET | Retrieve change implementation details |

| /api/now/table/kb_knowledge | GET/POST | Search and create articles |

| /api/now/table/kb_knowledge_base | GET | Find target knowledge base |

| /api/now/table/kb_category | GET | Find target category |

| /api/now/table/m2m_kb_task | POST | Link articles to source records |

Best Practices

Troubleshooting

"Created article has empty text field"

Cause: The text field requires HTML-formatted content; plain text may not render correctly

Solution: Wrap content in HTML tags (<p>, <ol>, <h2>) as shown in the template

"Cannot create article - missing required fields"

Cause: Knowledge base workflow requires fields like kb_knowledge_base, short_description, and workflow_state

Solution: Ensure all mandatory fields are populated. Query the sys_dictionary table for required fields: name=kb_knowledge^mandatory=true

"Article created but not visible in knowledge portal"

Cause: Article is in draft state and not yet published through the approval workflow

Solution: This is expected behavior. The knowledge manager must review and publish the article. Check the workflow_state field

"Cannot link article to incident - m2m_kb_task creation fails"

Cause: The many-to-many table requires valid sys_ids for both the article and the task

Solution: Verify both sys_ids exist. The task field must reference a record extending the task table (incident, problem, change_request)

"Duplicate article warning from knowledge workflow"

Cause: A similar article already exists and the workflow detected potential duplication

Solution: Review the existing article. If it covers the same topic, update it instead of creating a new one

Examples

Example 1: Article from Recurring Incident

Source: 5 incidents about "Printer spooler service stopped" (INC0015001-INC0015005)

Generated Article:

Example 2: Article from Problem Record

Source: PRB0005678 - "Intermittent database connection timeouts in CRM application"

Generated Article:

Example 3: Article from Change Request

Source: CHG0009876 - "Migrate email from on-premise Exchange to Office 365"

Generated Article:

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.