# Healthy Microtransaction Economy

> Ethical Game Monetization & Microtransaction Design — Use when user asks about ethical game monetization, microtransaction design, loot boxes, dark patterns, spending caps, battle pass systems, cosmetic monetization, PEGI/ESRB ratings, game economy ethics, whale protection, or any request to design/analyze game monetization systems. Also triggers for consumer protection in gaming, predatory monet…

- **Type:** Skill
- **Install:** `agentstack add skill-dungnotnull-healthy-microtransaction-economy-agent-skill-healthy-microtransaction-economy-agent-skill`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [dungnotnull](https://agentstack.voostack.com/s/dungnotnull)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [dungnotnull](https://github.com/dungnotnull)
- **Source:** https://github.com/dungnotnull/healthy-microtransaction-economy-agent-skill

## Install

```sh
agentstack add skill-dungnotnull-healthy-microtransaction-economy-agent-skill-healthy-microtransaction-economy-agent-skill
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Healthy Microtransaction Economy Design (Ethical Monetization)

## Overview

This is a professional-grade harness skill for **Ethical Game Monetization & Microtransaction Design**. It transforms Claude into a domain expert that delivers structured, evidence-backed outputs through a flexible, modular architecture.

## Quick Start

```bash
# Invoke the skill
/healthy-microtransaction-economy Analyze the monetization ethics of [game/mechanic]

# Direct invocation
/healthy-microtransaction-economy Design ethical monetization for an idle mobile game targeting casual players
```

## Flexible Agent/Skill Architecture

### Architecture Principles

1. **Modular Skill-Registry Pattern**: Skills are registered in a centralized registry with metadata, capabilities, and dependencies
2. **Chain-of-Thought Routers**: Dynamic routing between specialized sub-agents based on task context
3. **Specialized Sub-Agents**: Each sub-agent has specific domain expertise and clear responsibilities
4. **Hooks System**: Lifecycle hooks enable cross-cutting concerns (logging, monitoring, state sync)
5. **Type-Safe I/O**: All inputs and outputs validated against JSON schemas

### Skill Registry Structure

Skills are registered in the internal skill registry with the following metadata:

```yaml
skill_id: unique_identifier
name: display_name
version: semver_version
description: trigger_description
capabilities:
  - capability_1
  - capability_2
dependencies:
  - dependency_1
inputs:
  schema: input_schema_path
  required_fields: [field1, field2]
outputs:
  schema: output_schema_path
  format: output_template
execution:
  type: sequential | parallel | hybrid
  sub_skills: [sub_skill_ids]
  quality_gates: [gate_ids]
hooks:
  pre_execution: [hook1, hook2]
  post_execution: [hook3]
  on_error: [error_handler]
```

### Sub-Agent Registration

Each sub-agent is registered with:

```yaml
sub_agent_id: sub-core-analysis
name: Ethical Game Monetization Designer
role: domain_expert
expertise_areas:
  - Monetization model selection
  - Ethical boundary analysis
  - Dark pattern avoidance
  - Regulatory compliance
input_requirements:
  - game_description
  - target_audience
  - monetization_goals
output_format: analysis_scorecard
quality_gates: [G1, G2, G3, G4]
max_tokens: 40000
tool_permissions: [Read, WebFetch, Reasoning]
```

### Chain-of-Thought Routing

The skill uses dynamic routing to determine which sub-agents to invoke:

```python
def route_task(task_context):
    # Analyze task requirements
    required_capabilities = analyze_capabilities(task_context)

    # Select sub-agents
    selected_agents = []
    for agent in skill_registry.list_agents():
        if has_required_capabilities(agent, required_capabilities):
            if can_execute_parallel(agent, selected_agents):
                schedule_parallel(agent)
            else:
                schedule_sequential(agent)

    return selected_agents
```

### Execution Modes

#### Sequential Execution
Default mode for dependent tasks. Each sub-agent completes before the next starts.

```
requirements → evidence → core_analysis → knowledge → advisor → quality_gate
```

#### Parallel Execution
For independent sub-agents that can run concurrently (experimental feature).

```
                    [evidence_collector] ─┐
[user_input] ─→ [requirements]           ├→ [synthesizer] ─→ [quality_gate]
                    [knowledge_lookup] ─┘
```

#### Hybrid Execution
Combines sequential and parallel execution for optimal performance.

## Skill Resolution Process

### 1. Skill Registration (Load Time)

When the skill loads, it registers all components:

```python
class SkillRegistry:
    def __init__(self):
        self.skills = {}
        self.sub_agents = {}
        self.hooks = {}
        self.schemas = {}

    def register_skill(self, skill_metadata):
        skill_id = skill_metadata['skill_id']
        self.skills[skill_id] = skill_metadata
        # Load and validate schemas
        self._load_schemas(skill_metadata)

    def register_sub_agent(self, agent_metadata):
        agent_id = agent_metadata['sub_agent_id']
        self.sub_agents[agent_id] = agent_metadata
```

### 2. Skill Resolution (Invocation Time)

When user invokes the skill:

```python
def resolve_skill(user_input, context):
    # Step 1: Parse input
    parsed_input = parse_user_input(user_input)

    # Step 2: Check language
    language = detect_language(parsed_input['text'])

    # Step 3: Select sub-agents
    selected_agents = route_task({
        'input': parsed_input,
        'language': language,
        'context': context
    })

    # Step 4: Create execution plan
    execution_plan = create_execution_plan(selected_agents)

    # Step 5: Execute with hooks
    result = execute_with_hooks(execution_plan)

    return result
```

### 3. Skill Execution (Runtime)

Execution with hooks:

```python
def execute_with_hooks(plan):
    context = ExecutionContext()

    try:
        # Pre-execution hooks
        for hook in plan.pre_hooks:
            hook.before_execution(context)

        # Execute sub-agents
        for agent in plan.agents:
            result = execute_agent(agent, context)
            context.add_result(agent.id, result)

        # Post-execution hooks
        for hook in plan.post_hooks:
            hook.after_execution(context)

        # Quality gates
        for gate in plan.quality_gates:
            if not gate.validate(context):
                gate.auto_fix(context)

        return context.final_output()

    except Exception as e:
        # Error hooks
        for hook in plan.error_hooks:
            hook.handle_error(e, context)
        raise
```

## Input/Output Schemas

### Input Schema

All inputs must conform to this structure:

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "required": ["query", "language"],
  "properties": {
    "query": {
      "type": "string",
      "description": "User's analysis request",
      "minLength": 10
    },
    "language": {
      "type": "string",
      "enum": ["en", "vi"],
      "description": "Output language (English or Vietnamese)"
    },
    "context": {
      "type": "object",
      "properties": {
        "game": {"type": "string"},
        "audience": {"type": "string"},
        "goals": {"type": "array", "items": {"type": "string"}}
      }
    },
    "options": {
      "type": "object",
      "properties": {
        "strict_mode": {"type": "boolean"},
        "include_sources": {"type": "boolean"},
        "max_tokens": {"type": "number"}
      }
    }
  }
}
```

### Output Schema

All outputs conform to this structure:

```json
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "required": ["metadata", "executive_summary", "analysis", "recommendation"],
  "properties": {
    "metadata": {
      "type": "object",
      "properties": {
        "skill_version": {"type": "string"},
        "timestamp": {"type": "string", "format": "date-time"},
        "language": {"type": "string"},
        "degradation_level": {"type": "integer", "minimum": 0, "maximum": 4}
      }
    },
    "executive_summary": {
      "type": "string",
      "minLength": 100
    },
    "inputs_scope": {
      "type": "object",
      "properties": {
        "object": {"type": "string"},
        "scope": {"type": "string"},
        "timeframe": {"type": "string"}
      }
    },
    "evidence_collected": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "source": {"type": "string"},
          "tier": {"type": "integer", "minimum": 1, "maximum": 4},
          "content": {"type": "string"},
          "date": {"type": "string"}
        }
      }
    },
    "analysis": {
      "type": "object",
      "properties": {
        "monetization_model": {"type": "string"},
        "ethical_boundaries": {"type": "array"},
        "regulatory_compliance": {"type": "object"},
        "dark_pattern_analysis": {"type": "object"}
      }
    },
    "recommendation": {
      "type": "object",
      "properties": {
        "verdict": {
          "type": "string",
          "enum": ["Ethical & Sustainable", "Conditional", "Predatory Risk", "Inconclusive"]
        },
        "disclosure": {"type": "string"},
        "risks": {"type": "array"},
        "remediation": {"type": "array"}
      }
    }
  }
}
```

## Hooks System

### Hook Types

1. **Pre-Execution Hooks**: Run before any sub-agent executes
   - Language detection
   - Input validation
   - Context initialization

2. **Sub-Agent Hooks**: Run around each sub-agent execution
   - Agent-specific logging
   - Token budget tracking
   - Result caching

3. **Post-Execution Hooks**: Run after all sub-agents complete
   - Quality gate validation
   - Output formatting
   - Result aggregation

4. **Error Hooks**: Run on exceptions
   - Error logging
   - Graceful degradation
   - Fallback execution

### Hook Implementation

```python
class LanguageDetectionHook(PreExecutionHook):
    def execute(self, context):
        # Detect Vietnamese characters
        vi_chars = set('àáảãạăâđèéêìíòóôơùúưý')
        if any(c in vi_chars for c in context.input_text):
            context.language = 'vi'
        else:
            context.language = 'en'
        log_info(f"Language detected: {context.language}")
```

## Quality Gates

Quality gates validate output before delivery. See `config/features/quality_gate_config.json` for complete configuration.

### Gate Enforcement

```python
def enforce_quality_gates(context):
    for gate in context.quality_gates:
        attempt = 0
        while attempt < gate.max_retries:
            if gate.validate(context.output):
                break

            # Try auto-fix
            if gate.auto_fix_available:
                context.output = gate.auto_fix(context.output)
                attempt += 1
            else:
                # Emit limitation
                context.add_limitation(gate.name)
                break

        if attempt == gate.max_retries:
            context.add_limitation(f"Failed gate: {gate.name}")
```

## Graceful Degradation

The skill supports 5 degradation levels:

| Level | Condition | Behavior |
|-------|-----------|----------|
| 0 | All sources available | Full analysis |
| 1 | Some sources fail | Secondary sources + flags |
| 2 | Most sources fail | Knowledge base only + "historical" flag |
| 3 | Required inputs missing | Partial analysis + "DATA UNAVAILABLE" |
| 4 | All sources fail | Emit limitation notice, no fabrication |

## Token Optimization

The skill implements smart token management:

```python
class TokenBudgetManager:
    def __init__(self):
        self.budget = load_config('token_budgets.json')
        self.usage = {}

    def reserve_tokens(self, agent_id, estimated_tokens):
        if self.available() < estimated_tokens:
            # Trigger compression
            self.compress_context()
        self.usage[agent_id] = estimated_tokens

    def compress_context(self):
        # Remove less important sections
        # Summarize verbose content
        # Prioritize recent information
        pass
```

## Configuration Loading

Configuration is loaded from `config/` directories:

```python
class SkillConfig:
    def __init__(self):
        self.env = self.load_env_config()
        self.llm = self.load_llm_config()
        self.features = self.load_feature_flags()
        self.quality_gates = self.load_quality_gate_config()

    def load_env_config(self):
        env_file = os.getenv('ENV_FILE', 'config/env/.env')
        return dotenv_values(env_file)
```

## Logging

Structured logging with contextual information:

```python
class SkillLogger:
    def log_agent_start(self, agent_id, context):
        logger.info({
            "event": "agent_start",
            "agent_id": agent_id,
            "language": context.language,
            "timestamp": datetime.now().isoformat()
        })

    def log_gate_failure(self, gate_id, output):
        logger.warning({
            "event": "gate_failure",
            "gate_id": gate_id,
            "attempt": self.attempts[gate_id],
            "output_preview": output[:100]
        })
```

## Error Handling

Production-grade error handling:

```python
def execute_with_error_handling(plan):
    try:
        return execute_plan(plan)
    except TimeoutError:
        log_timeout()
        return degraded_execution(level=3)
    except APIError as e:
        if e.status_code == 429:
            return retry_with_backoff(plan)
        else:
            return degraded_execution(level=2)
    except ValidationError as e:
        log_validation_error(e)
        return error_response(e)
    except Exception as e:
        log_unexpected_error(e)
        return degraded_execution(level=4)
```

## Extending the Skill

To add a new sub-agent:

1. Create `skills/sub-new-agent.md` with proper frontmatter
2. Register in skill registry metadata
3. Define input/output schemas
4. Add quality gates if needed
5. Test with scenarios in `tests/test-scenarios.md`

To add a new hook:

1. Create hook class implementing appropriate interface
2. Register in `config/hooks/`
3. Add to execution plan
4. Test with various scenarios

## Best Practices

1. **Always validate inputs** against schemas
2. **Use hooks** for cross-cutting concerns
3. **Respect token budgets** - compress when needed
4. **Handle errors gracefully** - degrade rather than fail
5. **Log everything** with structured context
6. **Cite sources** for all claims
7. **Disclose limitations** before recommendations
8. **Test thoroughly** with multiple scenarios

## Version History

- **v1.0.0** (2026-07-15): Initial production release with flexible architecture

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [dungnotnull](https://github.com/dungnotnull)
- **Source:** [dungnotnull/healthy-microtransaction-economy-agent-skill](https://github.com/dungnotnull/healthy-microtransaction-economy-agent-skill)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-dungnotnull-healthy-microtransaction-economy-agent-skill-healthy-microtransaction-economy-agent-skill
- Seller: https://agentstack.voostack.com/s/dungnotnull
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
