AgentSkillsCN

workflow-clean-code-angular

系统化的 Angular 21 清晰代码工作流——扫描代码、修复反模式、强化架构规则并进行验证。采用并行代理、Angular MCP 工具,以及项目专属规则。

SKILL.md
--- frontmatter
name: workflow-clean-code-angular
description: "Systematic Angular 21 clean code workflow — scans, fixes anti-patterns, enforces architecture rules, and verifies. Uses parallel agents, Angular MCP tools, and project-specific rules."
argument-hint: "<scope> [-a auto] [-e economy] [-s save] [--arch] [--signals] [--styling] [--testing]"
allowed-tools: Read, Write, Edit, Glob, Grep, Bash, Task, AskUserQuestion, mcp__angular-cli__*, mcp__plugin_context7_context7__*
<objective> Fast, systematic clean code improvements for Angular 21+ projects. Enforces Pulpe architecture rules, modern signal patterns, Material 3 styling, and Angular best practices with documented sources and concrete fixes. </objective>

<quick_start>

Basic usage (analyze and fix a feature):

bash
/clean-code-angular feature/budget/

Auto mode (skip confirmations):

bash
/clean-code-angular -a feature/dashboard/

With save (output to .claude/output/clean-code-angular/):

bash
/clean-code-angular -s -a core/

Architecture focus:

bash
/clean-code-angular --arch feature/

What it does:

  1. Scans Angular files for anti-patterns (signals, DI, templates, architecture)
  2. Loads Angular 21 best practices via MCP + project rules
  3. Applies clean code improvements with concrete fixes
  4. Verifies with pnpm quality and tests
  5. Commits changes </quick_start>
<parameters>
FlagDescription
-aAuto mode: skip confirmations
-eEconomy mode: no subagents, direct tools only
-sSave mode: output to .claude/output/clean-code-angular/
-rResume mode: continue from previous task
--archForce architecture analysis (dependency direction, cross-feature imports)
--signalsForce signal patterns analysis (effect misuse, computed, linkedSignal)
--stylingForce styling analysis (::ng-deep, legacy Material, Tailwind v4)
--testingForce testing analysis (AAA, naming, test coverage)
<examples> ```bash /clean-code-angular feature/budget/ # Basic - scan a feature /clean-code-angular -a feature/dashboard/ # Auto mode /clean-code-angular -e -a core/ # Economy + auto /clean-code-angular -s pattern/ # Save outputs /clean-code-angular -r budget-feature # Resume /clean-code-angular --arch --signals layout/ # Force specific checks /clean-code-angular pending # Scan pending git changes /clean-code-angular diff main # Scan diff against main ``` </examples> </parameters> <workflow> ``` SCAN ──────────► APPLY ──────────► VERIFY │ │ │ │ │ └─ pnpm quality, test, commit │ └─ Load Angular MCP docs, apply fixes └─ Parse scope, detect anti-patterns, check architecture ``` </workflow>

<state_variables>

VariableTypeDescription
{task_description}stringScope to analyze (path or git scope)
{task_id}stringKebab-case identifier
{auto_mode}booleanSkip confirmations
{economy_mode}booleanNo subagents
{save_mode}booleanSave outputs
{force_arch}booleanForce architecture check
{force_signals}booleanForce signals check
{force_styling}booleanForce styling check
{force_testing}booleanForce testing check
{scoped_files}string[]Files in scope
{issues}arrayIssues found with file:line
{workspace_path}stringPath to angular.json

</state_variables>

<reference_files>

FileWhen Loaded
references/angular-clean-code.mdAlways
references/angular-architecture.mdArchitecture issues detected / --arch
references/angular-anti-patterns.mdAlways (checklist for scanning)

</reference_files>

<entry_point>

Load steps/step-01-scan.md

</entry_point>

<step_files>

StepFilePurpose
01step-01-scan.mdInit + scope + scan for anti-patterns
02step-02-apply.mdLoad docs + recommend + apply fixes
03step-03-verify.mdQuality check + test + commit

</step_files>

<execution_rules>

  • Load one step at a time
  • Use parallel agents in step-01 (unless economy mode)
  • Always call mcp__angular-cli__get_best_practices with workspace path
  • Always call mcp__angular-cli__list_projects to get workspace context
  • Follow patterns from reference files and Angular MCP docs
  • Run pnpm quality before completing
  • Scope-aware: only touch files within the specified scope </execution_rules>

<success_criteria>

  • Scope correctly parsed (path, pending, diff)
  • Angular anti-patterns identified with file:line references
  • Architecture rules enforced (dependency direction, feature isolation)
  • Signal patterns modernized (computed over effect, linkedSignal, etc.)
  • Fixes applied with documented sources
  • pnpm quality passes
  • Tests pass (if tests exist for scope)
  • Changes committed with clear message </success_criteria>