Skip to content
cljr-feature-dev logo

Cljr Feature Development

cljr-feature-dev

Develop features for the Cljr Clojure-to-.NET compiler. Use when adding emitter features, expression types, analyzer support, or testing features. Guides the complete workflow from Expr.cs to C# tests to NRepl verification. Critical for REPL-oriented development.

SKILL.md

Full skill instructions

Cljr Feature Development

This skill guides you through the complete workflow for adding features to the Cljr compiler, with proper testing in both C# unit tests and NRepl evaluation.

When to use this skill

  • Adding new language features to the emitter
  • Creating new expression types in the analyzer
  • Modifying existing expression handling
  • Testing features via C# unit tests
  • Testing features via NRepl evaluation (CRITICAL for REPL-oriented workflow)

Feature Development Workflow

Step 1: Define Expression Type (if new)

Location: src/​Cljr.Compiler/​Analyzer/​Expr.cs

Add a new record type extending Expr:

/// <summary>
/// Description of what this expression represents
/// </​summary>
public record MyFeatureExpr(
    string Property1,
    Expr Property2
) : Expr;

See expressions.md for all existing expression types.

Step 2: Add Analyzer Support

Location: src/​Cljr.Compiler/​Analyzer/​Analyzer.cs

  • Add case in AnalyzeForm() or AnalyzeSeq() to recognize the new form
  • Build the expression AST
  • Handle type hints and symbol resolution

Step 3: Add Emitter Support

Location: src/​Cljr.Compiler/​Emitter/​CSharpEmitter.cs

  • Add case to EmitExpr() switch statement
  • Generate valid C# code for the expression
case MyFeatureExpr e:
    EmitMyFeature(e);
    break;

Step 4: Write C# Unit Test for Compilation (REQUIRED)

Location: tests/​Cljr.Compiler.Tests/

Test that the emitter generates correct C# code:

[Fact]
public void MyFeature_EmitsCorrectCSharp()
{
    var source = "(my-feature args)";
    var result = Compile(source);
    Assert.Contains("expected C# output", result);
}

Step 5: Write C# Unit Test for NRepl Eval (REQUIRED)

Location: tests/​Cljr.Compiler.Tests/​ReplNamespaceTests.cs

This is CRITICAL for the REPL-oriented workflow. Test via NreplSession.EvalAsync():

[Fact]
public async Task MyFeature_WorksInRepl()
{
    var session = new NreplSession();

    var result = await session.EvalAsync("(my-feature args)");

    Assert.Null(result.Error);
    Assert.Equal(expectedValue, result.Values[0]);
}

See testing-patterns.md for comprehensive test patterns including:

  • State persistence across evaluations
  • Namespace isolation
  • Error handling

Step 6: Manual NRepl Verification (Optional)

Start the REPL and test interactively:

./​nrepl.sh
# or
dotnet run --project src/​Cljr.Cli -- nrepl

Then test your feature in the REPL to verify developer experience.

Key Files

FilePurpose
src/​Cljr.Compiler/​Analyzer/​Expr.csExpression type definitions
src/​Cljr.Compiler/​Analyzer/​Analyzer.csParsing and AST construction
src/​Cljr.Compiler/​Emitter/​CSharpEmitter.csC# code generation
tests/​Cljr.Compiler.Tests/​ReplNamespaceTests.csNRepl evaluation tests
src/​Cljr.Repl/​NreplSession.csREPL session API

Testing Requirements

Every feature MUST have:

  1. C# compilation test - Verify the emitter generates correct C#
  2. C# NRepl eval test - Verify the feature works in REPL evaluation via NreplSession.EvalAsync()

The NRepl eval test is especially important because it ensures the feature works in the interactive REPL-oriented development workflow that Clojure developers expect.

Run Tests

# Run all compiler tests
dotnet test tests/​Cljr.Compiler.Tests/

# Run specific test
dotnet test tests/​Cljr.Compiler.Tests/ --filter "MyFeature"

References

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View