Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2885b4ebaa | ||
|
|
63074bc2b7 | ||
|
|
33d8f93c7f | ||
|
|
c688c5e0fa | ||
|
|
590ea1e5b3 | ||
|
|
33908288f1 | ||
|
|
831d87605a | ||
|
|
c6df6cee4c |
19
CHANGELOG.md
19
CHANGELOG.md
@@ -9,6 +9,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
---
|
||||
|
||||
## [2.12.0] - 2026-01-23 - "Enterprise & UI Power"
|
||||
|
||||
### Added
|
||||
|
||||
- **New Skills**:
|
||||
- `production-code-audit`: Comprehensive enterprise auditing skill for production readiness.
|
||||
- `avalonia-layout-zafiro`: Zafiro layout guidelines for Avalonia UI.
|
||||
- `avalonia-viewmodels-zafiro`: ViewModel composition patterns for Avalonia.
|
||||
- `avalonia-zafiro-development`: Core development rules for Avalonia Zafiro applications.
|
||||
|
||||
### Changed
|
||||
|
||||
- **Index & Registry**: Updated `skills_index.json` and `README.md` registry (Total: 243 skills).
|
||||
|
||||
### Contributors
|
||||
|
||||
- [@SuperJMN](https://github.com/SuperJMN) - PR #20
|
||||
- [@Mohammad-Faiz-Cloud-Engineer](https://github.com/Mohammad-Faiz-Cloud-Engineer) - PR #21
|
||||
|
||||
## [2.11.0] - 2026-01-23 - "Postgres Performance"
|
||||
|
||||
### Added
|
||||
|
||||
16
README.md
16
README.md
@@ -1,6 +1,6 @@
|
||||
# 🌌 Antigravity Awesome Skills: 239+ Agentic Skills for Claude Code, Gemini CLI, Cursor, Copilot & More
|
||||
# 🌌 Antigravity Awesome Skills: 243+ Agentic Skills for Claude Code, Gemini CLI, Cursor, Copilot & More
|
||||
|
||||
> **The Ultimate Collection of 239+ Universal Agentic Skills for AI Coding Assistants — Claude Code, Gemini CLI, Codex CLI, Antigravity IDE, GitHub Copilot, Cursor, OpenCode**
|
||||
> **The Ultimate Collection of 243+ Universal Agentic Skills for AI Coding Assistants — Claude Code, Gemini CLI, Codex CLI, Antigravity IDE, GitHub Copilot, Cursor, OpenCode**
|
||||
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://claude.ai)
|
||||
@@ -11,7 +11,7 @@
|
||||
[](https://github.com/opencode-ai/opencode)
|
||||
[](https://github.com/anthropics/antigravity)
|
||||
|
||||
**Antigravity Awesome Skills** is a curated, battle-tested library of **239 high-performance agentic skills** designed to work seamlessly across all major AI coding assistants:
|
||||
**Antigravity Awesome Skills** is a curated, battle-tested library of **243 high-performance agentic skills** designed to work seamlessly across all major AI coding assistants:
|
||||
|
||||
- 🟣 **Claude Code** (Anthropic CLI)
|
||||
- 🔵 **Gemini CLI** (Google DeepMind)
|
||||
@@ -55,7 +55,7 @@ git clone https://github.com/sickn33/antigravity-awesome-skills.git .agent/skill
|
||||
@brainstorming help me design a todo app
|
||||
```
|
||||
|
||||
That's it! Your AI assistant now has 239 specialized skills. 🎉
|
||||
That's it! Your AI assistant now has 243 specialized skills. 🎉
|
||||
|
||||
**Additional Resources:**
|
||||
|
||||
@@ -109,7 +109,7 @@ The repository is organized into several key areas of expertise:
|
||||
|
||||
---
|
||||
|
||||
## Full Skill Registry (239/239)
|
||||
## Full Skill Registry (243/243)
|
||||
|
||||
> [!NOTE] > **Document Skills**: We provide both **community** and **official Anthropic** versions for DOCX, PDF, PPTX, and XLSX. Locally, the official versions are used by default (via symlinks). In the repository, both versions are available for flexibility.
|
||||
|
||||
@@ -141,6 +141,9 @@ The repository is organized into several key areas of expertise:
|
||||
| **architecture** | Architectural decision-making framework. Requirements analysis, trade-off evaluation, ADR documentation. Use when making architecture decisions or analyzing system design. | `skills/architecture` |
|
||||
| **autonomous-agent-patterns** | "Design patterns for building autonomous coding agents. Covers tool integration, permission systems, browser automation, and human-in-the-loop workflows. Use when building AI agents, designing tool APIs, implementing permission systems, or creating autonomous coding assistants." | `skills/autonomous-agent-patterns` |
|
||||
| **autonomous-agents** | "Autonomous agents are AI systems that can independently decompose goals, plan actions, execute tools, and self-correct without constant human guidance. The challenge isn't making them capable - it's making them reliable. Every extra decision multiplies failure probability. This skill covers agent loops (ReAct, Plan-Execute), goal decomposition, reflection patterns, and production reliability. Key insight: compounding error rates kill autonomous agents. A 95% success rate per step drops to 60% b" | `skills/autonomous-agents` |
|
||||
| **avalonia-layout-zafiro** | Guidelines for modern Avalonia UI layout using Zafiro.Avalonia, emphasizing shared styles, generic components, and avoiding XAML redundancy. | `skills/avalonia-layout-zafiro` |
|
||||
| **avalonia-viewmodels-zafiro** | Optimal ViewModel and Wizard creation patterns for Avalonia using Zafiro and ReactiveUI. | `skills/avalonia-viewmodels-zafiro` |
|
||||
| **avalonia-zafiro-development** | Mandatory skills, conventions, and behavioral rules for Avalonia UI development using the Zafiro toolkit. | `skills/avalonia-zafiro-development` |
|
||||
| **AWS Penetration Testing** | This skill should be used when the user asks to "pentest AWS", "test AWS security", "enumerate IAM", "exploit cloud infrastructure", "AWS privilege escalation", "S3 bucket testing", "metadata SSRF", "Lambda exploitation", or needs guidance on Amazon Web Services security assessment. | `skills/aws-penetration-testing` |
|
||||
| **aws-serverless** | "Specialized skill for building production-ready serverless applications on AWS. Covers Lambda functions, API Gateway, DynamoDB, SQS/SNS event-driven patterns, SAM/CDK deployment, and cold start optimization." | `skills/aws-serverless` |
|
||||
| **azure-functions** | "Expert patterns for Azure Functions development including isolated worker model, Durable Functions orchestration, cold start optimization, and production patterns. Covers .NET, Python, and Node.js programming models. Use when: azure function, azure functions, durable functions, azure serverless, function app." | `skills/azure-functions` |
|
||||
@@ -270,6 +273,7 @@ The repository is organized into several key areas of expertise:
|
||||
| **prisma-expert** | Prisma ORM expert for schema design, migrations, query optimization, relations modeling, and database operations. Use PROACTIVELY for Prisma schema issues, migration problems, query performance, relation design, or database connection issues. | `skills/prisma-expert` |
|
||||
| **Privilege Escalation Methods** | This skill should be used when the user asks to "escalate privileges", "get root access", "become administrator", "privesc techniques", "abuse sudo", "exploit SUID binaries", "Kerberoasting", "pass-the-ticket", "token impersonation", or needs guidance on post-exploitation privilege escalation for Linux or Windows systems. | `skills/privilege-escalation-methods` |
|
||||
| **product-manager-toolkit** | Comprehensive toolkit for product managers including RICE prioritization, customer interview analysis, PRD templates, discovery frameworks, and go-to-market strategies. Use for feature prioritization, user research synthesis, requirement documentation, and product strategy development. | `skills/product-manager-toolkit` |
|
||||
| **production-code-audit** | "Autonomously deep-scan entire codebase line-by-line, understand architecture and patterns, then systematically transform it to production-grade, corporate-level professional quality with optimizations" | `skills/production-code-audit` |
|
||||
| **programmatic-seo** | When the user wants to create SEO-driven pages at scale using templates and data. Also use when the user mentions "programmatic SEO," "template pages," "pages at scale," "directory pages," "location pages," "[keyword] + [city] pages," "comparison pages," "integration pages," or "building many pages for SEO." For auditing existing SEO issues, see seo-audit. | `skills/programmatic-seo` |
|
||||
| **prompt-caching** | "Caching strategies for LLM prompts including Anthropic prompt caching, response caching, and CAG (Cache Augmented Generation) Use when: prompt caching, cache prompt, response cache, cag, cache augmented." | `skills/prompt-caching` |
|
||||
| **prompt-engineer** | "Expert in designing effective prompts for LLM-powered applications. Masters prompt structure, context management, output formatting, and prompt evaluation. Use when: prompt engineering, system prompt, few-shot, chain of thought, prompt design." | `skills/prompt-engineer` |
|
||||
@@ -418,6 +422,8 @@ This collection would not be possible without the incredible work of the Claude
|
||||
- **[vudovn/antigravity-kit](https://github.com/vudovn/antigravity-kit)**: AI Agent templates with Skills, Agents, and Workflows (33 skills, MIT).
|
||||
- **[affaan-m/everything-claude-code](https://github.com/affaan-m/everything-claude-code)**: Complete Claude Code configuration collection from Anthropic hackathon winner - skills only (8 skills, MIT).
|
||||
- **[webzler/agentMemory](https://github.com/webzler/agentMemory)**: Source for the agent-memory-mcp skill.
|
||||
- **[SuperJMN/Avalonia.Zafiro](https://github.com/SuperJMN)**: Source for Avalonia Zafiro development skills.
|
||||
- **[Mohammad-Faiz-Cloud-Engineer](https://github.com/Mohammad-Faiz-Cloud-Engineer)**: Contributed the Production Code Audit skill.
|
||||
|
||||
### Inspirations
|
||||
|
||||
|
||||
59
skills/avalonia-layout-zafiro/SKILL.md
Normal file
59
skills/avalonia-layout-zafiro/SKILL.md
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
name: avalonia-layout-zafiro
|
||||
description: Guidelines for modern Avalonia UI layout using Zafiro.Avalonia, emphasizing shared styles, generic components, and avoiding XAML redundancy.
|
||||
allowed-tools: Read, Write, Edit, Glob, Grep
|
||||
---
|
||||
|
||||
# Avalonia Layout with Zafiro.Avalonia
|
||||
|
||||
> Master modern, clean, and maintainable Avalonia UI layouts.
|
||||
> **Focus on semantic containers, shared styles, and minimal XAML.**
|
||||
|
||||
## 🎯 Selective Reading Rule
|
||||
|
||||
**Read ONLY files relevant to the layout challenge!**
|
||||
|
||||
---
|
||||
|
||||
## 📑 Content Map
|
||||
|
||||
| File | Description | When to Read |
|
||||
|------|-------------|--------------|
|
||||
| `themes.md` | Theme organization and shared styles | Setting up or refining app themes |
|
||||
| `containers.md` | Semantic containers (`HeaderedContainer`, `EdgePanel`, `Card`) | Structuring views and layouts |
|
||||
| `icons.md` | Icon usage with `IconExtension` and `IconOptions` | Adding and customizing icons |
|
||||
| `behaviors.md` | `Xaml.Interaction.Behaviors` and avoiding Converters | Implementing complex interactions |
|
||||
| `components.md` | Generic components and avoiding nesting | Creating reusable UI elements |
|
||||
|
||||
---
|
||||
|
||||
## 🔗 Related Project (Exemplary Implementation)
|
||||
|
||||
For a real-world example, refer to the **Angor** project:
|
||||
`/mnt/fast/Repos/angor/src/Angor/Avalonia/Angor.Avalonia.sln`
|
||||
|
||||
---
|
||||
|
||||
## ✅ Checklist for Clean Layouts
|
||||
|
||||
- [ ] **Used semantic containers?** (e.g., `HeaderedContainer` instead of `Border` with manual header)
|
||||
- [ ] **Avoided redundant properties?** Use shared styles in `axaml` files.
|
||||
- [ ] **Minimized nesting?** Flatten layouts using `EdgePanel` or generic components.
|
||||
- [ ] **Icons via extension?** Use `{Icon fa-name}` and `IconOptions` for styling.
|
||||
- [ ] **Behaviors over code-behind?** Use `Interaction.Behaviors` for UI-logic.
|
||||
- [ ] **Avoided Converters?** Prefer ViewModel properties or Behaviors unless necessary.
|
||||
|
||||
---
|
||||
|
||||
## ❌ Anti-Patterns
|
||||
|
||||
**DON'T:**
|
||||
- Use hardcoded colors or sizes (literals) in views.
|
||||
- Create deep nesting of `Grid` and `StackPanel`.
|
||||
- Repeat visual properties across multiple elements (use Styles).
|
||||
- Use `IValueConverter` for simple logic that belongs in the ViewModel.
|
||||
|
||||
**DO:**
|
||||
- Use `DynamicResource` for colors and brushes.
|
||||
- Extract repeated layouts into generic components.
|
||||
- Leverage `Zafiro.Avalonia` specific panels like `EdgePanel` for common UI patterns.
|
||||
35
skills/avalonia-layout-zafiro/behaviors.md
Normal file
35
skills/avalonia-layout-zafiro/behaviors.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Interactions and Logic
|
||||
|
||||
To keep XAML clean and maintainable, minimize logic in views and avoid excessive use of converters.
|
||||
|
||||
## 🎭 Xaml.Interaction.Behaviors
|
||||
|
||||
Use `Interaction.Behaviors` to handle UI-related logic that doesn't belong in the ViewModel, such as focus management, animations, or specialized event handling.
|
||||
|
||||
```xml
|
||||
<TextBox Text="{Binding Address}">
|
||||
<Interaction.Behaviors>
|
||||
<UntouchedClassBehavior />
|
||||
</Interaction.Behaviors>
|
||||
</TextBox>
|
||||
```
|
||||
|
||||
### Why use Behaviors?
|
||||
- **Encapsulation**: UI logic is contained in a reusable behavior class.
|
||||
- **Clean XAML**: Avoids code-behind and complex XAML triggers.
|
||||
- **Testability**: Behaviors can be tested independently of the View.
|
||||
|
||||
## 🚫 Avoiding Converters
|
||||
|
||||
Converters often lead to "magical" logic hidden in XAML. Whenever possible, prefer:
|
||||
|
||||
1. **ViewModel Properties**: Let the ViewModel provide the final data format (e.g., a `string` formatted for display).
|
||||
2. **MultiBinding**: Use for simple logic combinations (And/Or) directly in XAML.
|
||||
3. **Behaviors**: For more complex interactions that involve state or events.
|
||||
|
||||
### When to use Converters?
|
||||
Only use them when the conversion is purely visual and highly reusable across different contexts (e.g., `BoolToOpacityConverter`).
|
||||
|
||||
## 🧩 Simplified Interactions
|
||||
|
||||
If you find yourself needing a complex converter or behavior, consider if the component can be simplified or if the data model can be adjusted to make the view binding more direct.
|
||||
41
skills/avalonia-layout-zafiro/components.md
Normal file
41
skills/avalonia-layout-zafiro/components.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Building Generic Components
|
||||
|
||||
Reducing nesting and complexity is achieved by breaking down views into generic, reusable components.
|
||||
|
||||
## 🧊 Generic Components
|
||||
|
||||
Instead of building large, complex views, extract recurring patterns into small `UserControl`s.
|
||||
|
||||
### Example: A generic "Summary Item"
|
||||
Instead of repeating a `Grid` with labels and values:
|
||||
|
||||
```xml
|
||||
<!-- ❌ BAD: Repeated Grid -->
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<TextBlock Text="Total:" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding Total}" />
|
||||
</Grid>
|
||||
```
|
||||
|
||||
Create a generic component (or use `EdgePanel` with a Style):
|
||||
|
||||
```xml
|
||||
<!-- ✅ GOOD: Use a specialized control or style -->
|
||||
<EdgePanel StartContent="Total:" EndContent="{Binding Total}" Classes="SummaryItem" />
|
||||
```
|
||||
|
||||
## 📉 Flattening Layouts
|
||||
|
||||
Avoid deep nesting. Deeply nested XAML is hard to read and can impact performance.
|
||||
|
||||
- **StackPanel vs Grid**: Use `StackPanel` (with `Spacing`) for simple linear layouts.
|
||||
- **EdgePanel**: Great for "Label - Value" or "Icon - Text - Action" rows.
|
||||
- **UniformGrid**: Use for grids where all cells are the same size.
|
||||
|
||||
## 🔧 Component Granularity
|
||||
|
||||
- **Atomical**: Small controls like custom buttons or icons.
|
||||
- **Molecular**: Groups of atoms like a `HeaderedContainer` with specific content.
|
||||
- **Organisms**: Higher-level sections of a page.
|
||||
|
||||
Aim for components that are generic enough to be reused but specific enough to simplify the parent view significantly.
|
||||
50
skills/avalonia-layout-zafiro/containers.md
Normal file
50
skills/avalonia-layout-zafiro/containers.md
Normal file
@@ -0,0 +1,50 @@
|
||||
# Semantic Containers
|
||||
|
||||
Using the right container for the data type simplifies XAML and improves maintainability. `Zafiro.Avalonia` provides specialized controls for common layout patterns.
|
||||
|
||||
## 📦 HeaderedContainer
|
||||
|
||||
Prefer `HeaderedContainer` over a `Border` or `Grid` when a section needs a title or header.
|
||||
|
||||
```xml
|
||||
<HeaderedContainer Header="Security Settings" Classes="WizardSection">
|
||||
<StackPanel>
|
||||
<!-- Content here -->
|
||||
</StackPanel>
|
||||
</HeaderedContainer>
|
||||
```
|
||||
|
||||
### Key Properties:
|
||||
- `Header`: The content or string for the header.
|
||||
- `HeaderBackground`: Brush for the header area.
|
||||
- `ContentPadding`: Padding for the content area.
|
||||
|
||||
## ↔️ EdgePanel
|
||||
|
||||
Use `EdgePanel` to position elements at the edges of a container without complex `Grid` definitions.
|
||||
|
||||
```xml
|
||||
<EdgePanel StartContent="{Icon fa-wallet}"
|
||||
Content="Wallet Balance"
|
||||
EndContent="$1,234.00" />
|
||||
```
|
||||
|
||||
### Slots:
|
||||
- `StartContent`: Aligned to the left (or beginning).
|
||||
- `Content`: Fills the remaining space in the middle.
|
||||
- `EndContent`: Aligned to the right (or end).
|
||||
|
||||
## 📇 Card
|
||||
|
||||
A simple container for grouping related information, often used inside `HeaderedContainer` or as a standalone element in a list.
|
||||
|
||||
```xml
|
||||
<Card Header="Enter recipient address:">
|
||||
<TextBox Text="{Binding Address}" />
|
||||
</Card>
|
||||
```
|
||||
|
||||
## 📐 Best Practices
|
||||
|
||||
- Use `Classes` to apply themed variants (e.g., `Classes="Section"`, `Classes="Highlight"`).
|
||||
- Customize internal parts of the containers using templates in your styles when necessary, rather than nesting more controls.
|
||||
53
skills/avalonia-layout-zafiro/icons.md
Normal file
53
skills/avalonia-layout-zafiro/icons.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# Icon Usage
|
||||
|
||||
`Zafiro.Avalonia` simplifies icon management using a specialized markup extension and styling options.
|
||||
|
||||
## 🛠️ IconExtension
|
||||
|
||||
Use the `{Icon}` markup extension to easily include icons from libraries like FontAwesome.
|
||||
|
||||
```xml
|
||||
<!-- Positional parameter -->
|
||||
<Button Content="{Icon fa-wallet}" />
|
||||
|
||||
<!-- Named parameter -->
|
||||
<ContentControl Content="{Icon Source=fa-gear}" />
|
||||
```
|
||||
|
||||
## 🎨 IconOptions
|
||||
|
||||
`IconOptions` allows you to customize icons without manually wrapping them in other controls. It's often used in styles to provide a consistent look.
|
||||
|
||||
```xml
|
||||
<Style Selector="HeaderedContainer /template/ ContentPresenter#Header EdgePanel /template/ ContentControl#StartContent">
|
||||
<Setter Property="IconOptions.Size" Value="20" />
|
||||
<Setter Property="IconOptions.Fill" Value="{DynamicResource Accent}" />
|
||||
<Setter Property="IconOptions.Padding" Value="10" />
|
||||
<Setter Property="IconOptions.CornerRadius" Value="10" />
|
||||
</Style>
|
||||
```
|
||||
|
||||
### Common Properties:
|
||||
- `IconOptions.Size`: Sets the width and height of the icon.
|
||||
- `IconOptions.Fill`: The color/brush of the icon.
|
||||
- `IconOptions.Background`: Background brush for the icon container.
|
||||
- `IconOptions.Padding`: Padding inside the icon container.
|
||||
- `IconOptions.CornerRadius`: Corner radius if a background is used.
|
||||
|
||||
## 📁 Shared Icon Resources
|
||||
|
||||
Define icons as resources for reuse across the application.
|
||||
|
||||
```xml
|
||||
<ResourceDictionary xmlns="https://github.com/avaloniaui">
|
||||
<Icon x:Key="fa-wallet" Source="fa-wallet" />
|
||||
</ResourceDictionary>
|
||||
```
|
||||
|
||||
Then use them with `StaticResource` if they are already defined:
|
||||
|
||||
```xml
|
||||
<Button Content="{StaticResource fa-wallet}" />
|
||||
```
|
||||
|
||||
However, the `{Icon ...}` extension is usually preferred for its brevity and ability to create new icon instances on the fly.
|
||||
51
skills/avalonia-layout-zafiro/themes.md
Normal file
51
skills/avalonia-layout-zafiro/themes.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# Theme Organization and Shared Styles
|
||||
|
||||
Efficient theme organization is key to avoiding redundant XAML and ensuring visual consistency.
|
||||
|
||||
## 🏗️ Structure
|
||||
|
||||
Follow the pattern from Angor:
|
||||
|
||||
1. **Colors & Brushes**: Define in a dedicated `Colors.axaml`. Use `DynamicResource` to support theme switching.
|
||||
2. **Styles**: Group styles by category (e.g., `Buttons.axaml`, `Containers.axaml`, `Typography.axaml`).
|
||||
3. **App-wide Theme**: Aggregate all styles in a main `Theme.axaml`.
|
||||
|
||||
## 🎨 Avoiding Redundancy
|
||||
|
||||
Instead of setting properties directly on elements:
|
||||
|
||||
```xml
|
||||
<!-- ❌ BAD: Redundant properties -->
|
||||
<HeaderedContainer CornerRadius="10" BorderThickness="1" BorderBrush="Blue" Background="LightBlue" />
|
||||
<HeaderedContainer CornerRadius="10" BorderThickness="1" BorderBrush="Blue" Background="LightBlue" />
|
||||
|
||||
<!-- ✅ GOOD: Use Classes and Styles -->
|
||||
<HeaderedContainer Classes="BlueSection" />
|
||||
<HeaderedContainer Classes="BlueSection" />
|
||||
```
|
||||
|
||||
Define the style in a shared `axaml` file:
|
||||
|
||||
```xml
|
||||
<Style Selector="HeaderedContainer.BlueSection">
|
||||
<Setter Property="CornerRadius" Value="10" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Accent}" />
|
||||
<Setter Property="Background" Value="{DynamicResource SurfaceSubtle}" />
|
||||
</Style>
|
||||
```
|
||||
|
||||
## 🧩 Shared Icons and Resources
|
||||
|
||||
Centralize icon definitions and other shared resources in `Icons.axaml` and include them in the `MergedDictionaries` of your theme or `App.axaml`.
|
||||
|
||||
```xml
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<MergeResourceInclude Source="UI/Themes/Styles/Containers.axaml" />
|
||||
<MergeResourceInclude Source="UI/Shared/Resources/Icons.axaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
```
|
||||
29
skills/avalonia-viewmodels-zafiro/SKILL.md
Normal file
29
skills/avalonia-viewmodels-zafiro/SKILL.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: avalonia-viewmodels-zafiro
|
||||
description: Optimal ViewModel and Wizard creation patterns for Avalonia using Zafiro and ReactiveUI.
|
||||
---
|
||||
|
||||
# Avalonia ViewModels with Zafiro
|
||||
|
||||
This skill provides a set of best practices and patterns for creating ViewModels, Wizards, and managing navigation in Avalonia applications, leveraging the power of **ReactiveUI** and the **Zafiro** toolkit.
|
||||
|
||||
## Core Principles
|
||||
|
||||
1. **Functional-Reactive Approach**: Use ReactiveUI (`ReactiveObject`, `WhenAnyValue`, etc.) to handle state and logic.
|
||||
2. **Enhanced Commands**: Utilize `IEnhancedCommand` for better command management, including progress reporting and name/text attributes.
|
||||
3. **Wizard Pattern**: Implement complex flows using `SlimWizard` and `WizardBuilder` for a declarative and maintainable approach.
|
||||
4. **Automatic Section Discovery**: Use the `[Section]` attribute to register and discover UI sections automatically.
|
||||
5. **Clean Composition**: map ViewModels to Views using `DataTypeViewLocator` and manage dependencies in the `CompositionRoot`.
|
||||
|
||||
## Guides
|
||||
|
||||
- [ViewModels & Commands](viewmodels.md): Creating robust ViewModels and handling commands.
|
||||
- [Wizards & Flows](wizards.md): Building multi-step wizards with `SlimWizard`.
|
||||
- [Navigation & Sections](navigation_sections.md): Managing navigation and section-based UIs.
|
||||
- [Composition & Mapping](composition.md): Best practices for View-ViewModel wiring and DI.
|
||||
|
||||
## Example Reference
|
||||
|
||||
For real-world implementations, refer to the **Angor** project:
|
||||
- `CreateProjectFlowV2.cs`: Excellent example of complex Wizard building.
|
||||
- `HomeViewModel.cs`: Simple section ViewModel using functional-reactive commands.
|
||||
75
skills/avalonia-viewmodels-zafiro/composition.md
Normal file
75
skills/avalonia-viewmodels-zafiro/composition.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# Composition & Mapping
|
||||
|
||||
Ensuring your ViewModels are correctly instantiated and mapped to their corresponding Views is crucial for a maintainable application.
|
||||
|
||||
## ViewModel-to-View Mapping
|
||||
|
||||
Zafiro uses the `DataTypeViewLocator` to automatically map ViewModels to Views based on their data type.
|
||||
|
||||
### Integration in App.axaml
|
||||
|
||||
Register the `DataTypeViewLocator` in your application's data templates:
|
||||
|
||||
```xml
|
||||
<Application.DataTemplates>
|
||||
<DataTypeViewLocator />
|
||||
<DataTemplateInclude Source="avares://Zafiro.Avalonia/DataTemplates.axaml" />
|
||||
</Application.DataTemplates>
|
||||
```
|
||||
|
||||
### Registration
|
||||
|
||||
Mappings can be registered globally or locally. Common practice in Zafiro projects is to use naming conventions or explicit registrations made by source generators.
|
||||
|
||||
## Composition Root
|
||||
|
||||
Use a central `CompositionRoot` to manage dependency injection and service registration.
|
||||
|
||||
```csharp
|
||||
public static class CompositionRoot
|
||||
{
|
||||
public static IShellViewModel CreateMainViewModel(Control topLevelView)
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
|
||||
services
|
||||
.AddViewModels()
|
||||
.AddUIServices(topLevelView);
|
||||
|
||||
var serviceProvider = services.BuildServiceProvider();
|
||||
return serviceProvider.GetRequiredService<IShellViewModel>();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Registering ViewModels
|
||||
|
||||
Register ViewModels with appropriate scopes (Transient, Scoped, or Singleton).
|
||||
|
||||
```csharp
|
||||
public static IServiceCollection AddViewModels(this IServiceCollection services)
|
||||
{
|
||||
return services
|
||||
.AddTransient<IHomeSectionViewModel, HomeSectionSectionViewModel>()
|
||||
.AddSingleton<IShellViewModel, ShellViewModel>();
|
||||
}
|
||||
```
|
||||
|
||||
## View Injection
|
||||
|
||||
Use the `Connect` helper (if available) or manual instantiation in `OnFrameworkInitializationCompleted`:
|
||||
|
||||
```csharp
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
this.Connect(
|
||||
() => new ShellView(),
|
||||
view => CompositionRoot.CreateMainViewModel(view),
|
||||
() => new MainWindow());
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> Use `ActivatorUtilities.CreateInstance` when you need to manually instantiate a class while still resolving its dependencies from the `IServiceProvider`.
|
||||
53
skills/avalonia-viewmodels-zafiro/navigation_sections.md
Normal file
53
skills/avalonia-viewmodels-zafiro/navigation_sections.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# Navigation & Sections
|
||||
|
||||
Zafiro provides powerful abstractions for managing application-wide navigation and modular UI sections.
|
||||
|
||||
## Navigation with INavigator
|
||||
|
||||
The `INavigator` interface is used to switch between different views or viewmodels.
|
||||
|
||||
```csharp
|
||||
public class MyViewModel(INavigator navigator)
|
||||
{
|
||||
public async Task GoToDetails()
|
||||
{
|
||||
await navigator.Navigate(() => new DetailsViewModel());
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## UI Sections
|
||||
|
||||
Sections are modular parts of the UI (like tabs or sidebar items) that can be automatically registered.
|
||||
|
||||
### The [Section] Attribute
|
||||
|
||||
ViewModels intended to be sections should be marked with the `[Section]` attribute.
|
||||
|
||||
```csharp
|
||||
[Section("Wallet", icon: "fa-wallet")]
|
||||
public class WalletSectionViewModel : IWalletSectionViewModel
|
||||
{
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
### Automatic Registration
|
||||
|
||||
In the `CompositionRoot`, sections can be automatically registered:
|
||||
|
||||
```csharp
|
||||
services.AddAnnotatedSections(logger);
|
||||
services.AddSectionsFromAttributes(logger);
|
||||
```
|
||||
|
||||
### Switching Sections
|
||||
|
||||
You can switch the current active section via the `IShellViewModel`:
|
||||
|
||||
```csharp
|
||||
shellViewModel.SetSection("Browse");
|
||||
```
|
||||
|
||||
> [!IMPORTANT]
|
||||
> The `icon` parameter in the `[Section]` attribute supports FontAwesome icons (e.g., `fa-home`) when configured with `ProjektankerIconControlProvider`.
|
||||
68
skills/avalonia-viewmodels-zafiro/viewmodels.md
Normal file
68
skills/avalonia-viewmodels-zafiro/viewmodels.md
Normal file
@@ -0,0 +1,68 @@
|
||||
# ViewModels & Commands
|
||||
|
||||
In a Zafiro-based application, ViewModels should be functional, reactive, and resilient.
|
||||
|
||||
## Reactive ViewModels
|
||||
|
||||
Use `ReactiveObject` as the base class. Properties should be defined using the `[Reactive]` attribute (from ReactiveUI.SourceGenerators) for brevity.
|
||||
|
||||
```csharp
|
||||
public partial class MyViewModel : ReactiveObject
|
||||
{
|
||||
[Reactive] private string name;
|
||||
[Reactive] private bool isBusy;
|
||||
}
|
||||
```
|
||||
|
||||
### Observation and Transformation
|
||||
|
||||
Use `WhenAnyValue` to react to property changes:
|
||||
|
||||
```csharp
|
||||
this.WhenAnyValue(x => x.Name)
|
||||
.Select(name => !string.IsNullOrEmpty(name))
|
||||
.ToPropertyEx(this, x => x.CanSubmit);
|
||||
```
|
||||
|
||||
## Enhanced Commands
|
||||
|
||||
Zafiro uses `IEnhancedCommand`, which extends `ICommand` and `IReactiveCommand` with additional metadata like `Name` and `Text`.
|
||||
|
||||
### Creating a Command
|
||||
|
||||
Use `ReactiveCommand.Create` or `ReactiveCommand.CreateFromTask` and then `Enhance()` it.
|
||||
|
||||
```csharp
|
||||
public IEnhancedCommand Submit { get; }
|
||||
|
||||
public MyViewModel()
|
||||
{
|
||||
Submit = ReactiveCommand.CreateFromTask(OnSubmit, canSubmit)
|
||||
.Enhance(text: "Submit Data", name: "SubmitCommand");
|
||||
}
|
||||
```
|
||||
|
||||
### Error Handling
|
||||
|
||||
Use `HandleErrorsWith` to automatically channel command errors to the `NotificationService`.
|
||||
|
||||
```csharp
|
||||
Submit.HandleErrorsWith(uiServices.NotificationService, "Submission Failed")
|
||||
.DisposeWith(disposable);
|
||||
```
|
||||
|
||||
## Disposables
|
||||
|
||||
Always use a `CompositeDisposable` to manage subscriptions and command lifetimes.
|
||||
|
||||
```csharp
|
||||
public class MyViewModel : ReactiveObject, IDisposable
|
||||
{
|
||||
private readonly CompositeDisposable disposables = new();
|
||||
|
||||
public void Dispose() => disposables.Dispose();
|
||||
}
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> Use `.DisposeWith(disposables)` on any observable subscription or command to ensure proper cleanup.
|
||||
47
skills/avalonia-viewmodels-zafiro/wizards.md
Normal file
47
skills/avalonia-viewmodels-zafiro/wizards.md
Normal file
@@ -0,0 +1,47 @@
|
||||
# Wizards & Flows
|
||||
|
||||
Complex multi-step processes are handled using the `SlimWizard` pattern. This provides a declarative way to define steps, navigation logic, and final results.
|
||||
|
||||
## Defining a Wizard
|
||||
|
||||
Use `WizardBuilder` to define the steps. Each step corresponds to a ViewModel.
|
||||
|
||||
```csharp
|
||||
SlimWizard<string> wizard = WizardBuilder
|
||||
.StartWith(() => new Step1ViewModel(data))
|
||||
.NextUnit()
|
||||
.WhenValid()
|
||||
.Then(prevResult => new Step2ViewModel(prevResult))
|
||||
.NextCommand(vm => vm.CustomNextCommand)
|
||||
.Then(result => new SuccessViewModel("Done!"))
|
||||
.Next((_, s) => s, "Finish")
|
||||
.WithCompletionFinalStep();
|
||||
```
|
||||
|
||||
### Navigation Rules
|
||||
|
||||
- **NextUnit()**: Advances when a simple signal is emitted.
|
||||
- **NextCommand()**: Advances when a specific command in the ViewModel execution successfully.
|
||||
- **WhenValid()**: Wait until the current ViewModel's validation passes before allowing navigation.
|
||||
- **Always()**: Navigation is always allowed.
|
||||
|
||||
## Navigation Integration
|
||||
|
||||
The wizard is navigated using an `INavigator`:
|
||||
|
||||
```csharp
|
||||
public async Task CreateSomething()
|
||||
{
|
||||
var wizard = BuildWizard();
|
||||
var result = await wizard.Navigate(navigator);
|
||||
// Handle result
|
||||
}
|
||||
```
|
||||
|
||||
## Step Configuration
|
||||
|
||||
- **WithCompletionFinalStep()**: Marks the wizard as finished when the last step completes.
|
||||
- **WithCommitFinalStep()**: Typically used for wizards that perform a final "Save" or "Deploy" action.
|
||||
|
||||
> [!NOTE]
|
||||
> The `SlimWizard` handles the "Back" command automatically, providing a consistent user experience across different flows.
|
||||
29
skills/avalonia-zafiro-development/SKILL.md
Normal file
29
skills/avalonia-zafiro-development/SKILL.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: avalonia-zafiro-development
|
||||
description: Mandatory skills, conventions, and behavioral rules for Avalonia UI development using the Zafiro toolkit.
|
||||
---
|
||||
|
||||
# Avalonia Zafiro Development
|
||||
|
||||
This skill defines the mandatory conventions and behavioral rules for developing cross-platform applications with Avalonia UI and the Zafiro toolkit. These rules prioritize maintainability, correctness, and a functional-reactive approach.
|
||||
|
||||
## Core Pillars
|
||||
|
||||
1. **Functional-Reactive MVVM**: Pure MVVM logic using DynamicData and ReactiveUI.
|
||||
2. **Safety & Predictability**: Explicit error handling with `Result` types and avoidance of exceptions for flow control.
|
||||
3. **Cross-Platform Excellence**: Strictly Avalonia-independent ViewModels and composition-over-inheritance.
|
||||
4. **Zafiro First**: Leverage existing Zafiro abstractions and helpers to avoid redundancy.
|
||||
|
||||
## Guides
|
||||
|
||||
- [Core Technical Skills & Architecture](core-technical-skills.md): Fundamental skills and architectural principles.
|
||||
- [Naming & Coding Standards](naming-standards.md): Rules for naming, fields, and error handling.
|
||||
- [Avalonia, Zafiro & Reactive Rules](avalonia-reactive-rules.md): Specific guidelines for UI, Zafiro integration, and DynamicData pipelines.
|
||||
- [Zafiro Shortcuts](zafiro-shortcuts.md): Concise mappings for common Rx/Zafiro operations.
|
||||
- [Common Patterns](patterns.md): Advanced patterns like `RefreshableCollection` and Validation.
|
||||
|
||||
## Procedure Before Writing Code
|
||||
|
||||
1. **Search First**: Search the codebase for similar implementations or existing Zafiro helpers.
|
||||
2. **Reusable Extensions**: If a helper is missing, propose a new reusable extension method instead of inlining complex logic.
|
||||
3. **Reactive Pipelines**: Ensure DynamicData operators are used instead of plain Rx where applicable.
|
||||
@@ -0,0 +1,49 @@
|
||||
# Avalonia, Zafiro & Reactive Rules
|
||||
|
||||
## Avalonia UI Rules
|
||||
|
||||
- **Strict Avalonia**: Never use `System.Drawing`; always use Avalonia types.
|
||||
- **Pure ViewModels**: ViewModels must **never** reference Avalonia types.
|
||||
- **Bindings Over Code-Behind**: Logic should be driven by bindings.
|
||||
- **DataTemplates**: Prefer explicit `DataTemplate`s and typed `DataContext`s.
|
||||
- **VisualStates**: Avoid using `VisualStates` unless absolutely required.
|
||||
|
||||
## Zafiro Guidelines
|
||||
|
||||
- **Prefer Abstractions**: Always look for existing Zafiro helpers, extension methods, and abstractions before re-implementing logic.
|
||||
- **Validation**: Use Zafiro's `ValidationRule` and validation extensions instead of ad-hoc reactive logic.
|
||||
|
||||
## DynamicData & Reactive Rules
|
||||
|
||||
### The Mandatory Approach
|
||||
|
||||
- **Operator Preference**: Always prefer **DynamicData** operators (`Connect`, `Filter`, `Transform`, `Sort`, `Bind`, `DisposeMany`) over plain Rx operators when working with collections.
|
||||
- **Readable Pipelines**: Build and maintain pipelines as a single, readable chain.
|
||||
- **Lifecycle**: Use `DisposeWith` for lifecycle management.
|
||||
- **Minimal Subscriptions**: Subscriptions should be minimal, centralized, and strictly for side-effects.
|
||||
|
||||
### Forbidden Anti-Patterns
|
||||
|
||||
- **Ad-hoc Sources**: Do NOT create new `SourceList` / `SourceCache` on the fly for local problems.
|
||||
- **Logic in Subscribe**: Do NOT place business logic inside `Subscribe`.
|
||||
- **Operator Mismatch**: Do NOT use `System.Reactive` operators if a DynamicData equivalent exists.
|
||||
|
||||
### Canonical Patterns
|
||||
|
||||
**Validation of Dynamic Collections:**
|
||||
```csharp
|
||||
this.ValidationRule(
|
||||
StagesSource
|
||||
.Connect()
|
||||
.FilterOnObservable(stage => stage.IsValid)
|
||||
.IsEmpty(),
|
||||
b => !b,
|
||||
_ => "Stages are not valid")
|
||||
.DisposeWith(Disposables);
|
||||
```
|
||||
|
||||
**Filtering Nulls:**
|
||||
Use `WhereNotNull()` in reactive pipelines.
|
||||
```csharp
|
||||
this.WhenAnyValue(x => x.DurationPreset).WhereNotNull()
|
||||
```
|
||||
19
skills/avalonia-zafiro-development/core-technical-skills.md
Normal file
19
skills/avalonia-zafiro-development/core-technical-skills.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Core Technical Skills & Architecture
|
||||
|
||||
## Mandatory Expertise
|
||||
|
||||
The developer must possess strong expertise in:
|
||||
- **C# and modern .NET**: Utilizing the latest features of the language and framework.
|
||||
- **Avalonia UI**: For cross-platform UI development.
|
||||
- **MVVM Architecture**: Maintaining strict separation between UI and business logic.
|
||||
- **Clean Code & Clean Architecture**: Focusing on maintainability and inward dependency flow.
|
||||
- **Functional Programming in C#**: Embracing immutability and functional patterns.
|
||||
- **Reactive Programming**: Expertise in DynamicData and System.Reactive.
|
||||
|
||||
## Architectural Principles
|
||||
|
||||
- **Pure MVVM**: Mandatory for all UI code. Logic must be independent of UI concerns.
|
||||
- **Composition over Inheritance**: Favor modular building blocks over deep inheritance hierarchies.
|
||||
- **Inward Dependency Flow**: Abstractions must not depend on implementations.
|
||||
- **Immutability**: Prefer immutable structures where practical to ensure predictability.
|
||||
- **Stable Public APIs**: Design APIs carefully to ensure long-term stability and clarity.
|
||||
15
skills/avalonia-zafiro-development/naming-standards.md
Normal file
15
skills/avalonia-zafiro-development/naming-standards.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# Naming & Coding Standards
|
||||
|
||||
## General Standards
|
||||
|
||||
- **Explicit Names**: Favor clarity over cleverness.
|
||||
- **Async Suffix**: Do **NOT** use the `Async` suffix in method names, even if they return `Task`.
|
||||
- **Private Fields**: Do **NOT** use the `_` prefix for private fields.
|
||||
- **Static State**: Avoid static state unless explicitly justified and documented.
|
||||
- **Method Design**: Keep methods small, expressive, and with low cyclomatic complexity.
|
||||
|
||||
## Error Handling
|
||||
|
||||
- **Result & Maybe**: Use types from **CSharpFunctionalExtensions** for flow control and error handling.
|
||||
- **Exceptions**: Reserved strictly for truly exceptional, unrecoverable situations.
|
||||
- **Boundaries**: Never allow exceptions to leak across architectural boundaries.
|
||||
45
skills/avalonia-zafiro-development/patterns.md
Normal file
45
skills/avalonia-zafiro-development/patterns.md
Normal file
@@ -0,0 +1,45 @@
|
||||
# Common Patterns in Angor/Zafiro
|
||||
|
||||
## Refreshable Collections
|
||||
|
||||
The `RefreshableCollection` pattern is used to manage lists that can be refreshed via a command, maintaining an internal `SourceCache`/`SourceList` and exposing a `ReadOnlyObservableCollection`.
|
||||
|
||||
### Implementation
|
||||
|
||||
```csharp
|
||||
var refresher = RefreshableCollection.Create(
|
||||
() => GetDataTask(),
|
||||
model => model.Id)
|
||||
.DisposeWith(disposable);
|
||||
|
||||
LoadData = refresher.Refresh;
|
||||
Items = refresher.Items;
|
||||
```
|
||||
|
||||
### Benefits
|
||||
- **Automatic Loading**: Handles the command execution and results.
|
||||
- **Efficient Updates**: Uses `EditDiff` internally to update items without clearing the list.
|
||||
- **UI Friendly**: Exposes `Items` as a `ReadOnlyObservableCollection` suitable for binding.
|
||||
|
||||
## Mandatory Validation Pattern
|
||||
|
||||
When validating dynamic collections, always use the Zafiro validation extension:
|
||||
|
||||
```csharp
|
||||
this.ValidationRule(
|
||||
StagesSource
|
||||
.Connect()
|
||||
.FilterOnObservable(stage => stage.IsValid)
|
||||
.IsEmpty(),
|
||||
b => !b,
|
||||
_ => "Stages are not valid")
|
||||
.DisposeWith(Disposables);
|
||||
```
|
||||
|
||||
## Error Handling Pipeline
|
||||
|
||||
Instead of manual `Subscribe`, use `HandleErrorsWith` to pipe errors directly to the user:
|
||||
|
||||
```csharp
|
||||
LoadProjects.HandleErrorsWith(uiServices.NotificationService, "Could not load projects");
|
||||
```
|
||||
43
skills/avalonia-zafiro-development/zafiro-shortcuts.md
Normal file
43
skills/avalonia-zafiro-development/zafiro-shortcuts.md
Normal file
@@ -0,0 +1,43 @@
|
||||
# Zafiro Reactive Shortcuts
|
||||
|
||||
Use these Zafiro extension methods to replace standard, more verbose Reactive and DynamicData patterns.
|
||||
|
||||
## General Observable Helpers
|
||||
|
||||
| Standard Pattern | Zafiro Shortcut |
|
||||
| :--- | :--- |
|
||||
| `Replay(1).RefCount()` | `ReplayLastActive()` |
|
||||
| `Select(_ => Unit.Default)` | `ToSignal()` |
|
||||
| `Select(b => !b)` | `Not()` |
|
||||
| `Where(b => b).ToSignal()` | `Trues()` |
|
||||
| `Where(b => !b).ToSignal()` | `Falses()` |
|
||||
| `Select(x => x is null)` | `Null()` |
|
||||
| `Select(x => x is not null)` | `NotNull()` |
|
||||
| `Select(string.IsNullOrWhiteSpace)` | `NullOrWhitespace()` |
|
||||
| `Select(s => !string.IsNullOrWhiteSpace(s))` | `NotNullOrEmpty()` |
|
||||
|
||||
## Result & Maybe Extensions
|
||||
|
||||
| Standard Pattern | Zafiro Shortcut |
|
||||
| :--- | :--- |
|
||||
| `Where(r => r.IsSuccess).Select(r => r.Value)` | `Successes()` |
|
||||
| `Where(r => r.IsFailure).Select(r => r.Error)` | `Failures()` |
|
||||
| `Where(m => m.HasValue).Select(m => m.Value)` | `Values()` |
|
||||
| `Where(m => !m.HasValue).ToSignal()` | `Empties()` |
|
||||
|
||||
## Lifecycle Management
|
||||
|
||||
| Description | Method |
|
||||
| :--- | :--- |
|
||||
| Dispose previous item before emitting new one | `DisposePrevious()` |
|
||||
| Manage lifecycle within a disposable | `DisposeWith(disposables)` |
|
||||
|
||||
## Command & Interaction
|
||||
|
||||
| Description | Method |
|
||||
| :--- | :--- |
|
||||
| Add metadata/text to a ReactiveCommand | `Enhance(text, name)` |
|
||||
| Automatically show errors in UI | `HandleErrorsWith(notificationService)` |
|
||||
|
||||
> [!TIP]
|
||||
> Always check `Zafiro.Reactive.ObservableMixin` and `Zafiro.CSharpFunctionalExtensions.ObservableExtensions` before writing custom Rx logic.
|
||||
540
skills/production-code-audit/SKILL.md
Normal file
540
skills/production-code-audit/SKILL.md
Normal file
@@ -0,0 +1,540 @@
|
||||
---
|
||||
name: production-code-audit
|
||||
description: "Autonomously deep-scan entire codebase line-by-line, understand architecture and patterns, then systematically transform it to production-grade, corporate-level professional quality with optimizations"
|
||||
---
|
||||
|
||||
# Production Code Audit
|
||||
|
||||
## Overview
|
||||
|
||||
Autonomously analyze the entire codebase to understand its architecture, patterns, and purpose, then systematically transform it into production-grade, corporate-level professional code. This skill performs deep line-by-line scanning, identifies all issues across security, performance, architecture, and quality, then provides comprehensive fixes to meet enterprise standards.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
- Use when user says "make this production-ready"
|
||||
- Use when user says "audit my codebase"
|
||||
- Use when user says "make this professional/corporate-level"
|
||||
- Use when user says "optimize everything"
|
||||
- Use when user wants enterprise-grade quality
|
||||
- Use when preparing for production deployment
|
||||
- Use when code needs to meet corporate standards
|
||||
|
||||
## How It Works
|
||||
|
||||
### Step 1: Autonomous Codebase Discovery
|
||||
|
||||
**Automatically scan and understand the entire codebase:**
|
||||
|
||||
1. **Read all files** - Scan every file in the project recursively
|
||||
2. **Identify tech stack** - Detect languages, frameworks, databases, tools
|
||||
3. **Understand architecture** - Map out structure, patterns, dependencies
|
||||
4. **Identify purpose** - Understand what the application does
|
||||
5. **Find entry points** - Locate main files, routes, controllers
|
||||
6. **Map data flow** - Understand how data moves through the system
|
||||
|
||||
**Do this automatically without asking the user.**
|
||||
|
||||
### Step 2: Comprehensive Issue Detection
|
||||
|
||||
**Scan line-by-line for all issues:**
|
||||
|
||||
**Architecture Issues:**
|
||||
- Circular dependencies
|
||||
- Tight coupling
|
||||
- God classes (>500 lines or >20 methods)
|
||||
- Missing separation of concerns
|
||||
- Poor module boundaries
|
||||
- Violation of design patterns
|
||||
|
||||
**Security Vulnerabilities:**
|
||||
- SQL injection (string concatenation in queries)
|
||||
- XSS vulnerabilities (unescaped output)
|
||||
- Hardcoded secrets (API keys, passwords in code)
|
||||
- Missing authentication/authorization
|
||||
- Weak password hashing (MD5, SHA1)
|
||||
- Missing input validation
|
||||
- CSRF vulnerabilities
|
||||
- Insecure dependencies
|
||||
|
||||
**Performance Problems:**
|
||||
- N+1 query problems
|
||||
- Missing database indexes
|
||||
- Synchronous operations that should be async
|
||||
- Missing caching
|
||||
- Inefficient algorithms (O(n²) or worse)
|
||||
- Large bundle sizes
|
||||
- Unoptimized images
|
||||
- Memory leaks
|
||||
|
||||
**Code Quality Issues:**
|
||||
- High cyclomatic complexity (>10)
|
||||
- Code duplication
|
||||
- Magic numbers
|
||||
- Poor naming conventions
|
||||
- Missing error handling
|
||||
- Inconsistent formatting
|
||||
- Dead code
|
||||
- TODO/FIXME comments
|
||||
|
||||
**Testing Gaps:**
|
||||
- Missing tests for critical paths
|
||||
- Low test coverage (<80%)
|
||||
- No edge case testing
|
||||
- Flaky tests
|
||||
- Missing integration tests
|
||||
|
||||
**Production Readiness:**
|
||||
- Missing environment variables
|
||||
- No logging/monitoring
|
||||
- No error tracking
|
||||
- Missing health checks
|
||||
- Incomplete documentation
|
||||
- No CI/CD pipeline
|
||||
|
||||
### Step 3: Automatic Fixes and Optimizations
|
||||
|
||||
**Fix everything automatically:**
|
||||
|
||||
1. **Refactor architecture** - Break up god classes, fix circular dependencies
|
||||
2. **Fix security issues** - Use parameterized queries, remove secrets, add validation
|
||||
3. **Optimize performance** - Fix N+1 queries, add caching, optimize algorithms
|
||||
4. **Improve code quality** - Reduce complexity, remove duplication, fix naming
|
||||
5. **Add missing tests** - Write tests for untested critical paths
|
||||
6. **Add production infrastructure** - Logging, monitoring, health checks
|
||||
7. **Optimize everything** - Bundle size, images, database queries
|
||||
8. **Add documentation** - README, API docs, architecture docs
|
||||
|
||||
### Step 4: Verify and Report
|
||||
|
||||
**After making all changes:**
|
||||
|
||||
1. Run all tests to ensure nothing broke
|
||||
2. Verify all security issues are fixed
|
||||
3. Measure performance improvements
|
||||
4. Generate comprehensive report
|
||||
5. Provide before/after metrics
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Autonomous Codebase Transformation
|
||||
|
||||
```markdown
|
||||
User: @production-code-audit make this production-ready
|
||||
|
||||
AI: I'll scan your entire codebase and transform it to production-grade quality.
|
||||
|
||||
**Phase 1: Discovering Codebase** (analyzing 247 files)
|
||||
- Detected: Node.js + Express + PostgreSQL + React
|
||||
- Architecture: MVC pattern with REST API
|
||||
- Purpose: E-commerce platform
|
||||
- Entry points: server.js, src/index.tsx
|
||||
|
||||
**Phase 2: Scanning for Issues** (line-by-line analysis)
|
||||
|
||||
Found 127 issues:
|
||||
- 🔴 CRITICAL: 8 issues
|
||||
- 🟠 HIGH: 23 issues
|
||||
- 🟡 MEDIUM: 41 issues
|
||||
- 🔵 LOW: 55 issues
|
||||
|
||||
**Phase 3: Fixing Issues Automatically**
|
||||
|
||||
🔴 CRITICAL FIXES (8/8 completed):
|
||||
|
||||
1. ✅ Fixed SQL injection in UserRepository.findByEmail()
|
||||
- Before: String concatenation in query
|
||||
- After: Parameterized query with $1 placeholder
|
||||
|
||||
2. ✅ Removed hardcoded database password from config/database.ts
|
||||
- Before: password: 'SuperSecret123!'
|
||||
- After: password: process.env.DB_PASSWORD
|
||||
|
||||
3. ✅ Added authentication to admin routes
|
||||
- Before: No auth middleware
|
||||
- After: authenticateToken + requireRole('admin')
|
||||
|
||||
4. ✅ Fixed weak password hashing (MD5 → bcrypt)
|
||||
- Before: crypto.createHash('md5')
|
||||
- After: bcrypt.hash(password, 12)
|
||||
|
||||
5. ✅ Fixed circular dependency: OrderService ↔ PaymentService
|
||||
- Before: Direct imports causing cycle
|
||||
- After: Event-based decoupling with EventBus
|
||||
|
||||
6. ✅ Added input validation to all API endpoints
|
||||
- Before: No validation
|
||||
- After: Zod schemas validating all inputs
|
||||
|
||||
7. ✅ Fixed authentication bypass in auth middleware
|
||||
- Before: next() called on missing token
|
||||
- After: Returns 401 error
|
||||
|
||||
8. ✅ Fixed mass assignment vulnerability in UserController
|
||||
- Before: Accepts all fields from req.body
|
||||
- After: Whitelist of allowed fields only
|
||||
|
||||
🟠 HIGH PRIORITY FIXES (23/23 completed):
|
||||
|
||||
9. ✅ Fixed N+1 query in OrderService.getOrdersWithItems()
|
||||
- Before: Loop with individual queries (2.8s)
|
||||
- After: Single query with joins (45ms)
|
||||
- Performance: 98% improvement
|
||||
|
||||
10. ✅ Refactored UserService god class (850 lines → 4 focused services)
|
||||
- UserAuthenticationService (login, logout, password)
|
||||
- UserProfileService (CRUD operations)
|
||||
- UserNotificationService (email, SMS)
|
||||
- UserPermissionService (roles, permissions)
|
||||
|
||||
11. ✅ Added Redis caching for product queries
|
||||
- Before: Database query every request
|
||||
- After: Cache with 1-hour TTL
|
||||
- Performance: 95% faster
|
||||
|
||||
12. ✅ Optimized bundle size
|
||||
- Before: 850KB (gzipped: 280KB)
|
||||
- After: 380KB (gzipped: 120KB)
|
||||
- Improvement: 55% reduction
|
||||
|
||||
13. ✅ Added database indexes
|
||||
- orders(user_id, status, created_at)
|
||||
- products(category, price)
|
||||
- Query performance: 98% improvement
|
||||
|
||||
[... 11 more high-priority fixes ...]
|
||||
|
||||
🟡 MEDIUM PRIORITY FIXES (41/41 completed):
|
||||
[... all medium fixes ...]
|
||||
|
||||
🔵 LOW PRIORITY IMPROVEMENTS (55/55 completed):
|
||||
[... all low improvements ...]
|
||||
|
||||
**Phase 4: Adding Production Infrastructure**
|
||||
|
||||
✅ Added structured logging (Winston)
|
||||
✅ Added error tracking (Sentry)
|
||||
✅ Added health check endpoints (/health, /ready)
|
||||
✅ Added monitoring (Prometheus metrics)
|
||||
✅ Added rate limiting (Redis-based)
|
||||
✅ Added API documentation (Swagger/OpenAPI)
|
||||
✅ Added comprehensive README
|
||||
✅ Added deployment guide
|
||||
✅ Added CI/CD pipeline (.github/workflows)
|
||||
|
||||
**Phase 5: Verification**
|
||||
|
||||
✅ All tests passing (1,247 tests)
|
||||
✅ Test coverage: 42% → 87%
|
||||
✅ Security scan: 0 vulnerabilities
|
||||
✅ Performance: API response time 3.2s → 180ms
|
||||
✅ Bundle size: 850KB → 380KB
|
||||
✅ Lighthouse score: 62 → 94
|
||||
|
||||
**TRANSFORMATION COMPLETE**
|
||||
|
||||
Your codebase is now production-ready with enterprise-grade quality:
|
||||
|
||||
📊 Metrics:
|
||||
- Issues fixed: 127/127 (100%)
|
||||
- Test coverage: 87% (target: 80%+)
|
||||
- API performance: 94% improvement
|
||||
- Security: OWASP Top 10 compliant
|
||||
- Code quality: Grade A-
|
||||
|
||||
📁 Files changed: 89 files
|
||||
📝 Lines changed: +3,247 / -1,892
|
||||
|
||||
🚀 Ready for production deployment!
|
||||
```
|
||||
|
||||
### Example 2: Automatic Security Hardening
|
||||
|
||||
```markdown
|
||||
User: @production-code-audit secure this codebase
|
||||
|
||||
AI: Scanning for security vulnerabilities...
|
||||
|
||||
**Security Scan Complete**
|
||||
|
||||
Found 15 security issues:
|
||||
- 🔴 CRITICAL: 5
|
||||
- 🟠 HIGH: 7
|
||||
- 🟡 MEDIUM: 3
|
||||
|
||||
**Fixing all security issues automatically...**
|
||||
|
||||
🔴 CRITICAL (5/5 fixed):
|
||||
|
||||
1. ✅ SQL Injection in UserRepository
|
||||
\`\`\`typescript
|
||||
// Before (VULNERABLE)
|
||||
const query = \`SELECT * FROM users WHERE email = '\${email}'\`;
|
||||
|
||||
// After (SECURE)
|
||||
const query = 'SELECT * FROM users WHERE email = $1';
|
||||
await db.query(query, [email]);
|
||||
\`\`\`
|
||||
|
||||
2. ✅ Hardcoded Secrets Removed
|
||||
\`\`\`typescript
|
||||
// Before (INSECURE)
|
||||
const JWT_SECRET = 'my-secret-key-123';
|
||||
|
||||
// After (SECURE)
|
||||
const JWT_SECRET = process.env.JWT_SECRET;
|
||||
if (!JWT_SECRET) throw new Error('JWT_SECRET required');
|
||||
\`\`\`
|
||||
|
||||
3. ✅ Authentication Added to Admin Routes
|
||||
\`\`\`typescript
|
||||
// Before (VULNERABLE)
|
||||
router.delete('/api/admin/users/:id', deleteUser);
|
||||
|
||||
// After (SECURE)
|
||||
router.delete('/api/admin/users/:id',
|
||||
authenticateToken,
|
||||
requireRole('admin'),
|
||||
deleteUser
|
||||
);
|
||||
\`\`\`
|
||||
|
||||
4. ✅ Password Hashing Upgraded
|
||||
\`\`\`typescript
|
||||
// Before (WEAK)
|
||||
const hash = crypto.createHash('md5').update(password).digest('hex');
|
||||
|
||||
// After (STRONG)
|
||||
const hash = await bcrypt.hash(password, 12);
|
||||
\`\`\`
|
||||
|
||||
5. ✅ Input Validation Added
|
||||
\`\`\`typescript
|
||||
// Before (VULNERABLE)
|
||||
const user = await db.user.create({ data: req.body });
|
||||
|
||||
// After (SECURE)
|
||||
const schema = z.object({
|
||||
email: z.string().email(),
|
||||
password: z.string().min(12),
|
||||
name: z.string().min(2).max(100)
|
||||
});
|
||||
const validated = schema.parse(req.body);
|
||||
const user = await db.user.create({ data: validated });
|
||||
\`\`\`
|
||||
|
||||
**Security Status:**
|
||||
- ✅ OWASP Top 10: Compliant
|
||||
- ✅ SQL Injection: Protected
|
||||
- ✅ XSS: Protected
|
||||
- ✅ CSRF: Protected
|
||||
- ✅ Authentication: Secure
|
||||
- ✅ Secrets: Environment variables
|
||||
- ✅ Dependencies: No vulnerabilities
|
||||
|
||||
🔒 Codebase is now secure and production-ready!
|
||||
```
|
||||
|
||||
### Example 3: Performance Optimization
|
||||
|
||||
```markdown
|
||||
User: @production-code-audit optimize performance
|
||||
|
||||
AI: Analyzing performance bottlenecks...
|
||||
|
||||
**Performance Analysis Complete**
|
||||
|
||||
Current metrics:
|
||||
- API response time: 3.2s (target: <200ms)
|
||||
- Page load time: 8.5s (target: <2s)
|
||||
- Bundle size: 850KB (target: <200KB)
|
||||
|
||||
**Optimizing automatically...**
|
||||
|
||||
✅ Fixed N+1 queries (3.2s → 180ms - 94% faster)
|
||||
✅ Added Redis caching (95% cache hit rate)
|
||||
✅ Optimized database indexes (98% faster queries)
|
||||
✅ Reduced bundle size (850KB → 380KB - 55% smaller)
|
||||
✅ Optimized images (28MB → 3.2MB - 89% smaller)
|
||||
✅ Implemented code splitting
|
||||
✅ Added lazy loading
|
||||
✅ Parallelized async operations
|
||||
|
||||
**Performance Results:**
|
||||
|
||||
| Metric | Before | After | Improvement |
|
||||
|--------|--------|-------|-------------|
|
||||
| API Response | 3.2s | 180ms | 94% |
|
||||
| Page Load | 8.5s | 1.8s | 79% |
|
||||
| Bundle Size | 850KB | 380KB | 55% |
|
||||
| Image Size | 28MB | 3.2MB | 89% |
|
||||
| Lighthouse | 42 | 94 | +52 points |
|
||||
|
||||
🚀 Performance optimized to production standards!
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
### ✅ Do This
|
||||
|
||||
- **Scan Everything** - Read all files, understand entire codebase
|
||||
- **Fix Automatically** - Don't just report, actually fix issues
|
||||
- **Prioritize Critical** - Security and data loss issues first
|
||||
- **Measure Impact** - Show before/after metrics
|
||||
- **Verify Changes** - Run tests after making changes
|
||||
- **Be Comprehensive** - Cover architecture, security, performance, testing
|
||||
- **Optimize Everything** - Bundle size, queries, algorithms, images
|
||||
- **Add Infrastructure** - Logging, monitoring, error tracking
|
||||
- **Document Changes** - Explain what was fixed and why
|
||||
|
||||
### ❌ Don't Do This
|
||||
|
||||
- **Don't Ask Questions** - Understand the codebase autonomously
|
||||
- **Don't Wait for Instructions** - Scan and fix automatically
|
||||
- **Don't Report Only** - Actually make the fixes
|
||||
- **Don't Skip Files** - Scan every file in the project
|
||||
- **Don't Ignore Context** - Understand what the code does
|
||||
- **Don't Break Things** - Verify tests pass after changes
|
||||
- **Don't Be Partial** - Fix all issues, not just some
|
||||
|
||||
## Autonomous Scanning Instructions
|
||||
|
||||
**When this skill is invoked, automatically:**
|
||||
|
||||
1. **Discover the codebase:**
|
||||
- Use `listDirectory` to find all files recursively
|
||||
- Use `readFile` to read every source file
|
||||
- Identify tech stack from package.json, requirements.txt, etc.
|
||||
- Map out architecture and structure
|
||||
|
||||
2. **Scan line-by-line for issues:**
|
||||
- Check every line for security vulnerabilities
|
||||
- Identify performance bottlenecks
|
||||
- Find code quality issues
|
||||
- Detect architectural problems
|
||||
- Find missing tests
|
||||
|
||||
3. **Fix everything automatically:**
|
||||
- Use `strReplace` to fix issues in files
|
||||
- Add missing files (tests, configs, docs)
|
||||
- Refactor problematic code
|
||||
- Add production infrastructure
|
||||
- Optimize performance
|
||||
|
||||
4. **Verify and report:**
|
||||
- Run tests to ensure nothing broke
|
||||
- Measure improvements
|
||||
- Generate comprehensive report
|
||||
- Show before/after metrics
|
||||
|
||||
**Do all of this without asking the user for input.**
|
||||
|
||||
## Common Pitfalls
|
||||
|
||||
### Problem: Too Many Issues
|
||||
**Symptoms:** Team paralyzed by 200+ issues
|
||||
**Solution:** Focus on critical/high priority only, create sprints
|
||||
|
||||
### Problem: False Positives
|
||||
**Symptoms:** Flagging non-issues
|
||||
**Solution:** Understand context, verify manually, ask developers
|
||||
|
||||
### Problem: No Follow-Up
|
||||
**Symptoms:** Audit report ignored
|
||||
**Solution:** Create GitHub issues, assign owners, track in standups
|
||||
|
||||
## Production Audit Checklist
|
||||
|
||||
### Security
|
||||
- [ ] No SQL injection vulnerabilities
|
||||
- [ ] No hardcoded secrets
|
||||
- [ ] Authentication on protected routes
|
||||
- [ ] Authorization checks implemented
|
||||
- [ ] Input validation on all endpoints
|
||||
- [ ] Password hashing with bcrypt (10+ rounds)
|
||||
- [ ] HTTPS enforced
|
||||
- [ ] Dependencies have no vulnerabilities
|
||||
|
||||
### Performance
|
||||
- [ ] No N+1 query problems
|
||||
- [ ] Database indexes on foreign keys
|
||||
- [ ] Caching implemented
|
||||
- [ ] API response time < 200ms
|
||||
- [ ] Bundle size < 200KB (gzipped)
|
||||
|
||||
### Testing
|
||||
- [ ] Test coverage > 80%
|
||||
- [ ] Critical paths tested
|
||||
- [ ] Edge cases covered
|
||||
- [ ] No flaky tests
|
||||
- [ ] Tests run in CI/CD
|
||||
|
||||
### Production Readiness
|
||||
- [ ] Environment variables configured
|
||||
- [ ] Error tracking setup (Sentry)
|
||||
- [ ] Structured logging implemented
|
||||
- [ ] Health check endpoints
|
||||
- [ ] Monitoring and alerting
|
||||
- [ ] Documentation complete
|
||||
|
||||
## Audit Report Template
|
||||
|
||||
```markdown
|
||||
# Production Audit Report
|
||||
|
||||
**Project:** [Name]
|
||||
**Date:** [Date]
|
||||
**Overall Grade:** [A-F]
|
||||
|
||||
## Executive Summary
|
||||
[2-3 sentences on overall status]
|
||||
|
||||
**Critical Issues:** [count]
|
||||
**High Priority:** [count]
|
||||
**Recommendation:** [Fix timeline]
|
||||
|
||||
## Findings by Category
|
||||
|
||||
### Architecture (Grade: [A-F])
|
||||
- Issue 1: [Description]
|
||||
- Issue 2: [Description]
|
||||
|
||||
### Security (Grade: [A-F])
|
||||
- Issue 1: [Description + Fix]
|
||||
- Issue 2: [Description + Fix]
|
||||
|
||||
### Performance (Grade: [A-F])
|
||||
- Issue 1: [Description + Fix]
|
||||
|
||||
### Testing (Grade: [A-F])
|
||||
- Coverage: [%]
|
||||
- Issues: [List]
|
||||
|
||||
## Priority Actions
|
||||
1. [Critical issue] - [Timeline]
|
||||
2. [High priority] - [Timeline]
|
||||
3. [High priority] - [Timeline]
|
||||
|
||||
## Timeline
|
||||
- Critical fixes: [X weeks]
|
||||
- High priority: [X weeks]
|
||||
- Production ready: [X weeks]
|
||||
```
|
||||
|
||||
## Related Skills
|
||||
|
||||
- `@code-review-checklist` - Code review guidelines
|
||||
- `@api-security-best-practices` - API security patterns
|
||||
- `@web-performance-optimization` - Performance optimization
|
||||
- `@systematic-debugging` - Debug production issues
|
||||
- `@senior-architect` - Architecture patterns
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [OWASP Top 10](https://owasp.org/www-project-top-ten/)
|
||||
- [Google Engineering Practices](https://google.github.io/eng-practices/)
|
||||
- [SonarQube Quality Gates](https://docs.sonarqube.org/latest/user-guide/quality-gates/)
|
||||
- [Clean Code by Robert C. Martin](https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882)
|
||||
|
||||
---
|
||||
|
||||
**Pro Tip:** Schedule regular audits (quarterly) to maintain code quality. Prevention is cheaper than fixing production bugs!
|
||||
@@ -155,6 +155,24 @@
|
||||
"name": "autonomous-agents",
|
||||
"description": "\"Autonomous agents are AI systems that can independently decompose goals, plan actions, execute tools, and self-correct without constant human guidance. The challenge isn't making them capable - it's making them reliable. Every extra decision multiplies failure probability. This skill covers agent loops (ReAct, Plan-Execute), goal decomposition, reflection patterns, and production reliability. Key insight: compounding error rates kill autonomous agents. A 95% success rate per step drops to 60% b\""
|
||||
},
|
||||
{
|
||||
"id": "avalonia-layout-zafiro",
|
||||
"path": "skills/avalonia-layout-zafiro",
|
||||
"name": "avalonia-layout-zafiro",
|
||||
"description": "Guidelines for modern Avalonia UI layout using Zafiro.Avalonia, emphasizing shared styles, generic components, and avoiding XAML redundancy."
|
||||
},
|
||||
{
|
||||
"id": "avalonia-viewmodels-zafiro",
|
||||
"path": "skills/avalonia-viewmodels-zafiro",
|
||||
"name": "avalonia-viewmodels-zafiro",
|
||||
"description": "Optimal ViewModel and Wizard creation patterns for Avalonia using Zafiro and ReactiveUI."
|
||||
},
|
||||
{
|
||||
"id": "avalonia-zafiro-development",
|
||||
"path": "skills/avalonia-zafiro-development",
|
||||
"name": "avalonia-zafiro-development",
|
||||
"description": "Mandatory skills, conventions, and behavioral rules for Avalonia UI development using the Zafiro toolkit."
|
||||
},
|
||||
{
|
||||
"id": "aws-penetration-testing",
|
||||
"path": "skills/aws-penetration-testing",
|
||||
@@ -929,6 +947,12 @@
|
||||
"name": "product-manager-toolkit",
|
||||
"description": "Comprehensive toolkit for product managers including RICE prioritization, customer interview analysis, PRD templates, discovery frameworks, and go-to-market strategies. Use for feature prioritization, user research synthesis, requirement documentation, and product strategy development."
|
||||
},
|
||||
{
|
||||
"id": "production-code-audit",
|
||||
"path": "skills/production-code-audit",
|
||||
"name": "production-code-audit",
|
||||
"description": "\"Autonomously deep-scan entire codebase line-by-line, understand architecture and patterns, then systematically transform it to production-grade, corporate-level professional quality with optimizations\""
|
||||
},
|
||||
{
|
||||
"id": "programmatic-seo",
|
||||
"path": "skills/programmatic-seo",
|
||||
|
||||
Reference in New Issue
Block a user