Scan and process code directives (@implement, @docs, @refactor, @test, @todo) based on natural language request
Scans codebase for directives (@implement, @docs, @refactor, @test, @todo) and processes them systematically based on natural language requests.
/plugin marketplace add asermax/claude-plugins/plugin install superpowers@asermax-plugins<request>Scan the codebase for code directives (@implement, @docs, @refactor, @test, @todo) and process them systematically based on your natural language request.
/superpowers:process-directives "implement all @implement directives in src/"
/superpowers:process-directives "process @todo comments in the auth module"
/superpowers:process-directives "handle all directives in src/components/UserProfile.tsx"
/superpowers:process-directives "find and process @test directives"
/superpowers:process-directives "scan for @refactor in the entire codebase"
FIRST ACTION - Load the skill to establish context:
Use the Skill tool to invoke superpowers:using-code-directives. This loads the skill definition and makes all directive handling procedures available.
Skill(skill: "superpowers:using-code-directives")
This provides:
Extract from the request:
Examples of parsing:
| Request | Directive Types | Scope |
|---|---|---|
| "implement all @implement directives in src/" | @implement | src/ directory |
| "process @todo comments in auth module" | @todo | Files matching "auth" |
| "handle all directives in UserProfile.tsx" | all types | UserProfile.tsx |
| "find @test directives" | @test | Current directory |
If request is ambiguous:
Use Grep to find directives in the specified scope:
# Scan for specific directive type
Grep(pattern: "@implement", path: "src/", output_mode: "content", -C: 3)
# Scan for multiple types
Grep(pattern: "@implement|@docs|@refactor|@test|@todo", path: "src/", output_mode: "content", -C: 3)
# Scan specific file
Grep(pattern: "@implement|@docs|@refactor|@test|@todo", path: "src/components/UserProfile.tsx", output_mode: "content", -C: 5)
Context flags (-C, -A, -B):
-C 3 to -C 5 to get surrounding contextParse grep output to extract:
Show user what was found:
Found 7 directives:
@implement (3 directives):
- src/utils/validation.ts:15 - Add email domain validation
- src/services/auth.ts:42 - Implement token refresh logic
- src/components/Form.tsx:108 - Add form validation
@test (2 directives):
- src/utils/validation.ts:18 - Test edge cases for empty input
- src/services/auth.ts:45 - Add integration test for auth flow
@todo (2 directives):
- src/api/client.ts:23 - Add retry logic
- src/components/Button.tsx:67 - Add loading state
Process all 7 directives?
Ask user for confirmation using AskUserQuestion:
If user selects "Select which ones":
For each directive to process:
Read the file containing the directive (use Read tool)
Identify directive type and load appropriate reference if needed:
implement.md if complexdocs.md for security validation stepsrefactor.md procedurestest.md procedurestodo.md proceduresRead full context around the directive:
Execute the directive according to its type:
Apply post-action transformation:
Mark as completed in todo list (use TodoWrite)
If errors or issues:
After processing all directives, provide summary:
Processed 7 directives:
✅ @implement (3/3 completed):
- src/utils/validation.ts:15 - Email domain validation implemented
- src/services/auth.ts:42 - Token refresh logic implemented
- src/components/Form.tsx:108 - Form validation added
✅ @test (2/2 completed):
- src/utils/validation.ts:18 - Edge case tests added
- src/services/auth.ts:45 - Integration test created
✅ @todo (2/2 completed):
- src/api/client.ts:23 - Retry logic added
- src/components/Button.tsx:67 - Loading state added
All directives processed successfully.
Files modified: 6
If any failed:
This command delegates to the skill for all procedure details:
Process directives systematically:
Always read full context before processing:
CRITICAL for @docs directives:
docs.md for complete security procedureDon't guess - ask user:
Error: File src/utils/validation.ts not found
This file may have been moved or deleted.
Skip this directive and continue with others?
Found directive: @todo: Fix this
This directive is unclear - what specifically needs fixing?
[Ask user for clarification or skip]
Error while processing @implement directive:
Failed to implement caching logic - missing cache library
Options:
1. Install cache library and retry
2. Skip this directive
3. Ask user how to proceed
/superpowers:process-directives "implement all @implement directives in src/services/"
Command will:
/superpowers:process-directives "handle @test directives in src/utils/validation.ts"
Command will:
/superpowers:process-directives "process all directives in current directory"
Command will: