We propose an automatic numerical method requiring minimal user intervention to simulate delamination in composite structures. We develop isogeometric cohesive elements for two- and three-dimensional delamination by exploiting the knot insertion algorithm directly from CAD data to generate cohesive elements along delamination. A complete computational framework is presented including pre-processing, processing and post-processing. They are explained in detail and implemented in MIGFEM - an open source Matlab Isogemetric Analysis code developed by the authors. The composite laminates are modeled using both NURBS solid and rotation-free shell elements. Several two and three dimensional examples ranging from standard delamination tests (the mixed mode bending test) to the L-shaped specimen with a fillet, three dimensional (3D) double cantilever beam and a 3D singly curved thick-walled laminate are provided. The method proposed provides a bi-directional system in which one can go forward from CAD to analysis and backwards from analysis to CAD. This is believed to facilitate the design of composite structures.