Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 147 additions & 0 deletions .agents/skills/blazing-story-story/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
---
allowed-tools: Glob Grep Read Write
compatibility: Designed for Blazing Story projects (a Blazor-based Storybook clone for .NET). Requires a .Stories project referencing BlazingStory NuGet packages.
description: Implement a Blazing Story story file (.stories.razor) for a Blazor UI component. Use when the user says "create a story for component X", "add stories for X", or similar requests in a Blazing Story (.NET / Blazor / Storybook) project.
license: Unlicense
metadata:
author: jsakamoto
github-path: skills/blazing-story-story
github-ref: refs/tags/v1.0.2
github-repo: https://github.com/BlazingStory/agent-skills
github-tree-sha: 36d13a0943547a646a3d91de27c9d8870b951cbd
name: blazing-story-story
---
# Blazing Story — Story Implementation

Create a `.stories.razor` file for a Blazor component in the currently open Blazing Story project.

## Investigation policy

The main goal of this policy is to free the developer from the hassle of approving "may I run this command?" prompts one by one. Many of those prompts come from operations that poke around outside the project — and most of the knowledge needed to write a story file is already available without them.

Implement the story relying primarily on:

- The guidance in this skill file
- Your own knowledge of C#, .NET, Blazor, and general web/UI development
- Other relevant skills available in this environment
- Already-configured MCP servers and tools
- Read-only exploration of the current project (`ls`, `Glob`, `Grep`, `Read`)

**Avoid** operations that inspect the NuGet package cache folder, decompile Blazing Story DLLs, or otherwise probe the installed package contents. These are slow, require the developer's per-command approval, and disrupt the flow of work.

If implementation details that are not covered above become necessary, consult the published source code on GitHub at https://github.com/jsakamoto/BlazingStory **instead of** digging into the local NuGet cache or decompiling DLLs.

This policy may be relaxed only when strictly unavoidable.

## Step 1: Identify the target component

From `$ARGUMENTS` or the user's message, determine the component name (e.g., `Button`, `Rating`).

## Step 2: Locate the component file

Search the workspace for a `.razor` file matching the component name (e.g., `Button.razor`). Read it to understand:

- All `[Parameter]` properties and their types
- Any `RenderFragment` parameters (e.g., `ChildContent`)
- Enum types used by parameters

## Step 3: Locate the stories project

Find the stories project directory — it is typically a separate project named `*.Stories` or containing a `Stories/` subfolder. Look for existing `.stories.razor` files to confirm the correct location and the `@using` conventions used.

## Step 4: Determine the story file path

Place the new file inside the `Stories/` folder of the stories project, mirroring the category structure if one already exists. Name the file `ComponentName.stories.razor`.

Example: `MyApp.Stories/Stories/Components/Button.stories.razor`

## Step 5: Write the story file

Use the following structure:

```razor
@attribute [Stories("Category/ComponentName")]

<Stories TComponent="ComponentName" Layout="typeof(Centered)">

<ArgType For="_ => _.EnumParam" Control="ControlType.Radio" />
<ArgType For="_ => _.ColorParam" Control="ControlType.Color" />

<Story Name="Default">
<Arguments>
<Arg For="_ => _.SomeParam" Value="someValue" />
</Arguments>
<Template>
<ComponentName @attributes="context.Args" />
</Template>
</Story>

</Stories>

@code {
private RenderFragment _content = @<text>Label</text>;
}
```

### Rules

**File naming**
- Must end in `.stories.razor` to enable the "Show code" feature in Blazing Story.

**`[Stories("...")]` path**
- Use `/` as separator. The path becomes the sidebar navigation tree.
- Mirror the folder path under `Stories/` (e.g., file at `Stories/Components/Button.stories.razor` → `[Stories("Components/Button")]`).

**`<Stories TComponent="...">`**
- `TComponent` is the Blazor component type.
- `Layout` is optional. Common choices:
- `Centered` — centers the component horizontally and vertically (good default for most UI components).
- `FullScreen` — fills the entire canvas (good for page-level components).
- `MarginedFrame` — adds a margin around the component.
- Omit `Layout` entirely if you are unsure or if the project has no custom layouts.

**`<ArgType>`**
- Controls how a parameter appears in the Controls panel.
- Available `ControlType` values:
- `ControlType.Default` — auto-detected from the parameter type (no need to specify explicitly).
- `ControlType.Radio` — radio buttons; good for enums with 2–4 values.
- `ControlType.Select` — dropdown; good for enums with 5+ values.
- `ControlType.Color` — color picker; use for `string` or `Color` parameters representing a color.

**`<Story Name="...">`**
- Each `<Story>` represents one variant shown in the sidebar.
- Always include a `"Default"` story as the baseline.
- Add further stories for meaningful parameter combinations (e.g., `"Large"`, `"Disabled"`, `"With Icon"`).

**`<Arguments>` and `<Arg>`**
- Use `<Arg For="_ => _.ParamName" Value="..." />` to set initial parameter values for a story.
- For `RenderFragment` parameters, define the value in the `@code` block and reference it via `<Arg>`:
```razor
<Arg For="_ => _.ChildContent" Value="_content" />

@code {
private RenderFragment _content = @<text>Click me</text>;
}
```
- Do **not** hardcode `RenderFragment` content directly in the `<Template>` markup — this prevents runtime modification via the Controls panel.

**`<Template>`**
- Always add `@attributes="context.Args"` to the component tag to wire up the Controls panel.
- Pass only parameters that cannot be handled via `@attributes` (e.g., event callbacks, non-parameter child content) directly in the markup.

**Null-forgiving operator**
- When the component type is nullable, use `_=>_!.PropertyName` in `For` lambdas:
```razor
<ArgType For="_=>_!.Color" Control="ControlType.Color" />
```

**`@using` directives**
- Check whether the component namespace is already imported globally (e.g., via `_Imports.razor`). Add `@using` only if needed.

## Step 6: Verify

After writing the file, briefly summarize:
- The file path created
- The stories added and which parameter variants they cover
- Any `ArgType` customizations applied
- Any assumptions made (e.g., chosen `Layout`, omitted optional parameters)
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: npm

- name: Install npm dependencies
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ obj

.vs
.tfignore
*.csproj.user
gulpfile.js
Building.md
IgniteUI.Blazor.csproj
Expand Down
11 changes: 8 additions & 3 deletions IgniteUI.Blazor.Lite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

<PropertyGroup>
<PackageIdSuffix>.Lite</PackageIdSuffix>

</PropertyGroup>

<!-- Removed as pinning the language to an older version prevents building in net10 where global usings files are autogenerated -->
Expand Down Expand Up @@ -40,11 +39,11 @@
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\Debug\$(TargetFramework)\IgniteUI.Blazor.xml</DocumentationFile>
<DocumentationFile>bin\Debug\$(TargetFramework)\IgniteUI.Blazor.Lite.xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>bin\Release\$(TargetFramework)\IgniteUI.Blazor.xml</DocumentationFile>
<DocumentationFile>bin\Release\$(TargetFramework)\IgniteUI.Blazor.Lite.xml</DocumentationFile>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
Expand All @@ -59,10 +58,12 @@

<ItemGroup>
<Compile Remove="dist\**" />
<Compile Remove="stories\**" />
<Compile Remove="tests\**" />
Comment on lines +61 to 62
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should've been a flag the structure of the source is set up for a single project and should've been moved, but that shipped sailed with the addition of the test project and we'll have to untangle those anyway and that can be done separately.

<Content Remove="dist\**" />
<Content Remove="src\**" />
<Content Remove="node_modules\**" />
<Content Remove="stories\**" />
<Content Remove="tests\**" />
<Content Remove="*.json" />
<EmbeddedResource Remove="dist\**" />
Expand All @@ -87,5 +88,9 @@
<PackagePath></PackagePath>
</None>
</ItemGroup>

<!--<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="npm run build &amp;&amp; npm run copythemes" />
</Target>-->

</Project>
17 changes: 17 additions & 0 deletions IgniteUI.Blazor.Lite.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0AB3BF05
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IgniteUI.Blazor.Tests", "tests\IgniteUI.Blazor.Tests\IgniteUI.Blazor.Tests.csproj", "{71037C73-544F-4D40-A7FA-10951682034B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "stories", "stories", "{EB5D65CF-FD37-16C0-3293-5E9FB153C94C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IgniteUI.Blazor.Stories", "stories\IgniteUI.Blazor.Stories.csproj", "{6A7088DF-1BB1-4951-A477-EEFB6076D14A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -43,12 +47,25 @@ Global
{71037C73-544F-4D40-A7FA-10951682034B}.Release|x64.Build.0 = Release|Any CPU
{71037C73-544F-4D40-A7FA-10951682034B}.Release|x86.ActiveCfg = Release|Any CPU
{71037C73-544F-4D40-A7FA-10951682034B}.Release|x86.Build.0 = Release|Any CPU
{6A7088DF-1BB1-4951-A477-EEFB6076D14A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A7088DF-1BB1-4951-A477-EEFB6076D14A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A7088DF-1BB1-4951-A477-EEFB6076D14A}.Debug|x64.ActiveCfg = Debug|Any CPU
{6A7088DF-1BB1-4951-A477-EEFB6076D14A}.Debug|x64.Build.0 = Debug|Any CPU
{6A7088DF-1BB1-4951-A477-EEFB6076D14A}.Debug|x86.ActiveCfg = Debug|Any CPU
{6A7088DF-1BB1-4951-A477-EEFB6076D14A}.Debug|x86.Build.0 = Debug|Any CPU
{6A7088DF-1BB1-4951-A477-EEFB6076D14A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A7088DF-1BB1-4951-A477-EEFB6076D14A}.Release|Any CPU.Build.0 = Release|Any CPU
{6A7088DF-1BB1-4951-A477-EEFB6076D14A}.Release|x64.ActiveCfg = Release|Any CPU
{6A7088DF-1BB1-4951-A477-EEFB6076D14A}.Release|x64.Build.0 = Release|Any CPU
{6A7088DF-1BB1-4951-A477-EEFB6076D14A}.Release|x86.ActiveCfg = Release|Any CPU
{6A7088DF-1BB1-4951-A477-EEFB6076D14A}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{71037C73-544F-4D40-A7FA-10951682034B} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
{6A7088DF-1BB1-4951-A477-EEFB6076D14A} = {EB5D65CF-FD37-16C0-3293-5E9FB153C94C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FBFD4BB8-45F8-4876-9E53-6245DB0FA00A}
Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,29 @@ Build and run the Blazor app.

<!-- ![](images/general/getting-started-blazor-card.jpg) -->

## Building and Running Locally

**Prerequisites:** [Node.js](https://nodejs.org/) 22 or later.

```bash
# 1. Install Node dependencies
npm install

# 2. Build the JS interop bundle
npm run build

# 3. Copy component themes to wwwroot
npm run copythemes
```

The `stories/` directory contains a [Blazing Story](https://github.com/jsakamoto/BlazingStory) app that demonstrates Ignite UI for Blazor components. To run it locally, the JS interop bundle and component themes must be built first.

After the above steps, open the solution in Visual Studio or run the stories project with the .NET CLI:

```bash
dotnet run --project stories/IgniteUI.Blazor.Stories.csproj
```

[Dock Manager]: https://www.infragistics.com/products/ignite-ui-blazor/blazor/components/layouts/dock-manager
[Commercial]: https://www.infragistics.com/legal/license
[MIT]: https://github.com/IgniteUI/igniteui-blazor/blob/master/LICENSE
Expand Down
Loading
Loading