Assign Fields programatically to custom node defined by custom module
To add the body field to a content type, you use node_add_body_field(). To add a field that is not the body field, you use field_create_field(), if the field doesn't exist, and field_create_instance() to assign an instance of the field to an entity (e.g. a node or a user object).

As example of how to use those functions, you can look at standard_install(), which is the installation hook of the standard profile, that contains the following code:

  $field = array(
    'field_name' =&gt; 'field_' . $vocabulary-&gt;machine_name, 
    'type' =&gt; 'taxonomy_term_reference',
    'cardinality' =&gt; FIELD_CARDINALITY_UNLIMITED, 
    'settings' =&gt; array(
      'allowed_values' =&gt; array(
        array(
          'vocabulary' =&gt; $vocabulary-&gt;machine_name, 
          'parent' =&gt; 0,
        ),
      ),
    ),
  );
  field_create_field($field);

  $instance = array(
    'field_name' =&gt; 'field_' . $vocabulary-&gt;machine_name, 
    'entity_type' =&gt; 'node', 
    'label' =&gt; 'Tags', 
    'bundle' =&gt; 'article', 
    'description' =&gt; $vocabulary-&gt;help, 
    'widget' =&gt; array(
      'type' =&gt; 'taxonomy_autocomplete', 
      'weight' =&gt; -4,
    ), 
    'display' =&gt; array(
      'default' =&gt; array(
        'type' =&gt; 'taxonomy_term_reference_link', 
        'weight' =&gt; 10,
      ), 
      'teaser' =&gt; array(
        'type' =&gt; 'taxonomy_term_reference_link', 
        'weight' =&gt; 10,
      ),
    ),
  );
  field_create_instance($instance);


The code is adding a taxonomy term field to the content type "Article."