create-infrastructure

A project guide for adding data and network code for a business area. It covers data models, API services, and repositories—the app code that fetches, stores, and exposes data.

In plain words
What is it for?
Use it to create a repository, API service, immutable data model, or complete infrastructure domain using the project's Dart libraries.
Why use it?
It gives new backend-facing code a consistent structure and standard ways to convert data, call APIs, and provide repositories to the app.

Skill for Claude CodeCodex

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 skills/anoopsg/agent_rules/create-infrastructure
Any agent
npx skills add anoopsg/agent_rules --skill create-infrastructure
Clone the repo
git clone --depth 1 https://github.com/anoopsg/agent_rules

Made for: Claude Code, Codex.

Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 995 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.00052 $0.00995
Opus 5 $0.00026 $0.00498
Sonnet 5 $0.00010 $0.00199
Haiku 4.5 $0.00005 $0.00100

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

Security

Grade A, and why

create-infrastructure 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.

src/exclusive/skills/create-infrastructure/SKILL.md · 158 lines

How it starts

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

Infrastructure Creation Skill

This skill defines the process for creating a new domain in the infrastructure/ layer, covering models, networking, and repositories.

1. Directory Structure

Infrastructure is organized by domain in lib/src/infrastructure/:

lib/src/infrastructure/my_domain/
├── models/             # DTOs and Domain Models
│   └── user_model.dart # Uses dart_mappable
├── services/           # Remote API definitions (Chopper)
│   └── my_service.dart
├── my_repository.dart  # Business logic interface
└── my_domain.dart      # Barrel file

2. Data Modeling (dart_mappable)

Always use @MappableClass() for models to get built-in JSON conversion and equality. Models must be immutable.

@MappableClass()
class UserProfile with UserProfileMappable {
  const UserProfile({
    required this.id,
    required this.email,
  });

  final String id;
  final String email;
}

3. Networking (Chopper)

Define API services as abstract classes extending ChopperService. Use apiClient to consume them.

3.1 Define the Service

@ChopperApi()
abstract class MyService extends ChopperService {
  static MyService create([ChopperClient? client]) => _$MyService(client);

  @GET(path: '/profile')
  Future<Response<UserProfile>> getProfile();
}

3.2 Register the Service

Add the service to apiClient in lib/src/infrastructure/_clients/api_client.dart:

@Riverpod(keepAlive: true)
ApiClient apiClient(Ref ref) {
  return ApiClient(
    services: [
      MyService.create(), // Register here
    ],
  );
}

4. Repositories

Repositories bridge the gap between clients (API, Storage) and the Features.

  • Rule: NEVER import from src/features/ into src/infrastructure/.
  • Pattern: Return Result<T, Failure> for operations that can fail.

4.1 Define Error Codes & Failures

Errors are centralized. You must define a technical code and its translation.

  1. Register the Code in lib/src/infrastructure/error_codes.dart:
enum AppErrorCode implements ErrorCode {
  myFeature404('myFeature404'), // Key in i18n
  // ...
}

Read the full file on GitHub · 158 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 · 158 lines · 52 tokens per session scan A baeab004203f

Subscribe to this mod's changes

create-infrastructure is a skill published in the GitHub repository anoopsg/agent_rules (2 stars, last pushed 1mo ago), licensed MIT. It adds 52 tokens to every session and 995 once invoked, about $0.0003 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.

Related

Other skills, from other repositories

technical-debt

Technical debt inventory, prioritization, and audit for PHP/Laravel (MySQL) and Node/TypeScript/React projects. Use when assessing code health, identifying refactoring candidates, planning debt paydown, or auditing a codebase for accumulated debt. Triggers on "audit technical debt", "find tech debt", "debt inventory"…

AsyrafHussin/agent-skills · 109 tokens

code-slop

Detect AI-generated code patterns ("slop") in PHP/Laravel and TypeScript/React source — comment narration, generic naming, premature interfaces, defensive overdose, mock-everything tests, and the absence of human "scars". Use when reviewing AI-assisted PRs, auditing code for taste/quality (not metrics — that's…

AsyrafHussin/agent-skills · 110 tokens

git-workflow

Git best practices, branching strategies, commit conventions, and PR workflows. Use when reviewing git history, writing commits, setting up branching strategy, or improving git practices. Triggers on "git best practices", "commit message", "branching strategy", or "PR workflow".

AsyrafHussin/agent-skills · 59 tokens

laravel-inertia-react

Laravel + Inertia.js + React integration patterns. Use when building Inertia page components, handling forms with useForm, managing shared data, or implementing persistent layouts. Triggers on tasks involving Inertia.js, page props, form handling, or Laravel React integration.

AsyrafHussin/agent-skills · 59 tokens

laravel-owasp-security

OWASP Top 10 security audit and secure coding guidelines for Laravel + React/Inertia.js applications. Use when auditing for vulnerabilities ("run OWASP audit", "security review", "check my app security") or writing secure Laravel code involving auth, payments, file uploads, or API design. Triggers on security-related…

AsyrafHussin/agent-skills · 87 tokens

project-docs

Project documentation lifecycle for PHP/Laravel and Node/TypeScript/React projects — bootstrapping essential docs, naming and folder conventions, freshness, and cleanup of AI-generated junk and stale files. Use when starting a new project, setting up docs/ structure, auditing markdown files, cleaning up the docs…

AsyrafHussin/agent-skills · 115 tokens