Agent skill
ai-assets
Create, modify, validate, and analyze Claude Code AI assets (rules, workflows, skills, hooks, CLAUDE.md) with prompt engineering discipline and dependency chain awareness
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/ai-assets
SKILL.md
AI Assets
Guides creation, modification, and validation of Claude Code AI assets. Every asset is a prompt for an LLM — apply prompt engineering rigor throughout.
Apply Agent(prompt-engineer) role for all steps below.
1. Determine Operation and Scope
Clarify with the user:
- Operation:
create|modify|validate|analyze - Asset type:
rule|workflow|skill|hook|agents-md - Target: file path or asset name
If the user's intent is ambiguous, ask before proceeding.
2. Gather Context
Read and internalize before making any changes:
- Target asset (if exists — for modify/validate/analyze)
- Vendor specs:
framework-summary.md— Section 2.x matching the asset type. This is the authoritative source for Claude Code capabilities, formats, and constraints - Authoring standards:
rules/global_rules.md— language, file size limits, cross-reference rules - Project conventions:
CLAUDE.md— naming, frontmatter, source management, interconnection patterns - Existing assets of the same type — scan the target directory to understand tone, structure, and naming patterns already in use
- Context engineering guide:
context-engineeringskill — context stack model, production checklists, reference templates. Required reading for AI-facing assets
3. Map Dependency Chain
Search the entire asset tree for references to/from the target. Build a dependency map:
[target asset]
├─ OUT (this asset references):
│ ├─ /workflow-name → file path [OK | MISSING]
│ ├─ @skill-name → file path [OK | MISSING]
│ └─ rule-name → file path [OK | MISSING]
├─ IN (referenced by):
│ ├─ asset-a.md (line N)
│ └─ asset-b.md (step N)
└─ HOOKS (enforced by):
└─ script.py → hook event
Search patterns: /asset-name, @asset-name, ../type/path.md, prose mentions in integration sections.
Flag issues:
- Broken refs: outgoing reference target doesn't exist
- Orphaned: zero incoming references (nothing calls or mentions this asset)
- Missing links: asset logically belongs in a chain but isn't connected
- Circular deps: A → B → A (acceptable for rules↔workflows, flag for review otherwise)
For analyze operations — present the full map and stop here. For other operations — use the map to inform subsequent steps.
4. Companion Asset Analysis
Before authoring, evaluate whether the target asset needs companion assets to be effective:
- Rule that defines a multi-step procedure → extract to a skill with checklists as resource files
- Rule that needs automated enforcement → propose a hook script
- Workflow with reusable sub-sequences → extract sub-workflows (
/sub-workflow) - Workflow that bundles complex knowledge → extract a skill for the knowledge, reference via
@skill-name - Skill that operationalizes a rule → verify the rule exists and cross-references the skill
- Any asset approaching 12K chars → split: offload detail to skill resources or sub-workflows
If companion assets are needed, create them as part of the same operation. Apply this entire workflow to each companion asset recursively (steps 2–8).
5. Author or Edit the Asset
Apply the asset-type spec from framework-summary.md Section 2.x:
<rule_spec>
- Frontmatter:
trigger((auto-loaded) | (agent) |glob|manual),description descriptionis the activation signal for (agent) — write it as a keyword-rich, specific summary. Too broad = false positives. Too narrow = missed activations- Trigger mode: (auto-loaded) for foundational constraints; (agent) for contextual guidance;
globfor file-type-specific;manualfor on-demand roles/expertise - Structure: imperative instructions, bullet points, numbered lists, XML tags for sections
- Max 12,000 chars </rule_spec>
<workflow_spec>
- Frontmatter:
description - Numbered steps — each step is one concrete action with a clear completion criterion
- Compose with
/sub-workflowto avoid duplication across workflows - Include decision points (if/then) for branching logic
- Max 12,000 chars </workflow_spec>
<skill_spec>
- Folder:
skill-name/SKILL.md+ resource files - Frontmatter:
name,description descriptiondrives progressive disclosure — optimize for automatic activation by Claude Code- Offload checklists, templates, guides to resource files (no size limit on resources)
- Max 12,000 chars for SKILL.md only </skill_spec>
<hook_spec>
- Config: JSON with hook event name, command, working directory
- Script: Python 3; stdin JSON; exit 0 (pass) or 2 (block)
- 11 events:
pre/PostToolUse (Read),pre/PostToolUse (Write|Edit),pre/PostToolUse (Bash),pre/PostToolUse,UserPromptSubmit,Stop,WorktreeCreate - Merge order: System → User → Workspace (all execute) </hook_spec>
<agents_md_spec>
- No frontmatter — auto-scoped by directory placement
- Root = always on; subdirectory = scoped to that dir tree
- Focus: what this directory does, which rules/workflows/skills apply
- Be specific, avoid redundancy with parent CLAUDE.md </agents_md_spec>
Role Hierarchy and Routing
Design role rules for composable specialization via Claude Code's agent/skill system:
- Layer 1 — Base role ((agent)): Universal principles, reasoning protocol, hard rules. Example:
software-engineer.role.md - Layer 2 — Specialization ((agent) or
glob): Stack-specific patterns. (agent) for project context matching;globfor file-type binding - Layer 3 — Explicit override (
manual): User forces via@role-name
Routing: CLAUDE.md declares tech stack → (agent) roles with matching description keywords activate automatically → glob activates on file patterns → multiple roles compose (base + specialization)
Composability rules:
- Base MUST NOT duplicate specializations; specializations MUST NOT duplicate base
- Each role's
descriptionmust clearly state scope to avoid activation overlap
6. Prompt Engineering Review
Every asset is a prompt for an LLM. Apply Agent(prompt-engineer) Reasoning Protocol to evaluate each asset:
- Assess — identify the prompt surface: what will Claude Code read and how will it shape behavior?
- Diagnose — what could go wrong? (wrong activation, vague instructions, conflicting rules, token waste, missed edge cases)
- Design review — verify the asset follows prompt engineering principles below
- Eval — define ≥1 scenario proving the asset works as intended + ≥1 scenario where it should NOT activate
Universal Checks (all asset types)
- Instruction clarity: imperative, unambiguous. No hedging ("try to", "consider") — use "do X", "never Y", "always Z"
- Structure: sections separated via headings, XML tags, bullet lists. Instructions never buried in prose
- Token efficiency: every token earns its place. Remove filler, redundancy, obvious statements
- Instruction hierarchy: system constraints > developer guidelines > user preferences. Explicit priority on conflicts
- Security: no secrets, PII, API keys. Instructions separated from data. No injection vectors
- Conflict check: no contradictions with other active assets (rules, CLAUDE.md, other workflows)
Context Engineering Checks (all asset types)
Apply context-engineering skill principles — every asset is context that enters Claude Code's window:
- Context stack awareness: Which context stack layer does this asset operate in? (L1: policy, L2: developer instructions, L3: tool contracts, L4: runtime state, etc.)
- Position effects: Critical constraints (Hard Rules, NEVER items) placed at the beginning. Output contracts at the end. No critical info buried in the middle of long sections
- Layer separation: Policy ("never do X") is separate from knowledge ("how to do Y"). No mixed sections
- Token budget impact: Does this asset justify its token cost? Can any section be compressed without losing signal?
- Cacheable prefix: For roles/rules — static content that rarely changes grouped to enable KV cache reuse
Asset-Type-Specific Checks
Rules ((agent)):
- Does
descriptioncontain keywords users naturally use when the rule should activate? - Is it specific enough to avoid false positives, broad enough to not miss real cases?
- Does it differentiate clearly from other rules with similar scope?
- Are negative instructions ("do NOT", anti-patterns) sufficient to prevent wrong behavior?
- Will Claude Code consistently produce the intended behavior when this rule is active?
Workflows:
- Does each step have a clear completion criterion?
- Are decision points (if/then) explicit — no ambiguous branching?
- Could Claude Code execute this workflow autonomously with minimal user input?
- Are sub-workflow calls (
/name) and skill refs (@name) correct?
Skills:
- Does
descriptiontrigger progressive disclosure for the right tasks only? - Are resource files referenced and accessible?
- Is knowledge actionable (checklists, patterns) vs purely informational?
Rules (roles):
- Are Hard Rules concrete and testable (not aspirational)?
- Is the role boundary clear — what is in scope vs delegated?
- Does it compose cleanly with Layer 1 base role without duplication?
7. Validate (mandatory on every create/modify)
This step is non-optional. Run the full checklist on every create or modify operation to prevent dependency corruption, broken cross-references, and size violations.
Format and structure:
- Correct YAML frontmatter for asset type
- File size ≤ 12,000 characters (rules, workflows, SKILL.md)
- All content in English
- File name follows naming convention (see
CLAUDE.md)
References and dependencies:
- All
/workflowreferences resolve to existing workflow files - All
@skillreferences resolve to existing skill folders - All relative paths are valid and point to existing files
- No absolute or machine-specific paths (
C:\Users\...,/home/...) - Related assets updated with cross-references to this asset
Prompt quality (per Agent(prompt-engineer) review — Step 6):
- All checks from Step 6 passed (universal + asset-type-specific)
-
descriptionis keyword-rich and activation-appropriate - No secrets, API keys, or PII
- Consistent with existing assets in tone and structure
- Behavioral test: Claude Code would produce correct behavior with this asset active
Context engineering (per context-engineering skill — Step 6):
- Asset maps to a context stack layer (or spans multiple with justification)
- No "lost-in-the-middle" — critical info not buried in middle of long asset
- Policy and knowledge sections distinct
- AI-facing assets reference
context-engineeringskill where relevant
Dependency chain integrity:
- No broken outgoing references
- Asset is reachable (referenced by at least one other asset or is top-level)
- No collateral damage — assets that reference this one still work after the change
- Companion assets (from step 4) are also validated
- SDLC lifecycle map in
ARCHITECTURE.mdupdated if applicable
8. Finalize
- Verify all assets (primary + companions) are saved in correct directories
- If cross-references changed, verify all affected assets are updated
- Present a summary to the user:
- What was created/modified (list all assets including companions)
- Dependency chain status (all refs OK / issues found)
- Role routing status (for role assets: which layers are covered, CLAUDE.md tech stack alignment)
- Validation checklist result (all passed / items requiring attention)
- Any remaining action items
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?