900-angular-store

A set of rules for managing application data in Angular stores. Angular is a framework for building web applications; stores are shared services that hold state, while signals are values that update the interface when data changes.

In plain words
What is it for?
Use it when creating Angular stores as injectable services, exposing read-only state, and computing values such as the selected product or products grouped by category.
Why use it?
It gives developers a consistent place and structure for shared data, loading status, errors, selected products, and derived values.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/jrpribs/smarterstarter/900-angular-store
Clone the repo
git clone --depth 1 https://github.com/JrPribs/SmarterStarter

Made for: Cursor.

Per session 6 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,409 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00006 $0.03409
Opus 5 $0.00003 $0.01705
Sonnet 5 $0.00001 $0.00682
Haiku 4.5 $0.00001 $0.00341

Measured 2d ago against content hash 62cb647eb204, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

900-angular-store scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/900-angular-store.mdc · 588 lines

How it starts

The opening of the file, as written. The whole thing — 588 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Angular Store Architecture and State Management

  • Store Structure: Create stores as injectable services with signals for state.
@Injectable({
  providedIn: 'root'
})
export class ProductStore {
  // Private writable signals
  private _products = signal<Product[]>([]);
  private _selectedProductId = signal<string | null>(null);
  private _loading = signal<boolean>(false);
  private _error = signal<string | null>(null);
  
  // Public read-only signals 
  public products = this._products.asReadonly();
  public selectedProductId = this._selectedProductId.asReadonly();
  public loading = this._loading.asReadonly();
  public error = this._error.asReadonly();
  
  // Computed signals for derived state
  public selectedProduct = computed(() => {
    const id = this._selectedProductId();
    return id ? this._products().find(p => p.id === id) || null : null;
  });
  
  public productsByCategory = computed(() => {
    const products = this._products();
    return products.reduce((acc, product) => {
      const category = product.category;
      if (!acc[category]) {
        acc[category] = [];
      }
      acc[category].push(product);
      return acc;
    }, {} as Record<string, Product[]>);
  });
  
  // Public methods for state updates
  setProducts(products: Product[]) {
    this._products.set(products);
  }
  
  setSelectedProductId(id: string | null) {
    this._selectedProductId.set(id);
  }
  
  setLoading(isLoading: boolean) {
    this._loading.set(isLoading);
  }
  
  setError(error: string | null) {
    this._error.set(error);
  }
  
  addProduct(product: Product) {
    this._products.update(products => [...products, product]);
  }
  
  updateProduct(updatedProduct: Product) {
    this._products.update(products => 
      products.map(p => p.id === updatedProduct.id ? updatedProduct : p)
    );
  }
  
  removeProduct(productId: string) {
    this._products.update(products => 
      products.filter(p => p.id !== productId)
    );
  }
}
  • State Normalization: Store data in a normalized form to avoid duplication and improve management.
@Injectable({
  providedIn: 'root'
})
export class UserStore {
  // Bad approach: nested data structure
  // private _userData = signal<{
  //   user: User,
  //   orders: Order[],
  //   addresses: Address[]
  // } | null>(null);
  
  // Good approach: normalized data
  private _user = signal<User | null>(null);
  private _orders = signal<Record<string, Order>>({});
  private _addresses = signal<Record<string, Address>>({});
  
  // Public read-only signals
  public user = this._user.asReadonly();
  public orders = this._orders.asReadonly();
  public addresses = this._addresses.asReadonly();
  
  // Computed signals for derived state
  public userOrders = computed(() => {
    const user = this._user();
    const orders = this._orders();
    if (!user) return [];
    
    return user.orderIds
      .map(id => orders[id])
      .filter(Boolean);
  });
  
  public userAddresses = computed(() => {
    const user = this._user();
    const addresses = this._addresses();
    if (!user) return [];
    
    return user.addressIds
      .map(id => addresses[id])
      .filter(Boolean);
  });
  
  // Set methods
  setUser(user: User | null) {
    this._user.set(user);
  }
  
  // Entities management methods
  addOrder(order: Order) {
    this._orders.update(orders => ({
      ...orders,
      [order.id]: order
    }));
    
    // Update user's orderIds if necessary
    if (this._user()) {
      this._user.update(user => {
        if (!user) return user;
        
        if (!user.orderIds.includes(order.id)) {
          return {
            ...user,
            orderIds: [...user.orderIds, order.id]
          };
        }
        
        return user;
      });
    }
  }
  
  addAddress(address: Address) {
    this._addresses.update(addresses => ({
      ...addresses,
      [address.id]: address
    }));
    
    if (this._user()) {
      this._user.update(user => {
        if (!user) return user;
        
        if (!user.addressIds.includes(address.id)) {
          return {
            ...user,
            addressIds: [...user.addressIds, address.id]
          };
        }
        
        return user;
      });
    }
  }
}

Read the full file on GitHub · 588 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 588 lines · 6 tokens per session scan A 62cb647eb204

Subscribe to this mod's changes

900-angular-store is a cursor rule published in the GitHub repository JrPribs/SmarterStarter (2 stars, last pushed 1y ago), licensed MIT. It adds 6 tokens to every session and 3,409 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.