| name | coding-workflow |
| description | Code creation workflow with Context7 integration for documentation-aware code generation. Creates, refactors, and extends MCP servers and Node.js/Python projects with up-to-date library documentation. |
| version | 2.0 |
| date | "2026-03-12T00:00:00.000Z" |
| license | MIT |
Coding Workflow
Workflow for code creation, refactoring, and extension with intelligent documentation lookup via Context7.
When to Use This Skill
Use this skill when:
- Creating new MCP server tools or endpoints
- Implementing new features in existing projects
- Refactoring code with modern best practices
- Integrating new libraries (npm/pip packages)
- Writing code that needs up-to-date API documentation
Core Capabilities
1. Context7 Documentation Lookup
Before writing code that uses external libraries, ALWAYS look up current documentation:
# Step 1: Resolve library ID
Use: resolve-library-id with libraryName
# Step 2: Fetch documentation
Use: get-library-docs with context7CompatibleLibraryID and topic
Common Libraries for MCP Development
| Library | Context7 ID | Common Topics |
|---|
| Express | /expressjs/express | routing, middleware, error handling |
| Node.js | /nodejs/node | fs, http, streams |
| Zod | /colinhacks/zod | schemas, validation |
| MCP SDK | /anthropics/mcp-typescript | tools, resources, prompts |
| Playwright | /microsoft/playwright | selectors, actions, assertions |
| IMAP | /mscdex/node-imap | connection, fetch, search |
Workflow: New MCP Tool
Phase 1: Requirements Analysis
## Tool Specification
**Name:** moodle_create_quiz
**Purpose:** Create a quiz in a Moodle course section
**Parameters:**
- courseId (required): Moodle course ID
- sectionNum (required): Section number
- quizName (required): Name of the quiz
- intro (optional): Quiz description
- timeLimit (optional): Time limit in seconds
**Returns:** Quiz ID and URL
**Moodle API:** mod_quiz_add_instance (requires local_sync_service plugin)
Phase 2: Documentation Lookup
get-library-docs("/anthropics/mcp-typescript", topic="tools")
get-library-docs("/colinhacks/zod", topic="object schemas")
get-library-docs("/axios/axios", topic="post requests")
Phase 3: Implementation
import { z } from 'zod';
const CreateQuizSchema = z.object({
courseId: z.string().min(1),
sectionNum: z.string().min(1),
quizName: z.string().min(1),
intro: z.string().optional(),
timeLimit: z.string().optional(),
});
export async function moodle_create_quiz(params, config) {
const validated = CreateQuizSchema.parse(params);
const response = await fetch(`${config.MOODLE_URL}/webservice/rest/server.php`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({
wstoken: config.MOODLE_TOKEN,
wsfunction: 'local_sync_service_create_quiz',
moodlewsrestformat: 'json',
courseid: validated.courseId,
sectionnum: validated.sectionNum,
name: validated.quizName,
intro: validated.intro || '',
timelimit: validated.timeLimit || '0',
}),
});
const data = await response.json();
if (data.exception) {
throw new Error(`Moodle API Error: ${data.message}`);
}
return {
success: true,
quizId: data.quizid,
url: `${config.MOODLE_URL}/mod/quiz/view.php?id=${data.cmid}`,
};
}
Phase 4: Tool Registration
server.tool(
'moodle_create_quiz',
'Create a quiz in a Moodle course section',
{
courseId: { type: 'string', description: 'Moodle course ID' },
sectionNum: { type: 'string', description: 'Section number (0-based)' },
quizName: { type: 'string', description: 'Name of the quiz' },
intro: { type: 'string', description: 'Quiz description (optional)' },
timeLimit: { type: 'string', description: 'Time limit in seconds (optional)' },
},
async (params) => {
return await moodle_create_quiz(params, config);
}
);
Code Quality Standards
1. Error Handling
try {
const result = await externalApi.call(params);
return { success: true, data: result };
} catch (error) {
console.error(`[${toolName}] Error:`, error.message);
return {
success: false,
error: error.message,
code: error.code || 'UNKNOWN_ERROR'
};
}
2. Input Validation
const schema = z.object({
required: z.string().min(1),
optional: z.string().optional().default('default'),
numeric: z.coerce.number().positive(),
});
3. Logging
console.log(`[${new Date().toISOString()}] [${toolName}] ${message}`);
4. TypeScript-like JSDoc
Refactoring Patterns
Extract Common Logic
export async function callMoodleApi(wsfunction, params, config) {
const response = await fetch(`${config.MOODLE_URL}/webservice/rest/server.php`, {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: new URLSearchParams({
wstoken: config.MOODLE_TOKEN,
wsfunction,
moodlewsrestformat: 'json',
...params,
}),
});
const data = await response.json();
if (data.exception) throw new Error(data.message);
return data;
}
Modernize Async Patterns
const [courses, users] = await Promise.all([
fetchCourses(),
fetchUsers(),
]);
Quick Reference
Context7 Lookup Template
1. resolve-library-id: "{library-name}"
2. get-library-docs: ID from step 1, topic: "{specific-topic}"
3. Apply patterns to implementation
File Structure for New Tool
mcp-servers/{server}/
├── src/
│ ├── server.mjs # Add tool registration
│ ├── tools/
│ │ └── {tool_name}.mjs # Tool implementation
│ └── utils/
│ └── {api}.mjs # Shared utilities
└── tests/
└── {tool_name}.test.mjs # Unit tests
Commit Message
feat({server}): add {tool_name} tool
- Implements {brief description}
- Uses {library} for {purpose}
- Closes #{issue} (if applicable)
Coding Workflow v2.0