Agent skill
rough-draft-pseudocode
Phase 2 - Define the logic flow for each function
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/rough-draft-pseudocode
SKILL.md
Step 0: Query Kodex
Query project knowledge for error handling and logic patterns.
Topic Inference (Pseudocode Focus)
From work item context, build candidates:
{item-keyword}-error-handling{item-keyword}-logicerror-patternsvalidation-patterns
Example
Tool: mcp__plugin_mermaid-collab_mermaid__kodex_query_topic
Args: { "project": "<cwd>", "name": "error-patterns" }
Display found topics as context before writing pseudocode.
Phase 2: Pseudocode
Define the logic flow for each function.
What to Produce
- Logic flow - Step-by-step description of what each function does
- Error handling approach - How errors are caught, propagated, reported
- Edge cases - Boundary conditions and how they're handled
- Dependencies - External services, databases, APIs called
Process
For each function from the Interface phase:
- Write plain-language pseudocode
- Identify error conditions
- List edge cases
- Note any external calls
Output Format
Create per-item pseudocode documents instead of adding to design.md:
For each work item N, create pseudocode-item-N.md:
Tool: mcp__plugin_mermaid-collab_mermaid__create_document
Args: {
"project": "<cwd>",
"session": "<session>",
"name": "pseudocode-item-N",
"content": "<pseudocode content for item N>"
}
Document structure:
# Pseudocode: Item N - [Title]
### AuthService.authenticate(email, password)
-
Validate email format
- If invalid: return { success: false, error: "Invalid email format" }
-
Look up user by email in database
- If not found: return { success: false, error: "User not found" }
-
Verify password hash
- If mismatch: return { success: false, error: "Invalid password" }
- Rate limit: after 5 failures, lock account for 15 minutes
-
Generate JWT token
- Include: user.id, user.role, expiry (1 hour)
-
Store token in Redis with TTL
- Key: "token:{tokenId}", Value: user.id
-
Return { success: true, user, token }
**Error Handling:**
- Database errors: Log and return generic "Authentication failed"
- Redis errors: Fall back to stateless JWT (no revocation support)
**Edge Cases:**
- Empty password: Reject before hashing
- Expired account: Check `user.expiresAt` before authenticating
- Concurrent logins: Allow (no session limit)
Verification Gate
Before moving to Phase 3, run verification:
./hooks/verify-phase.sh pseudocode <collab-name>
Checklist:
- Every function from Interface has pseudocode
- Error handling is explicit for each function
- Edge cases are identified
- External dependencies are noted
GATE: Do NOT proceed until this checklist passes.
If Pseudocode phase doesn't apply (e.g., no logic to describe, pure data changes):
- Document explicitly: "N/A - [reason why pseudocode phase doesn't apply]"
- Add this to the design doc Pseudocode section
- You still MUST proceed through skeleton and executing-plans
- Skipping to implementation is NEVER allowed
Update state on success:
Tool: mcp__plugin_mermaid-collab_mermaid__update_session_state
Args: { "project": "<cwd>", "session": "<name>", "phase": "rough-draft/skeleton" }
Note: lastActivity is automatically updated by the MCP tool.
Completion
At the end of this skill's work, call complete_skill:
Tool: mcp__plugin_mermaid-collab_mermaid__complete_skill
Args: { "project": "<cwd>", "session": "<session>", "skill": "rough-draft-pseudocode" }
Handle response:
- If
action == "clear": Invoke skill: collab-clear - If
next_skillis not null: Invoke that skill - If
next_skillis null: Workflow complete
Didn't find tool you were looking for?