Create skill

From Alexander-M-Dickerson/ai-asset-pricing · View interactive version

Create skill is an AI agent skill from the GitHub repository Alexander-M-Dickerson/ai-asset-pricing. Creates new Claude Code skills, auto-apply skills, or auto-trigger rules, or audits existing ones for quality and effectiveness.

How to use this skill

Skill file

Skill Creator & Auditor

Two modes: Create a new skill or Audit an existing one.

Examples

Mode Selection

Parse $ARGUMENTS:


CREATE MODE

Six phases: Determine Type → Gather Requirements → Choose Pattern → Generate → Validate → Register.

Phase 1: Determine Type

Parse $ARGUMENTS:

If $ARGUMENTS is empty, use AskUserQuestion to ask:

"What do you want to create? Provide a name (lowercase, hyphens) and choose a type."

Three types with different file locations and frontmatter:

| Type | Location | Key frontmatter |

|------|----------|-----------------|

| User-invocable skill (/name) | .claude/skills/{name}/SKILL.md | name, description, argument-hint |

| Auto-apply skill (triggers on task match) | .claude/skills/{name}/SKILL.md | name, description (includes "Auto-apply when...") |

| Auto-trigger rule (triggers on file paths) | .claude/rules/{name}.md | description, paths (globs). No name field. |

How to decide (type):

Skill vs Agent decision (ask this first):

| Question | Yes → | No → |

|----------|-------|------|

| Is the workflow rigid with known inputs? | Skill | Consider agent |

| Does it need judgment, discovery, or error recovery? | Agent | Skill |

| Will it run frequently (>5x/week)? | Skill (token savings compound) | Either |

| Does it need its own tool set or isolation? | Agent | Skill |

Skills run in the caller's context (zero spawn overhead, 75-80% fewer tokens than agents). If 90%+ of usage follows a fixed template, build a skill. Reserve agents for exploratory work. See docs/AGENT_LESSONS_LEARNED.md for case study.

Phase 2: Gather Requirements

Validate name

Collect requirements

Use a single AskUserQuestion to gather what's needed. Skip questions already answered by $ARGUMENTS:

  1. Purpose (1-2 sentences): What does this skill do?
  2. Trigger conditions: When should Claude activate this? (determines description field and rule globs)
  3. Arguments: Does it take arguments? What format? (for argument-hint)
  4. Auxiliary files needed? Reference docs, scripts, templates, style files?
  5. Closest existing skill: Which skill in this project is most similar in structure?

If the user names an existing skill, read its SKILL.md to understand the pattern before proceeding.

Phase 3: Choose Structural Pattern

Read the exemplar SKILL.md file for each relevant pattern before generating.

Pattern catalog

| Pattern | When to use | Exemplar (read this) |

|---------|------------|---------------------|

| Phased workflow | Multi-step processes with dependencies between steps | new-project/SKILL.md (3 phases) |

| Checklist / decision table | Systematic validation, branching logic, audit | submission-prep/SKILL.md (10 categories) |

| Code template | Must produce or follow exact code patterns | wrds-psql/SKILL.md (pipeline template) |

| Gotchas / known issues | Encoding domain traps Claude must avoid | wrds-psql/SKILL.md (19 numbered items) |

| Reference table | Quick-lookup data (palettes, sizes, thresholds) | publication-figures/SKILL.md |

| Philosophy + principles | Judgment-heavy tasks needing guiding principles | build-deck/SKILL.md (Rhetoric of Decks) |

Common combinations

Most skills combine 2-3 patterns:

Degrees of freedom

Match specificity to the task's fragility:

Before generating, read 1-2 exemplar SKILL.md files for the chosen pattern(s). This grounds the output in proven patterns from this project.

Phase 4: Generate the Skill

Frontmatter

For user-invocable or auto-apply skills:

---
name: {validated-name}
description: "{third-person description stating WHAT and WHEN, max 1024 chars}"
argument-hint: "{format hint, only if skill takes arguments}"
---

For auto-trigger rules:

---
description: {third-person description of what the rule enforces}
paths:
  - "**/*.{ext}"
  - "{other glob patterns}"
---

Rules have NO name field. The paths field lists glob patterns that trigger the rule.

Description writing rules

Body structure

# {Human-Readable Skill Name}

{1-2 sentence purpose statement}

## Examples                          ← only for user-invocable skills
- `/skill-name` -- basic usage
- `/skill-name arg` -- with argument
- `/skill-name --flag` -- variant

{Body sections using chosen pattern(s)}

## Output                           ← if skill produces a report/summary
{Template of what Claude prints when done}

Body writing rules

Auxiliary files

Only create auxiliary files if:

  1. The body would exceed ~400 lines without splitting
  2. The content is reference data (lookup tables, code libraries) not core workflow
  3. The file can stand alone without needing SKILL.md context

Keep references ONE level deep from SKILL.md. Never chain: file A → file B → file C.

For reference files longer than 100 lines, include a table of contents at the top.

Phase 5: Validate

Read best-practices.md (in this skill's directory) and run the validation checklist against the generated skill.

Frontmatter checks

Body checks

Anti-pattern checks

Fix any violations before presenting the skill to the user.

Phase 6: Register

Update CLAUDE.md

  1. Read root CLAUDE.md and find the ## Skills & Rules section
  2. Determine the correct category subsection:
  1. If no category fits, add to the nearest one or propose a new ### Category section
  2. Add a line using the exact format (note: em-dash —, not --):

Update README.md (infrastructure skills only)

Only add to the README skills tree if the skill is infrastructure-level (not domain-specific). Add under the skills/ section:

    {name}/SKILL.md                    # Short description (/skill-name)

Print summary

SKILL CREATED: {name}
==================

Type: {user-invocable skill | auto-apply skill | auto-trigger rule}
Location: {file path}
Patterns: {chosen patterns}
Lines: {line count} / 500

Registered in CLAUDE.md under: {category}

Files created:
  {list of files with line counts}

To test: ask Claude "when would you use {name}?" — the description should give a clear answer.

AUDIT MODE

Four phases: Read → Analyze → Report → Fix.

Phase 1: Read

Parse the audit target from $ARGUMENTS:

Also read:

Phase 2: Analyze

Run 12 checks grouped in 4 categories. For each: PASS, WARN, or FAIL.

A. Frontmatter Quality

A1. Name Valid
A2. Description Present
A3. Description Quality
A4. Type-Specific Fields

B. Body Quality

B5. Line Count
B6. Structured Sections
B7. Examples Section
B8. Token Efficiency
B9. Anti-Patterns

Check for: Windows-style backslash paths, menus without defaults, nested references deeper than 1 level, tool/package assumptions without availability checks.

C. Ecosystem Integration

C10. CLAUDE.md Registration

Check root CLAUDE.md for the skill under the Skills & Rules section.

C11. Auxiliary Files

Check if body references other files (e.g., best-practices.md, templates).

D. Cross-Skill Consistency

D12. No Scope Overlap

Compare this skill's description against all other skills.

Phase 3: Report

Print structured report:

SKILL AUDIT: {name}
=============================
File: .claude/skills/{name}/SKILL.md | Lines: {count} | Type: {user-invocable|auto-apply|rule}

A. FRONTMATTER          B. BODY QUALITY
[PASS] A1 Name          [PASS] B5  Lines ({n})
[PASS] A2 Description   [PASS] B6  Sections
[PASS] A3 Desc quality  [PASS] B7  Examples
[PASS] A4 Type fields   [PASS] B8  Token efficiency
                         [PASS] B9  Anti-patterns

C. ECOSYSTEM            D. CONSISTENCY
[PASS] C10 CLAUDE.md    [PASS] D12 Overlap
[PASS] C11 Aux files

SUGGESTIONS:
1. [B5] At 478 lines, approaching the 500-line limit.

RESULT: 12/12 passed, 0 warnings, 0 failures

For all mode, print each skill's report separately, then a summary table:

SUMMARY: {N} skills audited
==============================
| Skill                  | Pass | Warn | Fail |
|------------------------|------|------|------|
| build-deck             |  12  |   0  |   0  |
| create-skill           |  11  |   1  |   0  |
| wrds-psql              |  12  |   0  |   0  |
| ...                    |      |      |      |

Phase 4: Fix (Optional)

After reporting, offer to fix FAIL items:

Never auto-fix without showing the proposed change first.


Communication Rules

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.