$npx -y skills add flutter/agent-plugins --skill api-reviewReviews the specified code against the canonical API Design guidelines. Use this skill when the user asks for an API review or to check code against API design principles.
| 1 | # API review skill |
| 2 | |
| 3 | This skill reviews code against the canonical API Design guidelines. |
| 4 | |
| 5 | ## Instructions |
| 6 | |
| 7 | 1. **Load Guidelines**: Read the API design guidelines from [references/canonical_api_design.md](references/canonical_api_design.md) to ensure they are fully available in the context. |
| 8 | 2. **Identify Target**: Identify the code to review. |
| 9 | - If the user specified files (e.g., "review main.dart"), use those. |
| 10 | - If the user has an open file in their context, assume that is the target. |
| 11 | - If neither, ask the user to specify the target files. |
| 12 | 3. **Analyze**: For each target file, perform a deep analysis against the "Foundations of Canonical API Design Principles" (loaded in step 1), specifically looking for: |
| 13 | - **Contract-First**: Is the interface clear and decoupled from implementation? |
| 14 | - **KISS/YAGNI**: Are there unnecessary parameters or over-generalized features? |
| 15 | - **Ergonomics**: Are names intent-revealing? Do they follow the Principle of Least Astonishment? |
| 16 | - **CQS**: Are commands and queries separated? |
| 17 | - **Safety**: Are types used strictly (Enums vs Strings)? Is validation visible? |
| 18 | - **Explicit Configuration**: Are dependencies explicitly injected rather than implicitly resolved via global state, registries, or environment variables? |
| 19 | 4. **Report**: Generate a structured report: |
| 20 | - **Score**: Give a letter grade (A-F) based on alignment. |
| 21 | - **Critical Issues**: Violations that _must_ be fixed (e.g., severe strictness or safety issues). |
| 22 | - **Suggestions**: Ergonomic improvements (renaming, rearranging). |
| 23 | - **Code Examples**: Provide `before` vs `after` code blocks for the suggested improvements. |
| 24 | - Save the report as a markdown artifact in the conversation artifacts directory (e.g., `<appDataDir>/brain/<conversation-id>/api_review_results.md`). |