Module 02 · CLI Workflows
Slash Commands and Custom Workflows
Open lesson + course map
On this lesson
Course outline
Module 1 · Claude Code Fundamentals
Module 2 · CLI Workflows
Module 3 · Model Context Protocol Basics
Module 4 · Building an MCP Server
Reusable Claude Code workflows should encode a bounded procedure, inputs, checks, and stop conditions. Product terminology evolves—current documentation may present built-in commands, skills, or prompt workflows differently—so verify the live extension guide before creating files.
// concept
Choose a Repeatable Job
A good workflow is invoked often and has stable evidence, such as reviewing an API change, preparing a release note, or running a lesson-quality check. Define:
purpose and user
required arguments
allowed files/tools
ordered checks
output artifact
failure and escalation behaviorDo not hide deployment, deletion, payment, messaging, or credential rotation behind a casual command. Keep consequential operations in separately authenticated systems.
// concept
Design the Prompt as an Interface
Validate missing or ambiguous inputs. Tell the workflow to inspect current facts, not rely on remembered file structure. Require citations to file paths or test output. Bound the deliverable and forbid unrelated edits.
Example review contract:
Input: target branch or diff
Read: changed source, tests, relevant project rules
Check: correctness, security, regressions, missing tests
Output: findings ordered by severity with file references
Do not: edit, commit, push, or publish
Stop: target unavailable or generated diff is too large// worked_example
Worked Example
A Lahore agency creates a review-api-change workflow. It accepts a diff reference, loads API-specific rules, runs no mutation, and returns only evidence-backed findings. The team tests it against one known vulnerable sample and one clean sample.
A separate apply-review-fix task is not automatically chained. A human decides which finding is valid and opens a bounded implementation session.
Store the tested workflow beside its fixtures so later revisions can be compared against the same expected evidence and failure behavior.
// failure_cases
Failure Cases to Diagnose
6 cases to diagnose
Command is a giant universal prompt
split by job.
Arguments inserted into shell text
validate and pass safely.
Workflow edits while reviewing
separate read and write roles.
Current repository ignored
inspect before action.
No version or owner
document maintenance.
Success means polished prose
define evidence and checks.
// pakistan_angle
Pakistan Angle
Create workflows for reproducible client deliverables: website QA, quotation validation, localization review, or safe content checks. Do not encode unverifiable claims about Pakistani pricing, laws, or market behavior; require dated authoritative sources.
When selling a workflow, disclose its tool/data access and verification duties. The client is buying a controlled process, not guaranteed AI accuracy.
// hands_on
Hands-On Exercise
5 steps
Select one stable repeated job.
Define inputs, permissions, steps, output, and stops.
Implement using the current official extension mechanism.
Test known-pass, known-fail, missing-input, and adversarial-input cases.
Document owner and version.
// completion_rubric
Completion Rubric
6 checks — tick as you verify
// sources
Sources
3 official sources — check every claim yourself
// check_yourself
Check yourself
4 questions · answers and options are taken word-for-word from this course
1 / 4 · diagnose
Your work shows this failure mode: “Arguments inserted into shell text.” What does the lesson tell you to do about it?