npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@oliexe12/al-design-patterns

v0.1.0

Published

Search, compare, and retrieve AL design patterns through a CLI or MCP server.

Readme

Design Patterns in AL

This repository contains knowledge and examples for design patterns in the AL programming language. It supports both people and LLM-based tools.

The design pattern classification follows Refactoring.Guru.

Each pattern includes:

  • a short explanation of the problem,
  • a self-contained and readable AL example,
  • structured metadata in the central catalog,
  • stable paths that other workflows can use to retrieve the content.

Pattern catalog

| Group | Purpose | Included patterns | | --- | --- | --- | | Creational patterns (creational) | Control how objects are created | Factory Method, Abstract Factory, Builder, Prototype, Singleton | | Structural patterns (structural) | Organize relationships between components | Facade, Adapter, Bridge, Composite, Decorator, Flyweight, Proxy | | Behavioral patterns (behavioral) | Distribute responsibilities and communication | Chain of Responsibility, Command, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, Visitor |

Additional AL tags describe the practical use, such as orchestration, boundary, or coupling-reduction.

Quick start

Install Node.js 22 or later. You can then run the CLI without a permanent installation:

npx --yes --package=@oliexe12/al-design-patterns dp-al search "runtime algorithm"

Install the package globally if you use it often:

npm install --global @oliexe12/al-design-patterns
dp-al search "runtime algorithm"

The CLI returns JSON. Use these commands to explore the catalog:

dp-al list
dp-al search "change behavior at runtime" --limit 3
dp-al get strategy --include documentation,source
dp-al compare strategy state template-method
dp-al recommend --choose behavioral-pressure --choose algorithm-pressure --choose strategy
dp-al validate

Use dp-al search when you know the problem but not the pattern. Use dp-al get when you know the pattern ID.

MCP server

The MCP server lets an LLM search and read the pattern catalog. It provides four read-only tools:

  • search_patterns
  • recommend_pattern
  • get_pattern
  • compare_patterns

Add this server to an MCP client:

{
	"mcpServers": {
		"al-design-patterns": {
			"command": "npx",
			"args": [
				"--yes",
				"--package=@oliexe12/al-design-patterns",
				"dp-al-mcp"
			]
		}
	}
}

Use .vscode/mcp.json for VS Code. Use mcp.example.json for clients that use the mcpServers format.

Restart the MCP client after you add the configuration. The client starts and updates the package through npx.

Browse the examples

Each pattern page explains the problem, roles, trade-offs, and AL implementation. Select a pattern from the catalog above and follow its documented entry point.

Run pwsh scripts/Select-DesignPattern.ps1 for an interactive local selector. See the selection guide for the complete decision tree.

The examples target Business Central Application 28 and AL runtime 17. Use the AL extension to download symbols and compile the app.

Repository structure

src/Patterns/<Group>/<Pattern>/   executable AL code
patterns/<Group>/<Pattern>/       documentation for people and LLMs
knowledge/catalog.json            canonical machine-readable catalog
knowledge/pattern.schema.json     JSON Schema for catalog entries
scripts/Test-KnowledgeBase.ps1    consistency check
tools/                            shared CLI and MCP implementation

Contributing

Each new pattern must include documentation, code, and a catalog entry. See CONTRIBUTING.md for details.

License

This project uses the MIT License.

Sources

The descriptions and examples are original. Each pattern lists its technical sources, including Refactoring.Guru.