Skip to content

Commit fbe096e

Browse files
KebooCopilot
andauthored
Add SKILL.md skills and MCP server bundling to plugins (#4)
* Add SKILL.md files and MCP server config to plugins - Add 10 skill definitions across 5 plugins using the official SKILL.md format (frontmatter with name/description + invocation instructions): - coalesce-accelerator: generate-migration, scaffold-entity, add-data-source - enterprise-bug-fixing: start-bug-fix, write-bug-tests - csharp-best-practices: review-async, check-naming - vuetify-components: scaffold-component, add-form - testing-essentials: write-unit-tests - Declare the skills path field in each updated plugin.json so the Copilot CLI can discover and invoke skills via /skills invoke - Add enterprise-bug-fixing/.mcp.json bundling the four MCP servers that BugFixerAgent.agent.md depends on (Azure DevOps, context7, nuget, playwright). Declare mcpServers and agents path fields in the enterprise-bug-fixing plugin.json. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Migrate instruction files into plugin skills - Created 7 new SKILL.md files for instruction content without a matching skill: apply-csharp-patterns, apply-solid, apply-testing-patterns, use-composition-api, add-accessibility, run-code-generation, setup-coalesce-project - Enriched 6 existing SKILL.md files with full instruction content: check-naming, review-async, write-unit-tests, scaffold-component, start-bug-fix, scaffold-entity - Removed all 13 instruction .md files and 6 instructions/ directories - Removed non-standard 'contents' key from all 6 plugin.json files (the official plugin spec has no 'instructions' field) - Added 'skills' path to solid-principles/plugin.json Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6e3eb1b commit fbe096e

24 files changed

Lines changed: 1051 additions & 40 deletions

File tree

plugins/coalesce-accelerator/plugin.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@
2121
"Vuetify",
2222
"TypeScript"
2323
],
24-
"categories": ["Framework", "FullStack"],
25-
"contents": {
26-
"instructions": [
27-
"instructions/coalesce-workflows.md",
28-
"instructions/ef-core-patterns.md",
29-
"instructions/code-generation.md"
30-
]
31-
}
24+
"categories": [
25+
"Framework",
26+
"FullStack"
27+
],
28+
"skills": "skills/"
3229
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
name: add-data-source
3+
description: Add a custom Coalesce IDataSource to filter or shape entity data for a specific use case
4+
---
5+
6+
# Add Data Source Skill
7+
8+
Create a custom Coalesce `IDataSource<T>` implementation to provide filtered, shaped, or security-scoped access to an entity beyond the default CRUD behavior.
9+
10+
## When to Use
11+
12+
Invoke this skill when you need to:
13+
- Expose a filtered subset of an entity (e.g., "only active records")
14+
- Add includes/eager loading not present on the default source
15+
- Scope data to the current user (tenancy, ownership)
16+
- Return a projection or computed view of an entity
17+
18+
## Data Source Pattern
19+
20+
```csharp
21+
using IntelliTect.Coalesce;
22+
using IntelliTect.Coalesce.Api;
23+
using IntelliTect.Coalesce.TypeDefinition;
24+
25+
[Coalesce]
26+
public class ActiveEntitySource : StandardDataSource<Entity, AppDbContext>
27+
{
28+
public ActiveEntitySource(CrudContext<AppDbContext> context) : base(context) { }
29+
30+
public override IQueryable<Entity> GetQuery(IDataSourceParameters parameters)
31+
=> base.GetQuery(parameters)
32+
.Where(e => e.IsActive)
33+
.Include(e => e.RelatedEntity);
34+
}
35+
```
36+
37+
## Steps
38+
39+
1. **Create the data source class** in a `DataSources/` folder beside your entity models
40+
2. **Decorate with `[Coalesce]`** so the CLI picks it up during code generation
41+
3. **Override `GetQuery`** — compose from `base.GetQuery()` to retain default filtering/sorting support
42+
4. **Optionally override `TransformResults`** for post-query shaping
43+
5. **Run `coalesce_generate`** to expose it in the API:
44+
```bash
45+
coalesce_generate
46+
```
47+
6. **Verify the new data source appears** in the generated API and TypeScript service
48+
7. **Write tests** that confirm filtering/scoping works correctly
49+
50+
## User-Scoped Data Source Pattern
51+
52+
```csharp
53+
[Coalesce]
54+
public class MyRecordsSource : StandardDataSource<Record, AppDbContext>
55+
{
56+
private readonly ICurrentUserService _currentUser;
57+
58+
public MyRecordsSource(CrudContext<AppDbContext> context, ICurrentUserService currentUser)
59+
: base(context)
60+
{
61+
_currentUser = currentUser;
62+
}
63+
64+
public override IQueryable<Record> GetQuery(IDataSourceParameters parameters)
65+
=> base.GetQuery(parameters)
66+
.Where(r => r.OwnerId == _currentUser.UserId);
67+
}
68+
```
69+
70+
## Notes
71+
72+
- Multiple data sources can exist for the same entity — each becomes a selectable source in the API
73+
- The default data source is `StandardDataSource<T>` — your custom sources supplement it
74+
- Always test that unauthorized data cannot be reached through alternative data sources
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
---
2+
name: generate-migration
3+
description: Generate an EF Core migration and run it for the current Coalesce project
4+
---
5+
6+
# Generate Migration Skill
7+
8+
Generate a new EF Core database migration after making changes to Coalesce entity models, then optionally apply it to the database.
9+
10+
## When to Use
11+
12+
Invoke this skill after you have:
13+
- Added, renamed, or removed a property on a Coalesce entity
14+
- Added or removed a navigation property or relationship
15+
- Changed a `[StringLength]`, `[Required]`, or other schema-affecting attribute
16+
- Added a new entity class to the `DbContext`
17+
18+
## Steps
19+
20+
1. **Verify the model compiles**
21+
```bash
22+
dotnet build
23+
```
24+
Fix any compiler errors before proceeding.
25+
26+
2. **Regenerate Coalesce artifacts** to keep the API and TypeScript types in sync:
27+
```bash
28+
coalesce_generate
29+
```
30+
31+
3. **Add the EF Core migration** using a descriptive PascalCase name that describes the change:
32+
```bash
33+
dotnet ef migrations add <MigrationName> --project <DataProject> --startup-project <WebProject>
34+
```
35+
Examples: `AddCompanyPhoneNumber`, `RemoveOrderLegacyStatus`, `AddIndexOnUserEmail`
36+
37+
4. **Review the generated migration file** in `Migrations/` — verify the `Up()` and `Down()` methods match your intent. Check for:
38+
- Unexpected table drops or column drops
39+
- Missing `nullable` settings
40+
- Correct foreign key constraints
41+
42+
5. **Apply the migration to the database**:
43+
```bash
44+
dotnet ef database update --project <DataProject> --startup-project <WebProject>
45+
```
46+
47+
6. **Run tests** to confirm nothing regressed:
48+
```bash
49+
dotnet test
50+
```
51+
52+
## Naming Conventions
53+
54+
Migration names should be short, PascalCase, and describe **what changed**:
55+
-`AddUserEmailIndex`
56+
-`RenameCompanyAddressToStreet`
57+
-`Update1`, `Migration20240101`, `Changes`
58+
59+
## Notes
60+
61+
- Always review the generated `.cs` migration file before applying — EF Core may infer destructive changes
62+
- If the migration is complex, split it: one for schema changes, one for data changes
63+
- For seed data changes, consider a separate data migration or a custom `IHostedService`

plugins/coalesce-accelerator/instructions/code-generation.md renamed to plugins/coalesce-accelerator/skills/run-code-generation/SKILL.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
---
2+
name: run-code-generation
3+
description: Run Coalesce code generation to regenerate TypeScript types and API client after C# model changes
4+
---
5+
6+
# Run Code Generation Skill
7+
8+
Trigger and manage Coalesce's code generation pipeline to regenerate TypeScript types, API clients, and ViewModels after C# model or service changes.
9+
10+
## When to Use
11+
12+
Invoke this skill when you:
13+
- Have made changes to C# entity classes and need to regenerate TypeScript types
14+
- Need to run coalesce_generate and understand what it produces
15+
- Want to troubleshoot code generation errors or stale generated files
16+
- Are setting up or configuring the code generation pipeline
17+
118
# Coalesce Code Generation
219

320
This guide explains what Coalesce generates, how to run code generation, customize the output, and manage regeneration workflows.

plugins/coalesce-accelerator/instructions/ef-core-patterns.md renamed to plugins/coalesce-accelerator/skills/scaffold-entity/SKILL.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,92 @@
1+
---
2+
name: scaffold-entity
3+
description: Scaffold a new Coalesce entity class with EF Core annotations, navigation properties, and register it in the DbContext
4+
---
5+
6+
# Scaffold Entity Skill
7+
8+
Create a complete Coalesce-compatible C# entity class with appropriate EF Core data annotations, navigation properties, and DbContext registration.
9+
10+
## When to Use
11+
12+
Invoke this skill when you need to:
13+
- Add a new domain entity to the Coalesce data model
14+
- Create a related/child entity with a foreign key relationship
15+
- Scaffold a lookup/reference table entity
16+
17+
## Required Information
18+
19+
Before scaffolding, gather:
20+
1. **Entity name** — PascalCase noun (e.g., `Invoice`, `ProjectMilestone`)
21+
2. **Properties** — names, types, and whether required/optional
22+
3. **Relationships** — parent entity (if any), one-to-many or many-to-many
23+
4. **Table name** — usually pluralized entity name (e.g., `Invoices`)
24+
25+
## Scaffold Pattern
26+
27+
```csharp
28+
using System.ComponentModel.DataAnnotations;
29+
using System.ComponentModel.DataAnnotations.Schema;
30+
using IntelliTect.Coalesce.DataAnnotations;
31+
32+
[Table("EntityNamePlural")]
33+
public class EntityName
34+
{
35+
// Primary key — name must be {EntityName}Id
36+
[Key]
37+
public int EntityNameId { get; set; }
38+
39+
// Required string property
40+
[Required]
41+
[StringLength(255)]
42+
[Display(Name = "Friendly Label")]
43+
public required string Name { get; set; }
44+
45+
// Optional string property
46+
[StringLength(1024)]
47+
public string? Description { get; set; }
48+
49+
// Foreign key + navigation (many-to-one)
50+
public int ParentId { get; set; }
51+
public Parent Parent { get; set; } = null!;
52+
53+
// Audit fields
54+
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
55+
public DateTime? UpdatedAt { get; set; }
56+
}
57+
```
58+
59+
## Steps
60+
61+
1. **Create the entity file** in the `Models/` directory
62+
2. **Add the DbSet** to the application's `DbContext`:
63+
```csharp
64+
public DbSet<EntityName> EntityNames { get; set; }
65+
```
66+
3. **Run `coalesce_generate`** to generate the API and TypeScript types:
67+
```bash
68+
coalesce_generate
69+
```
70+
4. **Create a migration** to add the table (use the `generate-migration` skill)
71+
5. **Build and test**:
72+
```bash
73+
dotnet build && dotnet test
74+
```
75+
76+
## Coalesce-Specific Annotations
77+
78+
| Attribute | Effect |
79+
|-----------|--------|
80+
| `[Read(Roles = "Admin")]` | Restrict read access by role |
81+
| `[Edit(Roles = "Admin")]` | Restrict edit access by role |
82+
| `[Hidden]` | Exclude from generated list views |
83+
| `[Search]` | Include property in text search |
84+
| `[DefaultOrderBy]` | Set default sort property |
85+
| `[ListText]` | Use as display text in dropdowns |
86+
87+
88+
## Reference: EF Core Patterns
89+
190
# Entity Framework Core Patterns with Coalesce
291

392
This guide covers Entity Framework Core (EF Core) best practices, patterns, and configurations specifically for Coalesce development.

plugins/coalesce-accelerator/instructions/coalesce-workflows.md renamed to plugins/coalesce-accelerator/skills/setup-coalesce-project/SKILL.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
---
2+
name: setup-coalesce-project
3+
description: Set up a new Coalesce full-stack project from scratch including models, DbContext, and project structure
4+
---
5+
6+
# Setup Coalesce Project Skill
7+
8+
Guide the full setup of a new Coalesce full-stack project including C# models, EF Core DbContext, Coalesce configuration, and Vue 3 frontend scaffolding.
9+
10+
## When to Use
11+
12+
Invoke this skill when you:
13+
- Are starting a brand new Coalesce project from scratch
14+
- Need to configure an existing project to use Coalesce
15+
- Want to understand the required project structure and dependencies
16+
- Are setting up the full development workflow for a Coalesce application
17+
118
# Coalesce Workflows
219

320
This guide covers the end-to-end workflows for developing with Coalesce, from project setup through code generation to full-stack deployment.

plugins/csharp-best-practices/plugin.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,9 @@
2222
"enterprise",
2323
"dotnet"
2424
],
25-
"categories": ["Language", "Enterprise"],
26-
"contents": {
27-
"instructions": [
28-
"instructions/csharp-patterns.md",
29-
"instructions/naming-conventions.md",
30-
"instructions/async-patterns.md"
31-
]
32-
}
25+
"categories": [
26+
"Language",
27+
"Enterprise"
28+
],
29+
"skills": "skills/"
3330
}

plugins/csharp-best-practices/instructions/csharp-patterns.md renamed to plugins/csharp-best-practices/skills/apply-csharp-patterns/SKILL.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
---
2+
name: apply-csharp-patterns
3+
description: Apply enterprise C# patterns including error handling, dependency injection, and clean code principles
4+
---
5+
6+
# Apply C# Patterns Skill
7+
8+
Apply idiomatic C# language patterns including type design, null handling, pattern matching, LINQ, and modern C# features for clean, maintainable enterprise code.
9+
10+
## When to Use
11+
12+
Invoke this skill when you:
13+
- Need to refactor existing code to follow C# best practices
14+
- Are writing new C# code and want to apply proper patterns
15+
- Want a review of C# language feature usage in a file or class
16+
- Are modernizing older C# code to use current language features
17+
118
# C# Language Patterns & Best Practices
219

320
Comprehensive guide to idiomatic C# patterns, type design, and language features for writing maintainable, performant code.

0 commit comments

Comments
 (0)